A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Argument Error 2025

  1. #1
    Member
    Join Date
    Jan 2010
    Posts
    37

    Unhappy Argument Error 2025

    I have two buttons . When I click the wheelon button it adds certain objects to the stage. When I click the wheeloff button it clears the objects from the stage. Everything works fine the first time through however, if after clicking the wheelon button a 2nd time to add the objects back on the stage, if I then click the wheeloff button to remove them I get the following error message. Does anybody have an idea why it works the first time through but not on subsequent tries? Please help. Thank you


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


    wheelon_btn.addEventListener(MouseEvent.CLICK, spinButton);
    function spinButton(e:MouseEvent):void
    {

    stage.addChild(wheels)
    wheels.x=400
    wheels.y=350

    stage.addChild(flapholder)
    flapholder.x=400
    flapholder.y=-30

    stage.addChild(wheelflap)
    wheelflap.x=400
    wheelflap.y=30

    stage.addChild(wheelflap2)
    wheelflap2.x=400
    wheelflap2.y=30

    stage.addChild(handy)
    handy.x=700
    handy.y=300
    handy.height = 200
    handy.width = 200
    handy.alpha=1
    }

    wheeloff_btn.addEventListener(MouseEvent.CLICK, nowheel);
    function nowheel(e:MouseEvent):void
    {
    stage.removeChild(wheels)
    stage.removeChild(wheelflap)
    stage.removeChild(wheelflap2)
    stage.removeChild(flapholder)
    stage.removeChild(handy)

    Answer_btn.x=692
    wheelon_btn.x=704
    wheeloff_btn.x=1500



    }

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    You should be trying to do it more like so

    PHP Code:
    var w:wheels = new wheels();
    function 
    spinButton(e:MouseEvent):void
    {
        
        
    stage.addChild(w);
        
    w.400;
        
    w.350;

    function 
    nowheel(e:MouseEvent):void
    {
        
    stage.removeChild(w); 

  3. #3
    Member
    Join Date
    Jan 2010
    Posts
    37
    that didn't make a difference. still getting the infamous Error 2025 each time after the first time I use the nowheel button.

    rgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display:isplayObjectContainer/removeChild()
    at MethodInfo-148()

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Put your fla up here to look at, or make a sample copy.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center