The way I do this is I create a public property of type Object called
parentComponent in the Script/AS section of my TitleWindow. Then
after I create the PopUp I set the parentComponent. That way I can
get at the selectedItem and other information that I may need in the
PopUp without passing anything. I normally working within a
component that I have extended from one of the Flex components, so I
have a method like this:
protected var pop1:TitleWindow;
protected function createPopUp():void {
pop1 = new RemotingForm();
RemotingForm(pop1).parentComponent = this;
}
Where RemotingForm is the MXML TitleWindow.
Then in the TitleWindow I will reference the the selectedItem as
follows:
<mx:Script>
<![CDATA[
import flash.events.Event;
public var parentComponent:Object;
private var curItem:Object;
private function creationCompleteHandler(evt:Event):void {
curItem = parentComponent.selectedItem;
}
]]>
</mx:Script>
I use this technique with all of my list based components.
Maury
--- In [email protected], "tddclare" <[EMAIL PROTECTED]> wrote:
>
> I talk to myself all the time, so why not do it on FlexCoders?
>
> I was thinking more about my problem: I had tried to do something
> like this:
>
> //code here to create new popup of my TitleWindow form, then...
> myTitleWindow.person = myPerson;
>
> But I was getting errors and/or nothing because myTitleWindow was
not
> done creating its children before I set its person variable.
>
> So I did this:
>
> var myTitleWindow = //code to create the popup using my mxml
extension
> //of TitleWindow with the set person() function
in
> //it
> var myFunc:Function = function():void {myTitleWindow.person =
myPerson}
>
> myTitleWindow.addEventListener("creationComplete", myFunc);
>
> Seems to work, and is finally gives me a reason to understand why
one
> would ever create a variable of type Function.
>
> Comments or concerns are welcome... but I thought I'd share
>