Variable from PHP

  • spirit
  • Born
  • Born
  • User avatar
  • Posts: 3

Post 3+ Months Ago

Hellow everybody,

I have download a ready Flash gallery wich work with an array. For example:

this.pArray = ["image1.jpg","image2.jpg","image3.jpg","image4.jpg"];

But I whant to make it a litle bit dynamic and load all the images from some folder automaticly. For this reason I made a PHP script, wich returns as string the file list from the folder, formated like this:

"image1.jpg","image2.jpg","image3.jpg","image4.jpg"

My question is:
How can I substitute the string in the array with PHP variable. (I whant to put some variable inside the [] , if it is possible)

Please help.
Thanks in advance.
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

i suggest you this:
in PHP, output with echo a variable formated like this:
$strArray = "image1.jpg||image2.jpg||image3.jpg||image4.jpg";
echo "strArray=".$strArray;

then, from flash, using loadvars class, get strArray
and then:
var pArray = strArray.split("||");

sounds complicated enough for you?
  • spirit
  • Born
  • Born
  • User avatar
  • Posts: 3

Post 3+ Months Ago

Look,

I mage my PHP to return exactly this string:

"image1.jpg","image2.jpg","image3.jpg","image4.jpg "

with quotation marks and commas, because I do not understand Action Script verry well, and I want to use the original syntax of the flash movie.

The original flash movie have the folloing code:
...
this.pArray = ["image1.jpg","image2.jpg","image3.jpg","image4.jpg "];
...

and I want to substitute the string betwen [] exactly with the string, returned from PHP variable.
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

well, can't say i didnt try.
i give the code ... he says he doesnt want it. as u wish my friend.
  • spirit
  • Born
  • Born
  • User avatar
  • Posts: 3

Post 3+ Months Ago

I cannot understand you verry well (the problem is in me )

When I call: echo $varForFlash; , the result in the browser is:

"image1.jpg","someImage2.jpg","thirdImage3.jpg",.. . (depending on how many files there is in the folder - this is calculated from PHP and I modify the script with quotation marks and commas)

Now, I need exactly this string:
"image1.jpg","someImage2.jpg","thirdImage3.jpg",.. .

to put in Flash.
But, because the gallery is ready (downloaded from Internet) and the orriginal code is:

...
this.pArray = ["image1.jpg", "image2.jpg", "image3.jpg"]; //only three images
...

...I whant to substitute the string in the array with some kind of variable, called from PHP - $varForFlash.

Please, if you understand my problem - HELP.
Thanx in advance
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

would it be too much trouble for you to format the output as i said in my previous post?
is it that hard to have:
$varForFlash = $varForFlash.$crtFile."||"
?

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 3 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.