ActionScript 3.0 :: Swapping Depth Of MovieClips?
Aug 30, 2010
How do you go about swapping depths in AS3? I've got a movieClip (allContent_mc) that contains a bunch of other movieClips(mc1, mc2, etc.) that expand in size when clicked on. However, when they are expanded I need to make sure that the one being viewed is on top. The control to expand each clip lives within each clip itself. Ideally, when the expand code (below) is executed, I'd like to make sure the clip's depth supersedes all others. I'm keeping all the clips together in one larger clip because the larger clip is living inside a scrollPane component. Pretty sure I'm just not defining the path to the clip correctly.
ActionScript Code:
function goOpen(e:MouseEvent):void{
this.setChildIndex (square_mc , this.numChildren - 1 );[code]...........
View 7 Replies
Similar Posts:
Dec 14, 2011
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?
View 2 Replies
Feb 17, 2009
I'm wondering what codes I should use to get some movieclips get their depths swapped depending on their y position. The one with highest y is on top and etc.I have 3 movieclips named:
character1
character2
and character3
I've tried with some codes but they doesn't work.
View 0 Replies
Jan 21, 2004
Is it possible to swap the depths of externally loaded movies? if so, what is the best way to do it?
View 1 Replies
Jun 7, 2006
Flash 8 - AS 2.0
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.
instance7:-16352
mcThought:-16355
instance6:-16357
mcCode:-16360
[Code]....
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.
View 6 Replies
Jan 18, 2010
I have a movie "keyB" which contains many other movies "d", "e", "f"..."keyB" has a mouse event listener so when I click on "keyB" it tells me which movie inside of "keyB" I have just clicked on - d, e or f.d, e and f are the same movie from the library but with different names and are all on the same frame in the timeline.d, e and f are overlapping and I want whichever one was clicked on to come to the front.Here's what I've tried without any success:
ActionScript Code:
keyB.addEventListener(MouseEvent.CLICK, tellKey);
function tellKey(event:Event):void
[code].....
View 6 Replies
Oct 7, 2009
I'm trying to swap movieclips in and out of an area, rather than loading an endless number via attach/getNextHighestDepth. Is there a way to swap my attached movieclip A with a new attached movieclip B, so that either clip A or Clip B is loaded, but not both? Because my current program uses attached files of identical size that overlap, I didn't realize there was a problem until things slowed down. I checked my number of objects in the debug list between hitTests and lo and behold, the list of objects got longer each time, even though to the viewer, it looked the same.
View 4 Replies
Feb 2, 2009
I've 6 different movieclips on stage, with one main focal movieclip in the center. What i need is that when clicking on the surrounding movieclips they animate in to swap their position with the main focal movieclip, which then animates to take it's replacements former position. So after a few mouse clicks all of the movieclips could have had their position shuffled from it's original location.
I know i've seen a similar thing on a photo gallery where the current photo is swapped with whatever thumbnail is clicked on but can't seem to find an example.
Currently i have the positions of the movieclips controlled by variables, the animation handled by tweener, and can quite happily find the position/scale etc of the movieclip that get's clicked on, but can't figure out how to get the focal movieclips details as it might never be the same movieclip.
View 2 Replies
Sep 2, 2011
I have an animated character swc that is an empty skeleton basically (has all the body parts, animations, and functions/vars). I want to essentially put different clothes on that character at runtime so I don't have to have many copies of this character in my resources.
For example, I have 'skeleton' (the non-clothed model) and 'Bob', 'Jane', and 'Mary' characters. 'skeleton' is animated and fully works as an exported swc, and to get the other characters in their clothes/skins, I open up Flash CS5 and replace the movie clips with the 'clothed' versions of the components. To clarify,'skeleton' has "body parts" as movie clips that are all animated on the timeline, such as "head","face","left arm","right arm", etc. I open up 'Bob', who has the same exact design as 'skeleton', with the exception that 'Bob' has all the clothes and such as differently-designed movie clips. The size, shape, orientation, and reg points are all the same across all the components. After I've replaced all the movie clips in 'skeleton', I export it as a swc named 'Bob.swc' and I do this for all the characters.
What I'm asking is, how can I do this process ^, but at runtime instead, so I don't have all these duplicate root swcs ('skeleton' has a lot of frames on it) so I can cut down on a bunch of space? So I can do something like:
// bob gets all the actions and animations of skeleton
var bob:UIMovieClip = new skeleton()
// replace the body movieclip with a new looking one
bob.body = resources.bodyassets['bob']['body']
View 1 Replies
Jan 4, 2010
I'm running a loop that's creating a multiple movieclips. Each clip can be dragged to drop point on the screen. What i'm trying to accomplish is when you select an item to drag it should take the highest depth, and should appear over all other draggable items. Right now the first clip is always under all of them while the last is getting the highest.
View 1 Replies
Mar 14, 2012
i want when user rollover on any movieclip it comes on top after rollout it goes it's original position but, this code is showing error.ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
private function pan3D():void{
excelmc=thumbswork.excel
officemc=thumbswork.office
googlemc=thumbswork.google
[code]....
View 1 Replies
Dec 29, 2009
This is a bit of a rooky question, probably cos I'm a bit of a rooky, but how do I clear a level, say level 24 of movieclips?
View 3 Replies
Oct 11, 2011
I asked this question yesterday but I found out that my problem is using fullscreen my goal is 2 mc 2 buttons : if btn 1 is clicked mc1 fullscreen and mc2 appears at the right bottom corner on top of mc1 if btn 2 is clicked mc2 fullscreen and mc1 appears at the right bottom corner on top of mc2 stage.swapChildren or setChildIndex is the way but with the fullScreen I had this error appears
[Code]...
View 1 Replies
Dec 2, 2005
I have two movie clips. The child movieclip is a button with rollover events which is nested inside the parent. I would like the parent to also have rollover events, but I understand that this is not possible in flash. I am familiar with two workarounds: event bubbling/delegation and the event listeners.
[Code]....
View 7 Replies
Apr 12, 2007
i have a movie clip on the stage, and i need its depth to always be higher than everything, but other movieclips are being duplicated constantly. How do i do this?
View 2 Replies
May 30, 2007
im having some trouble when trying to implement the swap depth function to movieclips that have the setmask function implimented to them. the problem is that i can get the swapdepth to work but when the setmask is implimented at the same time the movie clips will not swap depths.
the code that i am using to set the mask is _root.bgmasked.setMask(_root.dragger); this is on frame one in the action/code layer bgmasked is the imaged being masked by dragger.
[Code]...
View 2 Replies
Jul 5, 2010
I am working on a game engine that works like an overhead RPG, but the terrain is drawn at an angle with the characters at the same angle to give the illusion of a 3D world. the problem I am running into is that, while I can get the character to move perfectly fine on the ground, I need to be able to set the character to go behind or above certain objects depending where he is.
The best example of what I am trying to accomplish is from Gaia's MMO.
[URL]
As you can see in the first frame of the image, the character is in front of the bush, but behind the lamppost. In the second frame he is both behind the lamppost and bush. In the last frame, he is in front of both the lamppost and bush. during all of this though the bush and Lamppost never change position with the terrain or each other.
Basically, I have come to the conclusion that I believe the way this RPG is able to do this is through distance detection and depth swaps.
ex. if distance is above 0 character is above object. if distance is below 0, character is below object.
The main I would like to accomplish with this is the character, enemies, and NPC's are the only thing that changes depth. why? If an enemy is following and is on a different depth then the character, possibly higher or lower then the object, it could appear above or below the object while the character is the opposite.
View 3 Replies
May 11, 2004
putting a movieclip into highest depth without knowing which clip is in the highest depth
View 2 Replies
Jul 3, 2008
I'm trying to get this script running. It's to make a menu consisting of 5 buttons next to each other. When one of the buttons is clicked, it swaps position and color with the most left of the sequence. The gap created by the transition is either filled with a simple swap, or having all the buttons left of the gap slide to the right.So I figured I'd arrange all the buttons in an array. Here's my script
Code:
#include "mc_tween2.as"
function setup() {
[code]......
View 11 Replies
Nov 16, 2009
I am currently working on a project of a commercial flash box thing for their website.I have a thing where I need a bunch of images to wipe in this certain way. They are in mc's, and just sitting there, while I have squares moving on top of them doing the wiping. I need to know how to swap these image mc's out when it hits a certain frame e.g. frame 70.
View 1 Replies
Feb 2, 2010
I'm trying to figure out how to have a movie clip randomly replaced every time the page is refreshed. I have 4 clips that I want to have appear in the overall movie, but swapped in and out randomly. Also, I want these clips to play once, then stop, but continue to show the last frame of the clip for the remainder of the time that the main movie is playing. I must be placing the stop() in the wrong place or something. I tried placing one inside the original movie clip before I published it, it works on it's own, but not when I place it in the timeline of the other movie. No matter where I put that stop command, it doesn't seem to work.
View 1 Replies
Sep 28, 2010
I upgraded recently to Adobe CS5 from MM Flash 8 so that I could recover some newer Flash components that were developed in a newer version. This all seemed to go with out any issue. However, once in CS5, I noticed twice that an images switched to another image in the library. So I had two copies of the image and one image that went missing. I solved this by just updating the image that was corrupted.
I was on a crunch for this project and was working 16hr days, so I just left my computer on over night with CS5 open. I published the presentation and sent it for approval. Once everything was approved closed CS5.
When I reopened it many, (around 30ish) of my images have been corrupted the same way. I went back to my previous backups and the last 8hrs worth also have the corruption.
Is this something I can easily and permanently fix in this demo or as long as I use it will it keep on screwing up?Is this issue only with images or is my action script also likely to be corrupted?
View 6 Replies
Oct 11, 2010
I simply want to be able to write a function within a class that swaps a button or movie clip on the stage (that sits within another movie clip)with another button/movie clip that is located within the library.I have attempted the addChild() method but that doesn't seem to be working so well...e.g.clipOnstage.myBtn.addChild("libraryClip")....was just hoping it would replace the mc that is already within the display object container (kind of like what loadMovie used to do in as2)
View 4 Replies
Feb 17, 2009
I basically have a large bar of items that fills up dynamically, they are all added to a dispCont movieclip as a container. When you click on one it gets pulled to the front, scales up and I want all the unselected Items to blur or become semi transparent. So i figured i could just tween the dispCont object, however this affects whatever is brought to the front, so i want to switch that into a new MovieClip called centerCont. Here is the code, ive been trying different things, I could just use a little input.[code]when I click on it because i am trying to set event.target.parent = centerCont;otherwise, uncommented and that removed i get Code:1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject.
View 0 Replies
Apr 27, 2010
I'm a pixel artist struggling with AS3.I want to load a sprite sheet from file, actionscript through the five rows of colors in the upper left to identify the five palattes (by default, the sprite sheet is colored using the first palette), then recolor the entire sprite sheet according the one of the five palettes, setting magenta to transparent. The end result being the ability to do this...
I can do loops and arrays, but I don't know how to actually cycle through the PNG identifying and replacing colors. I've loaded the sprite sheet and scrolled the palette out of view using scrollRect, but nothing else.
Code:
//Scale the screen x3
scaleX=3;
scaleY=3;
[code]....
View 4 Replies
May 15, 2010
For starters, I may be going about this all wrong, but I have two PNG bitmaps that I have embedded into my script:
[Embed(source="pic1.png")]
private var Image1:Class;
[Embed(source="pic2.png")]
private var Image2:Class;Now I can addChild and removeChild to get them on and off the screen, but this seems cumbersome.
View 7 Replies
Jul 7, 2010
I have got an animation using 4 jpeg pictures which are of course stored in my library...I use them multiple times in the animation and I need to change them from time to time but I dont want to swap them manually in flash. The ideal solution for me would be if I could write some code that is able to swap this images in library for those I have in folder where swf is saved. here you can see my animation for better understanding: [URL]
View 2 Replies
Mar 5, 2004
How you'd swap; after storing, _x /_y position values of movie clips on button instances ie. onClick ..... Let's say I had four 4 movies and 3 buttons the (first movie looking like a button but is active so it's not clickable at that point) mc1, mc2, mc3, mc4 when the movie loads they are in that order. When the user clicks mc2 or 3 or 4 it slides into the _x position of mc1, and mc1 slides into the _x pos. where mc2/3/ or 4 just was (they swap).... then the user clicks mc4 or 3 or 1 and it swaps pos. with mc2 and so on.... all this done with a smooth easing transition. An example similar to this is the navigation module on [URL].
View 10 Replies
Mar 8, 2005
I have an image (possibly in an MC), which I would like to change, depending on the section the user is in. Basically I am looking for something like what the Swap Symbol command does.. swapping the symbol with another one.
View 1 Replies
Jul 30, 2008
I have a list component being populated by XML. In the XML, it contains characters like & " etc.. I have a function that will replace that with its proper character like & and "
[Code]...
View 1 Replies