ActionScript 3.0 :: Add A Child Of Index 2 Or Higher?

Mar 3, 2010

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?

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Bitmap Has Higher Index Than Sprite?

Nov 10, 2009

I've just switched over to AS3, and I'm completely stumped with something.

I'm working on a project where I keep adding children to a MC already on the screen. There are two types of these children: Sprites that I use to draw lines using moveTo, lineTo, ect. Then there's sprites that have children inside of THEM that are bitmaps.

For some strange reason, the Sprites with the bitmaps on them always have a higher depth/index (AS3 terminology is still weird for me) than the normal Sprites.

Here's a diagram of my MC/children/children layers:

---------------=> (Sprites that draw lines)
(MC on Stage) =>
---------------=> (Sprites that hold bitmaps) => (Bitmap)

View 6 Replies

ActionScript 3.0 :: Having One Image Below Another Using Child Index

Jan 26, 2010

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

View 4 Replies

ActionScript 3.0 :: Won't Let Reset Child Index?

Jul 15, 2010

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.

[Code]...

View 2 Replies

ActionScript 3.0 :: Access Child At Top Index?

Dec 13, 2011

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]...

View 7 Replies

ActionScript 3.0 :: Setting Child Index In A Class?

Sep 26, 2009

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.

View 2 Replies

ActionScript 3.0 :: Setting Child Index From Within Array?

Sep 14, 2010

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);

[Code]...

View 3 Replies

ActionScript 3.0 :: Trace Child Index Number?

Mar 5, 2012

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)
{

[Code]....

View 1 Replies

ActionScript 3.0 :: Trying To Swap Child Index On Click

Feb 20, 2009

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.

View 0 Replies

ActionScript 3.0 :: Change Child Index And Alpha?

May 16, 2010

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

View 5 Replies

ActionScript 3.0 :: How To Trace Child Index Number

Mar 5, 2012

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"
}

View 1 Replies

ActionScript 3.0 :: Child - Parent - Index Level Setting?

Jul 2, 2009

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?

View 3 Replies

Arrays :: Changing Child Index Of MovieClips Based On Their Y Position?

Mar 1, 2012

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()

[Code].....

View 2 Replies

ActionScript 3.0 :: Tween Child Display Object Index Getting Screwed Up?

May 1, 2009

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:

Code:
this.tweenIn = new Tween(this, "y", Regular.easeOut, stageHeight, stageHeight - this.height, 2, true);
this.tweenOut = new Tween(this, "y", Regular.easeOut, stageHeight - this.height, stageHeight, 2, true);[code].....

View 9 Replies

Actionscript 3 :: Update Xml Document's Child Regardless Of It's "vertical Index" / Depth In It?

Dec 23, 2009

I'm in a situation where I have a xml document which is going to be updated in the following way: The deepest child within the document which surrounds a certain x,y position (depending on it's x, y, width and height attributes) is going to get a new child element. If multiple childs exist with the same depth, the bottom one is updated.

My first step was to find this deepest child, this already caused problems, but I managed to solve this with the following recursion[code]...

View 2 Replies

Flash :: Get The Specific Array Index Based On Value Inside The Index's Object?

Jun 22, 2011

So, for sending to individual streams we have to reference the connected netStream we want to send to in some way like this:

sendStream.peerStreams[0].send("MyFunction",param1,param2);

and I have to determine which peer I'm sending to by their ID such as "peerID1234"

I know that you can check the peerID of the stream by doing:

sendStream.peerStreams[0]["farID"]

how can I make my send stream function know to use the array index where the peerID is?

so basically it could be like:

sendStream.peerStreams[where peerStreams[]["farID"] == peerID].send("MyFunction",param1,param2);

View 1 Replies

Use 40 FPS Or Higher?

Nov 14, 2009

I dont understand why a simple vector mc TWEEN ANIMATION isnt smooth.Here is an example. I use 30 FPS and I dont want to use 40 FPS or higher.

View 1 Replies

Php :: Overwrite Entry Only If New One Is Higher?

Jun 6, 2011

I have table named "highscore" like this:

nameQL scoreQL
piotr 50

And flash game with NAME and SCORE exported to PHP with this names.How to make this in PHP file:

IF (NAME exists in database (nameQL)AND SCORE> this.name.scoreQL){Raplace scoreQL with SCORE WHERE nameQL=NAME}

