|
-
Senior Member
Need help with random loading movies
I am working on loading swfs dynamically but want them to load randomly everytime user visits site and also aut scale to the content being loaded into the main timeline..
What is the easiest way to do this? I am not very good at actionscripting..
Thanks
-
ReMember
Hi
I dont know if you load them into other MC's or just in level 1..
If you name your swf 0 1 2 3 4 ans so on its pretty easy..
make an empty mc, place it where you want the movie to load, pu tthis action on the clip..
onClipEvent(load){
movie_num=random(5)
loadMovie(movie_num+".swf",this)}
this will first define a random number between 0 and 5, next it loads the movie with that number.. "glueing" .swf at the end of it and loading it into the position of the movie cip.. this will only be done once, due to the onClipEvent(load) this action is only runned when the MC loads the first time...
if your movie has other names you have to make an array containing the names..
like
my_array=new Array("movie.swf","othermovie.swf")
and so on..
then on the clipevent use this instead
movie_num = random(5)
loadMovie(my_array[movie_num],this)
have fun
-
Senior Member
Thanks for the reply..
Ok what about auto sizing the swf(or pic)? I have vertical and horizontal pictures actually and want them to autosize in the movie clip that they load into..
how is this done?
-
Senior Member
I thought I had this working but its not... it doesn't do anything..
I have named my swf as 0,1,2,3,4.swf
but its just blank here is my code:
onClipEvent(load){
movie_num=random(4)
loadMovie(movie_num+".swf",this)}
I have put this on the empty movie clip is this correct??
thanks for the help
-
ReMember
Hmm I tried it to.. but cant get it to work with the onClipEvent either..
put if you go inside your empty clip and place this on your first frame..
Code:
movie_num = random(2);
movie_num = random(2);
loadMovie(movie_num+".swf", _root.loader_clip);
_root.loader_clip._height = 20;
_root.loader_clip._height = 20;
the _root.loader_clip is the instance name of the clip you load into, the _height is to scale it how you want.. you can allso use _xscale and _yscale
sorry I didn't test the code in advance.. nut I was so sure.. I still am... strange should do the same... well enough about me being an idiot this work I tested it...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|