ActionScript 3.0 :: How Does SetChildIndex(); Work?

Nov 28, 2007

For the life of me, I cannot understand this method. The help files are confusing to me, and I can't locate anything else on the web that explains how it works.

What I have is an array of 5 objects closely in a row, that tween and expand on a MOUSE_OVER. Trouble is, I want the object to be in front of the others on the MOUSE_OVER, but part of it is always beneath the object to its right or left. Here's the code I have:


Code:
import fl.transitions.*;
import fl.transitions.easing.*;

addEventListener(Event.ENTER_FRAME, setupVars);

function setupVars(e:Event):void {
trace("Entering setupVars");
//The following removes the Event.ENTER_FRAME listener so that it does not activate 30 times a second.
removeEventListener(Event.ENTER_FRAME,setupVars);
var myArray:Array = [box1_mc, box2_mc, box3_mc, box4_mc, box5_mc];
for(var i:Number = 0; i < myArray.length; i++) {
myArray[i].addEventListener(MouseEvent.MOUSE_OVER, boxOver);
myArray[i].addEventListener(MouseEvent.MOUSE_OUT, boxOut);
myArray[i].buttonMode = true;
}
}
var box:Tween;
var box2: Tween;
function boxOver(ev:Event):void {
box = new Tween(ev.target, "width", Elastic.easeIn, 100, 130, .5, true);
box = new Tween(ev.target, "height", Elastic.easeIn, 100, 130, .5, true);
trace("yay, it works")
}

function boxOut(ev:Event):void {
box2 = new Tween(ev.target, "width", Elastic.easeOut, 130, 100, 1, true);
box2 = new Tween(ev.target, "height", Elastic.easeOut, 130, 100, 1, true);
trace("yay, this one works, too")
}
Could someone be so kind as to help me with the setChildIndex method? I want any particular box to be in front of the others on the OVER.

View 4 Replies


Similar Posts:


ActionScript 3.0 :: SetChildIndex Inside Mc Don't Work On Main Timeline

Jan 3, 2011

Inside of movieclip on keyframe i want a script that tells to swap depths between 2 mc's that are on main timeline. When i use setChildIndex inside of mc flash hits me with Error #2025.

View 9 Replies

SetChildIndex To Move Selected Mc To Top

May 28, 2009

I'm trying to use the setChildIndex(); property to move a mc to the top of the stage when that particular mc is clicked on. I'm still not sure what is meant to go in the parentheses? Sorry, still new to AS3.0. The mc has it's own class called Ball and this is where I'm calling the setChildIndex property, in the dragIt function. Here's the code for the Ball class....

[Code]...

View 2 Replies

ActionScript 3.0 :: SetChildIndex For A Video?

Dec 10, 2009

know how to set the Child Index for a video inAS3 ? I have a class that extends the video class and I call it from my main class file. In my main class file I have other Movie Clips that I wan to put on top of the video instance

View 2 Replies

ActionScript 3.0 :: SetChildIndex Seems To Have No Effect?

Jan 21, 2010

I am trying to set a Sprite's z-index to topmost on mouseOver. In my mouseOver event I am calling:this.parent.setChildIndex(this, this.parent.numChildren - 1);If I trace the index of this before and after the call, the index has changed but my sprite still appears to be behind it's siblings.I am changing the scale of the object on mouseOver as well

View 3 Replies

ActionScript 3.0 :: SetChildIndex On A For Loop

Aug 28, 2009

What I have is an array of 3 pictures in a column, that expand on a MOUSE_OVER. I want the picture to be in front of the others on the MOUSE_OVER, but part of it is always beneath.

Code:
var thumbnails:Array = ["IMG_1258.JPG","IMG_1417.JPG","IMG_1428.JPG"];
var studioGallery:MovieClip = new MovieClip();
addChild(studioGallery);

[Code]....

I tried to add the following line of code on OnOver as I saw it in another thread, but it gives me an error message:

Code:
this.setChildIndex(this.getChildByName(evt.currentTarget.name), this.numChildren-1);

View 1 Replies

ActionScript 3.0 :: SetChildIndex Simple Depth?

Dec 12, 2006

I am creating multiple sprites on the stage using structured classes as shown below, I would like every time I click on one of these sprites to make it go on top of all previously created sprites. I would also like to know if this can be implemented from within the last class "class c" onMouseDown function.

[Code]...

