I’ve developed a component which is a combination of a few items (canvas, labels, etc…) but when I try to bind it to a variable such as : {stationXML.getItemAt(1).AAA.@value}, it doesnt work. Before I combined all the items in a component, they were all in the main MXML file at which time they worked.
Not sure if it matters, but the “stationXML” arraycollection variable is declared inside the file “Station.as”.
Any ideas?
When you say “global variable” where and how exactly is it declared? There aren’t really such a thing as a global variable in a Flex application. If you declare something in your main MXML class that doesn’t make it global, it makes it accessible by the instance of that main application class. If you want to access that value within a component then you must pass it down to that component. Alternatively, you could implement a singleton class to effectively provide “global” access to those values.
eg, in the component, create a public property:
then in the main mxml, pass the value down: