In the popup, you would do:

 

<mx:Text text="{_app.myBindablePublicVar}" ./>

 

Here is a full example.  In it, I passed in a reference to the mainApp
instead of using the Application.application reference.

 

http://www.cflex.net/showFileDetails.cfm?ObjectID=558

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: [email protected] [mailto:[email protected]] On
Behalf Of Dave Cates
Sent: Monday, August 10, 2009 10:33 AM
To: [email protected]
Subject: Re: [flexcoders] Re: PopUp databinding - possible?

 

  

Hi Tracey,

Your comment in your first reply is exactly what I'm asking clarification
on:

>From 1st reply...

" Now you can bind to any bindable property in MyMainAppFileName"

How would you do this?

Sorry if it's really simple but I can't work out how to databind in as3 to a
dynamically created popup.

Thanks.

  _____  

From: Tracy Spratt <[email protected]>
Reply-To: <[email protected]>
Date: Mon, 10 Aug 2009 10:09:05 -0400
To: <[email protected]>
Subject: RE: [flexcoders] Re: PopUp databinding - possible?

 
 
 

See the code in my first reply.
 

Tracy Spratt,
Lariat Services, development services available

  _____  

From: [email protected] [mailto:flexcoders@
<mailto:[email protected]> yahoogroups.com] On Behalf Of Dave Cates
Sent: Monday, August 10, 2009 7:16 AM
To: [email protected]
Subject: Re: [flexcoders] Re: PopUp databinding - possible?

  

Hi Tracey,

Many thanks for your responses so far.

My only question is how do you bind any data into the popup?

Some example code...

In the parent AS code:

// declare new instance of my popup item
Var addPopUP:MyPopUp = new MyPopUp();

// assign var value to popup
AddPopUp.someData = _someData;

// display popup
PopUpManager.addPopUP( addPopUp, this, true);


In the Popup:

[Bindable]
Private var _someData:String;

[Bindable]
Public function set someData  (value:String):void
{
    _someData = value;
}
Public function get someData():String
{
    return _someData;
}

So, with your code inserted, how would the code above look different so that
when the _someData var in the parent changed, popup would automatically see
that change? (without creating another function in the parent - it needs to
be binded).

Thanks!
Dave.

  _____  

From: Tracy Spratt <[email protected]>
Reply-To: <[email protected]>
Date: Fri, 7 Aug 2009 22:49:00 -0400
To: <[email protected]>
Subject: RE: [flexcoders] Re: PopUp databinding - possible?

 
 
 

".in the creationComplete="init() of the PopUp?" Yes. 
 
Full syntax of what?  This: "[Bindable]private var _app:MyMainAppFileName;"
is full syntax.
 

Tracy Spratt,
Lariat Services, development services available 

  _____  


From: [email protected] [mailto:flexcoders@
<mailto:[email protected]> yahoogroups.com] On Behalf Of
[email protected]
Sent: Friday, August 07, 2009 2:25 PM
To: [email protected]
Subject: [flexcoders] Re: PopUp databinding - possible?

  

Tracy:

What do you mean by?

In a creation complete handler, assign:
_var =Application.application as MyMainAppFileName;

Do you mean in the creationComplete="init() of the PopUp? If so, what is the
full syntax?

Thanks!
Lee

--- In [email protected] <mailto:flexcoders%
<mailto:flexcoders%40yahoogroups.com> 40yahoogroups.com> , "Tracy Spratt"
<tr...@...> wrote:
>
> Sure. In the pop-up, define a bindable variable, say
> 
> [Bindable]private var _app:MyMainAppFileName;
> 
> 
> 
> In a creation complete handler, assign:
> 
> _var = Application.application as MyMainAppFileName;
> 
> 
> 
> Now you can bind to any bindable property in MyMainAppFileName
> 
> 
> 
> If that is backwards to what you want, then I advise dispatching events
from
> the Pop-up. Remember, binding is just an event mechanism that is created
by
> the compiler.
> 
> 
> 
> 
> 
> Tracy Spratt,
> 
> Lariat Services, development services available
> 
> _____ 
> 
> From: [email protected] <mailto:flexcoders%
<mailto:flexcoders%40yahoogroups.com> 40yahoogroups.com> [mailto:flexcoders@
<mailto:[email protected]> yahoogroups.com <mailto:flexcoders%
<mailto:flexcoders%40yahoogroups.com> 40yahoogroups.com> ] On
> Behalf Of Dave Cates
> Sent: Friday, August 07, 2009 10:01 AM
> To: [email protected] <mailto:flexcoders%
<mailto:flexcoders%40yahoogroups.com> 40yahoogroups.com> 
> Subject: [flexcoders] PopUp databinding - possible?
> 
> 
> 
> 
> 
> Hi all,
> 
> I have an mxml component that I am displaying via the popup manager
method.
> 
> But, I have data that is sent to this popup that needs to be data bound -
> database updates etc.
> 
> So, how do you databind to the vars inside the popup? If the MXML
component
> was on the stage as normal I'd have no problems but the popup, my nature,
is
> created at run-time.
> 
> So is it possible and if so, how?!
> 
> Thanks!
> Dave.
>
  
    

  
    





Reply via email to