topical media & game development
#display-fullscreen.mx
#display-fullscreen.mx
[swf]
flex
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
paddingLeft="0" paddingTop="0" paddingBottom="0" paddingRight="0"
layout="absolute">
<mx:Script>
<![CDATA[
import flash.events.MouseEvent;
import flash.display.StageDisplayState;
import mx.managers.SystemManager;
handler(s)
private function toggle():void {
try {
switch (systemManager.stage.displayState) {
case StageDisplayState.FULL_SCREEN:
systemManager.stage.displayState = StageDisplayState.NORMAL;
break;
default: systemManager.stage.displayState = StageDisplayState.FULL_SCREEN;
break;
}
} catch (err:SecurityError) {
// ignore
}
}
video(s)
[Bindable]
private var index:uint = 0;
private var max:uint = 4;
public var video:Array = [
"../assets/clips/blip/rgbxyz.flv",
"../assets/clips/shout/strangest.flv",
"../assets/clips/tube/baby-laugh.flv",
"../assets/clips/tube/strings.flv"
];
[Bindable]
public var source:String = video[index];
click
private function click ( event:MouseEvent ):void
{
index += 1; if (index > (max-1)) index = 0;
myVid.stop();
source = video[index]; // bindable
myVid.play();
}
]]>
</mx:Script>
display
<mx:VideoDisplay id="myVid" source="{source}" height="100%" width="100%" autoPlay="false"/>
<mx:Label text="{index}" color="white" top="10" right="20"/>
controls
<mx:HBox left="20" bottom="10">
<mx:Button color="white" right="20" borderColor="0" fillAlphas="[0, 0]" label="!" click="click(event);"/>
</mx:HBox>
<mx:HBox right="20" bottom="10">
<mx:Button color="gray" borderColor="0" fillAlphas="[0, 0]" label=">" click="myVid.play();"/>
<mx:Button color="gray" borderColor="0" fillAlphas="[0, 0]" label="||" click="myVid.pause();"/>
<mx:Button color="gray" borderColor="0" fillAlphas="[0, 0]" label="_" click="myVid.stop();"/>
<mx:Button color="gray" borderColor="0" fillAlphas="[0, 0]" label="full" click="toggle();"/>
</mx:HBox>
</mx:Application>
(C) Æliens
27/08/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.