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
Similar Posts:
Feb 8, 2011
In my game, Ive got a HUD, (heads up display, life bar, points scorer etc...) and when an enemy comes onto the stage, the lifebar is appearing behind everything else, and it should really be the thing that's infront of everything else. Is there like a line of code and a function or variable I should declare or import that allows me to create depth and put my lifebar at the front.
View 2 Replies
Feb 25, 2009
I'm developing an AIR app using CS3. I had previously made one AIR app without much problems. So I start a new file and fill out the AIR settings (found under Commands). But the damn thing keeps screwing up settings. Some stay saved, some don't. It also keeps wanting to keep 2 files for inclusion that don't exist and are not even named correctly.
And now, after trying to fix some of the naming, it won't even create an AIR app anymore. It says there's a missing SWF file, but I published first, multiple times and yet, it doesn't see the swf.
View 1 Replies
Mar 18, 2009
I have a flash banner rotater and I have little squares at the bottom that are dynamically created which represent the slides in the banner, for example: if there are 4 slides in the banner there will be 4 little squares. Each little square is a button and if you click on a square it will take you to the slide that it represents. My problem is this: When I try to add numbers to each little square by dynamically creating a TextField then the text overlays the square so the button doesn't work.
View 2 Replies
Nov 15, 2009
hello everybody. I have a very weird problem. Recently my Flash IDE started to mess up dimensions. I mean when I create a new document or a rectangle for example, even if I set the height and width to the same value the height is always bigger than the width... I tried re-installing Flash CS4 again but that didn't solve the problem...
View 1 Replies
Jun 1, 2009
I am having trouble with unload an loading movies. Basically I am loading a movie into a container, which works a charm[code]...
Ideally I would like to add that second movie clip into a container so I can position it correctly, but when I try copying the code I use on the first it doesn't seem to work...is it to do with the "root" bit perhaps?
View 3 Replies
Aug 20, 2009
I've got a MovieClip with two frames for the UP and DOWN states with text on top of it. I've added MOUSE_DOWN and MOUSE_OUT event listeners, but the text gets in the way of the button reacting to the events.I tried fixing this by adding the text as a child of the button, but now the text and the button act like they're two separate buttons. Does anyone know of a clever way to make the text and the clip to act as one button?
View 2 Replies
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
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
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
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
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
Apr 27, 2010
I've got a line in my Actionscript like this:[code]If I click the auto format button with this line in there, it adds unnecessary semicolons through the rest of the code and the file stops working. Is there something wrong with the way I have this coded? It works just fine with the code in there before I hit the auto format button.
View 1 Replies
Sep 8, 2010
I dynamically set a color using this function in colortransform.
function setColor(o:DisplayObject,color:uint):void
{
var myColor:ColorTransform = o.transform.colorTransform;[code]...........
I then have a short timeline animation in Flash CS5 where the height grows just a little bit, and it does not grow.It grows in the preview, but not after compile.If i comment out this color transform function, the height animates correctly.
View 2 Replies
Jul 4, 2009
My air app is using the FlexChrome instead of the system chrome. The problem is I also have a .CSS for skinning that sets the skins for the Button class. This is also changing the 3 buttons (minimize, maximize, close) in the flex chrome which is undesired. Is there a way to make it not effect the Flex chrome buttons?Also the css file is in a central location and I use it for many apps so I would like not to have to change the css file but change something in my app only so I do not effect other projects.
View 1 Replies
Dec 20, 2010
I'm trying to replace some contents in a website by using the following code:[code]The problem is that I have some flash embedded on the DOM and whenever I try to do the replacement the browser crashes.Somebody should thing that a prepend or append in the right place should be a better method
to achieve this, but the elements I'm trying to locate and replace are html comments and the append prepend methods do not seem to work with this kind of nodes so they have to be treated as literal strings.
View 1 Replies
Feb 4, 2011
I'm working on a AS3 and Box2D game with moving platforms. The platforms are animated in Flash, and in actionscript I can read in their current position and adjust the physics bodies to match.However, there's always a delay, where the animation is one frame ahead of the physics. I wanted to fix this by reading in the clip's current position, storing it for later, and then putting the clip back to its position at the last frame.
But when I do this, it systematically refuses to budge. I coded up a simple test with a single moving box to test the idea, and I get the same problem ("movingBox" is a symbol that animates a single "box" symbol within it):
package
{
import flash.display.*;
import flash.events.*;[code].............
View 1 Replies
Jul 31, 2009
I have a xml file(pretty big like 600kb) and I am extracting data from him in a function. I call that function in the first frame. The question is how can I preload that function or because is messing all my animations.
View 6 Replies
Feb 24, 2011
I'm using the .sortOn() function in AS3.0 to sort an array with multiple elements.First, I push the values to the array, like this:[code] The program has a number of "loops" it goes through. So, I push data to this array (which is global) a first time, sort it, and then later I clear the array with the .shift() function in conjunction with a for loop. I then push new data to the array with the same line of code mentioned above.But what's happening is this: on the first round, everything works great, and this is what my output looks like:[code]Before I cleared the array with for loop and .shift(), it would say "Northern Alberta & Prairies" in ALL array slots. Since I started using the .shift() function I managed to get BC to remain, but it's still clearing my southern alberta entry.
View 2 Replies
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
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
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
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
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
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
May 2, 2010
I have just finished tweeking my html page setting the width and height to 100% so that it appears in the same place on every screen. It seemed successful until i click on a page with an externally loaded swf.URL...i am unsure wether this is an html problem or as3. I have already set the dimensions of the external swfs in flash using:[code]
View 3 Replies
Mar 7, 2009
My problem is I'd like to retain the transparency of agraphics fill on a DisplayObject after applying a filter. If Idraw, say a rectangle, through a Sprite's Graphics and while doingso, specify some transparency:
var spr:Sprite = new Sprite();
var g:Graphics = spr.graphics as Graphics;
g.beginFill(0x00ff00,
[code].....
View 1 Replies
Jun 23, 2009
I'm having an issue with sound that I'm playing from the library. With longer sound files, whenever I specify an offset in the play() method that's greater than 1000 milliseconds, it ends up messing the sound files timing. Specifically, it cuts about 1 second from the end so the sound file ends abruptly. I was wondering if any one else was having a similar issue.
View 0 Replies
Dec 9, 2009
I have built this, drag the various dots.[URL]...%20parent.html I did not use the flash startDrag because it had all sorts of issues. I wanted the dots to be restricted to the stage when dragged. That is any dot CAN leave the stage when it is not the one being dragged. For example make the kite big and drag the red dot, the blue dots are free to leave the stage (marked by outline in the online example) The code I have uses mousemove, and some globalToLocal conversion to keep the dots from leaving the stage area All was well so far.
Now I find out the kite has to be able to rotate! when I simply rotate the kite all of my dragging rules break down. Click the big blue button, each click rotates the kite 5 degrees. Looks OK at first, rotate 30 or 40 degrees and everything breaks down. I know its the globalToLocal limiting, is there a better way? Seems people here have a lot of experience with dragging and rotating in flash. Does anyone see a way to fix what happens, or a whole new way to do the drag.
[Code]......
View 0 Replies
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