Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




SwapDepth Troubles



hey, i want to swap the depths of a number of movieclips, well actually its more to scroll between them. So the mc at the top has to go to the bottom and the others move up. at the moment i have set it up with depths 1 2 3 4, once a button is clicked the depths increment and when the 4 goes to 5 it gets swapped again to 0. and then anther function is called to change this 0 to 1. now i got 1 4 3 2. but once the buton is clicked again it all goes wrong because when the 1 trys to increment to 2, the other 2 goes nuts, well not nuts just doesn't do anything, which screws up everything else.

Code:
left_btn.onPress = function(){

for(var r = 0;r < xmlLength;r++){
var movieClipHolder:String = "movieClipHolder"+(r)

var k = _root[movieClipHolder].getDepth();
_root[movieClipHolder].swapDepths(k + 1);

if(k == xmlLength){
_root[movieClipHolder].swapDepths(0);
}
if(k == 0){
_root[movieClipHolder].swapDepths(1);
}
trace("movieClip Holder" + r + " depth is " + _root[movieClipHolder].getDepth());
}
}

left_btn.onRelease = function(){

for(var r = 0;r < xmlLength;r++){
var movieClipHolder:String = "movieClipHolder"+(r)

var k = _root[movieClipHolder].getDepth();

if(k == 0){
_root[movieClipHolder].swapDepths(1);
}
trace("movieClip Holder" + r + " depth is " + _root[movieClipHolder].getDepth());
}
}
i think if i some how get the increment to wrk on the mc at depth 4 first each time it'll work. but i'd appreciate any input, pointers from anyone who knows this would be accomplished. thanks.

adam



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 03-01-2007, 02:47 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

SwapDepth On An MC That Contains An On(press) SwapDepth Within
On my main stage I have 6 MCs, triggered by menu buttons and all on the same layer. Each of these MCs is a draggable window using this code:code: on (press) {
startDrag("/dragMC1", false);
_parent.depth++;
this.swapDepths(_parent.depth);
}This works perfectly.

Now, I'm trying the make it so when you press the menu, that the chosen window loads on top.

I've tried a few things, and the closest I come is have the chosen window load on top, which is what I want, but it cancels out the above code.

Any help on this problem will be greatly appreciated.

SwapDepth Help Please
I am having a really big problem with swapDepths
i cant get it to work at all.

I have an array of objects, thats sorted in order of which closest to the front, I can't figure out the code to set the depths of each object after

obj.n is the objects name

i tried going

for(i=0; i<objarray.length; i++){
objarray[i[i]].swapDepths(i);
}
but that didn't work at all any help would be greatly appreciated

thanks

or any general help about swapDepth would be great
[Edited by FallenKnight on 07-02-2001 at 04:02 PM]

SwapDepth?
i am bad with code, i need to learn a lot more.

my problem:
i have 4 mc's which are on the same layer.
each has an elastic code attached so the zoom into view as follows

onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
elasticScale(1000, 0.8, 0.1);

} else {
elasticScale(50, 0.8, 0.03);
}
}

Swapdepth?
ok i have a frame with like 50 draggable on it. i need the draggable items to decrease in frame depth the higher the _x of the MC, i have no idea how to write this code. can anyone help me?

please.
mallrat

.swapDepth HELP....
I have tried to get .swapDepth to work, but I cant.

I need to make one movie clip "move infront" of the other

Anybody know how to use this? A .fla would be good...

Help please.

SwapDepth.....
I am having a problem with the play back of my movie when I test it.

I am using the swapDepth action (which I think is buggy...either that, or noone knows how to fix..)....

Anways-

scenerio:

Main (level_0) movie has some buttons...and some layout stuff...

on a layer in here..I have 3 MC's (with a stop action in the first frame..in the second frame I have a frame action to load an external.swf. This all works fine..(the loading part)

the problem is this: when I click on a button to load the external.swf's they dont run like they are supposed to...it totally bogs down the whole movie. Can anyone help? I will send the .fla/.swf to anyone who has knowledge about this stuff....

I can not for the life of me figure out "WHY" this is happening.
when I load the external.swf's normally (no swapDepth)...it "SEEMS" to act normal....

PLEASE help..I have been working on this for DAYS...and I can not seem to find the flaw in my work. Thanks

-whispers-

Swapdepth Help
hi, im currently having problems with using swap depth

i have two balls floating in 3d (see http://www.tesoweb.co.uk/experiment/3d.html)

the ball without the arrow is ball 1, the ball with the arrow is ball 2

if you go to the above url you will see ive put some dynamic text boxes on to see the current values etc

below is the code im using in the onClipEvent(enterFrame) ball 1 movie clip to display the data:

the dynamic text boxes are labelled 1 to 5, in the order they are displayed (top to bottom)

test1 and test 2 contain the current z angle of the balls


Code:
if (_root.test1 > _root.test2 ) {
_root.test3 = "ball one greater";
_root.test4 = _root.ball1.getDepth();
_root.test5 = _root.ball2.getDepth();
_root.ball1.swapDepths(_root.ball2);
} else if ( _root.test1 < _root.test2 ) {
_root.test3 = "ball two greater";
_root.test4 = _root.ball1.getDepth();
_root.test5 = _root.ball2.getDepth();
}
any clues on how to make the swap depth work would be appreciated (as you can see one of the balls is always in front of the other in this flash animation)

thnx

Swapdepth
I have attached the file because it might be better to see this problem than try to explain this one.

If u take a look at the file u will see 6 moving circles. I only have
script on one of them, which is the (Orange Circle). Once I get one to work completely I can apply the same script to the rest. What I am trying to do is on rollover, stop the main timeline and make that orange circle show on top of any circle that it might come in contact with using 'swapdepth'. That part I have done.

The problem is when I rollout the main timeline plays again but the orange circle stops when it should start to move again with the rest of the main timeline. Can u help me with this?

Thanks for any help that u can give me.

SwapDepth
Hi
I've got three MovieClips with an invisible button on top of each clip. When I move my mouse over each mc, I need this mc to place itself in front of the three mc's.
I've have tried several tutorials on swapDepth, but it never seem to work like I want it to. Is this supposed to be this complicated?
Can someone help me withh this problem. Hope you understand my weak explanation.

SwapDepth Again..
Hi
After a visit at kirupa.com I found just what I needed for swapping Depths...

What I did:
I made 4 square that onRollover scales from 50% to 100%

The Problem
The squares overlap when scaling from 50 to 100%..

I tried using a clever little script from kirupa that goes like this..
on (rollOver) {
_root.x += 4;
this.swapDepths(_root.x);
}

wich should allways put the selected square at the top of the stack.
But I behaves different each time...placing the square in a different z-order each time I rollOver.

I also, since Im on MX, tried using the putThisAtTheTop something class but that behaves even more weird..

the above code is placed on each of the squares and the _root.x variable is defined as "0" on load.

Does anyone know what is wrong with the code..or can someone offer a better way to force something to the top?

Thanks alot!!

Using SwapDepth
I hae 2 mc's. swap_over and swap_under. What I am trying to do is load the new mc's into swap_over and then move them into swap_under after they are loaded. This way all the new mc's will always load on top.

So how do I take a loaded mc in swap_over and instead of swaping....how do I move the movie to this other mc without reloading ?

Thanks

SwapDepth, As2
hey,
flash cs3, as2, i have a movie clip that is a panel composed of multiple little image, in this MC each little image is a MC itself, with this code on:
onClipEvent(enterFrame){
if(this.hitTest(_root._xmouse, _root._ymouse)){
this.nextFrame();

}
else {
this.prevFrame();
}

}

in each of this lil MC you have a rollover animation, that brings the concerned image to the center of the stage and then scale up,
my pb is that this animation happens behind the movie clip, how do i bring it in front?
heeeeeeelp!
thanks

SwapDepth(); ?
hi all, i need your help i got a sample here which i think swapDepth() is the rigth function for it coz (look in the link) i want when i mouseover the "a" the "b" will be behind it , and when i mouseover "b" the "a" will be behind it

i got a script on the invisible button in object "a"

on (rollOver) {
a.swapDepth(10);
b.swapdepth(5);
}



http://www.geocities.com/kenneth_v_us/sample.swf

SwapDepth And More
Hi, can someone please help a poor beginner.

I have a problem with how to combine two codes.
I'm making an interface consisting of a grid with squares. On rollover, the squares are supposed to
A) get the top position in the stacking order (swapDepths)
B.) grow bigger.