IF (NAME doesn't exists){Create new row with NAME and SCORE)

View 1 Replies

ActionScript 3.0 :: Multiple Buttons To Open Child Swfs Then Be Able To Close The Child From Within The Child?

Mar 25, 2009

I have a picture on the stage that has multiple items that have hotspots/links over them that should open a child swf on top of the background and show details about the items. then have a button in the child swf itself that removes the child from over the background so the user can click on another item etc.I found this code in someone's post and I am trying to modify it so that works for multiple swf files...it currently works for a single swf.I wan to pass the name of the button in front of the .swf in the URLRequest to have the same name as the instance name of the referring button. But I can't figure it out. Here is the code I am using on the stage

View 2 Replies

Actionscript 3 :: MovieClip Higher Than Set Mask?

Apr 9, 2011

I have a movieclip with a prefilled content (some simple vector graphic in a movieclip), with the height of 40. I then apply a mask to it, with the height of 30. Now i would think that the MovieClip is 30 pixel high, but it turns out to be 40 pixel high. Is there some property im not setting or does the movieclip always assume the height of ALL the content within it? or what?

Actually in another clip, too, I have predefined 2 vector graphics (in two seperate movieclips), where the highest one is applied as a mask to the second graphic. The movieclip again assumes the height of the highest element. That might be logical, as it is the mask, BUT! when i then resize my mask (programatically) the height of the movieclip remains the same.Is there some way to recalculate the height of a movie clip? Or am I missing something?

View 1 Replies

ActionScript 2.0 :: Volumen To Be Higher Than 0 When The Swf Is Loaded?

Oct 21, 2005

I would like the volumen to be higher than 0 when the swf is loaded, so that music can be heard without the need of dragging the volume...I've tried to set the dragger in the middle of the slider but still the actual sound is 0 at start.

The code is as follows:
this.ratio = 0;
dragger.onPress = function() {

[code]....

View 4 Replies

ActionScript 2.0 :: Which Movieclip Is At A Higher Level

Dec 23, 2006

If I have 2 movieclips, how can I know through actionscript which one is at a higher level?

View 2 Replies

Flex :: Check If An Integer Is Going Higher Or Lower In AS3

Apr 29, 2010

I'm trying to make a script that listens to a variable (int or Number) and then does certain functions whether the variable is going higher or lower. So for example if the number gets higher, it runs one function. If it gets lower, it runs another.

View 3 Replies

Actionscript 3 :: Function Won't Accept Any Number Higher Than 4?

Nov 16, 2010

you know any reason why a function won't accept any number higher than 4? This is all I'm doing. Works for 0-4, but once I hit 5 or higher, I get "A term is undefined and has no properties." But if I just put the number 5 in there, it all works just fine, so it's not an issue with the xml.. for some reason the function just won't accept anything higher than 4. weirding me out..... I can't see an explanation for it.

[Code].....

View 1 Replies

Flex :: Bitmapdata - Save Image With Higher Dpi?

Jun 14, 2011

In Flex, I am using graphics.codec.JPEGEncoder to save image files that are edited inside application (normal manipulations like brightness etc.) I am able to save files perfectly. What I want to know is that is there any way I can save the image with a better dpi? Say, for instance the image that is loaded and manipulated was originally of 72dpi, now can I save it with a dpi of 150 or 300 ? If so, how to do it.

Doesn't have to be using the JPEGEncoder, if there's any way to do it at all, like using any library etc, I am okay with it.

Note: If it matters, I am using Bitmapdata to store the image and manipulations and saving the image with JPEGEncoder by supplying it's data as bytearray like below.

var imageBytes:ByteArray = encoder.encode(myBitmapData);

View 1 Replies

Actionscript 3 :: SWF Has Higher Framerate Than Specified In Compiler Arguments

Sep 14, 2011

I compile a SWF with ANT using FDT. In the compiler arguments I am setting default-frame-rate to 30. When I run the SWF, the stage.framerate property is 30 (which is correct), but as the Stats util from mrdoob shows, the SWF runs way faster up to 52 fps.So it seems the compiler argument default-frame-rate is applied, still the events are fired at a higher rate.[code]

View 1 Replies

ActionScript 2.0 :: Check If A Number If Higher, Or Closer To A Value?

Mar 25, 2010

Is there anyway of using AS to check if a number is either higher than a certain value, or closer to a certain value. The purpose, if the number in the text box is either higher than the other text box, or closer to say, 500, than the other one, then, it displays something in a dynamic text box.

View 3 Replies

ActionScript 3.0 :: Display JPEGs With Higher Bit Depths?

Aug 23, 2010

I'm working on a medical imaging application and was wondering if there is a way to display 12-bit per pixel JPEGs in flash/as3? I'm assuming I'll have to convert the image into a more flash friendly format, but was hoping to avoid that as keeping the original quality of the image is vital.

View 3 Replies

ActionScript 2.0 :: Only Make The Higher Or Lower Numbers Available?

Jan 18, 2011

ok qiuck 1 how do make the random number generator start making as exaplme random numbers between 2 and 4. so it would select2,3,4 but o1 hope that makes sense

onEnterFrame = function(){
maths = Math.floor(Math.random() * 4);
trace(maths);

[code]....

View 1 Replies

ActionScript 2.0 :: Load Each New Movie Into A Higher Level Than The Last?

Jan 5, 2006

I'm designing a site at the moment & I've run into a minor snag. I am loading about five external swf's, for each page of the site, from the main 'home' page. you can view it here Trouble with levels. I can load the movies fine, but what I want is to load each new movie into a higher level than the last, as each movie appears with a mask (for an example have a look at the site I've done then click on the 'Contact Us' button - that is what I want to do on all of the pages...) all of the swf's are loaded into level one with the exception of the 'Contact Us' page. (By the way, there is no 'News' page yet)

The very simple code I used to load the movies is:

Code:
on (release) {
loadMovieNum("contact.swf", 2);
}

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved