Randomly Load External VDO w/o Repeat the Same File while Playing


hey! have done programming flash file. but, i'm tired of making not repeat vdo file playing.

i hope guys have solution me. *()*

this source code

 

 

////////////to load vdo/////////////// import flash.net.netstream; import flash.net.netconnection; import flash.media.video;   var video; var nc; var ns;   nc = new netconnection(); nc.connect(null); ns = new netstream(nc); ns.client = this; video = new video(550,400); addchild(video); video.attachnetstream(ns);   ///////////////////////////   /////////////array vdo files///////////// var vdostore:array = new array("westler.flv","tomandjerry.flv","getthere.flv");   ///////////////////////////   /////////////keyboard , screen show//////////////// import flash.events.keyboardevent; import flash.events.event;   stage.addeventlistener(keyboardevent.key_down,ondown); stage.addeventlistener(keyboardevent.key_up,onup);       function ondown(e:keyboardevent):void{ var selectedvid = vdostore[math.floor(math.random() * vdostore.length)]; //var dontrepeat:array = new array(); << tried create array keep file played    if (e.keycode==49)  {   ns.play(selectedvid);   stage.removeeventlistener(keyboardevent.key_down,ondown);   //onup(null);   }  if (e.keycode==69)  {   ns.play(selectedvid);    stage.removeeventlistener(keyboardevent.key_down,ondown);   //onup(null);   }  } function onup(e:keyboardevent):void {  if(e.keycode==49)  {   stage.addeventlistener(keyboardevent.key_down,ondown);  }  if(e.keycode==69)  {   stage.addeventlistener(keyboardevent.key_down,ondown);  }   }  

 

 

and thst code have removed things have experimented out. code working shown above.

i don't need them played before start new random. that, shouldn't play same vdo playing @ moment when click button after.

 

fyi,i add more vdos, 20, , more keyboard buttons click same numbers.

 

anyone? **pleaseeeeeeee >///<

one way remove played video array when played cannot licked again.

 

another way, since don't mind repeat later on, store index of selected video when played in variable compare selected index.  if selection matches variable run selection processing again until pick video.  easier have separate function selection.



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Thread: Can not create raid array: mdadm: no raid-devices specified.

Thread: HOW TO: Package and theme GTK+ / Gtkmm apps in Linux for Windows

Thread: Twinview issues