Skip to main content
Inspiring
August 13, 2009
Question

The supplied DisplayObject must be a child of the caller.

  • August 13, 2009
  • 1 reply
  • 5184 views

All,

I have a flash video that is basically a slide show from frame to frame using actionscript. Except on one of the frames I have inserted a .flv.

The problem is once I get past the frame with the .flv, when I navigate backwards from any frame, I get this error.

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    at DarylSpeakerSeries_fla::MainTimeline/NextSpecial()
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    at DarylSpeakerSeries_fla::MainTimeline/PreviousSpecial()

stop()

import fl.video.FLVPlayback;
import flash.ui.Keyboard;
import flash.events.KeyboardEvent;

var vid1:FLVPlayback = new FLVPlayback();

vid1.source = "flvs/PriorityMatrixFinal.flv";
addChild(vid1);

vid1.width = 650;
vid1.height = 433;

vid1.x = 70;
vid1.y = 70;

stage.addEventListener(KeyboardEvent.KEY_DOWN, NextSpecial);
Next_btn.addEventListener(MouseEvent.CLICK, NextSpecial);

Previous_btn.addEventListener(MouseEvent.CLICK, PreviousSpecial);


function NextSpecial(event)
{

     vid1.stop();
    removeChild(vid1);
    gotoAndPlay("after_priority_vid");
   
   
   
}


function PreviousSpecial(event)
{
   
        vid1.stop();
        removeChild(vid1);
        gotoAndPlay("before_Priority_vid");

}

Thanks in advance,

Anthony

This topic has been closed for replies.

1 reply

Inspiring
August 13, 2009

Just do this instead:

if(contains(vid1)){

removeChild(vid1);

}

Inspiring
August 13, 2009

This got rid of the error.  However, I still have the problem of clicking my previous button and it will only go one frame back.  Every frame before the frame containing the flvplayback works just fine.  But once I reach that frame I can only go back one frame.  If it is any help, the next button doesnt work either once I pass the frame with the flvplayback but the key_down will move it to the next frame.

Thanks in advance,

Anthony

Inspiring
August 13, 2009

did you do this:

function PreviousSpecial(event)
{
    if(contains(vid1)){
        vid1.stop();
        removeChild(vid1);

    }
        gotoAndPlay("before_Priority_vid");//still need that no matter what

}