Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flash Streaming video - rotatation of .FLV

Status
Not open for further replies.

bitdaf

IS-IT--Management
Feb 23, 2003
37
0
0
US
HI,

I'm new to Flash and using Flash 8 Pro.

The Video Import Component is great - I was able to set up a .swf file that pulls a .flv and streams the Flash movie.

What I would like to do, if possible, would be to pull a random .flv from a directory in the same manner. So that when the .swf loads instead of specifically going for a particular .flv I would like for it to randomly grab from a director of .flv files. So that with each page refresh a different video would stream.

Anyone know if this is possible within Flash? I would rather not use a rotation script if I don't have to.

Thanks!
Bitdaf
 
just add the flvs into an array

theFLvs =["1.flv",two.flv", ]

generate a random number from 0 to array length and load that flv
 
Hi Bill,

Thank you very much for the response. :)

I'm afraid it went way over my head - I'm very new to Flash and wouldn't have the first clue as to "how/where" to create an array unfortunately.

Could I impose on you to eleborate or maybe you know a link to an article or tutorial?

Thanks so much!
Bitdaf
 
main timeline frame 1

myFlvs_array:Array = new Array("bill.flv", "6.flv", "next.flv", "prev.flv", "Thursday.flv");

//just fill in the names of your flv's

//select an flv at random

flvToLoad = random(myFlvs_array.length)

my_video.attachVideo(myFlvs_array[flvToLoad]);
//where my_video is your video object
// start the stream
my_video.play(myFlvs_array[flvToLoad]);

//you will have more to add (you probably already have it) to do with your video object....but thats basically it
 
Thank you Bill! I'm going to have a go at it. :)

Bitdaf
 
Hi Bill,

I'm afraid I'm getting a syntax error here:

myFlvs_array:Array = new Array("bill.flv", "6.flv", "next.flv", "prev.flv", "Thursday.flv");

Even when I fill in my .flvs

Also - will this work wiht the import video method component?

Thanks
Bitdaf
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top