Copy link to clipboard
Copied
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at latest_fla::MainTimeline/action()
I get this error when i try to remove the instance of the ball after detecting collision over a wall.. i want the ball to disappear after it collides with the specific walls. i am new to AS and not ablt to sort out the problem. i am trying to make a game using AS3.0
Regards,
HoneyBadger
Now have one more problem. when navigating scenes,the keyboard and mouse control is present only in the scene 1. It is not functioning in the remaining scenes. How to sort out this issue ??
Most probably this is because there are no mouse and keyboard listeners in other scenes.
Copy link to clipboard
Copied
Go into your publish settings abd select the option to permit debugging. Your error message might then include a reference to the line of code that is causing the error. IT might help to place a trace before this line of code so that you can see if it is being called again after the removal has already taken place. Trace the object that is supposed to be removed to see if it exists.
Copy link to clipboard
Copied
thanks for the reply !!
yeah ! the object exists even after i remove it .. i am trying to fix it now.. i have used a void function associated with removeEventListener.. hope that wont be a problem.. trying to sort out if there is some mistake with the instances if the ball.. will check and get back...
Copy link to clipboard
Copied
Hello !
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at 27th_fla::MainTimeline/action()[may27_fla.MainTimeline::frame1:36]
I am not able to fix this.!
35 stage.removeEventListener(Event.ENTER_FRAME,rem1);
36 removeChild(myobjectMC);
rem1 is an empty function whih i have used just for the sake of a function to be associated with removeEventListener .!
Please help .! I am not able to sort of this issue.
Thanks in Advance,
HoneyBadger.
Copy link to clipboard
Copied
Removing object from display list doesn't constitute nullifying it. It still exists and you can add it back as a child. The error indicates that you attempt to remove a child that is not a child.
try:
if(this.contains(myobjectMC)) removeChild(myobjectMC);
Copy link to clipboard
Copied
Tried to trace and found that the instance of the object exists even after removing the child. Not able to resolve the issue . any suggestions ?
Now have one more problem. when navigating scenes,the keyboard and mouse control is present only in the scene 1. It is not functioning in the remaining scenes. How to sort out this issue ??
Honey Badger
Copy link to clipboard
Copied
Now have one more problem. when navigating scenes,the keyboard and mouse control is present only in the scene 1. It is not functioning in the remaining scenes. How to sort out this issue ??
Most probably this is because there are no mouse and keyboard listeners in other scenes.
Copy link to clipboard
Copied
Thanks Andrei1 for the reply.
Now I get the same kind of error but for the hittest. what does the error below mean. hit test object must be not null. does it mean that my object does not exist ?
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at tryagain_fla::MainTimeline/action()
And i realised that the event listeners fir keyboard and mouse are missing in the other scenes which cause the problem. How to include the listeners.?
Should i just add the listener event and the function to the scene ? Since this is my very first project in AS3 i am not able to get things right.!
Thanks and Regards,
HoneyBadger.
Copy link to clipboard
Copied
Thanks A Lot Andrei1 !!
It worked. TO deflect object from the obstacle i use the predefined hitTestObject. Is there any options to implement an optimised collision within objects.??
Regards,
HoneyBadger.
Copy link to clipboard
Copied
You are welcome. I am not sure what you would like to optimize though.
Copy link to clipboard
Copied
Hi All,
The wierdest thing which suprised me was that, the keyboard controls worked perfectly when i saved the file as CS3. But the controls are blocked in CS4. Have no idea why this is happening .!?
Honey badger
Copy link to clipboard
Copied
Hi All
I implemented Grant Skinner's Collision in my Ball game to reflect my ball with the obstacles.I just changed the directions of the ball after detecting collision.
if(detect_collision != null){
Ball.xDir *= -1;
}
Is there a better way to do that.And there is some problem is collision which i am working on.~! there's no error but at times. TUNELLING occurs and the ball passes through the obstacle.
Any Suggestions ??
Regards,
Honey Badger
Copy link to clipboard
Copied
It is hard to tell without seeing code.