I'm relatively new to all this but I do happen to have done this
recently and here's how:
A model containing data to be passed to the popup. This exists on
the parent of the popup.
<mx:Model id="searchData">
<searchView>{cbSearchView.selectedItem.data}</searchView>
<searchCN>{tiSearchCN.text}</searchCN>
<searchSapCustNo>{tiSapCustNo.text}</searchSapCustNo>
<searchBatchID>{tiBatchID.text}</searchBatchID>
</mx:Model>
The AS to create the popup:
var popupScreen:TitleWindow = TitleWindow( PopUpManager.createPopUp
( this,
creditBatchPopup,
true,
{title: 'Credit Batches', closeButton: false,
parentComponent: this.searchData},
false) );
The popup can then refer to data in the model with
parentComponent.searchView etc etc.
As I say, I'm new - so there's a good chance there's a better way
(if so, can someone please tell me!) - but the above does seem to
work!
Cheers,
Jamie.
--- In [email protected], "Francesco" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I've a question about passing parameter.
>
> The problem:
>
> I have a panel with a button. (popupwindowdemo.mxml)
> When I press the button a popup window will be opened
> (the definition of the window stay in another file
logonwindowdemo.mxml)
>
> My question is:
>
> How can I pass a parameter (String) from the panel to the popup
windows
> (pressing the button) ?
>
> In my case I'd like that the field "userid" will be automatically
> completed...
>
>
>
> Thanks
> Francesco
>
>
>
>
>
>
>
> Here is the code (from explorer)
>
> /****************************/
> popupwindowdemo.mxml
> /****************************/
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
>
> <mx:Script>
>
> function showWindow(modal) {
> var popup = mx.managers.PopUpManager.createPopUp(_root,
> LogonWindow, modal, {deferred: true});
> }
>
> </mx:Script>
>
> <mx:Button label="Show Window" click="showWindow(false)"
width="150"/>
> <mx:Button label="Show Modal Window" click="showWindow(true)"
> width="150"/>
>
> </mx:Application>
>
>
> /*****************************/
> logonwindowdemo.mxml
> /*****************************/
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <mx:TitleWindow xmlns:mx="http://www.macromedia.com/2003/mxml"
> title="Logon">
>
> <mx:Form>
>
> <mx:FormItem label="UserId" required="true">
> <mx:TextInput id="userId" width="150"/>
> </mx:FormItem>
>
> <mx:FormItem label="Password" required="true">
> <mx:TextInput id="password" width="150"/>
> </mx:FormItem>
>
> <mx:FormItem>
> <mx:HBox horizontalGap="30">
> <mx:Button label="Logon"/>
> <mx:Button label="Cancel" click="this.deletePopUp
()"/>
> </mx:HBox>
> </mx:FormItem>
>
> </mx:Form>
>
> </mx:TitleWindow>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/