I have a custom video player that I want to call from time to time in my project.
When I call the clip from within a function the controller “breaks” (the buttons don’t recognize as buttons and the seekbar doesnt work at all.
If i call the clip from outside of the function everything works fine!
The below code is on the same frame of the main timeline. the button that launches is it buried in a few levels.
///This code works fine, controller and all
var vidBox:setNewBox=new setNewBox("video/Step_1.flv");
addChild(vidBox);
///This code the controller doesn't work at all. but the video plays fine.
function doVid(link:String){
var vidBox:setNewBox=new setNewBox(link);
addChild(vidBox);
}
this.tourContainer_mc.step1_mc.clip_mc.vid_btn.addEventListener (MouseEvent.CLICK, function(e:Event) { doVid("video/Step_1.flv"); });
Here is the setNewBox package.
package com.connatserdev{
//FLASH CLASS IMPORTS
import flash.display.MovieClip;
public class setNewBox extends MovieClip {
public function setNewBox(vidSource:String) {
var newBox:MovieClip = new MovieClip();
//adds Video Player into NewBox
var vidPlaya = newBox.addChild(new videoPlayer_mc());
vidPlaya.display.source = vidSource;
addChild(newBox);
//centers Newbox
newBox.x = 470;
newBox.y = 285;
///CloseBox
vidPlaya.close_btn.addEventListener ('mouseDown', function() {
//stops video playback
vidPlaya.display.stop();
removeChild(newBox);
});
}
}
}
I would appreciate any and all suggestions.
Thank you very much.