Groups | Blog | Home
all groups > macromedia flash sitedesign > february 2004 >

macromedia flash sitedesign : Linking to an external JPG


Sylvain Provencher
2/21/2004 4:01:04 PM
Ok, not sure if this is even possible. I would like to have my main movie
load a different background image each time a visitor comes back to the
site.

1. Can I link the movie to an external random image (10 different
backgrounds)?

2. Or do they all need to be embedded in my movie?

3. Or should I create different movies with different backgrounds that would
load randomly?

Hope I'm making sense...

Sly
Sylvain Provencher
2/21/2004 5:59:49 PM
Hey cool - this is exactly what I was looking for :-)

Many thanks, mate

Sly



On 02/21/04 16:41, in article c18ts4$9hj$1@forums.macromedia.com, "abeall"
[quoted text, click to view]
abeall
2/22/2004 12:41:40 AM
Sure!

This is pretty simple(and pretty popular) so I'm sure there are a host of
tutorials/samples you could learn from. Try www.flashkit.com , www.kirupa.com ,
www.actionscript.org , and of course www.google.com

To load an external .jpg, you use the actionscript command:
loadMovie("full path and name of movie","target MovieClip for it to load into)
or
loadMovieNum("full path and name of movie",1) //where 1 is a 'level' which is
like a layer for external movies; your'e main movie is always level 0, so this
wouldnt work for background

So let's say you had 10 .jpg files, all already sized to fit your flash doc
perfectly, and all named "back"+number, ex "back1" , "back2"

You could use this on frame 1 of your movie:
n=random(10)+1;//+1 because random creates a number from 0 to the number in ()
- 1, in this case 0-9.
blank_mc.loadMovie("back"+n)

then just create a blank movie clip, position it at (0,0), put on a background
layer, and give it an instance name(in propery panel) of "blank_mc"

HTH
abeall
2/22/2004 1:16:12 PM
no problem.

let me know if you run intol any problems getting it to work.

AddThis Social Bookmark Button