It’s not quite like that.  Turn on the keep-generated-as in flex-config and then compile your MXML file andyou’ll see a –generated.as file that gives you a sense of the code layout.  The big thing to notice is the variable declarations for any object that has an id.   Later on when the objects are instantiated they will be assigned to those variables.  All components have a concept of their MXML document (the parentDocument property) and therefore can get assigned to the right variable easily.

 

Matt

 


From: JesterXL [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 08, 2005 11:38 AM
To: Flexcoders
Subject: [flexcoders] Object Aliasing?

 

Before I go digging to figure it out, I wanted to see how close I was.  If I
put a button called "submit_pb" ina ViewStack, I can still reference my
submit_pb normally; I don't have to do myView.submit_pb to access the
methods & properties on submit_pb.

How is it that Flex resolves these namespaces?  After tracing some children,
they are nested pretty deep, so I'm impressed at how fluidly this works, and
how transparent it is to the developer.

Here's my guess; am I close?

--JesterXL

function init()
{
createEmptyMovieClip("view_mc", 0);
view_mc.createEmptyMovieClip("view1", 0);
view_mc.createEmptyMovieClip("view2", 1);
trace(view1);
}

function __resolve(name:String):Function
{
trace("name: " + name);
return view_mc[name];
}

init();



Reply via email to