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
The supplied DisplayObject must be a...Just do this instead:
if(contains(vid1)){
removeChild(vid1);
}
The supplied DisplayObject must be a...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
did you do this:
function PreviousSpecial(event)
{
?if(contains(vid1)){
?vid1.stop();
?removeChild(vid1);
?}
?gotoAndPlay(''before_Priority_vid'');//still need that no matter what
}
Yes, I did that.?It will let me go back one frame.?But that's it.?I can go two forward and only one back.?Or three forward and only one back.?Not multiple backs.
Thanks in advance,
Anthony
the problem is in your listener:
Previous_btn.addEventListener(MouseEvent.CLICK, PreviousSpecial);
Since you have this this will always send the timeline to where the PreviousSpecial points to. If you already have another listener doing the previous and next just remove those here. If you don't then remove those and add back the one you used before:
function NextSpecial(event)
{
vid1.stop();
?removeChild(vid1);
?gotoAndPlay(''after_priority_vid'');
stage.removeEventListener(KeyboardEvent.KEY_DOWN, NextSpecial);
Next_btn.removeEventListener(MouseEvent.CLICK, NextSpecial);
Previous_btn.removeEventListener(MouseEvent.CLICK, PreviousSpecial);
//add back the normal listener if need be
?
}
function PreviousSpecial(event)
{
?
?vid1.stop();
?removeChild(vid1);
?gotoAndPlay(''before_Priority_vid'');
stage.removeEventListener(KeyboardEvent.KEY_DOWN, NextSpecial);
Next_btn.removeEventListener(MouseEvent.CLICK, NextSpecial);
Previous_btn.removeEventListener(MouseEvent.CLICK, PreviousSpecial);
//add back the normal listener if need be
}
Works like a charm on the button click.?It won't remove the flvplayback using the key_down event listener.?It goes to the next frame but the video remains on the stage.
Also, I have this code on every other frame that does not have a flvplayback on it.
stop();
import flash.ui.Keyboard;
import flash.events.KeyboardEvent;
stage.addEventListener(KeyboardEvent.KEY_DOWN, Next);
Next_btn.addEventListener(MouseEvent.CLICK, Next);
Previous_btn.addEventListener(MouseEvent.CLICK, Previous);
And my first frame has this additional code in it.
function Next(event)
{
?nextFrame();
?stage.removeEventListener(KeyboardEvent.KEY_DOWN, Next);
?Next_btn.removeEventListener(MouseEvent.CLICK, Next);
?Previous_btn.removeEventListener(MouseEvent.CLICK, Previous);
?
}
function Previous (event)
{
?prevFrame();
?stage.removeEventListener(KeyboardEvent.KEY_DOWN, Next);
?Next_btn.removeEventListener(MouseEvent.CLICK, Next);
?Previous_btn.removeEventListener(MouseEvent.CLICK, Previous);
}
Thanks so much.
Anthony
No comments:
Post a Comment