Argumenterror Error #2025 Removechild
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack as3 error 1010 Overflow the company Business Learn more about hiring developers or posting ads with us
Argument Error 2025
Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community actionscript error 1010 of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ActionScript 3.0 Argument Error:2025 (Remove Child Problem) up vote 0 down vote favorite I am encountering actionscript error 2025 the following error message whenever I compile my project in Adobe Flash CS4: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/removeChild() at stageRotation/spawnParticle() at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick() the code that generates the error is shown below: for (var i:int = 0; i < particleArrayForward.length; i++ ) { if (particleArrayForward[i] != null) { trace("particleArrayForward[" + i + "]:" + particleArrayForward[i]); this.removeChild(particleArrayForward[i]); } } Any input appreciated.
As3 Error #1010 A Term Is Undefined And Has No Properties
Thanks. :) actionscript-3 removechild share|improve this question edited Aug 1 '11 at 20:55 scunliffe 39.2k1588136 asked Jul 27 '10 at 4:44 Smiley 69973053 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote accepted removeChild throws this error when the passed argument is not a child of the parent that called the method. Are particles added as child to another sub-container within this object? Make sure it is indeed a child of the caller: for (var i:int = 0; i < particleArrayForward.length; i++ ) { if (particleArrayForward[i] != null && particleArrayForward[i].parent == this) { trace("particleArrayForward[" + i + "]:" + particleArrayForward[i]); this.removeChild(particleArrayForward[i]); } } If the particles are not direct children of this object, you can remove them using: for (var i:int = 0; i < particleArrayForward.length; i++ ) { if (particleArrayForward[i] != null && particleArrayForward[i].parent != null) { trace("particle at " + i + " " + particleArrayForward[i]); trace("parent is " + particleArrayForward[i].parent); particleArrayForward[i].parent.removeChild(particleArrayForward[i]); } } share|improve this answer answered Jul 27 '10 at 7:00 Amarghosh 42.1k768103 thanks for this. it worked! –Smiley Jul 27 '10 at 7:22 add a comment| Did you find this question interesting? Try our newsletter Sign up for our newsletter and get our top new questions delivered to your inbox
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site type error #1010 in actionscript About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up I keep getting 'ArgumentError: http://stackoverflow.com/questions/3340804/actionscript-3-0-argument-error2025-remove-child-problem Error #2025: The supplied DisplayObject must be a child of the caller' inside timer event up vote 0 down vote favorite I'm trying to remove this item from the stage and keep getting this error. The code seems to work and the object is removed but the game seems kinda buggy. Here's the full error: "ArgumentError: Error #2025: The supplied DisplayObject must be a child http://stackoverflow.com/questions/30495506/i-keep-getting-argumenterror-error-2025-the-supplied-displayobject-must-be-a of the caller. at flash.display::DisplayObjectContainer/removeChild() at JumpingGame/onTick2()[E:\Folder\Folder\Folder\Folder\JumpingGame.as:95] at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick()" The error is pointing to: removeChild(enemy) removeChild(leg); removeChild(life); I'm also getting: "TypeError: Error #1009: Cannot access a property or method of a null object reference" on this line theLives.text = liveLives.toString(); Here's my code: package { import flash.display.MovieClip; import flash.utils.Timer; import flash.events.TimerEvent; public class JumpingGame extends MovieClip { public var army:Array; public var powerups:Array; public var pluslives:Array; public var newDoodle:doodle; public var enemyTimer:Timer; public var legTimer:Timer; public var lifeTimer:Timer; public function JumpingGame() { enemyTimer = new Timer( 40 ); enemyTimer.addEventListener( TimerEvent.TIMER, onTick ); enemyTimer.start(); legTimer = new Timer( 20 ); legTimer.addEventListener( TimerEvent.TIMER, onTick2 ); legTimer.start(); lifeTimer = new Timer( 30 ); lifeTimer.addEventListener( TimerEvent.TIMER, onTick3 ); lifeTimer.start(); army = new Array(); var newEnemy = new Enemy( 100, -15 ); army.push( newEnemy ); addChild( newEnemy ); powerups = new Array(); var newLeg = new Leg( 300, -15 ); powerups.push( newLeg ); addChild( newLeg ); pluslives = new Array(); var newLife = new Plus1( 300, -15 ); pluslives.push( newLife ); addChild( newLife ); newDoodle = new doodle(); addChild( newDoodle ); newDoodle.y = stage.stageHeight - 50; newDoodle.x = stage.stageWidth / 2; } public function onTick( timerEvent:Time