Pass variables from PHP to Flash

  • frons
  • Born
  • Born
  • frons
  • Posts: 3
  • Loc: Ancona, ITALY

Post 3+ Months Ago

Hello, this is my first post.

I have a problem: I wanna make a sort of online catalog in Flash with variables from a .php files.

This is the last of the php code I wrote to catch data from a MySQL db and pass to Flash:

PHP Code: [ Select ]
$select = "SELECT * FROM recensioni WHERE flag='si' AND archivio ='no' ORDER BY data DESC, data_inserimento DESC LIMIT 12";
 
 
 
$result = mysql_query($select);
 
 
 
// To count the rows (total result)
 
$rows = mysql_num_rows($result);
 
 
 
// For each result
 
while($list = mysql_fetch_array($result)){
 
    $id = $list["id"];
 
    $nome = $list["nome_gruppo"];
 
    $titolo = $list["titolo"];
 
    $genere = $list["genere"];
 
    $image =  $list["immagine_copertina"];
 
 
 
    print("Total=$rows&Oggetto$id=$nome|$titolo|$genere|$image&");}
  1. $select = "SELECT * FROM recensioni WHERE flag='si' AND archivio ='no' ORDER BY data DESC, data_inserimento DESC LIMIT 12";
  2.  
  3.  
  4.  
  5. $result = mysql_query($select);
  6.  
  7.  
  8.  
  9. // To count the rows (total result)
  10.  
  11. $rows = mysql_num_rows($result);
  12.  
  13.  
  14.  
  15. // For each result
  16.  
  17. while($list = mysql_fetch_array($result)){
  18.  
  19.     $id = $list["id"];
  20.  
  21.     $nome = $list["nome_gruppo"];
  22.  
  23.     $titolo = $list["titolo"];
  24.  
  25.     $genere = $list["genere"];
  26.  
  27.     $image =  $list["immagine_copertina"];
  28.  
  29.  
  30.  
  31.     print("Total=$rows&Oggetto$id=$nome|$titolo|$genere|$image&");}


Then I've created a Flash file with some dynamic text boxes and a image container: the text boxes gotta show the .php variables (for each object if the catalogue) while the image loader should load the right image each time.

What's the exact actionscript code that allows Flash to reach the .php variables?

Please help me!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

I find it easier to have php build an xml file and then have flash read that. You can import the xml file at run time or you can do a sendAndLoad to get the xml file (or individual variables you need)

http://www.kirupa.com/developer/flashcs3/using_xml_as3_pg1.htm
  • deckyfrombgd
  • Newbie
  • Newbie
  • deckyfrombgd
  • Posts: 14
  • Loc: Belgrade,Serbia

Post 3+ Months Ago

I had same problem,and succesfully solved with technique described on this site:
http://www.nunomira.com/tutorials/loading_variables.php
There you can find few ways to import data from php to swf,I choose embeded
HTML tags,and it works perfect.
Read about cache-killer too,it's very usefull.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 10 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
 
 

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