ActionScript 2.0 :: Arrangement Of MovieClip In Z Depth
Jan 8, 2004
I have a slide show of images for my banner that is loaded through the use of a component in my library. The component merely swaps images with a fade out/in as a transition. Now, that is working fine, the thing that I am having a problem with is that I cannot place an graphic/text on top of the component. I what the banner to be in the background. What do I have to add to the component to insure that it will always load in the back, not infront of the text, graphic, etc...
what the line of code would be-- where having made several buttons, on rollover, scales their respective image. However, on scaling, these images are arranged according to their layers and would therefore be obscured by text or an adjacent image.How could I make it so that everytime I rollover the hotspot, the image will scale and automatically arrange itself to the front of everything? Is there anything to do with its depth and setting its properties?
How can I set the depth for a movieclip.Actually I want my popup to always come on the top and there is some problem using swapdepth.Would it help setting the depth of movieclip to be something like 10000??
As you can see I have all those circles scattered around the stage. What I'm looking to achieve now is keeping that same disposition, "grid" and arrangement I want them to tighten or loosen up when the stage resize listener is called. I know how to do this for all the other elements but here I'm playing with a bunch of different circles that follow a certain gridded pattern and I want to keep that. Here's the code I'm using to create, place and arrange the circles on the stage.
What I'm looking to achieve now is�keeping that same disposition, "grid" and arrangement I want them to tighten or loosen up when the stage resize listener is called. I know how to do this for all the other elements but here I'm playing with a bunch of different circles that follow a certain gridded pattern and I want to keep that. Here's the code I'm using to create, place and arrange the circles on the stage. I think it might help..or not..
I'm trying to display a range of dynamic textfields, using an array.
I can place everything on the stage fine, but I just can't figure out the maths behind placing each textfield next to each other horizontally. So, despite the length of the word, the spacing between each textfield is the same, e.g. 10px.
I'm sooooo eager for this one little calculation!
Code: var myArray:Array = new Array("little", "looooooong", "huuuuuuuuuuuuuggeeeeee", "tiny"); var container_mc:MovieClip = new MovieClip(); container_mc.x = 80;
Im trying to change the depth or index of a movieclip when its click. And bring it to the top of everything. The problem is that the movie clip is not added by addChild, but nested in a frame.
so if i try and use any of these:
anyMC.parent.setChildIndex(anyMC, anyMC.parent.numChildren-1); or public function bringMCToFront($mc:MovieClip){ $mc.parent.setChildIndex($mc, $mc.parent.numChildren-1);}
by it gives me this error: Error #1065: Variable setChildIndex is not defined.
Im trying to keep all my movieclips onto 1 layer/mother mc to speed up the flash display engine
I have these takable items(movieclips) that respawn after a while.
Initially i build the level starting with all the takable items before adding all the players/npc's. This way the player and npc's walk over the objects if they are not taken.
After an items respawns though, i have to re add them to the main mc and then they appear to be over the npc's and they seem to be moving under a carpet of stuff. Its a nice 3d effect but totally unwanted in this scenario.
Is there a way to make sure that items are added as child before a certain clip (like the player). I tried using addchildat but this gives me a index error now and then. I dont really understand how the depths are worked out by flash.
I was thinking of storing the original depth of an item movieclip and then on restore, addchild at at its old depth. Or is there a more sensible way?
Also: can two movieclips occupy the same index/depth level? or are the incemented or something?
I have 4 movieclips on my "layer1". Everytime my mouse is onRollOver of a movieclip, I just want THIS movieclip coming to the FRONT, that's to say the Highest Depth.
(in Visual Basic, "ZOrder(0)" is simple.. but harder in ActionScript.. lol )
I've found some many examples "around" this, but did'nt success to adapt the code to my simple needs !
Is it possible to keep a movieClip at the lowest depth and stack other movieClips on top. I have a container movieClip that I add a movieClip called floorTile. I want floorTile to always be at level 0 no matter what. Then when I click on another movieClip, I want this to be added on top of the floorTile.
ActionScript Code: //create a container to hold the floor tile and textures var myContainer:MovieClip = new MovieClip() myContainer.x=425;
the question is a bit more involed. I have a dynamic text box, which I've put inside a movieclip. I hae a number of movieclips that I bring in using attachMovie, but my movieclip which contains my text box is underneath all the other movieclips.
I would like to know how I can tell my movie to display above all the other?
I started with some AS2 pageflip code that I've been modifying because I needed the code in AS3, and I wanted to make some changes to it. At anyrate, I'm having a problem with the depth of two movieclips created. The code first creates a page using the makePage function, and then creates a shade for that page (makeShade function).When running the code, the page appears on top of the shade. When using getChildIndex, the page's index = 11, and the shade's index = 14.
The complete code is super long so I've attached the code that has the shade and page below:
//create left-aligned page-sized solid fill function makePage(targ, xQuadrant) { //trace ("in make page");
I have some code in ActionScript 2 similar to the below snippet (Item being a MovieClip):[code]I'm unable to remove Temp after swapping the depth (works fine otherwise).[code]how to get rid of Temp?
Is there a way to change the depth (index number) of a movieClip when I click on it to drag. Example:Say I have three circles. Each circle has a MOUSE_UP and MOUSE_DOWN eventListener. When one is clicked It will bring it to the front so when I drag it will be above the two other circles.
Code: moviclip.swapDepths(movieclip._y); and it worked perfectly.
but I decided that I wanted to continue the development of the game in AS3 (so that it will be more up to date and I could learn the new syntax), and I found the equivalent to swapDepths is setChildIndex. so I followed the new rules and came up with this code:Code: setChildIndex(character_mc, character_mc.y);but, sadly it does not work the same. the game becomes extremely laggy and almost unresponsive, but becomes normal again if I remove the code. So, my question is how can I add a similar code for this to work properly.
I have about 85 movie clips on stage and they all have startDrag with MOUSE_DOWN.here is the thing I need the active one to come forward to the top of all others.I tried using:
setChildIndex(e.currentTarget, 85)
on the mouse over function but its not working its giving me an error 1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.displayisplayObject.
I would like to be able to draw a simple box as a background/placeholder, dress it up with buttons and movie clips at design time, and at runtime call a function to replace the simple box with a new design. How would I go about doing this? I have a graphic design that is too complicated to make with flash. So i made a piece of actionscript that can restyle any existing movieclip. This piece of code works. It basically gets the coordinates of the specified mc, creates a new one in it's place and deletes the original. Unfortunately this also removes any nested movieclips and buttons and breaks animation tweens of this mc. So if the original mc would have a button on it and animates from left to right, the new one doesn't. mc.clear(); looked very promising, but it only clears stuff you put on it at runtime while I need to clear the stuff from design-time. (= the simple box drawing object)Creating a movieclip with the same name, at the same depth doesn't seem to work. oldbox.parent.createEmptyMovieClip(oldbox._name, oldbox.getDepth()); The old movieclip keeps existing and neither of them animates.So I'm searching for a way to replace a movieclip or clear it's content at runtime.
I would like to be able to draw a simple box as a background/placeholder, dress it up with buttons and movie clips at design time, and at runtime call a function to replace the simple box with the new design. How would I go about doing this? I have a graphic design that is too complicated to make with flash. So i made a piece of actionscript that can restyle any existing movieclip. This piece of code works. It basically gets the coordinates of the specified mc, creates a new one in it's place and deletes the original. Unfortunately this also removes any nested movieclips and buttons and breaks animation tweens of this mc. So if the original mc would have a button on it and animates from left to right, the new one doesn't.
mc.clear(); looked very promising, but it only clears stuff you put on it at runtime while I need to clear the stuff from design-time. (= the simple box drawing object) Creating a movieclip with the same name, at the same depth doesn't seem to work. oldbox.parent.createEmptyMovieClip(oldbox._name, oldbox.getDepth()); The old movieclip keeps existing and neither of them animates.So I'm searching for a way to replace a movieclip or clear it's content at runtime. Or am I thinking in the wrong direction and are there other ways to restyle a movie clip?
Ok kiddies. I've been toying with AS and trig. and have a little wiggly worm that half-heartedly responds to the mouse just as I want. It's created by looping 30 times through a for loop and using attachmovie() like this.
for(i=0; i<30; i++){ attachMovie("mcCircle", "mcCircle" + i, i, {_x:mx[i], _y:my[i]}); }
As you can see for their depths I have used the increment of the for loop. So I have 30 clips with depths from 0 to 29. On the other hand, the graphics which have been statically placed on the stage have these depths.
What I need is to place the mcCircle clips underneath some of the objects on the stage. Imparticularly, the menu bar at the top of the stage and the logo at the bottom while staying on top of the background. I just want it to look like it's going behind these two graphics. I've tried a number of things and have ran out of ideas. By the way - the bottom of frame 27 of the actions layer has the code that is outputting the depths in the Output panel in Flash.
I've got this new problem where I'm trying to remove a container movieclip i've attached the first time the function is run, but I try to remove it and replace it again, but the second time around it gets a negative depth and all goes to hell.
Code:
function populateBasket(){ trace("B4 REMOVE:" + basketRows.loader.container.getDepth()); basketRows.loader.container.removeMovieClip();
I have three movieclips (used as buttons) on my main MC. The following code swaps the depth of a dynamically loaded image the when I rollOver each movieclip (button). I want to put the button.rollOver code in a for loop so I dont have to repeat this code for every image loaded.