Here is an example that shows several ways to pass data between a popup and the main app. It does not show using events.
http://www.cflex.net/showFileDetails.cfm?ObjectID=558 Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of kalpkat9 Sent: Sunday, October 28, 2007 11:26 PM To: [email protected] Subject: [flexcoders] Re: Trigger a function in the main applicatoin mxml from a popup window. ok, I guess this will suffice if the popup was just an alert. but the popup window i am working on is a component by itself with datagrids and states, so i have to trigger the with button click from this titlewindow/popup window component. how is that i could access a function in the mainApp.mxml from my popup custom component mxml?. Thank you again. (sincerely appreciate your responses). --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , Bjorn Schultheiss <[EMAIL PROTECTED]> wrote: > > Try from in the mainApp scope. > > > http://livedocs.adobe.com/labs/flex3/html/help.html? <http://livedocs.adobe.com/labs/flex3/html/help.html?> > content=controls_22.html > > <?xml version="1.0"?> > <!-- controls\alert\AlertIcon.mxml --> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> "> > > <mx:Script> > <![CDATA[ > import mx.controls.Alert; > import mx.events.CloseEvent; > > [Embed(source="assets/alertIcon.jpg")] > [Bindable] > public var iconSymbol:Class; > > private function alertListener(eventObj:CloseEvent):void { > // Check to see if the OK button was pressed. > if (eventObj.detail==Alert.OK) { > myText.text = myInput.text; > } > } > ]]> > </mx:Script> > > <mx:TextInput id="myInput" > width="150" > text=""/> > <mx:Button id="myButton" > label="Copy Text" > click='Alert.show("Copy Text?", "Alert", > Alert.OK | Alert.CANCEL, this, > alertListener, iconSymbol, Alert.OK );'/> > <mx:TextInput id="myText"/> > </mx:Application> > > > > On 29/10/2007, at 1:56 PM, kalpkat9 wrote: > > > Thanks for taking your time to respond, Bjorn. > > > > I am triggering a function called submitData() from the click event of > > my button inside the popup window. > > > > private function submitData():void{ > > mainApp.currentState.name = "secondState"; > > } > > > > This doesnt seem to accomplish what I wish for (of changing the state > > of my mainApp.mxml) > > > > How is that I can access a function from my main application mxml, > > for example: changeState(). > > > > private function changeState():void{ > > currentState = "secondState"; > > } > > > > Please excuse my ignorance. Could you let me know what I am missing? > > > > Thank you. > > > > --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , Bjorn Schultheiss > > <bjorn.mailinglists@> wrote: > > > > > > Listen to the closeEvent from the popup and call the function from > > > the handler. > > > > > > Bjorn > > > > > > > > > On 29/10/2007, at 12:10 PM, kalpkat9 wrote: > > > > > > > Hi, > > > > > > > > This might be a really petty question to ask, but I will greatly > > > > appreciate if someone can answer. > > > > > > > > How can I trigger a function in my main application mxml, from > > a popup > > > > window(title window/panel) after a submit button click. (I am > > > > trying to > > > > change the state of my main application by clicking the submit > > button) > > > > > > > > Thank you, > > > > Kal. > > > > > > > > > > > > > > > > > > > > > >

