I have a set of buttons which trigger menu panels to tween up from below the screen. I want these menu panels to be displayed behind the buttons (which are displayed on the button edge of the screen). So I add the menus to the parent container, then I add the buttons, so that the menus would be behind the buttons and getChildIndex(buttons) = 1 and getChildIndex(menus) = 0.
The menus are correctly displayed behind the buttons when I comment out the tween code. But when I implement the tweens and start the tween of the menus, they do their motion tween but are displayed in front of the buttons instead of behind; somehow their display object index order got screwed up.from the Menu class:
know if the index effect the scope of an object because I am creating a game and for some reason, I get an error like below
TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.objects::Torret/updateObject() at com.objects::EngineApi/loop()
[Code].....
updateObject is the loop for all my objects. I have one centralized loop and in that loop it calls on an array of objects that have been placed on the stage. all of them containing the method updateObject. to update the status of the object. addGameChild() is a encapsulated addChild() , that not only adds the object to the stage, but places it in a array so it's updateObject() method can be called on. it is also used to make it easier for garbage collection.
Assume I have an array with references to different display objects on the stage. The display objects do not have any other explicit references except for the array indexes. How do I evaluate if a certain index of the array is a reference to a certain display object?Some code to clarify:
This is the error I am getting....This is the situation I am using addChild and removeChild. I have two main movieclips that this is based around. workss_mc and work_mc. workss_mc is the slideshow, work_mc is the selection grid. When you click on an object in work_mc I am adding adding a child (workss_mc) and removing work_mc at the same time. That works fine; however, in workss_mc I have a back button, this back button is used to remove works_mc once it is removed it sends you back to work_mc. Once you are back on work_mc everything should work completely the same, however, it's like it's ignoring the code.Here is the code for the button:
Code: urbanthmb_mc.addEventListener(MouseEvent.CLICK, clickHandler); function clickHandler(event:Event) { var workss_mc = new mc_workss();[code].......
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild() at working_loader_container3_fla::MainTimeline/frame4() at flash.display::MovieClip/prevFrame()
I have been getting this error after a bunch of different ways of trying this. I am attempting to create a new instance of my movieclip which displays external images via xml. I want a new instance of the movieclip every other frame and need to be able to remove each instance on every other frame. It will work going forwards, with a remove child call but as soon as I go back a frame, the error pops up.
i need some help to understand how to access a property of a child of a DisplayObject. within a class i have an object with the variable name: btnLMain i have assigned it a name property: btnLMain.name = "btnL"; btnLMain also has a property: btnLMain.clickNum = 0; // thats the one i need to access when i instantiate the class (btnL) containing this code in the parent class i need to access the property "clickNum" so i did this:
Basically I've got a class called Controller and another class called:"EnemyShip".In EnemyShip's step() event (the ENTER_FRAME event), I call myStage.removeChild(this);[code]myStage is a reference in the constructor of the EnemyShip.as class
how to access a property of a child of a DisplayObject.
within a class i have an object with the variable name: btnLMain i have assigned it a name property: btnLMain.name = "btnLMain"; btnLMain also has a property: btnLMain.clickNum = 0; // thats the one i need to access when i instantiate the class (btnL) containing this code in the parent class i need to access the property "clickNum" so i did this:
var dispObj:DisplayObject = btnL.getChildByName(btnLMain); displayObj.clickNum++;
but then i get the error: 1119: Access of possibly undefined property clickNum through a reference with static type flash.display:DisplayObject.
so then i reviewed documentation and from what i understand i am not able to access the property of the child of the DisplayObject as it is a static property...
so now i am trying to figure out how to access that property in the child Class.
I'm not too familiar with how I can use the getChildIndex() along with an if statement in a mouse_move event to make sure one image is always above the other or one is always on the bottom
I'm working on a project conversion from AS2 to AS3.
In AS2, I used a mainMenu file and loaded a Navigation file at _level 999 (very top). Then I loaded and unloaded different modules on _level 5.I also loaded and unloaded an external Glossary file on _level 95.Now in AS3 I am using AddChildAt(1) for the Naviation file and AddChildAt(.1) and removeChildAt(.1) for the module files. The Glossary file only seems to work at Child Index 1, so I'm guessing it pushes the Navigation file to a higher index. Is there a reference that explains the Index properties of the Child and why sometimes I get an error when I try to add a Child of Index 2 or higher?
I've got multiple images being loaded from an xml document and when they're created they add it to the stage and call a setIndex function to set it to 0. But when I try to the same object later on when they're called I get this compiler error:
I marked in bold the lines that relate. Out of the last two lines I marked bold I get this compiler error when I use the first one: 1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:Sprite.
and this output error when from the last bold line: TypeError: Error #2007: Parameter child must be non-null.
I am adding movieclips (myBall) to the stage by the click of a button. There is a base class applied to myBall which allows it (and its children) to be dragged and dropped. Within the base class on mouse down, along with startDrag, the movieclip is being brought to the top index. I would like to be able to refer to this movieclip in my document class. The point of doing this would be to apply a function to the last clicked movieclip (finding what movieclip was last clicked would happen by applying the function to the movieclip (myBall) with the highest index).[code]...
If I create a rectangle with 100px width and 100px height and then rotate it, the size of the element's "box" will have increased.With 45 rotation, the size becomes about 143x143 (from 100x100).Doing sometimes like cos(angleRad) * currentWidth seems to work for 45 rotation, but for other bigger angles it doesn't.At the moment I am doing this:
var currentRotation = object.rotation; object.rotation = 0; var normalizedWidth = object.width;
Im trying to build a class that moves around some movieclips on the stage, but it would never be that easy would it!
Code: package { import flash.display.MovieClip; public class Rotation extends MovieClip {
[Code]...
So I waddled it down to the "stage.addChildAt(mcContainer[i], i);" bit and I've tried everything that I could think of, but nothing seems to work.
With this version of the code, I would get "The supplied index is out of bounds." error, I can change it to addChildAt etc, but that just gives me a different error.
I had this working when it was in a flash file, its converting it into a usable class thats bugging me. All the MovieClips in the array are being exported for Actionscript.
Here's what I'm trying to accomplish: I have as3 script that successfully displays an array of MovieClips, the MCs have variable xy positions, and in some cases they overlap each other. I have a function within the array that I can't quite figure out. Here's what I'd like the function to do: When the cursor rolls over a particular MC displayed by the array,I'd like that MC to be brought to the front of the others. This is my script:
var myArray:Array = new Array(); for(var i:int=0; i<8; i++) { myArray[i]= new myImage();addChild(myArray[i]);myArray[i].x = 180*i;myArray[i].y = 330;myArray[i].addEventListener(MouseEvent.ROLL_OVER , overlap); function overlap (event:MouseEvent):void {trace('function triggered on image ' + i);
I have 3 objects (mask_cat, mask_dog, mask_sea_monster)on the stage and I want the user to be able to move them independently with the ol' click and drag.[code]So far only the, sea_ monster moves. The odd thing is the sea_monster moves when I click on the dog or the cat also, but not if I click anywhere else.
I have 10 movie clips on the stage all of them are on the same layer and the alpha property at 0.5.
I want a single movie clip to randomly move to the top of the other at timed intervals. This movie clip alpha property will change to 1 while the other movie clip will remain at 0.5
I want to know the index number of the object when I clicked it.. trace(mc.getChildAt(0)) = display the object at the index 0 lets say the output is [object] button Now I want to reverse it. When I click the object button button.addEventListener(MouseEvent.CLICK, onClick) function onClick(e:MouseEvent){ trace(e.currentTarget.????????) //I want to trace what index number is that button, the output should be "0" }
I encountered and did not make heads or tails out of this whole new concept of child, parent and setting a index level. What is an index level and this 'child and parent' thing?
I'm writing a game with Flash CS5/AS 3.0 that tries to simulate depth of field by drawing all the relevant Movie Clips based on their Y position in ascending order, i.e. things lower on the stage overlap things higher on the stage. A MovieClip with a Y position of 10 would therefore need to have a lower index compared to a MovieClip with a Y position of 20, so the second one gets drawn on top of the first.
I wrote a quick and dirty function just to test this. During the trace, I've noticed that the truck's index hits 0 when I go near the top of the stage, but if I go too far up it will completely disappear from the stage. Trace then starts generating this error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/getChildIndex() at EICT::Game/ReorganizeDisplayIndexes()
I have swf object with z-index:-5; position:absolute; Also a div with ul in it where div has also, z-index:5; position:absolute; All browsers display div over my flash except IE9.
Is there a direct way to get the item index of the data inside an itemRenderer? I need to display the item number against each item. I am currently doing a workaround and won't allow reuse of my itemRenderer component.
var index:int = model.dataColl.getItemIndex(data) + 1; itemNo = index.toString();
This is what i am using now, it works, but the concepts of component reuse and data abstraction are compromised.
I have an Actionscript project that I was building using Flash CS4. I embedded a font using the follow: [Embed(source="/bin/assets/fonts/MyriadPro-Regular.otf", fontWeight="normal", fontFamily="Myriad Pro")]
Then throughout my application in my TextFields I would set embedFonts to true antialiastype to advanced and set the thickness property of the text field. And setting the font-family from a stylesheet. This was all working exactly as I expected it would with no issues whatsoever and months of development.
I just upgraded to CS5 and published and none of my text is rendered at all. I was able to resolve this by removing the embedFonts = true from the textfields, but this leaves me with no control over the thickness at all.
I searched everywhere, does anyone know what the proper way to do this in CS5 is now? I've tried embedding my font directly within the CS5 IDE but still no thickness control.
I have an Movie Clip in Flash that have subobject of button type which has subobject of input text and movie clips. Right after creation core Moveclip all subobject are set to null, when I expect them to be valid objects.
[Code]...
MC_Core_design was created in Flash and exported to Actionscript. I've done this for button_1 class aswell. The code was written using Flex. When I comment out both lines that result in error I get correct view of the core Movie clip with all subobject. How can I set subobject properties right after object creation?