ActionScript 2.0 :: Implement The Swap Depth Function To Movieclips?
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.
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
i'm workin with some "self created windows" in my flash app. how can i put the window i click on front of the others? I found smth about swapDepth, but there is no swapDepth in as3.
This should be really easy to do, but i cant find anything from searching. It's all tuturials for buttons and stuff. All i want to do, is put a MC called "face" on top of everything. What exactly would be the AS3 for this, and where would i put it?
I want to place a MC on top of everything thats also inside the MC it's in.The MC to be placed on top must not be on top on everything on the stage, just on top of everything inside the MC that its located in.Is this possible? what would be the code? because i'm pretty poor with AS3.
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++)[code].............
How would I swap the depth of image 6 (image_arr[5].) and have it come to the surface?
I've finally decided to dive into AS 3.0, coming from a design background, It's been a struggle. I'm using the book "Learning AS 3.0 - A Beginners's Guide" and got stuck on Chapter 4 - Depth Management.
I have dynamically layout layout 5 boxes that overlap each other, after that, Im able to target each box with my Event Listener (evt.target.alpha -= 0.2), but I'm not able to swap their depths (this.setChildIndex(evt.target, this.numChildren-1)
Code: // Layout Boxes - Dynamically for(var i:Number=0; i < 5; i++){ var box:MovieClip = new Box();
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:[code]How would I swap the depth of image 6 (image_arr[5].) and have it come to the surface?
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.
If I want an object to obtain the highest depth onRelease, which method from the following (or any other) would be the best? Using a createEmptyMC at highest depth and then swap to with that hight or use DepthManager.setDepthTo()?
i am trying to implement an image gallery in as3. I have already did the same with as2. I am trying to migrate to as3 version. I have two movieclip holders name "holder0" and "holder1" on the stage.These two moviclips are created statically on the stage to hold images.Now i want to swap the two movieclips.
I have this script I am writing where when someone hovers over a button it displays a popup box until they roll off. I have that function working alright, but I need the movie clips to swap depths, I realize I can do this with setChildIndex but I'm running into a small problem with my children/parent situation. My items are added as such: root > color_mc (blue or red or whatever) > button (this is the hover) I have the event listener added to the button for each color, but I need it so that when the button is rolled over, it takes the color_mc and moves it to the -1 spot. I've tried writing the code a number of ways but can't seem to get it.
Code: function manageMouseOver(event:MouseEvent):void{ var parentClip = event.target.parent.name; parentClip.setChildIndex(parentClip, parentClip.numChildren - 1); event.target.parent.gotoAndPlay(2); }
That code gives me the following error: Error #1069: Property numChildren not found on String and there is no default value.
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.
I am trying to swapping a movie clip with another movie clip keeping the x y coordinates in the same location as the original. This is to be done within a case statement. [code]...
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
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.
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.
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?
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.
I have two main clips with clickable clicks within each. I am using swapDepths on the two main clips in a tab navagation fashion. The problem is that if I click on the space between the nested clips in the top clip it actually is hitting the buttons(movieclips) on the other clip under it. Any suggestions?
I need a function to find the lowest available depth for use in attach movies and such. And I also wanted to ask if running a function like this a lot would be too intensive to be practical.
I have a 3D field with many MovieClips in it, and seems like the one last added is the one that overlaps others and not the one with highest z value. Is there any property/function that sets z-index? (sorting children by z value seems too much like a hack). A 3D engine that can place MovieClips will be helpful(but not one that requires custom drawing). I'm using Flash CS5 with ActionScript 3
I need the enemies to move around the obstacles on screen. I have tried several methods but it seems to screw up other functions in my game... For example the depth sorting function starts messing up (sortchildren()). I think its because i'm such an amateur.
I'm doing a basic site with frame labels on the main timeline whose name corresponds to the btn names. A simple otoAndPlay(evt.target.name); I have a basic navigation setup of 7 mcs with mouse eventlisteners for CLICK, ROLL_OVER and ROLL_OUT.
Does anyone know a better way to do this so when my mcs are clicked they display the rollover content/art? In essence I'm trying to achieve that when the user clicks a btn it goes to that "page" and the corresponding btn stays highlighted. Pretty standard web navigation technique but I just don't know what the best way to do this in flash is and with how my site is setup.