This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash Site Design > February 2004 > Linking to an external JPG





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Linking to an external JPG
Sylvain Provencher

2004-02-21, 8:28 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

abeall

2004-02-21, 9:28 pm

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

Sylvain Provencher

2004-02-21, 10:28 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"
<webforumsuser@macromedia.com> wrote:

> 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

2004-02-22, 9:28 am

no problem.

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

cheers!
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews