Ultrashock Forums > Flash > ActionScript
random background when loading website

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
random background when loading website
Old 2003-05-12

Hi there,

I'm new to Actionscript and was hoping somone could assist me with creating a random picture loader for my background, so that when you enter the website the picture in the background is different every time you enter.

Thanks for any help!
postbit arrow 4 comments | 506 views postbit arrow Reply: with Quote   
Registered User
melb06 is offline
seperator
Posts: 9
2003-05-12
seperator

Ultrashock Member Comments:
PEDALSPEED PEDALSPEED is offline PEDALSPEED lives in United States 2003-05-12 #2 Old  
Create an mc called MyMC. You will load your background into this instance.
Then, create four or so jpgs called mymovie1.jpg, mymovie2.jpg, etc.

Code:
myExtension = random(5)
trace(myExtension)
loadMovie ("myMovie" add myExtension add ".jpg", "myMc");
Reply With Quote  
melb06 melb06 is offline 2003-05-12 #3 Old  
thanks for the quick reply, does the code go within the movie clip or on a controller on stage. the output works randomising the number of the image, however it's not loading it.

I'm not sure whether this would be due to me having gifs and different names....but I've changed everything to show the below"

myExtension = random(7)
trace(myExtension)
loadMovie ("REFLECTIONS_MAIN0" add myExtension add ".gif", "myMc");
Reply With Quote  
PEDALSPEED PEDALSPEED is offline PEDALSPEED lives in United States 2003-05-13 #4 Old  
Flash does not support gifs. Only Non-progressive jpgs.

To support gifs, the player would require a decompressor which would increase the player's download time.
Reply With Quote  
melb06 melb06 is offline 2003-05-13 #5 Old  
thanks for that, I'll change all my images to jpegs.

I did work out a way of loading them at random, but it seems to be very slow and this must be the reason why.
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: