The Little Guy Posted November 29, 2010 Share Posted November 29, 2010 I have a flash player that when loaded works in my browser on my local machine (file:///C:/Flash/player.swf) but when I upload it to my web server, it stops working. I am using the YouTube ActionScript API I can get the video. and show it in my player and all, its jut that my custom play/stop buttons don't display/work on my web server. This is very confusing, why would this be happening? I am appending a unique query string to the end of the file: /incl/flash/player.swf?md5=<?php echo md5(time()); ?> That should be requiring it to not cache. I am using swfobject to embed it, but that shouldn't matter because if you view just the swf file it still doesn't work. ActionScript: package{ import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; import flash.system.Security; import flash.display.Loader; import flash.net.URLRequest; public class Main extends Sprite{ Security.allowDomain("www.youtube.com"); public var player:Object; public var vidid:String = 'CUBrA_cD_Io'; public var loader:Loader = new Loader(); public var playBtn:Play = new Play(); public var pauseBtn:Pause = new Pause(); public function Main(){ loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit); loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3")); } function onLoaderInit(event:Event):void { addChild(loader); loader.content.addEventListener("onReady", onPlayerReady); loader.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); playBtn.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); pauseBtn.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); loader.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut); loader.addEventListener(MouseEvent.CLICK, onClick); playBtn.addEventListener(MouseEvent.CLICK, onClick); pauseBtn.addEventListener(MouseEvent.CLICK, onClick); /*loader.content.addEventListener("onError", onPlayerError); loader.content.addEventListener("onStateChange", onPlayerStateChange); loader.content.addEventListener("onPlaybackQualityChange", onVideoPlaybackQualityChange);*/ } function onPlayerReady(e:Event):void { player = loader.content; player.setSize(stage.stageWidth, stage.stageHeight); //vidid = stage.loaderInfo.parameters["id"]; player.cueVideoById(vidid, 0); } function onMouseOver(e:MouseEvent){ addPP(); } function addPP(){ if(player.getPlayerState()==1){ pauseBtn.x = (stage.stageWidth - pauseBtn.width) / 2; pauseBtn.y = (stage.stageHeight - pauseBtn.height) / 2; addChild(pauseBtn); } if(player.getPlayerState()==2){ playBtn.x = (stage.stageWidth - playBtn.width) / 2; playBtn.y = (stage.stageHeight - playBtn.height) / 2; addChild(playBtn); } } function onMouseOut(e:MouseEvent){ removePP(); } function removePP(){ try{ removeChild(pauseBtn); }catch(ev){} try{ removeChild(playBtn); }catch(ev){} } function onClick(e:MouseEvent){ if(player.getPlayerState()==1){ player.pauseVideo(); }else if(player.getPlayerState()==2){ player.playVideo(); } removePP(); addPP(); } } } Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted November 30, 2010 Author Share Posted November 30, 2010 I figured it out: http://actionscript.org/forums/showthread.php3?t=250992 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.