A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: SwapDepth / Return to Original Position/ Animated Buttons

  1. #1
    Junior Member
    Join Date
    Jul 2004
    Posts
    5

    SwapDepth / Return to Original Position/ Animated Buttons

    Hi,

    I was hoping someone might be able to help me.

    I am creating a interactive desk, where all the items do something on the desk (i.e. rollover a post-it note and it enlarges so its readable) etc.

    I have approximently 15 items on my desk and have created each item in a button, where the "Over" state is a moveclip that animates it enlarging.

    My problem is the depth function; I can't work out how to rollover something and when the animation begins bring it to the front and at the end of the animation send it back to its original position.

    Anyone have any ideas? I would really appreciate any help.

    Cheers

    Mike

  2. #2
    Junior Member
    Join Date
    Mar 2005
    Location
    VA
    Posts
    2
    Not sure i follow exactly what it is youre trying to do, but if its just bring the pencil above the rollover content from its current location use

    button_mc.onRollOver = function() {
    notepad_mc.setDepthAbove(button_mc)
    }
    button_mc.onRollOut = function() {
    notepad_mc.setDepthBelow(button_mc)
    }


    This only works well if you change the button to a movieclip and only in Actionscript 2. But if not, It seems like you could create a new layer on the button and simply reuse the movie clip. But once again, Im not exactly sure what youre trying to do.

    Hope that helps,
    Jamie
    Last edited by JamieLife; 03-07-2005 at 09:37 AM.

  3. #3
    Junior Member
    Join Date
    Jul 2004
    Posts
    5
    Thanks for your reply Jamie...

    I'll try and explain a little better:

    I have multiple buttons (15), which when you rollover them play an animation, the animation is the button enlarging.

    Let's say I have 4 buttons, ordered by depth like below:

    1
    2
    3
    4

    On(rollOver) button "3" - my order will change to:

    3
    1
    2
    4

    On(rollOut) - my order will be restored:

    1
    2
    3
    4

    I can't get the rollout to restore the button to its original location in the depth ordering.


    Hope this makes more sense,

    Cheers
    Mike

  4. #4
    Junior Member
    Join Date
    Mar 2005
    Location
    VA
    Posts
    2
    Ok I played around with this for a while. The attached file was the best I personally could come up with.

    Depth in flash has given me a lot of problems. The only thing i could think to do was swap whatever clip I wanted in front with the forward most clip. This poses minor problems mainly with the middle clips but depending on what youre working with it may not be a big deal.

    Apparently other people are having problems with it as well. http://www.actionscript.org/forums/showthread.php3?t=65669 I found that, which explains the play heads role in depth a little more.

    Hopefully the attachment helps, if you figure out a better way, or if anyone else has an idea, feel free to help out here.
    Attached Files Attached Files

  5. #5
    Junior Member
    Join Date
    Jul 2004
    Posts
    5
    Hi Jamie,

    Thanks for your attempts.

    After much messing around and changing Actionscript I've managed to get something working the way I wanted it too, although it may not be the best way, its works fine for me.

    What I did is create a button with "image1", this is a standard button with the below on the button actionscript:

    on (rollOver) {
    topDepth++;
    _root.image1.swapDepths(topDepth);
    _root.image1_mc.gotoAndPlay(2);
    }
    on (rollOut) {
    _root.image1.swapDepths(topDepth);
    _root.image1_mc.gotoAndPlay(9);
    }

    Then I had a movieclip, with frame 1 empty with "stop();". Frame 2-8 had the image enlarging then "stop();" at frame 8, frame 9-12 had the image fade away and then a "stop();".

    So basically my button was a play button for a movieclip.

    Hope that makes sense and it's probably not the best way to do it, but it works and after spending nearly a day on it, it will do.

    Cheers

    Mike

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