I have recently been trying to start using DepthManager, and in some cases I
have been successful, but I have a problem using it within a class.
This example causes the compiler to report "There is no method with the name
'createChildAtDepth'"
/***********************************/
import mx.managers.DepthManager;
class SubMovie extends MovieClip
{
private var Square1:MovieClip;
// Constructor
private function SubMovie()
{
Square1 = createChildAtDepth("Square",DepthManager.kTop);
}
}
/***********************************/
If I can bypass the compiler's error checking, the code does in fact work, for
instance by invoking createChildAtDepth() like this:
Square1 = this["createChildAtDepth"].call(this,"Square",DepthManager.kTop);
However I feel it is bad practice to make something work by fooling the
compiler and I'm wondering if there is a proper way to inform the compiler that
createChildAtDepth() has been added to MovieClip's prototype.
I have tried DepthManager(this).createChildAtDepth("Square",DepthManager.kTop);
and UIObject(this).createChildAtDepth("Square",DepthManager.kTop);
Although both of them compile without complaint, they both fail at runtime.
I know I can also avoid the problem by making my class extend UIObject instead
of MovieClip, so this query is scarcely urgent; but the fact that my original
method failed suggests there is a gap in my understanding of Actionscript
fundamentals (or that the documentation of DepthManager is misleading), so I'd
be grateful if anyone can advise me.
Regards
Andy Kirkham
_______________________________________________
[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