IDE :: Children And Go To Next Frame?

Mar 18, 2010

I am creating a breakout game and below is a part of my code:

function updateGame(e:Event) {
if (ball_mc.hitTestObject(brickone_mc)) {
beepSound.play();
yVel*=-1;
removeChild(brickone_mc);

[Code]...

I have got it removing the bricks as each brick has an instance name, I am now wanting to go to an end screen once all the bricks have been removed, is there a way to count the children and then put a gotoAndStop() in?

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Xml.children() Returns Grand-children And Gr8-gran-children?

Nov 18, 2009

I'm making a OSX-finder-type file browser in CS4.The Structure for the folder and files is being generated by a PHP in a XML, heres an example:(sorry the xml is not sorted, but the command i'm using in php doesn't sort it)

Code:
<root>
<dir name="images">

[code]....

View 2 Replies

ActionScript 2.0 :: Referencing Frame Label Children?

Jul 24, 2011

I have this issue with action script I've written (AS2), it is simple movement code for an on-screen character.

I have a character set up with a hierarchy of nested movie clips and frame labels.

Main character MC (1 frame, no label)
|
Front/Side/Back pose MCs (several separate frames, with labels, no animations)
|
Animation MCs for single pose (e.g. idle, walk, crouch, etc) (several separate frames, with labels)

I want to reference the child frame labels with gotoAndStop ('Front.walk'), or similar...

Here is the code I have now:

keyListener = new Object();

keyListener.onKeyDown = function ()
{

[Code]....

The problem is, as soon as the character moves one direction and changes to the desired pose, when I try to go the opposite direction... the pose doesn't change to the opposite direction frame label. So it only works once, and stays on that child frame label.

Is there a problem with the way I'm referencing the child frame labels?

View 2 Replies

AS3 :: Flash - Unable To Add Children When Exporting In Frame 2 For Classes?

Dec 28, 2011

Here is my code:

public function main() {
stage.addEventListener(KeyboardEvent.KEY_UP, hurdlesReactToArrowKeys);
var loginScreen:dealerLogin = new dealerLogin

[code]......

View 1 Replies

ActionScript 3.0 :: Can't Remove Leftover Children From Previous Frame

Nov 9, 2009

I have created a flash file to serve as an image gallery with several different chapters. Each individual chapter is represented by a different frame on the timeline. On each chapter/frame, there is a thumbnail gallery at the bottom of the screen. When you click on the thumbnail, I have loaders set up to load and display the full size image. Then I have a loaderX.addEventListener set up so that when you click on the loaded image, it disappears. The problem occurs when you leave a full-size picture open, and then you navigate to another frame. Then when you try and click on it, you can't remove it anymore.

Now, I can't remove the loader(s) when the next chapter button is clicked because unless the user has clicked on the thumbnail, the loader has not been added to the stage, so there won't be anything to remove. I tried adding the following 'if' statement into the function that navigates to the next frame,

'if(stage.NumChildren >0){stage.removeChildAt(0)}

but the problem with that is that then it just removes all the children and either doesn't advance to the next frame or is just removing all children on the next frame as well, so i end up with an empty stage.

I've been dealing with this problem for close to two weeks now, and I can't even find a bulky way around it, never mind finding a tight clean fix.

View 3 Replies

ActionScript 3.0 :: Multiple Children Spawned With Timer Makes Old Children Inactive?

Mar 24, 2009

In this game attached I need the old Children (rats) to hurt the character when he walks into them, however only the most recently added Child is active in that way... also the rats seem to appear above the character instead of below, is there any way to resolve these issues??

View 4 Replies

ActionScript 3.0 :: [CS4] Children Inside Children - 1119: Access Of Possibly Undefined Property NumChildren

Jan 12, 2011

I have a Sprite called pageContent. Inside pageContent are 12 more Sprites with unique names, a couple of Buttons, and some TextFields. Inside each of the 12 Sprites I have either one or two TextFields and one TextInput. My question is, since they are children inside a child of pageContent, how can I access them? Here is how I am trying to do it:

[Code]...

In my mind, this should totally work. But surprise, surprise, it doesn't. I have debugged it and it works fine for the first two lines, but when it tries to get numChildren of a Child of pageContent (line 3), I get this error: PHP Code: 1119: Access of possibly undefined property numChildren through a reference with static type flash.display:DisplayObject.

View 4 Replies

ActionScript 2.0 :: RollOver & RollOut In Children's Children's Movieclip?

Jan 11, 2010

I want to have a rollover effect of a movieclip (mo1) inside a movieclip (mo) of another movieclip (popup1).Is it possible to do that? I try calling it using this code in the frame 1 of my flash, am i doing wrongly?

Code:
popup1.mo.mo1.onRollOver = function() {
popup1.mo.mo1.gotoAndStop(2);

[code]......

View 9 Replies

Data Integration :: Pulling In Children Of Children In XML

Sep 23, 2006

Newbie to XML here and I have what I *hope* is an easy problem, but I just don't know the answer. And as I have to try and show this by Monday, I'm sort of stuck. I am trying to pull in information about houses via an xml file. Each house has 1 address, 1 owner, 1 description, and about 6 photos. I have no problem accessing the address, owner, etc, and I can always access the first photo, but whenever I cycle through the photos, I seem to cycle through the first photo for every house, not every photo for each house.

Basically, I need the children <images> to go up by one, without the the parent going up by 1. I am hoping I am describing this well. My code looks like this:

[Code]...

View 4 Replies

Flex - Access Children Of Children Recursively?

Mar 10, 2010

I have a Canvas which has many components inside it and those again, have many components inside them.

getChildren() returns only the top level children. What is the best way to retrieve all the children (children of children of children and so on).

Well, I sorta know how to do this by iterating through the children, but the code is really messy. I'd prefer to use a nice recursive function. Has anyone written this before? Or is there a Util class to do this?

View 3 Replies

Data Integration :: Pulling In Children Of Children In XML?

Jul 24, 2010

I am trying to pull in information about houses via an xmlfile. Each house has 1 address, 1 owner, 1 description, and about 6photos. I have no problem accessing the address, owner, etc, and Ican always access the first photo, but whenever I cycle through thephotos, I seem to cycle through the first photo for every house,not every photo for each house.Basically, I need the children <images> to go up byone, without the the parent going up by 1. I am hoping I amdescribing this well.My code looks like this:

total = xmlNode.childNodes.length;
totalb =
xmlNode.childNodes[0].childNodes[5].childNodes.length;

[code].....

View 1 Replies

Actionscript :: Add Children To Accordion Children In Flex 4?

Oct 28, 2011

I have an ArrayCollection that is read to generate containers in an accordion programmatically:

<s:ArrayCollection id="_ac_ps">
<fx:Object label="Block and lot" data="_blocklot" searchType="districtblocklot"
info="" />

[code].......

View 1 Replies

ActionScript 3.0 :: Accessing Children Of Children

Jan 11, 2011

for some reason STORAGE[0].getChildAt(0) works whereas liner.getChildAt(0).getChildAt(0) does not. STORAGE is a movieclip and a child of liner. the error is something about not being able to use getChildAt on a display object. what's wrong? is there any other approach i could use? PS: liner.getChildAt(0) works and does indeed seem to refer to STORAGE[0]

View 2 Replies

ActionScript 2.0 :: Make Movie Play Frame X To Frame Y Then Switch To Frame Z?

Nov 21, 2007

I have my flash on multiple scenes, and would like to play an animation when clicking on the navigation button before switching to a different scene.

I'm halfway to accomplishing this.

Here is what i used

Code:
_root.gotoAndPlay("changepage1");
_root.onEnterFrame=function(){
if(this._currentframe=="changepage2"){

[Code]....

The above code is on a blank keyframe. Changepage1 is the start of the animation and Changepage2 is the end of the animation.

Upon clicking the navigation button it plays the above scenes.

However it doesn't change scenes to scene "Home2".

View 1 Replies

ActionScript 3.0 :: Rewind To First Frame On Entering Certain Frame / Stopping In Frame?

Mar 4, 2009

What command do I enter for the movie to rewind to first frame on entering a certain frame / stopping in a frame?It's my first time using Flash, and I'm working on a double menu (second menu has a "close" button, where I want to get back to the first menu).

View 5 Replies

ActionScript 2.0 :: [F8] Play Frame 2 For A Duration Of 1 Frame Then Frame 3?

Jul 13, 2006

i have a movieclip on stage. it has 3 frames but is stopped with "stop():" so it only shows the first frame on mousedown i want it to play frame 2 for a duration of 1 frame then frame 3.

View 3 Replies

ActionScript 1/2 :: Set Frames To Play Frame 1, Frame 3, Frame 5

Mar 13, 2011

I hope I can ask this correctly. I'll paraphrase.
 
press_mc.onRelease = function(){
mover2_mc.play()};
 
This is a snippet of some code I'm working on. Currently I have a mc that you press that plays another mc. That mc that reacts has 5 frames, each frame with stop(); on each frame. I do a normal play code because it lets me play through and cycle back to frame 1 after frame 5 (so if I click the mc it eventually cycles back to the first frame and starts the process over again). If I do a nextframe it stops at frame 5, so that's why I use play.
 
press_mc click on it and it tells mover2_mc to advance a frame and recycles back to frame one to redo the process.Can I tell press_mc to play and skip a frame or to have it play a list of frames that I tell? I can't do a _currentframe +2 because it'll halt at frame 5.

View 6 Replies

IDE :: Adding Children To XML?

Jan 27, 2009

Well I have something like this:

<tests>
<test>1</test>
</tests>

[Code]....

Is there a way to make it add the child properly instead of botching the entry up like that?

Code:
var test:XML = new XML("<tests><test>1</test></tests>");
test.appendChild(new XML("<test>2</test>"));
trace(test);

View 1 Replies

Parents Won't Stop Having Children

Nov 10, 2009

ok, my Digital arts class is making a flash project, and im like the only one actually making a game, so im pretty much alone. i got a lot of help from the people on the AS3 forum, but im pretty sure that my question is too easy to put there. so, i have an array, and it basicly puts a spike on the screen at a random Y, and moves it across the screen, but, when i hit a spike, and ti goes to the you lose screen, the loop keeps adding children, and putting them on the screen, is it possible to just say stop adding children, and go to the next frame? i have a break, but when i stop colliding with the spike in the next frame, the spikes start coming again. also, can i totally reset the movie? cause when i just go to frame 1, the array plays itself ontop of itself and it gets twice as hard

View 2 Replies

AS3: Added Children Not Showing Up?

Nov 27, 2009

I'm getting a list of movieclips with attached scripts to display, but when I try to put them on the sceen nothing shows up.I can trace the elements in the list and it will tell me there are elements there.I can trace getChildAt(numChildren -1) and it will tell me there is something there but nothing is visible.If I generate the list in the constructor of the class that handles the displaying it does show them, but when I try to load them when they are actually needed they don't show up.Here's a simplification of the code(its a small part of a larger project and I can't put all of it up somewhere public)This code does what it should do(unfortunately that is not what I need done)

Code:

package foo.bar
{
import flash.display.MovieClip;
import flash.display.DisplayObjectContainer;

[code]...

The traces all show up so I know its running the method, the traces tell me it adds stuff the the screen, but what I see on the screen remains completely stagnant, as if nothing is being added.

View 2 Replies

ActionScript 3.0 :: Can't Remove The Children

Mar 12, 2010

adding all the bricks of another movie clip into an array in my controlling mc (GameScreen). Except, when I try to remove them from the display list by accessing them from their array, I get

Quote:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller at flash.display:isplayObjectContainer/removeChild()...and so on

I'm guessing it's something to do with adding another movie clip's children into an array in a movieclip that isn't the stored clips' direct parent, but it's parent's parent.

Code:
private function checkBrickHit():void{
for(var i:int=0;i<brickArray.length;i++){

[code]....

View 3 Replies

ActionScript 3.0 :: Get Children Of A Child?

Mar 9, 2011

I have a movieclip called "myClip" and I add a random child to myClip which is either "myChild1", "myChild2", or "myChild3" and inside of all of these is a child called "myLittleChild".

How would I call on the child "myLittleChild"?

View 2 Replies

ActionScript 3.0 :: HitTestObject On Children To Themselves?

Jan 9, 2012

I have children being added to the stage, and they all have the same name:

[Code].....

and then inside them I have them looking for a hit test of any movieclip with the name art_crab, but I keep getting a null response...

[Code]....

how i can make sure that they collide and i dont get this response?

View 7 Replies

ActionScript 3.0 :: Swap Children At Once?

Nov 6, 2008

I have 4 tab movieClips (Suppose 1_mc,2_mc, 3_mc, 4_mc).Not 1_mc is on top and covering some part of 2_mc, same as 2_mc is covering some part of 3_mc, and 3_mc is covering some part of 4_mc.Now whenever i clicked any tab Movieclip. it should come on top of all MovieClips.

in AS2 there was a method swapDepths(This.getNextHighestDepth()) and by that we can swap current movieclip by all other MovieClips.So is there any code in AS3 also, which can swap child at once with all the Movieclips? I checked from setChildIndex and swapChildren too but its taking more length of code and complexity too, to understand which movieclips has to be swaped now?

View 4 Replies

ActionScript 3.0 :: Add All Values From Xml.children()

Sep 1, 2010

I have an xml of numbers that I am using to power some dynamic bar charts..
 
I can easily pull out a string of all node values for variable area (SQMI)
 
trace(stsXml.Records.Record.SQMI.children());
 
the trace result looks like this
 
6729014724597803833449707411067084872157776104101113713121757
 
these values do not appear to be seperated but I am hoping they are (there should be 11 unique values here).
 
How can I sum the 11 values as extracted from my XML?

View 2 Replies

ActionScript 3.0 :: External SWF Children?

Sep 30, 2010

I am loading external swf in main swf using Loader. this external swf has an as class which extends sprite and adds images and sprite to that class sprite..now when i load this external swf in main swf i get external class sprite...But if i trace this sprite children then i get 0.

View 1 Replies

Actionscript 3 :: How To Update Children

Aug 15, 2010

For starters let me just say that I am very new to action script and also that I'm not using adobe creative suite, I am using notepad with flex as a compiler. I have two classes, a main class and a class called OBJECT_square.

Here is the MAIN class:

package
{
import flash.display.*; import mx.core.*;
import flash.events.*; import mx.collections.*;
import flash.geom.*; import mx.controls.*;

[code]...

Now my problem is this. Simply put I would like the square that OBJECT_square draws to move right when I press the right arrow key. Right now I can only get it to be drawn once (though I am actually creating two separate squares in two different spots). Now the thing I need to know is if I have used the keyboard event correctly in OBJECT_square. I used keyboard event in the main class as well to display the last key I pressed but I'm not sure how to use it in a class other than the main one. Also I'm not sure how to 'update' the square so that it is redrawn when it moves, that is remove its old self from the display list and reinsert its new self. The whole kinda point to the code is that the square be 'self-sufficient', ie contains all the code needed to draw it and move it rather than relying on any other class. I basically want it so that once another class has made a square the square is capable of doing everything else on its own.

View 1 Replies

Flash :: AS3 - Children Are Not Displayed?

Jun 19, 2011

I have a container symbol called BoxContainer. This can contain an unknown number of Radio Button components. To add these, I have an array of Radio Buttons called boxes.This is part of the CheckBoxes class.Here's my problem: When I add the radio buttons as children to the stage, from the frame itself, it works just fine. However, I need to add it to the BoxContainer movie clip. I have tried:

On the frame:
for(var i in Checkbox.boxes)
{[code]..........

However, both of these do not work. When I run the flash, the radio buttons are not visible. How can I fix this?

View 1 Replies

Put All Children Of A MovieClip Into An Array?

Jul 11, 2011

I have an movieClip Container and I want to move all its children into an Array.i think about the method I used to delete all children of a container by using while and removechild at 0, but I think it wont work in this situation.

View 2 Replies

AS3 :: Re-order The Children Of Container?

Jul 12, 2011

I have a little trouble in managing the children my container. The fact is that it has a lot of children and their y coordinates are very random.

Is there anyway i can order them by y coordinates that the lower will be in the front and the higher with be in the back?

is it something that that I can do with 2 "for"?

View 3 Replies







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