Quick Flash MX question

Hi,

I am trying to load a random jpg into a flash movie…I do not want it to be the background, so the (loading a random background tutorial did not help…I am sure it held alot of the concepts that I need to know)

I am new to flash and am not good at actionscript…

I realize that I need to create x number of swf files for the load…

but I do not know how to tell it where to load it…place it

( x 15.1 y 0 )

if you can help me I would highly appreciate it

thanks

Casey


_root.createemptymovieclip("empty");
empty._x=15;
empty._y=0;
empty.loadMovie("mymovie.jpg");

hope it helps.

How do I load this image so that it chooses a random swf?

thanks thus far, you replied super fast, I appreciate it

Casey

Well… a few ways, I guess.

What are your swf’s called?

How many are there?

You could load your swf names into an array, and choose a random number from the array…


myarray=["first.swf","second.swf","third.swf"];

picker=math.floor(math.random()*((2)+1));//pick zero, one, or two

mymovie.loadmovie(myarray[picker]);//pick an item from array

so, combine both posts, and you should have what you want. Let me know if you have questions.

First off your the man!

I have 6 swf’s

they are called

random1.swf
random2.swf
ect…

I was wondering if I had to make these into swf’s or could just leave them as jpg’s?

they are loading into in 200px x 200px portion in the middle of the movie.

Oh yeah…you are the man

Casey

Yes… Montoya is the man :slight_smile:

in MX, they can be jpg or swf’s. It doesnt matter.

Nah… Im a rookie! But, thanks! Always glad to help!

Modest too :stuck_out_tongue:

I have 8 jpgs

random1.jpg - random8.jpg


_root.createemptymovieclip("empty");
empty._x=15;
empty._y=0;

myarray=["random1.jpg","random2.jpg","random3.jpg","random4.jpg","random5.jpg","random6.jpg","random8.jpg"];

****this is where I get confused*********

picker=math.floor(math.random()*((2)+1));//pick zero, one, or two

mymovie.loadmovie(myarray[picker]);//pick an item from array



also does it matter where I place these jpg’s, or do they have to be imported into the library?

If anyone could help I would appreciate, thanks

Case

Try this:


picker = math.floor(math.random()*(4));// add 1 digit whenever u got more files

Hope it helps!

yours,
h88

Do I need to load the jpgs in the library…

Case

Ok guys

here’s what i got


_root.createemptymovieclip("empty");
empty._x=133;
empty._y=0;
myarray=["random1.jpg","random2.jpg","random3.jpg","random4.jpg","random5.jpg","random6.jpg","random8.jpg"];
picker = math.floor(math.random()*(4));// add 1 digit whenever u got more files
mymovie.loadmovie(myarray[picker]);//pick an item from array

when I insert this EXACTLY into my movie nothing happens…
I don’t know what I am doing wrong but could definitly use some help…

Thanks so much already guys,

Casey

p.s. I know the x,y values are different…but they are correct…fyi…to clear up any confusion

_root.createEmptyMovieClip("empty", 1);
empty._x = 133;
empty._y = 0;
myarray = ["random1.jpg", "random2.jpg", "random3.jpg", "random4.jpg", "random5.jpg", "random6.jpg", "random7.jpg"];
picker = Math.floor(Math.random()*(7));
// add 1 digit whenever u got more files
empty.loadMovie(myarray[picker]);
//pick an item from array

Still to know avail will this load the images into the movie…I tried converting the jpg’s into swf’s and trying that way as well…

…and still I am speechless

do I need to import them into my libarary under those specific names? or just have them in the same directory as my movie?

any how if anyone can see what the problem is I am dying to figure it out

h88 Thanks so far for the help…

Casey

hi h88,
this code works greate with me, but when i want to use it in onPress function it didn’t work… :frowning:


_root.createEmptyMovieClip("holder", 1);
holder._x = 50;
holder._y = 50;
myArray = ["1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg"];
picker = Math.floor(Math.random()*(5));
_root.my_mc.onPress = function() {
	_root.holder.loadMovie(myArray[picker]);
};

itried to but onPress in looping function (onEnterFrame) but the same …
can i do it with onPress… :q:

thanx C:-)

I want this to load into movie on frame 25

Maybe this will help, but currently I am just pasting the above code into the action script?

Thanks

Casey

so what is your Prob.?
put the code in frame 25 … :slight_smile:

I do put the code in 25th frame, I have the listed jpgs in the same directory and loaded in the libarary…but it still pulls up nothing

Casey

nothing nothing…
or load one jpg, just one…
try the code i used it’s working with me. :slight_smile:
but if you load one jpg … it’s work too but it’ll change to another one when reach frame 25 for second time…

i think you need it change all time not in specific frame… RIGHT?
i hope you fix your Prob.

C:-)

Huh, i always test something when i post here, check the attached zip, and don’t forget to unzip all the files in the same directory!

yours,
h88