Is that bug or feature?

Monday, June 13th, 2005

I’ve found this by mistake, and do not know if it is bug or some kind or feature (suppose bug :) ).

Here is code:

[as]
var mc = _root.createEmptyMovieClip(”mc”,100)
var mc2 = _root.createEmptyMovieClip(”mc”,90)

var a = mc.attachMovie(”a”,”a”,100)
trace(a.getDepth())
a.swapDepths(300)
trace(a.getDepth())
[/as]

and the result will be the same 100. But why, I’ve swaped depth, so it should be 300! As I said it was by mistake, so I was trying another examples, and all was working except this example. Then i had copy and paste code from this example to another, and have found why it doesn’t work here.

[as]
var mc = _root.createEmptyMovieClip(”mc”,100)
var mc2 = _root.createEmptyMovieClip(”mc”,90)
[/as]

same name for new movieclip. All works because old mc movieclip was replaced by new mc2, but swapDepths it doesn’t work from now on. It is interesting because mc should not exists (as I think) because movieclip was replaced by mc2. But why then I can attachMovie to mc?

[as]
var a = mc.attachMovie(”a”,”a”,100)
[/as]

Let me know :) Thanks.

tagged under:

ABOUT THIS AUTHOR

Get a Trackback link

3 Comments


  1. creynders
    Visit Site
    June 13th, 2005

    You’re mistaken. The second movieclip doesn’t overwrite the first one. There are simply 2 movie clip instances with the same instance name (but on different depths)

    Why the swapdepths doesn’t work, i don’t know….


  2. Administrator
    Visit Site
    June 13th, 2005

    but there is problem when you want get instance on movieclips:

    var mc = _root.mc, which movieclip shoud be taken…

    I think, that’s way swapdepths doesnt work (maybe) :)


  3. eq2 plat
    Visit Site
    April 13th, 2008

    This is a tricky one…

    Have you figured out why the swapdepths don’t work since?

Live Preview

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

CommentLuv Enabled

Images is enhanced with WordPress Lightbox JS by Zeo