A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.

  1. #1
    Junior Member
    Join Date
    Jun 2008
    Posts
    3

    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.

    Hi all,

    I'm trying to modify a flex utility called photoNavigator. Basically all it does is that it loads a high res jpeg image and allows the user to magnify a portion of the image.

    what im trying to do is allow the user to load different images. Obviously i try and remove the previous instance of photoNavgator and add a new instance (which contains the new file location as well). This is the simple code:

    ********************************************
    public function init():void
    {
    photo1 = new PhotoNavigator('pic1.jpg');
    addChild (photo1);
    }

    public function button9Handler(event:MouseEvent)
    {
    removeChild(photo1); // removes the previous instance of PhotoNavigator - works
    photo2 = new PhotoNavigator('pic2.jpg');
    addChild(photo2);//trying to add a new instance of PhotoNavigator - doesnt work
    }

    *************************
    this is the error message i get.

    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display:isplayObjectContainer/removeChild()
    at org.flepstudio:hotoNavigator/setComplete()

    please help!!!

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You are mistaken somewhere. The error is from "removeChild", not "addChild". So your works and doesn't work comments don't make sense.

  3. #3
    Junior Member
    Join Date
    Jun 2008
    Posts
    3

    thanks for replying

    if i take out the addChild('photo2') statement - everything is as it should be. The privous instance of PhotoNavigator is removed from the stage. There is not a problem.

    but the moment i try to addChild('photo2') again - it doesnt work again. So if it is a problem of removeChild()- ....?

  4. #4
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Perhaps the logic is messed up somewhere else. The stack trace indicates that it is in a method inside PhotoNavigator called setComplete. There is a removeChild line in there that is throwing the error.

  5. #5
    Junior Member
    Join Date
    Jun 2008
    Posts
    3
    thanks buddy - There is a father.removeChild there.

    When i try to removeChild again its trying to remove something which isnt there...

    once again thank you

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