To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 10-11-2004, 03:11 PM   #1
sixfoorbratt
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
sixfoorbratt is offline   Reply With Quote
Old 10-11-2004, 03:54 PM   #2
jbum
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
File Type: fla depth_swap.fla (24.5 KB, 4360 views)
__________________
jbum is offline   Reply With Quote
Old 10-11-2004, 04:39 PM   #3
sixfoorbratt
Junior Member
 
Join Date: Oct 2004
Posts: 10
Thanks

Found that out the hard way
sixfoorbratt is offline   Reply With Quote
Old 03-22-2007, 07:28 PM   #4
x66x66
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.
x66x66 is offline   Reply With Quote
Old 08-08-2008, 12:31 PM   #5
designFanatic
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..
designFanatic is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:36 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.