The DepthManager doesn't have a static initialize method like EventDispatcher.
Methods are added to the MovieClip prototype in the DepthManager class
constructor, so you have to make sure the DepthManager gets
compiled into your swf and that it's constructor is run before you use it's
methods.
import mx.core.UIComponent;
import mx.events.EventDispatcher;
import mx.managers.DepthManager;
class TestCase extends MovieClip {
private static var __mixin = EventDispatcher.initialize(TestCase.prototype);
// declare EventDispatcher methods
public var dispatchEvent:Function;
public var addEventListener:Function;
public var removeEventListener:Function;
// make sure DepthManager gets compiled
private static var __depthManager:DepthManager;
// declare DepthManager methods
public var createClassChildAtDepth:Function;
public var createChildAtDepth:Function;
public var setDepthTo:Function;
public var setDepthAbove:Function;
public var setDepthBelow:Function;
public var findNextAvailableDepth:Function;
public var shuffleDepths:Function;
public var getDepthByFlag:Function;
public var buildDepthTable:Function;
public function TestCase() {
}
private function createCard(index:Number):Card {
var card_mc:Card = this.createClassChildAtDepth(Card,
DepthManager.kTop);
return card_mc;
}
}
May have some errors in code as I quickly wrote it down, not tested.
regards,
Muzak
----- Original Message -----
From: "Alexander Farber" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Tuesday, May 29, 2007 11:39 PM
Subject: [Flashcoders] There is no method with the
name'createClassChildAtDepth'.
> Hello Flashcoders,
>
> is there please a way to use DepthManager from a MovieClip-based class?
>
> I have prepared this short test code which compiles fine:
>
> import mx.core.UIComponent;
> import mx.events.EventDispatcher;
> import mx.managers.DepthManager;
>
> class TestCase extends UIComponent
> {
> private static var mixin = EventDispatcher.initialize(TestCase.prototype);
>
> public function TestCase() {
> //init();
> //createChildren();
> }
>
> private function init():Void {
> }
>
> private function createCard(index:Number):Card {
> var card_mc:Card = this.createClassChildAtDepth(Card, DepthManager.kTop);
>
> // XXX
>
> return card_mc;
> }
>
> private function createChildren():Void {
> size();
> }
>
> private function size():Void {
> }
> }
>
> But when I replace the class declaration line by
> class TestCase extends MovieClip
> and click at the "Check syntax" button, then I get compile error:
> There is no method with the name 'createClassChildAtDepth'.
>
> What am I missing here please?
>
> Do I need to call smth. similar to EventDispatcher.initialize()
> to initialize the DepthManager?
>
> Regards
> Alex
>
> --
_______________________________________________
[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