View 6 Replies

ActionScript 3.0 :: Drawing Shape And SetChildIndex?

Mar 7, 2011

I'm making an android air application for school, a sketch app.But I'm facing an annoying problem, when I'm drawing I can draw over my bar and my menu, here's some code:

[code]....

--> so this is the function for drawing a shape on stage the shape is declared as

Actionscript Code:
public static var brushDraw:Shape = new Shape();

now the problem is that I can draw over my menu and everything. Putting the setChildIndex of brushDraw to 1 doesn't work, it gives some error...

View 1 Replies

ActionScript 3.0 :: Remove The Objetc After SetChildIndex?

Aug 2, 2009

In Flash, some of the objects I put on the stage directly (e.g. mc_), and some of the objects are using "add child" function to be put on the stage.For some reason, I need to use setchildIndex function in frame 15 to bring the object (mc_A  on the top my stage.But this causes a problem that is, object A is always there from frame 1-15.Actually I don't need mc_A on frame 1. So in order to remove object I use removeChild or set mc_A.visible=false, but it doesn't work because I got the typeError said "TypeError: Error #1009: Cannot access a property or method of a null object reference." I know it makes sense because mc_A is not in frame 1. Of course, it couldn't access to the object.I attach an example file, hope it could describe my problem more clearly.Attachments:setChildIndex.fla.zip (7.2 K)

View 7 Replies

ActionScript 3.0 :: SetChildIndex Messing Things Up?

Oct 4, 2009

So the MouseEvent.CLICK event works just fine when i don't have the setChildIndex, but when i do nothing happens anymore. Here is the code:

var kake:Kake = new Kake();
kake.x = 87.5;
kake.y = 358.5;
addChild(kake);
setChildIndex(kake,2);

[Code]...

View 3 Replies

ActionScript 3.0 :: SetChildIndex Of Dynamic Target?

Jan 13, 2011

I have an XML file with a path to a number of images which I load to the stage.

Code:
public function popStage():void{for(var i=0; i<xml.projectInfo.length(); i++){var picLoader:Loader = new Loader();
var picHolder:Sprite = new Sprite();
picLoader.load(new URLRequest(String(xml.projectInfo[i].image)));

[code]....

What I want to do is bring the infoBox to the top Index than bring the image to the top index after that so that the logo is over the infoBox. The infoBox is no problem but I can't seem to get the code right for the target to have the top index. I have tried a number of variations and done some research but no luck. [URL]

View 5 Replies

ActionScript 3.0 :: Bitmap Disappear After SetChildIndex

Apr 30, 2009

I have a bitmap inside a Movieclip. So, when I swap the parent, the bitmap disappears... This is my setup:

ScreenMC Children:
0. name:instance178 type:object [object Sprite]
1. name:instance176 type:object [object MovieClip]
2. name:instance16 type:object [object Bitmap]

[Code].....

View 1 Replies

ActionScript 3.0 :: Flash SetChildIndex Not Working

Aug 3, 2010

I am trying to do is dynamically place movie clips into a container called container. when I roll over the movie clip I need it to show on top.. right now its either not showing up on top or I get an Error #2006.. out of bounds... Below is my AS3 code that I created to do what I want.. so far everything is working except the rollover effect..

PHP Code:
import caurina.transitions.*;
var imgHolder:MovieClip;
for (var i:int = 0; i < 6; i++){
imgHolder = new imageHolder();
imgHolder.x = (imgHolder.width + 3) * i;
[Code] .....

View 1 Replies

ActionScript 3.0 :: Bring A Movieclip To The Front Using SetChildIndex

Nov 18, 2009

I'm having reel trouble trying to bring a movieclip to the front using setChildIndex. I have 3 movieclips that are being loaded into a movieclip that sits on the stage. I'm using:

[Code]...

View 2 Replies

ActionScript 3.0 :: SetChildIndex Over Movieclips Not Working Properly?

Aug 30, 2010

the code which works over stage, is not working properly over a movieclip..sample, i have many objects to stay at different indexes at flash..with that code block below. I add 300 mc's to stage,

Code:
for (var j:Number = 0; j<300; j++) {
var mc2:MovieClip = new MovieClip();
stage.addChildAt(mc2, j);
}

TO be able to change indexes with different items.. i have random movieclips which have to be placed indexes between 5 and 300.. And everything goes great when i do this directly at stage..But when i do this with a movieclip.. example;

Code:
for (var i:Number = 0; i<300; i++) {
var mc3:MovieClip = new MovieClip();
my_mc.addChildAt(mc3, i);
}

i can't see the movieclips inside.. but i know they are at their right indexes..but somehow they are getting behind those fake movieclips..

View 15 Replies

ActionScript 3.0 :: SetChildIndex Kills Frame Animation

Oct 15, 2010

I've got a movie with some buttons in the middle of the screen. I've got a tween on the buttons to make them grow/shrink on rollOver/rollOut, when a button is clicked, I've got a frame animation that moves the buttons to the top of the screen and shrinks them. This all works fine.

When the buttons grow, they need to appear on top of all the other buttons. Since there's no more swapDepths, I'm using setChildIndex to move the rolled over button to the top. Now, when I click one of the buttons (after rolling over it), any of the buttons I've rolled over aren't affected by the frame animation.[code]...

View 7 Replies

Professional :: SetChildIndex - Setup To The Same Instance Names

Feb 10, 2011

I have a bunch of movie clips set up to the same instance names as the ones mentioned in the follwoing code using this. however I am trying to make it so that when clicked, the mouse click event will cause the selected item to be set to the front of the stage and not to be overlapped by anything in front of it. I have been doing research and know its done using setChildIndex but evertime I try and implement it I get errors I muse be doing something wrong could one show me in this code where the 2 or 3 lines of code would go?

[Code]...

View 2 Replies

ActionScript 3.0 :: Bring Image To Front - SetChildIndex ?

Jun 30, 2009

I have thumbnails that load from an XML file, the thumbs are positioned horizontally across a containing MC.

They are spaced so they overlap, and I want the thumb that is MOUSE_OVER to come to the top

ActionScript Code:
var thumbCon:MovieClip = new MovieClip();
var leftGutter:Number=30;

[Code]....

View 2 Replies

ActionScript 3.0 :: SetChildIndex - Getting MovieClips To Swap Depths

Oct 4, 2011

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.

View 4 Replies

Actionscript 3.0 :: AddChild, SetChildIndex And SwapChildren; Make On Top?

Sep 29, 2011

i tried all 3 of these, and i get errorReferenceError: Error #1065: Variable TLFTextField is not defined.orTypeError: Error #1034: Type Coercion failed: cannot convert "instance207" to flash.display.DisplayObject.

at menucaller/self_overHandler()
Code: Select all  private function self_overHandler(event:MouseEvent):void
{

[code].....

View 4 Replies

ActionScript 3.0 :: SetChildIndex And Boundaries - Grab The Index Of Mc's

Jul 22, 2010

I am adding movieClips to the stage. I then am able to change the index of each movieClip, by moving some mc's behind or in front of one another. Prior to uploading these mc's to my database, I get their index locations. Let's just pretend we are working with 3 mc's (even though it could be unlimited). I grab the index of these mc's, and I get (35, 2, 38). I then send this information to the database. Looking at those numbers, we can tell there are a ton of objects on the stage. Information is sent to DB, and now I open up a new FLA, ready to get the information.

Now I want to get this information, and add the mc's to a container, in the same exact order they were in before. Because I am adding them to a fresh container, and there are no other objects within the container, these will obviously be out of bounds (except for the one mc at index "2"). I understand they are out of bounds because unlike when I sent them to the DB, there were tons of objects on the stage. This time, there is only the container, and the 3 mc's, so their old index of (35, 2, 38) won't work.

[Code]....

View 10 Replies

ActionScript 3.0 :: SetChildIndex - Border Slides Underneath The Other Images

Sep 19, 2009

I'm working a project where images expand 50px on roll_over and then retract on roll_out. On roll_over the images overlap and I use the setChildIndex to keep the target on top. This works fine. What I'm having issues with is the border that is displayed on roll_over. The first time I cycle through the images, everything works fine, after that only the image stays on top, the border slides underneath the other images. I looked up the Adobe 'setChildIndex' I'm afraid I don't understand the numChildren-1 thing.

[Code]...

View 3 Replies

Flash CS5 :: Glitch With SetChildIndex And Dynamic Text Fields?

Oct 22, 2010

I have a movie clip with 5 frames.  When I'm on frame 3 (main game play) and I use the setChildIndex command on an on-screen element that exists on the frame itself, the element in question will now be permenantly added to the stage, and will persist across the remaining frames (end level and end game). This behavior was not present in the project until I converted it to CS5. If I remove the setChildIndex command, the on-screen elements stop sorting their depth (as your would expect) and they no longer bleed into the next frame which is for level ending.

I am also having trouble with a dynamic text field. It's currently set to not be selectable, but when you mouse over the field it shows the cursor symbol for your mouse pointer, and when you click over it, a small block highlight appears on the left or right side of the field. You can't change the field contents, or even select them, but when you try a small selection black mark appears on the end of the field.  I've destroyed and recreated this field, and the bahavior seems to be staying the same.

View 3 Replies

Actionscript 3 :: Use SetChildIndex() To Bring The Current MovieClip To The Front

Nov 25, 2011

I am trying to use setChildIndex() to bring the current movieClip to the front. I have the following code on the first frame of the TimeLine. setChildIndex(currentMovieClip,numChildren - 1); And am getting the following errors. Scene 1, Layer 'Layer 2', Frame 1, Line 20 1093: Syntax error. Scene 1, Layer 'Layer 2', Frame 1, Line 20 1084: Syntax error: expecting rightparen before 1. Should I be using stage or something else is wrong?

View 1 Replies

ActionScript 3.0 :: SetChildIndex - Getting Error #1034 : Type Coercion Failed: Cannot Convert McBlad$ To Flash?

Mar 29, 2012

I get this error: TypeError: Error #1034: Type Coercion failed: cannot convert mcBlad$ to flash.display.DisplayObject.at Notitieblok_fla::MainTimeline/backCard()

On the following code:

ActionScript Code:
import flash.events.Event;
import flash.display.MovieClip;
import flash.events.MouseEvent;[code].....

View 2 Replies

ActionScript 3.0 :: SetChildIndex And SwapChildren - On Mouse Over Set The Parent Of The Moused Over Text Field To The Highest Depth Child Of Its Parent

Sep 29, 2011

trying to on mouse over set the parent of the moused over text field to the highest depth child of its parent i tried both of these: [code] private function

[Code]...

View 3 Replies

ActionScript 3.0 :: Dynamic Fonts Don't Work... But Arial And Verdana Work?

Mar 19, 2012

I am trying to defeat my psychological block with dynamically loaded fonts in AS3, and I have an annoying problem. I am creating a clock with a textfield and I am loading fonts from a SWF library: the available classes/linkages are "Arial", "ArialBold", "MyriadPro", "MyriadProBold" and "Verdana".This is the line where I get the class from the SWF, and it extracts the class correctly

Code:
clock = new Clock( { fontClass: assetsLoader.getFontClass("skin", "Arial") } );
The constructor...

[code]......

View 7 Replies

IDE :: Swf Files Work Fine Separately, Don't Work When On Same Page?

Feb 22, 2010

I have run across a strange problem. When I load products2.swf by itself, I can call the two "copy" files and everything works. When I open 0342.swf (the index page), I can switch between the home and products2 pages, but I can't view the "copy" pages.I'm guessing there may be some sort of conflict with variable names, but I have been messing with it for most of today.I have uploaded all of the FLA files to here:[url]....

If you make an swf file out of each of the attached items, and open the 0342 file, you will see what is supposed to be happening.

on (release) {
if (_root.currMovie == undefined) {
_root.currMovie = "home";[code].....

View 3 Replies

ActionScript 3.0 :: Width Doesn't Work - How To Make It Work

Apr 21, 2010

I have a button object that I need to scale to align with the variable width of an array of images.However, when I set the width in code, the button does not actually become that width. Tracing out the width gives me the correct value, but on screen.. it's off.

I've proved it to myself by scaling the same button object manually in the properties pane and visually comparing. Both of the buttons below have a width of 410.

Code:
navigatorDown_btn.width = 410;
navigatorDown_btn.x = (stage.stageWidth/2)-(navigatorDown_btn.width/2);
trace(navigatorDown_btn.width); // output: 410

View 4 Replies

ActionScript 1/2 :: 2 Buttons Won't Work That Were Created Exactly Like Many Others That Work

Jun 1, 2011

I am using Flash CS4 with actionscript 2 to create an interacitve portfolio.I have 2 text buttons that work when I test them with "enable simple buttons." When I publish to IE these buttons won't work.  I have created over 50 buttons using the same methods, they all work.

View 8 Replies







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