Flash MX 2004 Components, "this.getNextHighestDepth()"

Hi everyone

I was playing around with Flash MX 2004 components.

Has anyone noticed this problem, trying to remove a dynamically created Button? while using the “this.getNextHighestDepth()” function.


this.createObject("Button","cbtSubmit",this.getNextHighestDepth(),{_x:200,_y:200});

cbtSubmit.label = "testing 01";

this.destroyObject("cbtSubmit");

The following code creates the Button and labels it correcty. However it doesn’t remove the Button :puzzle:

But if I replace “this.getNextHighestDepth()” with a number or variable then it removes the instance.

Thanks in advance :smiley: