all groups > flash actionscript > january 2007 >
You're in the

flash actionscript

group:

loading images externally and ramdomly


loading images externally and ramdomly hutch-diggens
1/17/2007 5:27:55 PM
flash actionscript:
I'm having some difficulties here. I have two swf's, one controls the
other---not the problem. On the one swf there are buttons and the other are
images, you rollover a btn a different image pops up...you get the point. Now,
on the swf with the images--I am trying to have the images load exteranlly, but
also randomly. Is this possible?

Any suggestions would be greatly appreciated.
thanks,
hutch
Re: loading images externally and ramdomly .:}x-=V!P=-x{:.
1/17/2007 5:36:03 PM
Yes possible, put the images in a folder then the names in a XML. Have flash
load the XML and put the names into an array and then generate a random number
to access the array and then load the random image

Re: loading images externally and ramdomly hutch-diggens
1/17/2007 6:36:41 PM
Could you by chance give me an example. I'm not to great with the whole XML thing.
again, it's so much appreciated.
Re: loading images externally and ramdomly .:}x-=V!P=-x{:.
1/17/2007 6:47:59 PM
heres an example of a xml with 3 images

<?xml version="1.0" encoding="utf-8"?>
<images>
<image="images/img1.jpg" />
<image="images/img2.jpg" />
<image="images/img3.jpg" />
Re: loading images externally and ramdomly hutch-diggens
1/22/2007 4:26:51 PM
I've been searching around for tutorials on this, and I found some stuff. I
haven't found exactly what I'm looking for, but close. Do you have to use XML
to make this work? I found this code---

pic_arr = ["images/1", "images/2", "images/3", "images/4", "images/5"];
one_btn.onRelease = function() {
ranNum = Math.floor(Math.random()*pic_arr.length);
holder_mc.loadMovie(pic_arr[ranNum]+".jpg");
};

this works, but what's the difference between using this and XML?
Also, do you know how I might intergrate this with LocalConnection?
I really appreciate the help.

hutch
Re: loading images externally and ramdomly hutch-diggens
1/23/2007 2:55:58 PM
Ok, I got this all to work, but now I'm sitting on a problem --- my client will
not be able to add or take out images dynamicly. So, I guess I need to
incorporact XML.
I know .:}x-=V!P=-x{:. posted some XML script above but I'm not really sure
how to incorporate that into flash, and create an array from it.
Please help this poor soul!!!
thanks.
Re: loading images externally and ramdomly .:}x-=V!P=-x{:.
1/31/2007 7:44:46 PM
AddThis Social Bookmark Button