fscommand2 ("SetSoftKeys", "", "Exit"); fscommand2 ("FullScreen", true); Stage.scaleMode = "noScale"; Stage.align = "tl"; var nc:NetConnection; var ns:NetStream; var videoDisplay:Video; var timeInterval:Number; var videoContent:Array = [{path:"slsTour", name:"SLS Tour"}, {path:"slsLiveGlobal_1", name:"SLS Live"}]; var keyListener:Object = {}; var stageListener:Object = new Object(); var isFullScreen:Boolean; var videoPosition:Object; videoPosition = {x:videoDisplay._x, y:videoDisplay._y, width:videoDisplay._width, height:videoDisplay._height}; stageListener.onResize = function() { trace ("Stage size is now "+Stage.width+" x "+Stage.height+" px"); if (isFullScreen) { videoDisplay._x = 0; videoDisplay._y = 0; videoDisplay._width = Stage.width; videoDisplay._height = Stage.height; } }; Stage.addListener (stageListener); keyListener.onKeyDown = function():Void { if (Key.getCode () == ExtendedKey.SOFT2) { fscommand2 ("Quit"); return; } var index:Number = chr(Key.getCode()); if (!isNaN (index)) { if (index>=1 && index<=2) { index = index-1; playVideo (videoContent[index].path,videoContent[index].name); } else if (index == 3) { resizeVideo (); } } }; Key.addListener (keyListener); function resizeVideo() { if (isFullScreen) { videoDisplay._x = videoPosition.x; videoDisplay._y = videoPosition.y; videoDisplay._width = videoPosition.width; videoDisplay._height = videoPosition.height; } else { videoDisplay._x = 0; videoDisplay._y = 0; videoDisplay._width = Stage.width; videoDisplay._height = Stage.height; } isFullScreen = (!isFullScreen); } function playVideo(file:String, name:String):Void { if (!nc) { nc = new NetConnection(); trace ("Connected = "+nc.connect ("rtmp://virtualhost.server.com/strangelooplive", "user", "password")); } if (!ns) { ns = new NetStream(nc); } ns.play (file); videoDisplay.attachVideo(ns); if (timeInterval) { clearInterval (timeInterval); } timeInterval = setInterval (getTimeInfo, 300, ns, name, video_txt); } function getTimeInfo (ns:NetStream, nm:String, txt:TextField):Void { txt.text = "Playing: "+nm+" "+Math.round(ns.time)+" seconds"; }