So, each square on the screen is an instance of an MC called SquareProgrammed. The SquareProgrammed mc:s are consisting of 2 elements:
a green button, and another movieclip, called SquareGrows.

SquareGrows is a simple 5 frame shapetween that makes the square go from small to big.

The Button has the following actionscript:

ActionScript Code:
on (rollOver) {
    this.swapDepths("_level0:square"+_level0:highest);
    _level0:highest = substring(_name, 7, 1);
}

This makes the instance of the SquareProgrammed mc jump on top of the other
squares.

In the first frame of the mc SquareGrows we have the following code:


ActionScript Code:
stop();
this.onEnterFrame = function() {
    if (rewind == true) {
        prevFrame();
    }
};
this.onRollOver = function() {
    rewind = false;
    play();
};
this.onRollOut = function() {
    rewind = true;
};

and on the last frame we have a

ActionScript Code:
stop();


This makes the mc SquareGrows go from small to big (animate from frame 1 to 5) when
the mouse is over it, and back to small again when the mouse rolls out.

As you can see in the swf that I uploaded, it doesn't work to have the
actionscript both on the button and inside of the mc SquareGrows. Can anyone help me
to combine the two codes so that all the code is on the button?.

Thank you,
regards willythekid

SwapDepth Vs. Something Else
I have 3-4 movieclips on my stage that are thumbnails and onRollOver they each pop up to reveal a larger image...

The problem I am having is that on some of the popups, the thumbnails of some of the images are on top of the larger image. I've looked around and found swapDepth and have tried that... but it's acting funky: i.e. It will initially work, but if I roll over the same image twice, it swaps the depth again.

Is there any other way to have the Z order of each movie clip change to the highest value onRollOver? So that when mc1 is rolledover, it's Z value =10 (and each of the others is less than that), and when mc2 is rolledover then it's Z value changes to 10 and now is on top of all the others....

Any info would be appreciated.

Thanks,
Brian

Help With Swapdepth
hello, i'm using the tutorial http://www.kirupa.com/developer/acti.../swapdepth.htm but as my file is an external swf i changed the code to
Code:
on (press, dragOver) {
startDrag(_parent.pola3,false, -285, 100, 210, -25);
}
on (release, rollOut, dragOut) {
stopDrag();
}
on (press, release, dragOver, dragOut) {
_parent.x +=2;
_parent.pola3.swapDepths(_parent.x);
}
but it's totally messing my file, i can't drag my mc's anymore but the swapdepth work while it seems to be incrementing more and more. my file is here (quite big!)http://www.artefakt.be/pola.zip
Thanks,

Ubik

SwapDepth Help
what im trying to do:

attach 4 boxes to the stage (mcBox1...mcBox4)
you can click and drag the boxes and drop them over an "X"
once the box has been dropped its pushing its respective number into an array (arrayX)

once all four boxes have been placed over the "X" im comparing the arrayX string with another array (arrayY) which has the correct combination if the arrays match you win if not it clears arrayX and the boxes are randomly placed on the screen so you can try again.

well ive gotten 85% of it working but im having trouble with the swapDepth() it only works when i "double click" the box

if anyone can help or see where ive gone wrong i'd appreciate it
thanks

file can be downloaded here:
http://www.midnitefx.net/swap.fla

SwapDepth
I have three movie clips onstage, and I am trying to swap the depths. These clips are located in a movie called "Home" which I am trying to load into an empty movieclip called MyMclip on the main timeline. The code for the movieclips:

on (press, release, dragOver, dragOut) {
_root.x +=2;
_root.myMovie3.swapDepths(_root.x);
}

This works fine when I view the swf "Home"by itself, but does not work when I load it into the main timeline. I have tried changing _root to "this". Can someone tell me what I am doing wrong. myMovie3 is one of the three movieclips I am trying to swap.

SwapDepth
hey,
flash cs3, as2, i have a movie clip that is a panel composed of multiple little image, in this MC each little image is a MC itself, with this code on:
onClipEvent(enterFrame){
if(this.hitTest(_root._xmouse, _root._ymouse)){
this.nextFrame();

}
else {
this.prevFrame();
}

}

in each of this lil MC you have a rollover animation, that brings the concerned image to the center of the stage and then scale up,
my pb is that this animation happens behind the movie clip, how do i bring it in front?
heeeeeeelp!
thanks

