topical media & game development

talk show tell print

#display-cuepoint.mx

#display-cuepoint.mx [swf] flex


  <?xml version="1.0"?>
  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  xmlns:ae="*" 
  paddingLeft="0" paddingTop="0" paddingBottom="0" paddingRight="0"
  layout="absolute">
  

handler(s)


  <ae:component_screen id="display"/>
  

script


  <mx:Script>
  <![CDATA[
     import mx.events.CuePointEvent;
     import mx.controls.videoClasses.CuePointManager;
     [Bindable] public var movie:String = "../assets/clips/tube/china/calligraphy.flv";
     [Bindable] private var state:uint = 0;
  
     [Bindable] private var cuepoints:Array = [
         {name:'cue 0', time:0.00},
         {name:'cue 1', time:2.60},
         {name:'cue 2', time:3.75},
         {name:'cue 3', time:5.75}
         ];
     [Bindable] private var info:String = "";
     private function click(video:Object):void {
     if (state < 4) info = cuepoints[state].name;
     if (state == 0) { story.text = "..."; }
     else if (state == 1) { story.text = "... once upon a time"; }
     else if (state == 2) { story.text = "there was a ..."; }
     else if (state == 3) { story.text = ""; }
     else { story.text = ""; info=""; state = 0; }
     state += 1;
     }
  
  ]]>
  </mx:Script>
  

display


  <mx:VideoDisplay id="myVid" source="{movie}" height="100%" width="100%" autoPlay="false"
  cuePointManagerClass="mx.controls.videoClasses.CuePointManager"
  cuePoints="{cuepoints}"
  cuePoint="click(event)"
  />
  <mx:Label text="{movie} / {state}" color="white" top="10" right="20"/>
  <mx:Label id="story" text="" color="white" top="75" left="100" fontSize="40"/>
  <mx:Label text="{myVid.playheadTime} / {info}" color="white" top="10" left="20"/>
  

controls


  <mx:HBox left="20" bottom="10">
  <mx:Button color="white" borderColor="0" fillAlphas="[0.0, 0.0]" label="!" click="click(myVid);"/>
  </mx:HBox>
  <mx:HBox right="20" bottom="10">
  <mx:Button color="gray" borderColor="0" fillAlphas="[0.0, 0.0]" label=">" click="myVid.play();"/>
  <mx:Button color="gray" borderColor="0" fillAlphas="[0.0, 0.0]" label="||" click="myVid.pause();"/>
  <mx:Button color="gray" borderColor="0" fillAlphas="[0.0, 0.0]" label="_" click="myVid.stop();"/>
  <mx:Button color="gray" borderColor="0" fillAlphas="[0.0, 0.0]" label="full" click="display.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.