I guess you would have to consider coupling.
You could have your mainApp register as a listener to your popup. dispatch an event from your popup that triggers the method in your mainApp view. I guess you could also register your mainApp as a 'mediator' of your component popup.

Normally i would use an MVC architecture and my currentState would be bound to a property on the model.


Bjorn



On 29/10/2007, at 2:25 PM, kalpkat9 wrote:

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 flexcoders@yahoogroups.com, Bjorn Schultheiss
<[EMAIL PROTECTED]> wrote:
>
> Try from in the mainApp scope.
>
>
> 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";>
>
> <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 flexcoders@yahoogroups.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.
> > > >
> > > >
> > > >
> > >
> >
> >
> >
>




Reply via email to