Help With Swapdepth
hello, i'm using the tutorial http://www.kirupa.com/developer/acti.../swapdepth.htm but as my file is an external swf i changed the code to
Code:
on (press, dragOver) {
startDrag(_parent.pola3,false, -285, 100, 210, -25);
}
on (release, rollOut, dragOut) {
stopDrag();
}
on (press, release, dragOver, dragOut) {
_parent.x +=2;
_parent.pola3.swapDepths(_parent.x);
}
but it's totally messing my file, i can't drag my mc's anymore but the swapdepth work while it seems to be incrementing more and more. my file is here (quite big!)http://www.artefakt.be/pola.zip
Thanks,

Ubik

SwapDepth
ok, building my first flash game, I've got this far... i have a series of items drag and dropable to targets, my problem is that my first item to drag and drop (a jumpsuit for my person) covers a few other target areas and now i cant make the other items drop to their targets

i need to make the targets accessable even though their area is covered by another item (eg. i cant get kneepads on the jumpsuit because the jumpsuit covers the kneepad target)

SwapDepth
I have two MCs on the same level, on the  _root.
I am tryin to swap their depths.

CODE_root.mc1.swapDepth("_root.mc2");

Swapdepth
http://www.fb.se/flash/fb.asp?lang=se could somebody tell how to make this menu /(portfolio) with swapdepth code. Or wich codes i need to use and wich is best way.
Thanks

SwapDepth Problem....
Hi.

I need to put 2 numerical variables together, and then set the depth on an mc with the result..

Something like:

x = 2;
y = 1;
scenedepth = x.toString() + y.toString();
_root.box2.swapDepths(scenedepth);

But this is ignored. Why dosent this work?

Tim.

HELP - SwapDepth Problem - HELP
I think I have things setup properly, but it's not working!

Navigation:
on (release) {
if (_root.navChange == "msebrand") {
// do nothing if page already loaded
} else {
loadMovieNum ("msebrand.swf", 2);
_level3.gotoAndPlay("outro");
_root.navChange = "msebrand"
}
}

I have placed the following code in the final frame of the home page "outro"

_level2.swapDepths(_level3);
_level3.gotoAndPlay("introfromhome");

SO - The home page should shift back to level2 and the now-loaded msebrand page should be loaded and playing from "introfromhome" in _level3. IT'S NOT WORKING AND I HAVE A DEADLINE!

I need the new page (.swf) to load in the background while the current page plays an outro. I then need these to pages to swap (and the swapped-out page to unload...how?).

Any help would be wonderful!

SwapDepth Question
Hello. For some odd reason i forogt the syntax on how you assosiate the depth of the said MC with its current _y location...

I thought it was:
onClipEvent(enterFrame){
this.swapDepths = this._y
}
but that doesnt work... Do you know it by any chance? I would realy appretiate it. I need it for a small project im working on Thanks so much!

Bradley Hammer

SwapDepth Windows
Hello all

I'm trying to develop a website that incorporates Microsoft style windows but am having problems getting inactive windows back to the front of other overlapping windows. I have 5 MC's in one layer that become windows when activated via a seperate panel. The following script is contained in a button within each movie clip that is utilised like a status bar:

on (press) {
startDrag ("");
this.swapDepths(_y,0);
}
on (release) {
stopDrag ();
}

I am trying to use this to bring the window to the front when the status bar is clicked (and / or clicked and dragged). I think it's probably something to do with that (_y,0) bit?!?

I have (by my standards) been partially successful, but the movie clips only seem to 'come to the front' once. Any ideas what's going on?

The script is probably laughable to some of you but I am very inexperienced in Flash so I am amazed I got this far!

Any comments would be greatly appreciated!

SwapDepth For _levels ?
anyone know of a function method or technique one could use to for example: make a swf loaded into _level3 somehow reload into _level4.

not with load and unload movie though. i dont want blinking files reloads and i dont want my swf to replay when its loaded , i would like for it to simply have a diffrent _level property. /?
anyone , anyone?

kinda like swapDepth but for _levels.

Swapdepth And Fading
OK I've looked around and can't find my answer to this.

