Skip to main content
August 11, 2009
Answered

Gumbo FlexGlobals.topLevelApplication data binding issues

  • August 11, 2009
  • 5 replies
  • 11032 views

Hi

what is the reccomended way to bind a datasource of a sub-component to a Bindable collection in the top level application location.

in 3, for this I would use {Application.application.instance_of_bindable_variable}, now I get a warning saying that data binding will not be able to detect assingments to  {FlexGlobals.topLevelApplication.instance_of_bindable_variable}

so, how do i bind a data source of a sub-component to a variable instantiated at the Application level in Flex 4?

Thanks,

Jed

    This topic has been closed for replies.
    Correct answer Alex J Harui

    Hi Alex, thanks for the reply.

    i added an import statement to mx.core.Application to the component and cast the FlexGlobals.topLevelApplication call, as you suggested, and it will not find the property now : "Eror 1119, access of possibly undefined property."

    I am trying to bind to a public ArrayCollcection that is marked with metadata as bindable in the toplevelApplication mxml file. as such

    ## index.mxml

    [Bindable]

    public var myArrayCollection:ArrayCollection;

    ## myComponent.mxml

    <myComponent source = "{Application(FlexGlobals.topLevelApplication).myArrayCollection}" />

    -------------------

    The project is imported from a Flex 3.x project and we are trying to move it over. Would it matter if the namespace for the script tag is mx vs fx, eg <mx:Script> | <fx:Script> ?

    any help would be much appreciated. Thanks in advance.


    My bad, instead of Application use the name of your application MainApp(FlexGlobals...).someProperty

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc.

    Blog: http://blogs.adobe.com/aharui

    5 replies

    Participant
    July 18, 2011

    Using parentApplication to navigate to where I wanted worked for me. Actually was the only way to get rid of the warrning.

    Regards,

    Janez

    Participant
    November 18, 2011

    Thanks Janez, parentApplication worked for me too.

    Known Participant
    March 2, 2010

    I'm a one man shop and this touches 74 files, in one project for one client.  I have over 400 compiler warnings.  I like to keep them as clean as possible, because once in a very great while they really save my bacon.   Shame on me for using globals.  Shame on the Flex team for all the "make work" for simple contractor trying to make ends meet.

    June 28, 2010

    My Application variables are like this:

    EmployeeID = Application.application.parameters.EmployeeID

    How should it look like now?

    FlexGlobals.topLevelApplication.parameters.EmployeeID ?

    Not sure, anyone

    thanks

    George

    Adobe Employee
    June 29, 2010

    Sure. You may want to cast to Application though.

    Application(FlexGlobals.topLevelApplication).parameters.EmployeeID

    Known Participant
    March 2, 2010

    I'm getting the compiler warning; Description Resource Path Location Type

    Data binding will not be able to detect assignments to "topLevelApplication".

    Regardless, what do I do if I want to bind to a global but use it in multiple applications?  

    "{myApp1(mx.core.FlexGlobals.topLevelApplication).someVar}"

    "{myApp2(mx.core.FlexGlobals.topLevelApplication).someVar}"

    Please help!

    Adobe Employee
    March 2, 2010

    You could define a common interface that both applications implement if you

    want to use the exact same code in two different apps.

    I think you would get the same warning in 3.x if you used

    "{myApp1(Application.application).someVar}"

    I would try just ignoring the warning and see if it works. If not, I would

    recommend placing all app data you want to bind to in a data model instead.

    August 14, 2009

    thanks Alex. for any readers interested, the name of the app is the actual name of the default mxml application file, in our case its generically called, index.mxml, as opposed to the name property that you can assign to the Application tag.

    August 12, 2009

    Bump!

    Adobe Employee
    August 12, 2009

    Try "{Application(FlexGlobals.topLevelApplication).somePropOnApplication}"

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc.

    Blog: http://blogs.adobe.com/aharui

    August 14, 2009

    Hi Alex, thanks for the reply.

    i added an import statement to mx.core.Application to the component and cast the FlexGlobals.topLevelApplication call, as you suggested, and it will not find the property now : "Eror 1119, access of possibly undefined property."

    I am trying to bind to a public ArrayCollcection that is marked with metadata as bindable in the toplevelApplication mxml file. as such

    ## index.mxml

    [Bindable]

    public var myArrayCollection:ArrayCollection;

    ## myComponent.mxml

    <myComponent source = "{Application(FlexGlobals.topLevelApplication).myArrayCollection}" />

    -------------------

    The project is imported from a Flex 3.x project and we are trying to move it over. Would it matter if the namespace for the script tag is mx vs fx, eg <mx:Script> | <fx:Script> ?

    any help would be much appreciated. Thanks in advance.