A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Actionscript to bring layer to front

  1. #1
    Junior Member
    Join Date
    Oct 2004
    Posts
    10

    Actionscript to bring layer to front

    Hi most helpfull

    I am using MX 2004. I have several MC clips near each other. I would like to know if you have a tutorial that will show me how to bring the layer to the front on rollOver and move it to an X, Y co-ordinate.

    Thanks

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    A script like this, attached to the movieclip, should do it:

    code:

    on(rollOver)
    {
    this.swapDepths(1000);
    this._x = 200;
    this._y = 200;
    }



    I've attached a sample flash file.

    It's worth noting that rollOver events and moving the _x _y coordinates often produce strange results. For example, if you move the movie out from under the mouse, then you will immediately get a rollOut event.

    In this example, I am not moving the movies "back" on a rollOut event, which is something you might want to do, but keeping the above in mind, this can also set up an undersirable oscillation:

    1. the mouse moves over the movie, it gets a rollover event.

    2. The rollover event handler moves the movie out from under the mouse. the movie gets a rollout event.

    3. the rollout event handler moves the movie back under the mouse. the movie gets a rollover event.

    4. Repeat from step 2.
    Attached Files Attached Files

  3. #3
    Junior Member
    Join Date
    Oct 2004
    Posts
    10

    Thanks

    Found that out the hard way

  4. #4
    Junior Member
    Join Date
    Mar 2007
    Posts
    1

    masking

    I tried that in one of my Dresser games on a symbol under a mask and the mask didn't work once the button was pressed. How come and is their a way to fix that?

    PS=I know this board is like 2 years old, but oh well.

  5. #5
    Junior Member
    Join Date
    Jun 2008
    Posts
    2
    Quote Originally Posted by x66x66
    I tried that in one of my Dresser games on a symbol under a mask and the mask didn't work once the button was pressed. How come and is their a way to fix that?

    PS=I know this board is like 2 years old, but oh well.
    Put the mask and the object being masked inside of its own MC and call that mc to the front.

    Just a little late..

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