A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: strange swapDepths behaviour

  1. #1
    383,890,620 polygons nGFX's Avatar
    Join Date
    Oct 2002
    Location
    Germany / Ruhrgebiet
    Posts
    901

    strange swapDepths behaviour

    ... mhm today i experienced the following:

    my new game has a cursor which is visible only during the game.
    when you finish a level the playhead jumps to "LevelDone" where the cursor has NO frames (so the mc should be removed, along with it's events)

    this worked fine UNTILL i needed the cursor to be over some generated tiles so i used swapDepths ... bad idea

    i noticed that the cursor is not removed correctly from the stage - it is invisible or something else, 'cause when i now start a new level, the playhaid jumps to "Play" and the cursor appears on the stage again.

    AND ALL THE F***ING EVENTS ARE FIRED TWICE !?

    for testing reasons i added a mouseup to the cursor with nothing more than a trace inside.

    when played for the first time, only one trace was executed, but when the second level started there where 2 and after the third 3 ...

    i solved the problem by adding a container_mc ... so i don't have to bother anymore...

    but the 2hours i needed to get behind this where wasted, damn!


    just to let you know ...

    <olli/>

  2. #2
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    that's not something new, but i wasted several evenings with that method several months ago (around one year ago in fact). simply because your swaped MC, even with no frame, is still here at its "virtual" depth. i say virtual because it changes its depth while swapping, and is not on the timeline anymore...

    > to avoid that, simply remove it via the simple removeMovie code...

    OR do a containerMC like you did, and the thing is removed.

  3. #3
    383,890,620 polygons nGFX's Avatar
    Join Date
    Oct 2002
    Location
    Germany / Ruhrgebiet
    Posts
    901
    ... but i still believe that the events should NOT be executed twice

    <olli/>

  4. #4
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    when played for the first time, only one trace was executed, but when the second level started there where 2 and after the third 3 ...
    that's because the "old" cursor was still there, at its depth, so each time you think it's deleted and add another one (via attachMC/duplicateMC i suppose), there were 2 cursors, then 3...

    well yes, it was terrible when it happened to me the first time; i remember that all my swaped elements where all around when i changed the map (it was a zelda-like view)...

  5. #5
    383,890,620 polygons nGFX's Avatar
    Join Date
    Oct 2002
    Location
    Germany / Ruhrgebiet
    Posts
    901
    think it's deleted and add another one (via attachMC/duplicateMC i suppose),
    ... nope, i didn't, that's why i find this SO strange ... the cursor was just "attached" via timeline and the swapdepths was executed everytime the "Play" frame was reached ...

    so i thought that in the worst case the old cursor would just be replaced with the new one AND only one cursor is shown in the variable dump (ctrl+alt+v), too.

    <olli/>

  6. #6
    Senior Member Penleeki's Avatar
    Join Date
    Mar 2003
    Location
    England
    Posts
    223
    I usually avoid using swapDepths on anything that hasn't been attached/duplicated because of the scary things that happen.

  7. #7
    383,890,620 polygons nGFX's Avatar
    Join Date
    Oct 2002
    Location
    Germany / Ruhrgebiet
    Posts
    901
    ... i have never used it on a "timeline-object" before and i sure will not do it again ...

    <olli/>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center