Hi everyone,
I wonder if you can help me.
I am using Aral's code behind method of building a Flex app
http://www.adobe.com/devnet/flex/quickstart/building_components_using_code_behind/
and it works really well so far. Now I've hit a problem which is
probably easy to solve but I can't figure out.
My main MXML file is index.mxml and it uses an AS class Main.as
<custom:Main
xmlns:custom="comps.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
>
The MXML has a Canvas, then another Canvas, then another Canvas, then
a TabNavigator and the third tab has a Listbox. So this is the tree:
Main
|____ canv1
|
|__ canv2
|___canv3
|___tabnav
|_______users_list
Main.as receives an event from another class instance (soConnector)
and upon this event I want to bind a property dpUsers (an
ArrayCollection) which exists within soConnector to the users_list
Listbox. This is where I receive the event in Main:
private function soHandler( e:SOEvent ):void
{
trace("soHandler - SO ready");
answer_pb.addEventListener(MouseEvent.CLICK, answerHandler);
}
I tried adding this to soHandler:
users_list.dataProvider = soConnector.dpUsers;
But this throws an error, it appears that users_list is null and I
have to drill down to it through canv1, canv2 and so on. But how? I
can't seem to be able to append several getChildByName methods to one
another:
canv1.getChildByName("canv2").getChildByName("canv3").getChildByName("tabnav").getChildByName("users_list")
does not seem to work
it states:
1061: Call to a possibly undefined method getChildByName through a
reference with static type flash.display:DisplayObject.
Any help appreciated. This must be dead easy if you know how
Cheers
Stefan