Tracy's comment about binding caught my eye because I've been
experiencing what seems to be unreliable binding in my application.
I'm curious as to whether the reason is the issue Tracy mentioned. As
an example:

>From my main page, I'll open a popup window whose ComboBoxes should be
pre-populated with the results from a database call via a
RemoteObject. These ComboBoxes are empty, and only populate if I close
the window and re-open it. The same goes for the DataGrid and Labels
that will be populated with search results-- they are initially empty,
but populate once the window is closed and re-opened. I should mention
that I am using Cairngorm, and the dataProviders for all of these
components are ModelLocator variables, and thus static.

The way that I have worked around this is to stop using ModelLocator
variables as dataProviders, which I don't like doing, because I feel
like I'm deviating from the Cairngorm architecture. Here is what I am
doing instead:

Whenever an event completes (a "SetSearchResultSelection," for
example, which will store the object that the user selects of all the
search results stored in the DataGrid), I fire a "FinishedEvent" from
within that Command class's execute() method that announces that the
event has completed. This allows me access to the Command class's
variables (eventObject.<var_name>, for example) in my ViewHelper's
handleEvent() method via event.data.<var_name>.

Anytime I use this work-around instead of binding to ModelLocator
variables, the components populate the first time the window is
opened. Can anyone offer any insight as to why this is the case?

Thank you.

--- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> In your code, you do not have "two mxml files".  It does not matter
> where the code for a component comes from.  When the component gets
> instantiated, it is "in" the application, and you can reference the
> parent application as Manish suggests.
> 
>  
> 
> Be careful with binding.  While I am not sure about parentApplication or
> parentDocument references, I AM sure about the
> mx.core.Application.application style reference from within a component:
> It will NOT reliably support binding, because of data typing issues.  If
> you need to bind to something in the application scope, post, and I'll
> suggest some solutions.
> 
>  
> 
> Tracy
> 
>  
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Parekh, Shweta - BLS CTR
> Sent: Friday, October 14, 2005 1:49 PM
> To: flexcoders@yahoogroups.com
> Subject: RE: [flexcoders] Problem with repeater and datagrid -- Please
> help!
> 
>  
> 
> So then two mxml files will be accessing the same actionscript. In one
> mxml, the member is set and the other mxml accesses the member. That
> might work for me. But can two mxml files access the same actionscript?
> 
>  
> 
> -Shweta
> 
>       -----Original Message-----
>       From: flexcoders@yahoogroups.com
> [mailto:[EMAIL PROTECTED] On Behalf Of Mink, Joseph
>       Sent: Friday, October 14, 2005 1:18 PM
>       To: flexcoders@yahoogroups.com
>       Subject: RE: [flexcoders] Problem with repeater and datagrid --
> Please help!
> 
>       Or you can create a static actionscript class with a private
> member.  Set that member, and then everyone who accesses the static
> class will get the same value for that static member:
> 
>        
> 
>       class StaticClass
> 
>       {
> 
>         public static var theValue;
> 
>       }
> 
>        
> 
>       ...
> 
>        
> 
>       StaticClass.theValue = something;
> 
>        
> 
>       ...
> 
>        
> 
>       if (StaticClass.theValue == something)
> 
>       ...
> 
>        
> 
>       Does that help?
> 
>        
> 
>       
> ________________________________
> 
> 
>       From: flexcoders@yahoogroups.com
> [mailto:[EMAIL PROTECTED] On Behalf Of Manish Jethani
>       Sent: Friday, October 14, 2005 12:27 PM
>       To: flexcoders@yahoogroups.com
>       Subject: Re: [flexcoders] Problem with repeater and datagrid --
> Please help!
> 
>       On 10/14/05, Parekh, Shweta - BLS CTR <[EMAIL PROTECTED]>
> wrote:
>       
>       > 1. Are there global variables in Flex so that I can take the
> result from
>       > remote call in a global variable and then use it anywhere --
> in my case in
>       > the child component?
>       
>       You can save the result in the application and then refer to it
> from
>       child components using the expression
> "parentApplication.myResult"
>       (can even bind to it I guess).





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
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/
 




Reply via email to