Flex :: Change Depth When Using AddChild?
Jun 9, 2010I'm adding a bg to the same canvas, but it's overlapping everything added before it.
View 2 RepliesI'm adding a bg to the same canvas, but it's overlapping everything added before it.
View 2 Repliesdoes that make sense at all? here's what i'm trying to do, the code is below. i'm building a touchscreen interface for a tradeshow, which mainly is a slideshow, with three buttons, one of which, when clicked, needs to load the company's webpage. i need to keep the webpage "inside" my environment and keep the navigation buttons on screen, so the user can touch the other two buttons for the rest of the content. so far, i've got an image on the stage, then call a button with addchild. i've got that loading a movieclip via addchild, also, which then calls the url, then i lose my nav button. is it possible to somehow load a url, and control it's depth index? or, accomplish the desired result in a different way?
var button_1:btn1 = new btn1();
button_1.x = 196;
button_1.y = 860;
[code].....
I have been trying to change the depth of an object. I have only just started learning AS3, so I haven't looked into this yet.So far I have been using a trial-&-error method to try to get this piece of code to work which I found on a site, but I have not succeeded:
Code:
setChildIndex(example,numChildren-1);
I am putting this code in it's class, and I tried replacing the word example with 'this'. Can someone please help me? When I test the swf it comes up with this in output:
Code:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/setChildIndex()
at Foreground/enterFrame()
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.
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]....
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?
right now I have some balls being generated like addChildAt(ball, 0);However what if I wanted to change the order of one specific ball?So make one ball 2 and add a alpha layer inbetween so the other balls cant be clicked.
View 14 RepliesIf i wanted to change the depth of a movieclip using AS3
View 2 RepliesObasically I have the codes I need to make my project work but the problem is when I put my drag and drop code with my swap depth on hittest code my drag code stops working heeres the codes:
code for swap depth on a hit test:
Actionscript Code:
newDepth = 2;Object.swapDepths(newDepth);
Code for drag and drop:
Actionscript Code:
object.onPress = function(){object.startDrag();}object.onRelease = function(){object.stopDrag();}
I've got a spiral
-----------------
function spiral(centerX, centerY, radius, sides, coils, rotation){ with(this){ moveTo(centerX, centerY); var awayStep = radius/sides; var aroundStep = coils/sides;// 0 to 1 based. var aroundRadians = aroundStep * 2 * Math.PI; rotation *= 2 * Math.PI; for(var i=1; i<=sides; i++){ var away = i * awayStep; var around = i *
[code]....
and I want some movie clips to appear infront as well as behind it, but right now it always appears on the bottom layer. Is there a way to attach the drawing to a movie clip or something so I can change it's depth?
I have a cube with depth = 0 that acts as a double sided plane.[code]...
We can't use depth as a property of the cube, so how can I change the depth of the cube?
I am trying to change the depth of MCs that are already positioned on the stage. However, there doesn't seem to be a property such as _depth. So can I even change the depth of an MC during the game and if so how would I do it?
View 3 RepliesHow can I do so the textfield will be OVER the movieclip I just created with: createEmptyMovieClip("Line",1);
View 2 Repliesthis is a simple one. on Frame XX i want to have symbols on layers 1,2,3 (for sake of argument) at differnt depths. thats the tag to change the depth of multiple symbols?
View 7 RepliesI know when you assign an empty movieclip or a movieclip to the stage via actionscirpt you have to set a z depth on the layer.
Is it possible to change the depth of the movie clip? If so how?
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.
View 7 RepliesI have a stack of 3 Mcs, 1, 2 and 3, one over the other, at the same layer.
I want to make an action, that makes the top level MCs, when clicked, to go under the other 2 MCs, and so on.
Is it possible? I tried to make it, but discovered that it's not possible to define negative depth for a MC.
Im having a dynamic textfield in on the main timeline which loads an external text file. Im also using addChild on the main timeline to display a mc. The problem is that the textfield is always behind the mc!! how can i change the depth of the textfield?
View 2 RepliesI am trying to change the depth of MCs that are already positioned on the stage. However, there doesn't seem to be a property such as _depth. So can I even change the depth of an MC during the game and if so how would I do it?
View 3 RepliesI've got a looping slideshow. I'd like to place a sliding menu at the bottom of the screen. The problem is I've created the slideshow dynamically, and the images being loaded all inherit a depth greater than 0.
how I can place the sliding menu at the very top of the presentation when it's already on the stage?
I'm looking to create a rotating set of images, simulated to look 3D... that can rotate either left or right, reactive to someones mouse location.
The path of the images would look like a flat oval, and as the images came to the forefront, they would be at full scale, have the lowest position (high _y), have the highest depth (appear in front of everything else) and be dead center _x.
As they slide left or right, they would reduce everything by a relative 50% to the final shift (scale, _y, and depth) until they got to the end, moving in an upward arc following the oval path. When they got to the end, and kept rotating beyond (move in the opposite _x. but appear to follow the flow of the arc), continuing to decrease in scale, _y, and depth.
why changing the index or depth of the movieClip breaks the the timeline animation of this movieClip !!
View 7 RepliesI have the following scenarios.
[Code]....
how can I change the txtField.text without using the addChild function in the main class?? because the Content Class is already visible when you compile it.. and when I remove the that addChild function, the txtField.text is still in its default value which is "Lorem Ipsum"
is it somehow possible to get item's depth in ArrayCollection?
View 3 Repliesputting a movieclip into highest depth without knowing which clip is in the highest depth
View 2 RepliesI am drawing some lines in my program using
graphics.lineTo(xx, yy);
The program has a background image over which these lines are drawn.The problem which I am facing is that the image overshadows the lines and the lines are not visible to the user.Since these lines do not have an id, I am not sure as to how I can assign a depth to them?
I am getting a warning when i run my application flash builder burrito.the warning is Warning: Failed to place object at depth 1.
View 2 Repliesi'm desperately trying to set my border container the highest z-index so it will always appear on top.
how can I know how many objects are in my flex stage, so i'll be able to set the bordercontainer the highest depth? what shell i write in the depth property in order the border container would always be on top? (it's important to mention that i created dynamic objects)
<s:BorderContainer includeIn="state2" width="200" height="200" backgroundColor="#992F2F"
horizontalCenter="-61" verticalCenter="23" depth.state2=currentState.num>
</s:BorderContainer>
I'm trying to have a class file which can add objects to the stage via addChild; however, when I call addChild from within the class file, I get the error "1180: Call to a possibly undefined method addChild." I've tried importing flash.display.* and that doesn't fix the problem. Does the class file have to extend Sprite or MovieClip to be able to add objects to the stage?
View 8 RepliesI have downloaded Box2d ([URL]) and created a project that looks like this: [URL]. catalyst is the green cube and it has the base class "shapes.box", it is inside "world" which has the base class "wck.World". What i want to do is to add another "catalyst" from the library inside "world" when i click on add_btn. I tried to accomplish this by this code:
[Code]...
Symbol 'buttons', Layer 'Actions', Frame 1, Line 41061: Call to a possibly undefined method addChild through a reference with static type Class.