Jump to content


Displaying PHP variables


  • You cannot reply to this topic
1 reply to this topic

#1 ReZTeR

    Young Padawan

  • Members
  • Pip
  • 9 posts

Posted 08 July 2007 - 06:58 AM

Short Version
How do you display a PHP variable in a text box in flash?

Long Version
Basically I want to have quotes displayed on my website but inside a flash file. I have a .txt file with some quote in which is like:
I said this and yeah booo|Jim Bob
Get out of my house you smell of urine|Your father
Hello|Friendly Person
Like on the left is the quote and on the right is the person who said it. My PHP file opens this, picks a random line (quote) and then separates the quote and name to two separate variables just like this:
<?php
$file = file ("quotes.txt");
$random = array_rand($file);
$quotes = $file[$random];
$pieces = explode("|", $quotes);
$quote = $pieces[0];
$nam = $pieces[1];
?>
and if I echo either of those variable I get exactly what I want. But I want them in a text box in flash and I have no idea what so ever! Help would be nice.

#2 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 09 July 2007 - 09:54 AM

You could set the variable when you embed the swf onto the page. Then reference the variable by using _root.varName





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users