topical media & game development

talk show tell print

#display-video.mx

#display-video.mx [swf] [flash] 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;
  

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" 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:HBox>
  </mx:Application>
  


(C) Æliens 04/09/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.