Groups | Blog | Home
all groups > flash actionscript > june 2004 >

flash actionscript : Does setDepthTo( ) even work in 2004?


B
6/4/2004 7:33:15 PM
Hello everyone... I'm trying to set the depth level of a movie clip by using
the setDepthTo(10) method and no matter what I do, the movie clip will not
change depths. It's almost like the setDepthTo method is not even a real Flash
method. The reason why I say that is because in the Actionscript Panel, all
methods turn blue when you type them out. the setDepthTo ( ) stays black which
indicates to me that something is not right with the method.

I'm not doing anything fancy... just trying to insure that the movie clip is
above another as it plays.

I can't figure out what I'm doing wrong.

Thanks for your help!!

Brenda
B
6/5/2004 1:40:21 AM
I've done a search online and I've found very little in regards to setDepthTo(
). I have a 2.0 actionscript book and it doesn't have anything about
setDepthTo ( ). I don't get this since, according to the actionscript
dictionary under the Flash help menu, it is indeed a valid method. However, it
doesn't work when I try to apply it and it (meaning setDepthTo) doesn't turn
blue like all the other methods do when coded into the actionscript panel.

?????

Brenda
B
6/5/2004 2:18:24 AM
Jeckyl, thank you for the information!!! Now I know why it doesn't work with
a movie clip!

I tried swapDepths but I found out that, though it will place the movie clip
above the other items, if the method is called while the movie clip is tweening
then it stops the tween.

I've found another workaround though so it's all good.

Thanks for your help,

Brenda
Jeckyl
6/5/2004 11:52:36 AM
setDepthTo only works with components that have that (and other
DepthManager) methods implemented. You cannot use it with a regular
movieclip

Use swapDepths instead.

Jeckyl
6/6/2004 1:19:59 PM
[quoted text, click to view]

Didn't know that one. Have to put that on my list of strange things that
happen. Eg. if you use script to control _x or othe rproperties in a clip,
then the clip will stop being controlled by timelines motion tweens. A clip
can only have one master, and once that mater becomes script, it will never
again respond to timeline tweens.

[quoted text, click to view]

That's good .. good luck !!

Cat1977
10/29/2004 1:06:06 PM
kunjanos
11/15/2004 10:38:49 AM
:rose; OK...I also tryd the .setDepthTo() and it sucks...We are so lucky that
..swapDepths() works...so if you want your movie clip to stay on Top...or become
the on top visible movie clip then you should create an empty movieclip with a
very high depth (ex. 1000) and swap their depths...
Rothrock
11/15/2004 1:42:25 PM
Actually 1000 isn't so high. Check out this
http://www.kirupa.com/developer/actionscript/depths.htm for more information
about swapDepths than you every wanted to know. Also, you don't have to take
swapDepths literally. You don't actually have to swap anything, you can just
take a move that already exists and set it's depth. If there is something at
that depth already, then they will be swapped, but otherwise it will just go to
that depth.
kunjanos
11/16/2004 9:36:16 AM
You are rigth...but when I needed it I had to swap back the images later....It
was an example of what to do when you have a lot of images on the same movie
(ex a puzzle) and you start draging them....now because the are in the same
movie and they have their depth different appeared the problem when dragging:
one image i above the dragged image and another is below it. That is why I had
to swap the depth the highest existing depth when dragging, and then swap back
the depth...And 1000 is enough in my application....and you can use the
..getNextHighestDepth() instead of 1000 or 2334535686879845673489694....it is
better...Bye
AddThis Social Bookmark Button