Isometric Swap Depth Problems
I am wondering if someone can shed some light on this problem. I have put together an isometric map builder and have a "character" that is able to move around on the tiles. The problem that I am having is with the z-sorting. After moving the character around the map for a little while, it starts to fall behind tiles...randomly. I have tried to find as much information about this issue, but I can't get any answers.
So, I have posted the .swf, as well as the .fla for anyone interested to check out. Thanks in advance for any help.
http://www.nerdfactory.com/isometric/
Ultrashock Forums > Flash > ActionScript
Posted on: 2002-07-04
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[F8] Non-tiled Isometric Swap Depth
Hi all,
so much has been written about swaping depths in iso world and yet more needs to be answered. My problem wouldn't exist if I used the classic tiled engine, but really, there is no way how I can insert it into my aplication.
On the picture below is what I'm trying to explain in words here:
Basicaly I am using rectangle objects of variable sizes and not only proportions but really different height and width values for each of them.
Now if you imagine a very long rectangle and a square, there is very likely a difficult situation to occur, when the small square should be in front of the long one, but acording to the algorytm it wouldn't.
Now I probably need to manage something with width and height of each object, but I feel a little lost here...if anyone could give me a hint, thx ya all
Problem About Depth Of Objects..(swap Depth) Plse.help
umph..hello i'm nameg sir
i'm trying to do dragging project. drag isomatric object in small room(isomatric view too) for test installation..(so i necessary have foreground objects,background objects ..u know)
now i can drag many objs. in same movie when i press it , by i use swap depth command (for see it above other)and drag it around sometime it works...but sometime it don't!...
1..... some obj. automatic swap its depth! when i release other one....i don't know why
2. some time i dup. new obj. to drag and it del some old obj. that call before
ps. i use swap code from this site tutorial ...s.a.Drag & Drop / Swap DepthsAuthor by : estudioworks
thank u so muchhhhhhhhhhhhh
Isometric Depth Sorting
I've built several games using isometric display math and they've worked out well enough, but for a new project I've elected to use a method that allows objects to be pushed & raise above the floor. I'm using concepts used in this tutorial:
http://www.kirupa.com/developer/actionscript/isometric_transforms.htm
So far, it's working really well, but depth-sorting has me at a loss. Using traditional methods like the ones described in this tutorial don't work for my purposes:
http://www.kirupa.com/developer/isometric/depth_sorting.htm
I'm using a set of functions to convert x,y,z (3d space) to x,y (screen). I've come up with a way to assign a depth value to every object and then sort them (rather than swapping directly to that number which limits the depth resolution since Flash supports a finite # of layers). That works OK, but I can't seem to get it to take an object's dimensions (a,b,c) into account.
Any ideas? I can post some of the code here, but I fear that it might just confuse the issue.
Isometric Tile Depth Trouble
I am very new to this isometric stuff and decided to take a shot at it to see what I can do, and followed Tonypa's trusted isometric tutorials to get started. Up till now I was doing a fairly good job, but I am having trouble with the swapDepths() of my Hero and Tiles on the stage. The problem is the Hero is behind the Tile when standing on the top most of the current tile it is standing on, and it works as expected when the Hero is on the bottom half of the Tile.
I attached a sample photo to show what I mean by 'behind', or underneth would be a better word I guess.
This is what I have on my building the Tiles on the stage function:
game.mc.attachMovie("Tile", "t_" + i + "_" + j, ((j+i)*game.ts/2*300+(j-i)*game.ts+1));
Where game.ts is 60. On the Hero walking function I have this line of code determining the new depth to swap with
var d:Number = (mc.yiso-((game.ts-mc.height)/2)*300+(mc.xiso)+1;
Both of these lines of code are the same from what Tonypa shared when calculating the depth order, but his is working and mine isn't. I appreciate any help get me around this, thanks in advance.
Swap Depth
I have 5 buttons i my menu and have made a MC for each of the buttons. The MC's has their own layer. The problem is if u press
BTN 5 first then press BTN 1. The button 1 MC start playing under the MC related to BTN 5.
I was told that I have to use a swapDepth action. The button actions that I have used is:
on (release) {
_root.instance name.play();
}
what will the the swapDepths action be?
Swap Depth Nav
I am creating a swap depth nav
there are movie clips on the main stage each has a button inside
Kind of lost
-thanx for the help
p2studios.com
Swap Depth
hi folks,
can anybody please help me with some actionscript trouble?
in the attached file I sent you my problem. I got a master movie which loads over some buttons external swf's into my master movie. these swf should be able to swap their depth-value when clicking on them (like you already know it from MS Windows).
Until this point everything works fine, but if I load all the movies on my stage they dont behave as they should.
when I click on movie1 to bring it up on top of the others, movie3 is also kicking through. Is tere a way to avoid this effect?
every support is appreciated.
bye
smik
Swap Depth
i load external movie with loadMovie action.
It loads the SWFs into the movie correct.
I have problem, how simply switch between the loaded movies.
The last loaded movie overlay all loaded movies.
How is possible do it the swap of the loaded movies?
Please see the file u will understand.
Swap Depth
dunno why i am posting here again after 10000 posts for help and never got any bloody replies or help but still gonna give it last shot....
http://www.galleysgourmet.com/working/
(preloaders not in yet so might be a while as u see blank screen)
i got this problem of swapping depths. currrently the windows can swap depths when u click on itself, but if u open a new category, i could'nt get the depth to swap... any idea how should i do this? (go to EVENTS category and you'll know what i mean)
on the window to swap i had this script
on (press) {
_root.depthSwap(this._name);
startDrag(this);
}
on (release) {
stopDrag();
}
i figured if i dump this script on the buttons, it would make it swap when opening window... but it doesnt work no matter how i edit...
any help would REALLY BE APPRECIATED....
Swap Depth?
Hello,
I have a movie that is putting an mc under another. The mc that it's putting it under is undefined so far (not sure exactly how to define). I tried swap depth and on all of the other clips that I tested it with, I noticed it changing (they were undefined too says the trace, while the one I'd like on top shows up at depth 1).
So, my questions are: how do I define the depth of a clip before I put in swap depths if it hasn't been done, why is it showing up as undefined- I thought there was a default value,16383, for the depth ( I used thse directions) http://www.allflights.net/Macromedia...3lev1sec2.html
And last, is this the best way to get the clip on top of the others?
(note: the clip that is showing up on top is done all in action script while the other which I'd like to be on top is in the timeline. Maybe as overrides timeline clips?)
Any help would be appreciated.
Swap Depth
I´ve been working on my homepage for a while now. Bumped in to a problem the other day.
I have several rollout menus, each containing several buttons.
Every menu corresponds to a gallery and every button to a specific image in that gallery.
The menus are placed on different leyers on frame one on the main timeline.
Within every menu i´ve placed the corresponding gallery wich are invisable and become visable on press on one of the menu buttons
The problem is when i enter menu nr3 on leyer 3 and press one of the puttons to display the image in the gallery the image is displayed under the layer 1 and layer 2 so the menus 1 and 2 float on top of the image.
I´ve read about swap depths but don´t have a clue on how to apply it to my menu....
I´ve attached a fla
Would really apreciate if anyone can take the time and have a look.
//Dr.
Please Help Swap Depth
how do i control when the swapdepth happens in the time line of the movieclip whose depth i want to swap?
I want the depth to be swapped at the height of the menu buttons jump.
all the buttons overlap but when you rollover they jump.
here is the file
thanks
Swap Depth
Can someone please tell me why this swapdepths doesn't work?
heres the fla
http://www.soccerschool.com.ar/f/swap.zip
Here's the code:
Code:
//Action attached to frame 1
function depthSwap (x) {
for (i=0; i<cA.length; i++) {
if (cA[i] == x) {
xPos = i;
}
}
i = xPos;
for (i=xPos; i>0; i--) {
_root[x].swapDepths(_root[cA[i]]);
cA[i] = cA[i-1];
}
_root[x].swapDepths(_root[cA[0]]);
cA[0] = x;
}
cA = new Array();
for (i=0; i<7; i++) {
cA[i] = "c"+i;
}
//Action on the movieclip called c1 - the same on the other called c2 -
onClipEvent (mouseMove) {
if (this.hitTest(_root._xmouse, _root._ymouse, false));
{_root.status = ( hitTest(_root._xmouse, _root._ymouse, false));
_root.depthSwap(this._name);
}
}
Swap Depth
i have 3 button that load 3 images, i have 2 movieClips when first button is clicked it loads 1 movieClip with the image and the 2nd button clicked once loaded would fade out the first(top) mc . and it would just keep swaping based on if its loaded.
PHP Code:
function swapPhoto(newHero) { var currHero = newHero; if (newHero == currHero) { _root.picture.loadMovie(newHero); _root.picture.swapDepths(_root.picture2); trace("D1"); } else { _root.picture.loadMovie(currHero); _root.picture2.swapDepths(_root.picture); trace("D2"); }}
Please Help Swap Depth
how do i control when the swapdepth happens in the time line of the movieclip whose depth i want to swap?
I want the depth to be swapped at the height of the menu buttons jump.
all the buttons overlap but when you rollover they jump.
here is the file
thanks
Swap Depth
Can someone please tell me why this swapdepths doesn't work?
heres the fla
http://www.soccerschool.com.ar/f/swap.zip
Here's the code:
Code:
//Action attached to frame 1
function depthSwap (x) {
for (i=0; i<cA.length; i++) {
if (cA[i] == x) {
xPos = i;
}
}
i = xPos;
for (i=xPos; i>0; i--) {
_root[x].swapDepths(_root[cA[i]]);
cA[i] = cA[i-1];
}
_root[x].swapDepths(_root[cA[0]]);
cA[0] = x;
}
cA = new Array();
for (i=0; i<7; i++) {
cA[i] = "c"+i;
}
//Action on the movieclip called c1 - the same on the other called c2 -
onClipEvent (mouseMove) {
if (this.hitTest(_root._xmouse, _root._ymouse, false));
{_root.status = ( hitTest(_root._xmouse, _root._ymouse, false));
_root.depthSwap(this._name);
}
}
Swap Depth I AS3.0
Hello All... first of all im very happy to be here in this forum... thanks a lot!
I want to make a Circle and Square over that circle, but when i press the square that square will swap over the circle... i think this function in AS2.0 was executed by swapDepth but i never used it in AS2.0.. so i want to code it now in AS3.0 but i don't have any idea about the code.. someone can help me with this?
thanks a lot guys!
Swap Depth
i have an external movie with three movieclips/buttons inside it and i would like the depths of these to be swaped when clicked, so the clicked one is always on top. How would i do this?
Thanks
Square
Swap Depth
allow me to ask a simple question. I have 50 buttons that I can drag around, and I want to change their level when I click anyone of them...like if there's 3 buttons stacked to each other, when I click on the bottom one, it'll come to the front, and be the top one...how should I make this work?? thank you!!
Swap Depth Inside MC.. ?
Hey.
Ok i have an MC.
Inside of it I have 3 other MC's that i want to use swapDepth
1st frame
------
level0:highest = "2";
------
on each of the drag bars (of the 3MC's) i have:
------
on (press) {
this.swapDepths( "_level0.window" + _level0:highest );
_level0:highest = substring ( _name, 7, 1 );
startDrag (this);
}
on (release) {
stopDrag ();
}
------
its works fine if its not inside an MC so is it the _level0 thats screwing it up?
THX in advance.
Swap Depth Problem
Hi all!
i am having a little problem "swapping depth" between several MC's that load on different levels into a main movie. i thought that perhaps some more experienced "FlashHead" could shed some light on this issue and stop me from pulling any more hairs out of my head....
specifically, i designed a neat little navigation system with 5 different movies (menu options) that load into levels 8, 7, 6, 5, & 4. i've gotten evertything to work, but MC's that load in at lower levels are covered up by higher ones. i tried by putting a button with the swapDepth command, but i don't think i have the action script quite right.
any help would be greatly appreciated. ;-)
-otama
Managing Swap Depth With Mc's
I have a set of thumbnail images. Each is a button that triggers the mc with the larger image to play. It slides out from the side of the movie, in its last slide out keyframe is a command to send the previously selected image mc back to frame 1.
That parts fine.
I used swap depth to bring the selected image mc to the top. I store the name of the selected mc in variable, when the next mc is selected I swap with it. It works but what I really need is the old image to slide out over the last viewed image.
To do this the "stacked" order of the mcs needs to be managed better. The new one has to come to the top and the last viewed has to go down to the level below.
Any idea how I can achieve this.
tutorials, code, suggestions, anything please
mark
Simple Swap Depth. How?
how do i make several windows swapdepth when i click on them. i had one that worked fine until i had more than 2 windows that had to swapdepth.
thanx
_level / Depth -- Swap
I,m building an app .. in wich I duplicate some Movies
therefore I use a container in _root; when I duplicate this container, it's placed in _level0 ..
Now when I load a SWF they load in _level1, over the other clips....
Is there a easy way .. to duplicate the movies in level2- or swap to level2 ..
I was thinking of loading an Movie with the container on level2 and duplicating that ..
THNXX in advange
Nyls
Will Swap Depth Work?
Hi all,
I'm new to actionscripting so please bare with me.
Basically I have 5 movie clips all in the same frame of my main timeline. There are 5 buttons, each of which will load its respective movie.
I would like to have it when the user clicks on which ever button, it will load its corresponding movie on TOP. I have tweening going on in the clips so I'm trying to create the illusion of stuff being added when you click on button 1 thru 5. This can be achieved with loading into levels, but of course only the movie on the highest level will be on top at all times - you can't click on button 1 and bring that movie on top.
Swapdepth can work in a sense but I've only been able to figure it out where it kicks out the previous movie, as if I were loading them into a container movie clip. I would like to keep the effect that can be achieved with levels, with each movie clip being added to one another.
I hope that isn't too confusing. Any help would really be appreciated...
Swap Depth Question Again
Hi,
I've got some trouble on using swap depth (i asked this question 2 days ago, but seems not work..). Let me describe what i've done.
I have create two layers in Flash. "upper layer" & "lower layer". I simply draw a big rectangle on "upper layer" and put a small rectangle movie clip on "lower layer". Here is the script for the movie clip.
onClipEvent(mouseDown) {
startDrag(this)
this.swapDepths(10);
}
onClipEvent(mouseUp) {
stopDrag();
this.swapDepths(0);
}
seems very straightforward...The purpose is: Before i drag the movie clip, the small rectangle movie clip should be covered by the big rectangle. Whenever my mouse is down. The big recentangle would now be under the movie clip, it works..but I want to make it below the big rectangle again whenever the mouse is UP. But now it is still on top of the big rectangle forever. Is there something wrong of my script? thanks.
Swap Depth Question
Hi,
I've got some trouble on using swap depth (i asked this question 2 days ago, but seems not work..). Let me describe what i've done.
I have create two layers in Flash. "upper layer" & "lower layer". I simply draw a big rectangle on "upper layer" and put a small rectangle movie clip on "lower layer". Here is the script for the movie clip.
onClipEvent(mouseDown) {
startDrag(this)
this.swapDepths(10);
}
onClipEvent(mouseUp) {
stopDrag();
this.swapDepths(0);
}
seems very straightforward...The purpose is: Before i drag the movie clip, the small rectangle movie clip should be covered by the big rectangle. Whenever my mouse is down. The big recentangle would now be under the movie clip, it works..but I want to make it below the big rectangle again whenever the mouse is UP. But now it is still on top of the big rectangle forever. Is there something wrong of my script? thanks.
I Don't Understand Swap Depth
Hi there.
I tried looking on the other posts for swap depths and I don't really understand it... tired a few different bits of code to no avail.
Basically I need the 1st and 2nd squares to swap depths. When you rollover the 2nd square, it is partially covered by the 'BIO' text of the first.
Ideally, I'd like ALL the squares to swap depths in case I need them to, i.e all come to the front.
Attached is my Flash MX FLA.
Any help would be fantastic.
Swap Depth Question
Hi everyone...is there a way or a code to swap the depth of a mc, to move it to the top. If I have 9 pictures loading into empty mc's, I want the viewer to be able to click on the open picture in the corresponding mc and have that pic/mc be the top depth. Is there a code to automatically make the mc that the person clicks on to be the top depth?
Swap Depth Question
Hi,
I've got a combobox with a few values in there, and what I'm trying to is have a number of movieclips over-lapping on the same layer, but be called to the from using the swapDepth feature. I might be going about it all wrong, but the reason behind this is that within the 'menu item' movie clips, there are draggable clips which I want to reamin on the stage while you can look at the rest of the menu items. (I hope this makes sense)
The code that I'm trying is ;
on (release) {
(style.getSelectedItem().data).swapDepths(BLANK);
}
Where my combobox is called 'style'.
Any help would be appriciated.
Thanks,
Berzenjak
Swap Depth Problem - Need Some Help
Hi,
I have 6 MC (rectangles), which I've given instance names b1 to b6 and which each containe a button which when clicked expands the selected rectangle over the full screen width and height.
The button contains the following script :
on (press) {
this.swapDepths( "_level0:b" + _level0:highest);
_level0:highest = substring ( _name, 7, 1 );
_root.back1height=520;
_root.back1width=680;
_root.win1height=465;
_root.win1width=680;
}
I've added the following script one the timeline :
_level0:highest = "6";
back1width=220;
back2width=220;
back1height=255;
back2height=255;
win1width=220;
win2width=220;
win1height=200;
win2height=200;
What I require is that when I click the button of the selected MC, this MC swaps depth with the remaining 5 MC's (goes on top). But with the script used it doesn't seem to work.
Can anyone help me out with this.
Thanks,
Smalco
Swap Depth Of Levels
is there anyway to swap the depth of levels, e.g if I have a movie loaded with loadmovie in level11 can I swap it with another movie loaded with loadmovie which is in level20? swapDepths doesn't seem to work for this.
TIA
percepts
Swap Depth Problem
Hi
I am having a strange problem with my swap depth code.
As soon as I drag the mc, the mc I drag reloads in its original place again so i end up with 2 copy’s of the mc I just dragged. When I take the swap dept code out of the button and drag the mc it works fine.
This is what I have done: I put this code on the first frame in main timeline
depths = 300;
I then put this in all of the buttons that drag the mc they are in:
_parent.depth++;
this.swapDepths(_parent.depth);
any ideas on why its doing that and how I could fix it?
This is a link so you can see what I am talking about:
www.flasexpression.com/firstpage.html
Drag the yellow bars of any of the menus an you will see what I mean.
any help in this will be much appreciated.
Swap Depth Of External Swf
hi everyone does anybody have an idea on how to swap depth of an external movie within the main movie..?
......it would be a great help if anyone can help me thanks ahead....
Swap Depths Set Max Depth
So, i thought i had this under control, but it still has bugs. I have a movie clip that i want to be set at the highest depth, so it will cover up these two other movie clip i have. These two moive clip are dragable and they swap depths. The problem i am having is that my two movie clips that swap depths are getting put at the highest depth, regardless of the code in place.
In the time line i have this code:
Code:
MovieClip.prototype.getMaxDepth = function() {
var maxDepth = 1;
for (var i in this) {
if (this[i] instanceof MovieClip) {
if ((this[i]).getDepth()>=maxDepth) {
maxDepth = (this[i]).getDepth()+1;
}
}
}
trace("maxDepth:"+maxDepth);
return maxDepth;
};
this.attachMovie("this.anim1.contactBox_mc", this.getMaxDepth());
this.attachMovie("this.anim2.infoBox_mc", this.getMaxDepth());
I have this code on the movie clip that i want set to the highest depth (it is placed inside my moive clip in the timeline):
Code:
var fdepth= this._parent.getMaxDepth();
this.swapDepths(fdepth);
Any ideas for me?
Swap Depth Trouble
ok i have all the code in there but for some reason it wont work so if someone could take a look and possibly find the problem then i would be grateful
The file is in Flash 5 format
Swap Depth Problems
hi, can anyone help me fix some code, i am using the swap depth function.
i have a movie with 10 thumbnail buttons, that open 10 images into a container (mc1). then the image is swaped to a lower depth container (mc2), and any new image loaded afterwards always appears in the upper container, and so infront of the older image.
that works fine, but then i added an additional 10 buttons and just copied the code into an additional location of the timeline in the same movie, and now it screws up. the screw up causes images to load into the lower container, under an already loaded image, it is intermittent and sometimes the first 10 images load in reverse, and sometimes the second. i have tried a few things like swiching the layers of the containers. but how i have it seems logical with container 1 (mc1) on a higher layer than container 2 (mc2). but strangely this doesn't always work and seems to work in reverse too, sometimes for both.
i test it and it works fine and then sometime later i find it doesn't work. not sure the cause, but i think the solution is a quick simplification of the code and possibly even just th location of it and ordering of the containers. i have the same code in 3 locations in the same clip-
scene 2- frame 10
scene 3- frame 1
scene 3- frame 26
attached is the fla- ex23mini.fla.zip (240k)
to see it in operation go to- www.youare.com and click on 'world', then click on '31', or '11', or '28'.
i am a action script novice and i would like to minimise overall changes to the code.
thanks for any help, i definately appreciate it.
mark
ps. if you have any comments on the site in general, let me know. thanks
Swap Depth Problems
hi, can anyone help me fix some code, i am using the swap depth function.
i have a movie with 10 thumbnail buttons, that open 10 images into a container (mc1). then the image is swaped to a lower depth container (mc2), and any new image loaded afterwards always appears in the upper container, and so infront of the older image.
that works fine, but then i added an additional 10 buttons and just copied the code into an additional location of the timeline in the same movie, and now it screws up. the screw up causes images to load into the lower container, under an already loaded image, it is intermittent and sometimes the first 10 images load in reverse, and sometimes the second. i have tried a few things like swiching the layers of the containers. but how i have it seems logical with container 1 (mc1) on a higher layer than container 2 (mc2). but strangely this doesn't always work and seems to work in reverse too, sometimes for both.
i test it and it works fine and then sometime later i find it doesn't work. not sure the cause, but i think the solution is a quick simplification of the code and possibly even just th location of it and ordering of the containers. i have the same code in 3 locations in the same clip-
scene 2- frame 10
scene 3- frame 1
scene 3- frame 26
attached is the fla- ex23mini.fla.zip (240k)
to see it in operation go to- www.youare.com and click on 'world', then click on '31', or '11', or '28'.
i am a action script novice and i would like to minimise overall changes to the code. thanks for any help, i definately appreciate it.
mark
ps. if you have any comments on the site in general, let me know. thanks
Swap Depth For Windows.
I've created all of my windows for my site, and each window is on its own layer.
Now on checking out several .FLA examples I'm seeing that most of the scripts have all of the windows on the same layer.
Is there a simple way (simple actionscript method) for me to allow users to click on a window (if several are open ) and have the window selected come to the front?
Or do I have to move everything to the same layer in order to get this funtionality.
Swap Depth Issue
Hi all, been trying to work this problem out for the past couple of hours with no luck.
On stage I have the following:
Background image/pattern = mcb
masked image = car
Mask = qtr_mc
Basically I have loaded from an external swf the background (mcb) and what I want is to have the mask (qtr_mc) obscure part of the background and to show the image underneath (in this instance "car").
Now part of the problem is that both the background and the mask have been set a depth of -16384 (according to the trace command I have inserted in the script). I seem to have a problem changing the depth so that the mask sits on top of the background.
The script is: code: this.createEmptyMovieClip("mcb",0)
mcb.swapDepths(0)
trace(getDepth(mcb))
trace(getDepth(qtr_mc))
//load first movie into clip 1 to start with the first image
mcb.loadMovie("levQuarterRound.swf");
mcb._y = 0;
//variables that store current clip and current content index
activeTarget = mcb;
qtr_mc.swapDepths(1);
car.setMask(qtr_mc);
Maybe an alternative solution is not to call the background as an external swf but to have it directly on stage.
Any clues as to where I'm going wrong?
Swap Depth Question
Thanks to those who are reading this! I am making an above-view RPG game, and I was wondering if anyone could help out. I want to make it so when the hero(mc) passes by anything, such as a tree(mc), bush(mc), or a fencepost(mc), he'll be swapped above or below them depending on what y-axis from that the hero(mc) is standing. For example, if the hero(mc) is at a higher y-axis than say bush1(mc), then he will be swapped to a lower depth level than bush1(mc), so he appears behind the bush(mc).
I will be more than happy to (when the game is completed) give you credit. Please, and thankyou for your help
-KCB
[F8] Swap Depth Of A Button
can i swap depths of buttons on different layers of my main movie eg:
but1.onPress = function ()
{
but1.swapDepths(but2)
};
is my syntax correct cos i'm having trouble with getting it to work. Or do they need to be MC's
Ps. it's in function form as i have other stuff going on when i press but1, i've deleted for clarity.
Rat
[F8] Depth Swap Becoming Disabled, But Why?
Hey everyone. Welcome to my first post!
Here's what I'm trying to do:
• change the opacity of a fixed shape ("mask") to be 0% while dragging another object.
• Bring draggable objects to the front with depthSwap when clicked on.
It seems that I can get one or the other to work, but not both at the same time. Here is the code I'm using on my button. As is, depthSwap is not working.
Quote:
on (press) {
_root.depthSwap(this._name);
startDrag(b6);
}
on (press) {
setProperty("mask", _alpha, "0");
}
on (release) {
stopDrag();
setProperty("mask", _alpha, "100");
}
the code at root level is this:
Quote:
function depthSwap (x) {
for (i=0; i<cA.length; i++) {
if (cA[i] == x) {
xPos = i;
}
}
i = xPos;
for (i=xPos; i>0; i--) {
_root[x].swapDepths(_root[cA[i]]);
cA[i] = cA[i-1];
}
_root[x].swapDepths(_root[cA[0]]);
cA[0] = x;
}
cA = new Array();
for (i=0; i<7; i++) {
cA[i] = "c"+i;
}
Any suggestions at a glance to fix this up? Do I need to provide more info?
I'm pretty novice at this in the grand scheme. Help a sister out. Thanks a bunch!
Swap Swf Levels Instead Of Mc Depth?
Hi,
I was wandering if is it possible to swap swf levels like when u swap MC depths?
I know how to swap a concrete swf level with another concrete swf level, example: _level5.swapDepths(level7). This only works if I just have 2 external swf to swap.
What I need to do is to bring any swf u rollover to the highest level. What I mean by "any" is that if u have allready sent a swf from level 5 to the top level the second time u rollover it cannot tell it to move from 5 to the top, u have to tell it to go from current level to de highest one, which at first maybe was 6 and now it's 20 because all the other swf have move from it's first level position.
Thanks in advance!
[CS3] Help Problems With Swap Depth.
Hello!!! I need some help. Probably the most frustrated I have been in awhile. I'm definitely not a scripter or programmer so I appreciate any help with this.
What I have is a row of buttons. They overlap. When I rollover them I want to change there depth to the top. I have gotten this to work no problem by itself.
I also need the movie clip, when clicked to go to a area on the time line. Again, no problem on it's own.
THE PROBLEM. When I have the rollover and the swap depth on the MC combined with the on release and publish,,,,,it seems to work fine. Until you click around maybe 4-5 times. Then one of the movie clips get's hung up and you can't click on it anymore.
HELP!!! please!.
Thanks so much guys.
Swap Depth Question
I am trying to create a slideshow with images that live in the library. My issue is when the new image is attached it is loading into the same level instead of on top. Here is the code i am having this issue with.
Code:
stop();
var i:Number = 0;
var ticker:Number;
var time:Number = 500;
//
_root.createEmptyMovieClip("container", this.getNextHighestDepth());
//
init();
function init() {
ticker = setInterval(tick, 2000, this);
}
function tick(MC) {
if ((++MC.i) == 1) {
_root.x += 2;
this.swapDepths(_root.x);
container.attachMovie("outfit"+i, "OF1", this.swapDepths(_root.x));
container.OF1._x = 60;
container.OF1._y = 108;
} else if (MC.i == 2) {
_root.x += 2;
container.attachMovie("outfit"+i, "OF2", this.swapDepths(_root.x));
container.OF2._x = 60;
container.OF2._y = 108;
} else if (MC.i == 3) {
_root.x += 2;
container.attachMovie("outfit"+i, "OF3", this.swapDepths(_root.x));
container.OF3._x = 60;
container.OF3._y = 108;
} else if (MC.i == 4) {
_root.x += 2;
container.attachMovie("outfit"+i, "OF4", this.swapDepths(_root.x));
container.OF4._x = 60;
container.OF4._y = 108;
_root.i = 0;
}
}
Swap Depth In Flash Mx?
hey i saw the tutorial on sap depth .. it's for flash 5 i think but i can get it to work. the question i have is : how do i apply swapdepth in a keyframe intead of on an 'on release' or ' on press' ??
i have 3 empty movieclips that are on stage to load pictures. container1, container2, container3 and a series of pictures. they load in when the playhead goes to a new frame (at the moment). i named the pictures 01.swf, 02.swf etc...
ActionScript Code:
container2.loadMovie("06.swf");
so the user clicks a button and the playhead moves to a marker (and stops) .. and in there the container is identified and loads. what i would like to do is make sure that the new movie is always loading ontop of the last one: because if it loads underneath then you wont see it - obviously.
i tried:
ActionScript Code:
container2.loadMovie("02.swf");
container2.swapDepths( "_level0:window" + _level0:highest );
_level0:highest = substring ( _name, 10, 1 );
but i'm not too hot at AS so i guess i have something wrong. i got rid of 'this' because the script is now in a frame and not in the movieclip / button. the buton i am using just moves the playhead to a different place. to be honest i have kinda tied myself in knots thinking about this: im sure there is a simple way to do it.
thanks for chekkin' it out and for any ideas you have.
Swap Depth Of JPGs, Is It Possible?
We can swap depths of movie clips... ok....what about JPGs?
I have an empty MC where I want to load images from an array and then starts swapping thier depths.
Here is the script I use for loading them and the script I wans hoping will work for swapping thier depths:
onClipEvent (load){
var image_arr = new Array "1.jpg","2.jpg","3.jpg"....,"7.jpg");
for (var i=0;i<image_arr.length;i++)
{
loadMovieNum(image_arr[i], i);
trace ("loaded image " + image_arr[i] + " in level " + i) }
}
onClipEvent (enterFrame){
trace (this + image_arr[5]);
this.image_arr[5].swapDepths (6);
}
How would I swap the depth of image 6 (image_arr[5].) and have it come to the surface?
Swap Depth...elegantly
I'd like to ask 4 some help regarding swap depth. I'd like to do this in a more elegant way, because currently I''m loading external movies into a greater and greater level. It's working alright, but the final effect is really not what I want to do...
What I'd like it to do is:
1, Load a movie_1 in (let's say) level3
2. load movie_2 in level 4, when it loaded I'd like to unload movie_1
3. load movie_2 into level three so if I press button nr 3, 4 5 etc,
the corresponding external swf is level 4.
So basicly I want to load a movie in a higher level that the previos movie, when it is loaded want to delete the movie under it and swap depth to the lower level.
Hopefully I didn't explane it to hard
Any ways find my current solution @ the following link:
www.mziq.hu/stuff/swapstuff.zip
|