Hi, I have an XML flash gallery which uses
<img>photoGallery/img1.jpg</img>
to call an image.
Is there a way to use the <img></img> tags and call a random image from a folder?
Thanks
Hi, I have an XML flash gallery which uses
<img>photoGallery/img1.jpg</img>
to call an image.
Is there a way to use the <img></img> tags and call a random image from a folder?
Thanks
[quote=fasterthanlight™;2323161]this isn’t an XML problem,
its how you are manipulating the XML from within flash,
you probably have a For loop which iterates through your XML to output the value into an array,
Just output whatever is in your array with a random function.
var someArray:array = [“value1”, “value2” … ]
var randomInt:number = random(someArray.length);
trace (someArray[randomInt]);[/quote]
Hello,
I’m trying to do the exact same thing here. I have a movie clip on my stage which holds multiple images. I’d like that movieclip to display random images from my XML file. I used the code above just to see what would happen and I receive the following error:
1180: Call to a possible undefined method random
I’m using the same code as above:
var someArray:Array = ["value1", "value2", "value3", "value4", "value5", "value6" ]
var randomInt:Number = random(someArray.length);
trace (someArray[randomInt]);
Any ideas why that’s not working?
He said that the code wasn’t copy-and-paste-able. This code has a similar effect.
Math.floor(Math.random() * someArray.length)
hey…
there is no XML codes by which you can bring random images…the use above told you the way is the right way to add random images in flash…
:: Copyright KIRUPA 2024 //--