I have 10 buttons when you click on one I want the background image to fade while a new one flies in to take it's place as the new background image, I'm using movie clips with 2 blurred bitmaps and then the still to give the effect of flying straight in. I need to be able to also swapdepth so it doesn't matter which button is pushed the image files in on top of the image that is fading out.

I hope this is enough info. any thoughts? Thanks.

SwapDepth Mayhem~
I am working on a Flash solitaire game, and things are going smoothly, except that the cards, which are MC's need to stack in the proper order. I tried to solve this by using swapDepths (there seems to be no other way to change a card's depth (or z stacking)) and it works until the cards begin to have conflicts, and changing one card's depth often causes a different card to be put in the wrong depth (such as behind a card it should be in front of).

Has anyone done complicated stacking and come up with a system of keeping track of card depths so these 'swap conflicts' don't occur?

I've thought about using and array to keep the depth info but I'm not sure how to use the depth info effectively.

thanks in advance for any ideas, suggestions, out right solutions, or ridicule for even attempting this in the first place.

Andrew

Swapdepth Question
I`ve been playing around with swapdepth function a little bit and I was wondering if there is a function for this:

I donīt wanna change depths between movieclips, but I have a few of them that are menues, and when you click on one, i want that one to be on top of all others. Is there a instruction to send it to the top of the movie?

Change Swapdepth
Hi,

In my movie I use multiple scenes.
In one of them I have to change the swapdepth of an mc.
My problem starts that when I go to the next scene,
the mc that I set on top (of the swapdepths), stays on top even in the next scene.
So I have a new scene with an mc from the previous scene in front of it.
Can someone tell me how to change the swapdepth of an mc
using frameactions, and not objectactions?
I tried, syntax is accepted, but there is no result of the frameaction.

SwapDepth.....cant Get It To Work.
I am having trouble geeting my swapDepth commands to work.
I have never used swapDepth before so be gentle (and as clear, easy as possible..)

Got a main movie with some buttons.
On a layer in the main movie timeline..I have "3" MC's.
Each MC has a stop in FRAME 1 and in FRAME 2 it has the frame actions to load an "EXTERNAL.swf" (also have a stop in frame 2 as well)

This is the code I have on my buttons:

on (release) {
tellTarget ("_root.about_swap") {
swapDepths(3);
gotoAndPlay (2);
}
}

Probably wrong..but I tried anyways.

2 questions:

a. When using this swapDepth action...and loading the external.swf's into the MC's...what level should the external.swf's be loaded into? I have all currently loading into level 1

b. Can "tellTarget" the MC that I want to swapDepths on...and also change the playhead position? Like,..not only swapDepth..but also gotoAndStop (2)??

Please advise..thanks.


-whispers-

Swapdepth Problems.
Ok i can do this with movie clips in the main fla but when i load in movies i cant seem to get it to work. This is the code for my movies inside the main fla.

on (press) {
startDrag ("/one", false, 0, 25.4, 400, 230);
this._alpha = 50;
this.swapDepths(_root.mcNum);
_root.mcNum = "_root.one";
}
on (release, releaseOutside) {
this._alpha = 100;
stopDrag ();
}

Now thats on one off the buttons that controls a movie clip and all is well as i said. Now i want to actualy change it all so each page so to speak loads from outside the main fla and still have the swapthdepth work but without succes. Is it even possible to use the swapthdepth on external loaded MC's ?? If so then is there a tutorial or even if one off you kind hearted souls could help me out here that would be great.

Thanks in advance for any help offerd.

Preload And SwapDepth?
Hello,

I was hoping is someone could help me with this. I have several forms which the user will view in sequence. I would like to load the first form. While user is a this level, I would like to load the second form underneath the first. Once the user finishes the first form, I wanted to swapdepths and have the second form display instantly.

The problem is: when I started to load the second form underneath, the first form freezes until the second is loaded...

Does anyone know of a solution?

Thanks,

--sL

SwapDepth Problem
Hi

I am trying to attach a number of movieclips in another movieclip. Say I am trying to attach movieclip istance "m1" and "m2" to movieclip Instance "m3"

Now movieclip "m1" has a child clip (say "ch1") inside it which is draggable.

While it is not attached and I drag the childclip independently there is no issue to the swapDepth and it works fine.

But once I am attaching m1 to m3 and then attach m2 again on m3 and then drag the child of m1 the swapdepth doesnt work and the clip goes below the other clips.

I am attaching the image of how it looks

can anybody tell me why this is happening and more importantly the solution to this ....

Regards
Poli Gupta

SwapDepth On EnterFrame
Okay, i have this AS on a MC



onClipEvent(enterFrame) {
if(key.isDown(key.UP)) {
this._y -= 5;
}
if(key.isDown(key.DOWN)) {
this._y += 5;
}
if(key.isDown(key.LEFT)) {
this._x -=5;
}
if(key.isDown(key.RIGHT)) {
this._x +=5;
}

if(this,hitTest(_root.box)) {
_root.y +=2;
_root.circle.swapDepths(_root.y);
} else {
_root.y = _root.box;
_root.circle.swapDepths(_root.y);


}
}


in the else statement, how can i get that to not keep swapping, like how can i delete that after it runs once?

SwapDepth Question.
I'm trying to use swapdepth.
I want to have a series of movies all jumbled on top of each other.
I want to have a series of buttons that brings to the top one of the movies.

I thought this was straightforward.
I randomly placed all of the movies on top of each other.
Created a series of buttons that changed the depth of one movie at a time so that it came to the top of the pile.

BUT... unfortunately... I'm not having much success.
When changing the depth of one of the movies, I want the others to stay as they are.
This doesn't happen.
Why is this?

I've had a look at a few other movies...
And they seem to use arrays for storing depth levels??
Do I have to do this?
Do I have to keep track of the depth levels or something?

Any help would be appreciated.

Thanks.


Jam

Cant Do SwapDepth With CreateEmptyMovie Mc's
hi,
i create two empty movies and attach 2 movie to them.
i try to switch the depth of one of the movies but no luck.
they stay and don't change their status (foreground/background)

can you tell me why?
(file attached)

thanks in advance,
Avi.

SwapDepth Command
I have an image of the state of Idaho that is sliced into different images to look like seperate counties. Each seperate county is going to be a roll over button that gets larger and has a drop shadow affect to it over the other counties. When you roll out, the button moves back down to its original position. When none of the buttons are being rolled over they all just sit there making up the state as a whole. I am trying to use the swapDepth command so that whichever button you are rolling over at the time is above all other counties and shows the drop shadow of the image making it look like it is out in front. This works every other time you roll over it. If I roll over home, it works great, then I roll out and roll over pics, it works great. Then I roll out of pics and back over home, now home is sitting behind pics, it doesn't swap the depth.

Can anyone help?

Below is the code:

homeButton


Code:
onClipEvent(enterFrame){
_root.homeButton.onRollOver = function() {
this.swapDepths(_root.picsButton);
}
_root.homeButton.onRollOut = function() {
this.swapDepths(_root.picsButton);
}
}

on(rollOver){
_root.homeButton.gotoAndPlay(2);

}
on(rollOut){
_root.homeButton.gotoAndPlay(10);
}


picsButton


Code:
onClipEvent(enterFrame){
_root.picsButton.onRollOver = function() {
this.swapDepths(_root.homeButton);
}
_root.picsButton.onRollOut = function() {
this.swapDepths(_root.homeButton);
}
}

on(rollOver){
_root.picsButton.gotoAndPlay(2);

}
on(rollOut){
_root.picsButton.gotoAndPlay(10);
}


Thanks in advance

Pls Help Me - SwapDepth Problem..
Hi, How can I press the Button1 and it will automatically increase the depth in the loadmovie(). (So I can display as many Popup in different depth using the loadmovie function)

Thankx.. really need advise.

Button.swapDepth ?
I want to swap depths with buttons and am using:
PHP Code:



Button.prototype.swapDepths = MovieClip.prototype.swapDepths;




but it doesnt seem to work on button1.swapDepth(2000).
What am I doing wrong?

Thanks for your help

SwapDepth Loop
Can anyone tell me what is wrong with this code. It only cycles through the first 2 array elements. I know this can be done with layers/tweens, but I'm trying to get a better handle on Actionscript.


Code:
var images:Array = [imgseq2_img1, imgseq2_img2, imgseq2_img3, imgseq2_img4, imgseq2_img5];
var v:Number = 0;
while (v < 5){
if (_global.imgseq2_curimg == images[v] || _global.imgseq2_curimg == "") {
var w:Number = v++;
images[v].swapDepths(images[w]);
_global.imgseq2_curimg = images[w];
trace("w="+w);
trace(_global.imgseq2_curimg);
img_seq2.gotoAndPlay(1);
}
else {
v++;
}
trace("v="+v);
}
Thanks.

SwapDepth Or SetDepth
Is there a way to set Depth to certain "Depth" instead to use ordinary swapDepth function?

swapDepth is to limited.

SwapDepth Pains. Please Help
I been working on this one project. and I have buttons that when you move your mouse over it, the buttons jump out. The thing is the idea is for each button to over lap the others and I did alot of reading on SwapDepth and still can't make it work.

Please help

My test page is here
http://www.stangette.com/about/index2.html

Click the "Car" logo in the top right hand corner to open the menu.
Move you mouse over the 3 buttons. You will see the middle one stay behind.

I tried to attach the FLA but its too big 700K. so you can download
mainindex5.fla

Thank you in advance. I seen you experts fix alot of issues

SwapDepth Question
Hi everyone,
I'm new here, so thanks for any help you may be able to offer. I am working in MX2004. Also, sorry if my terminology is weird!

Here is my question.
I am building elastic button annimations where the buttons grow in size when rolled over. I need the expanded button to move to the highest depth so the inactive buttons are below it. The code I have written is not allowing it for some reason.

Does anyone see a problem with this code?

on (rollOver) {
this.swapDepths(getNextHighestDepth);
onEnterFrame = function () {
this.elasticScale(300, 2, .3);
};
}
on (rollOut) {
onEnterFrame = function () {
this.elasticScale(100, 1.2, .2);
};
}



Thanks you very much for any help with this.

Problem With Swapdepth
Hi,

I am having some problems with swaping the depth in flash. Is there a way to swap depth between levels? In my current project, i attempted to load an external mc from my level0 moveclip where the loaded mc will side on other level (e.g. _level5) other than level0.

In my _level0 mc, my swap depth function is:

_root.windows.onPress = function():Void {
_root.swapDepths(_root.getNextHighestDepth());
}

I also added a similar swap function in the external mc i intended to load on _level5:

_root.windows.onPress = function():Void {
_root.swapDepths(_level0.getNextHighestDepth());
}

However, i am only able to swap the depth once. Is there a problem with the code? Can someone help me with this? Thanks a million!!

Swapdepth Weirdness
Greetings,
I'm working in Flash CS3, but targeting Flash Player 6 (Actionscript 2).

See code below for snowfall, plus multiple layers that need to be ABOVE the snowfall. Can anyone tell me why the text1 mc and the teamphoto mc are BELOW the snow, while the rest of the layers are (correctly) above?

amount = 100;
mWidth = Stage.width;
mHeight = Stage.height;
for (var i = 0; i<amount; i++) {
thisFlake = this.attachMovie("flake", "flake"+i, i);
with (thisFlake) {
_x = Math.random()*mWidth;
_y = Math.random()*mHeight;
_xscale = _yscale=_alpha=40+Math.random()*60;
}
thisFlake.yspeed = Math.random()*3+ .1;
thisFlake.increment = -0.025+Math.random()*0.05;
thisFlake.onEnterFrame = function() {
this.radians += this.increment;
this._y += this.yspeed;
this._x += Math.sin(this.radians);
if (this._y>=mHeight) {
this._y = -10;
this._x = -10+Math.random()*mWidth;
}
if (this._x>=mWidth || this._x<=0) {
this._y = -10;
this._x = -10+Math.random()*mWidth;
}
}
}

text1.swapDepths(900);
logo.swapDepths(800);
greentop.swapDepths(700);
greenbottom.swapDepths(600);
teamphoto.swapDepths(500);


Many thanks in advance,
casimara

Problem With SwapDepth.....
Hi guys.
I attach an FLA bearing my problem. I have only buttons in frame 1, and a textbox label in frame 2. When I click the button, I expect only the label to display in frame 2. However, the buttons also display?
I've played around with my code usung trial and error and found that if I remove the line which says '_root["mh"+i].swapDepths(numofmenus-i+1)' it works as expected. However, I do need to swap depths ideally.....
Why is this happening?
Thanks for any help....

Copyright Đ 2005-08 www.BigResource.com, All rights reserved