mmc> The first is accessing the class scope from within a xml object ,
mmc> solved by defining a local variable withing the constructor
mmc> before your XML object.
mmc>
mmc> var parent:ClassName= this;
mmc> _xmlData.onLoad = function(success:Boolean) {
mmc> if(success) {
mmc> parent.[class imethods you want to reference here]
mmc> }
It's better to avoid using inline functions. And you don't need to
reinvent the wheel - use the mx.utils.Delegate class (or an
equivalent) for scoping issues.
mmc> Another is accessing the container clip for a class if created at
mmc> runtime solved by simply passing a reference to the container as
mmc> an argument in the constructor
Well, probably you mean "object instance" and not "class". Actualy
there is no "container" for object instances, there is no hierarchical
structure among object instances, no parents and no children - an
object can be referred from anywhere and multiple variables (residing
in different objects) can point to the same instance. If you want to
access an object's methods/properties from inside another object, then
you need to hold a reference to it of course, and you may call it a
"container", "parent" or "child", but this expresses a logical
relation only rather than a "physical" one.
mmc> But one issue that sometimes puzzles me is how to accurately
mmc> reference the class anywhere in a class.
mmc> If you are sub-classing a Movieclip, then technically speaking,
mmc> using 'this' references the MovieClip, not the class, am I
mmc> correct?
"this" refers to the object instance and not the class. If you
subclass a MovieClip and instatiate an object instance of the
descendant class, then "this" obviously refers to it.
Attila
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com