• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Game Design - Argument Error !! Related with removeChild()

New Here ,
May 25, 2010 May 25, 2010

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

TOPICS
ActionScript

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 04, 2010 Jun 04, 2010

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.

Votes

Translate

Translate
LEGEND ,
May 25, 2010 May 25, 2010

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 25, 2010 May 25, 2010

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...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 26, 2010 May 26, 2010

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 04, 2010 Jun 04, 2010

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);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 03, 2010 Jun 03, 2010

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 04, 2010 Jun 04, 2010

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 07, 2010 Jun 07, 2010

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 09, 2010 Jun 09, 2010

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 10, 2010 Jun 10, 2010

Copy link to clipboard

Copied

You are welcome. I am not sure what you would like to optimize though.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 03, 2010 Jun 03, 2010

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 11, 2010 Jun 11, 2010

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 11, 2010 Jun 11, 2010

Copy link to clipboard

Copied

LATEST

It is hard to tell without seeing code.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines