There is one other way to do the same. You can have a parentDocument property in your custom class and set that to the view as shown below
OverviewGraph.as public var parentDocument:*; trace(parentDocument._responseOverviewXML); Test.mxml [Bindable] public var _responseOverviewXML:String; [Bindable] public var _resultGraphXml:String; [Bindable] public var _rootEntityId:String var overview_obj:OverviewGraph=new OverviewGraph(); overview_obj.parentDocument = this; Thanks! Veena On Fri, Mar 11, 2011 at 11:52 AM, Venkat Viswanathan <helloven...@gmail.com>wrote: > Hi Madhavi, > > The correct way to accessing variables inside components from the main > application is by passing the value to the component. So your > component should have a public property. And in your main application, > after you instantiate your component, your can either set the property > like: > > overview_obj.responseOverviewXML = this._responseOverviewXML; > > or bind the variables using BindingUtils. > > > BindingUtils.bindProperty(overview_obj,"responseOverviewXML",this,"_responseOverviewXML"); > > By this way, your component will stay loosely coupled and can be > easily reused. > > --------------- > The quick and dirty way (which I will NOT recommend is)... from your > component, you can do this: > this.parentDocument._responseOverviewXML > > or > > this.parentApplication._responseOverviewXML > > Although you will be able to access it, your component will become > tightly coupled with your application and if you try to use this > component elsewhere, it may not work. Try doing it by the first way I > mentioned. > > > Happy Coding :) > > Regards, > Venkat > > On Mar 11, 4:29 am, madhavi chinni <madhugeetanjal...@gmail.com> > wrote: > > Hi, > > > > I want to access the variables in my main flex project mxml file in > > other custom components. > > Ex: // Variable decleration > > for Bindable > > [Bindable] > > public var _responseOverviewXML:String; > > [Bindable] > > public var _resultGraphXml:String; > > > > [Bindable] > > public var _rootEntityId:String > > > > The above are the variable declartions and I have a custom component > > called OverviewGraph.I have instanciated the custom component in the > > action script of the main mxml file as given below: > > var overview_obj:OverviewGraph=new OverviewGraph(); > > > > Could anyone tell me how can I access the above variables ine the > > custom component OverviewGraph? > > > > Thanks, > > Madhavi > > -- > You received this message because you are subscribed to the Google Groups > "Flex India Community" group. > To post to this group, send email to flex_india@googlegroups.com. > To unsubscribe from this group, send email to > flex_india+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/flex_india?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@googlegroups.com. To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.