PDA

View Full Version : variable array


baby-pink
07-27-2005, 12:08 PM
Dear all,

I have got

trace (myVars.var1);
_root.test.text = myVars.var1;
container.loadMovie("test/"+myVars.var1, 0);

and these codes shows the jpg file inside var1 very well.
but now I need to tell flash to show the pictures in directory without specifying var1 or 2. to make a slideshow.
Do I have to do it with buttons or array? and how does the codes works because looking at other tutorials, they have to say what are the content of the array.

Please help me out
thanks

Ricod
07-27-2005, 03:11 PM
Why would you be unable to specify the value of a variable ?

baby-pink
07-28-2005, 08:12 AM
Hii,

I couldn't specify the var because the php read files directly from directory.
So what I tried to do is make firstimage.jpg into var1, secondimage.jpg into var2 and so on.
and now what i need is the codes that tells flash show var2 maybe 10seconds after var1 and so on.
please help me out.

MichaelxxOA
07-28-2005, 08:25 AM
if you are using php for that you could have script print out the contents of the directory in a format flash can read such as

picturesArray=mypic1,mypic2... so on and so forth..

which if you are programming php to return contents of a directory shouldn't be to difficult to figure out, you can load this variable into flash and then seperate it at the commas ',' and then use that as the array :)

-Michael

baby-pink
07-28-2005, 08:45 AM
actually my output from php right now is

&var1=robert.jpg&var2=Sharon.jpg&2

the number 2 at the right is the $count -------counting number of files in that directory

now my question is:
1. is it better to use the array from the php or flash???and how use array if I don't exactly know the what the names of the files will be?
2. since the flash can already read the var1 how to make it slide to var2 automatically?

please help me out :)

baby-pink
07-28-2005, 10:37 AM
here I have an editional question.

_root.test.text = myVars.var1;
the codes take my var1, but now I need to take the $count also from php to flash. what should replace the var1?
because it doesn't work with
_root.test.text = myVars.count; nor
_root.test.text = myVars.nroffiles;

Ricod
07-28-2005, 01:15 PM
I took a quick peek at one of the PHP / Flash tutorials in the tutorial section and they get a php variable in Flash as follows :
//php
//values already defined
$values="&flashVariableName=$phpvalue&anotherFlashVariable=$anotherPHPValue";
echo "$values ";
//Flash
trace(flashVariableName);
To have the next one loaded in automatically after 10 seconds, you can use the setInterval() method. I suggest you start downloading the picture immedeately and just don't show it until after 10 seconds, to decrease the wait for the user.