解决了我自己。我应该引用my_loader而不是my_player
我有一个愚蠢的东西。
我用Flash创建了某种“网站”,每页使用1帧。在第3帧,我使用此代码
创建了一个YouTube视频播放器Security.allowDomain("www.youtube.com");
var my_player:Object;
var my_loader:Loader = new Loader();
my_loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
my_loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);
function onLoaderInit(e:Event):void{
addChild(my_loader);
my_player = my_loader.content;
my_player.addEventListener("onReady", onPlayerReady);
}
function onPlayerReady(e:Event):void{
my_player.setSize(640,360);
my_player.x = 370;
my_player.y = 200;
my_player.loadVideoById("44LnsBZ3OTc",0);
}
play_btn.addEventListener(MouseEvent.CLICK, playVid);
function playVid(e:MouseEvent):void {
my_player.playVideo();
}
pause_btn.addEventListener(MouseEvent.CLICK, pauseVid);
function pauseVid(e:MouseEvent):void {
my_player.pauseVideo();
}
问题是:切换帧时(GotoAndPlay(#),它会改变帧,但my_player帧仍然保留。无论我尝试过什么。
任何解决方案?
FLA档案:https://www.dropbox.com/s/alouv7nxinnbjkp/EindopdrachtPortfolio.fla