Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
0

Gumbo FlexGlobals.topLevelApplication data binding issues

Guest
Aug 11, 2009 Aug 11, 2009

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

10.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Aug 14, 2009 Aug 14, 2009

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

Translate
Guest
Aug 12, 2009 Aug 12, 2009

Bump!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 12, 2009 Aug 12, 2009

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

Alex Harui

Flex SDK Developer

Adobe Systems Inc.

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 14, 2009 Aug 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 14, 2009 Aug 14, 2009

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 14, 2009 Aug 14, 2009

hi alex,

I spoke too soon. still no binding detected. I can reference index.myArrayCollection directly but I get a error that I am trying to cal and undefined method through a reference to a static Class. is the defaultApplication file compiled into a static class? Will I need to move the source of these bindable arrays outside the main application file?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 14, 2009 Aug 14, 2009

Can I see some code snippets?

Alex Harui

Flex SDK Developer

Adobe Systems Inc.

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 14, 2009 Aug 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 01, 2010 Mar 01, 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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 01, 2010 Mar 01, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 01, 2010 Mar 01, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 28, 2010 Jun 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jun 28, 2010 Jun 28, 2010

Sure. You may want to cast to Application though.

Application(FlexGlobals.topLevelApplication).parameters.EmployeeID

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 17, 2010 Sep 17, 2010

I just tried it and was able to bind against my FlexGlobal ArrayCollection.

It does produce a warning "DataBinding will not be able to detect assignments to topLevelApplication".

I am unsure what that really means, will it not detect changes from other components bound to this ArrayCollection? I dont know yet.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 18, 2011 Jul 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 18, 2011 Nov 18, 2011
LATEST

Thanks Janez, parentApplication worked for me too.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines