Another Flash and PHP question :P

Alright, so here’s my current dillema; I have already existing PHP scripts and the like set up for my website, although I wasn’t the one in charge of PHP. Now then, our webmaster has since left, and we’re trying to pick up the pieces. Luckily, we’ve found another PHP savvy person to get things up and running with the grooviness. Now, from what I could see from the already existing PHP, it would not transfer over very well to Flash, so what we did was write a seperate PHP script to make the already existing scripts into something Flash could read and display properly in the text boxes… using this here script:

function directory($dir)
 while( ($file = readdir($handle))!=false)
  $files[] = $file;
 return $files;

$news_dir = "news/";
$news = directory($news_dir);
$news_count = count($news) -1;
(isset($_GET['prev'])) ? $prev = $_GET['prev'] : $prev = 0;
if($prev > $news_count) $prev = $news_count;
$i = $news_count - $prev;
  include($news_dir . $news[$i]);
  $postTime = obtain_time($news[$i]);
  $postDate = obtain_date($news[$i]);
  $postAuthor = obtain_poster($news[$i], "modeAuthor");
  $postEmail = obtain_poster($news[$i], "modeEmail");
  $postSig = obtain_poster($news[$i], "modeSig"); 
  $postText = trim($postText);
print "time=$postTime&date=$postDate&author=$postAuthor&email=$postEmail&title=$postTitle&text=$postText";

Now, here’s where it starts to get a little tricky. We can get it to load properly into Flash with the LoadVars() function from that… it’d be something like… h**p://, and Flash can take that in from the variables displayed in the PHP. I have two questions to ask from this:

  1. There are multiple newsposts in there, and I would like to set up buttons in flash to go back through previous newsposts for archiving sake. The webaddress would be something like… hp:// or [url=“”]hp:// or what have you. How would I set it up in a button to go back and forth through the different newsposts?

  2. As a LoadVars() function, I realize that it doesn’t work the same as loading in a regular text document… my concern with this is whether or not html code like <a href> and the like will work. Is there a solution to this?

If I’m not explaining everything very well, just let me know, because I realize I’m not the best at explaining things -_-;; . Any help on this would be greatly appreciated.


item two - just turn on html tags on your flash textbox the little “<>” button - when the text is loaded into that form field, it will display html formatting properly.

Yes, I’ve done that before… but it didn’t work COMPLETELY until I added…

 loadText = new loadVars();
//creating the loadVarsText function
loadText.onLoad = function() 
			 //where Newsbox is the dynamic textbox and news is the variable in the text file
			Newsbox.htmlText =;

When I was just loading in text boxes before, I clicked the <> tag, and it didn’t work until I added THAT code, making the dynamic textbox formatted as html text… maybe I’m just being a little presumptuous, I dunno, but that’s the sort of problem I think I’m gonna run into considering I’m using the LoadVars() function for loading in the PHP :\

Well, I think I kinda know what I want…

Something where the previous newsposts can be assigned by a variable, and then loaded into the text box… Something sorta like…

loadVars(“readnews.php?=” &[“variable”], this, “GET”);

where “variable” will be the number for the previous newsposts appended onto the end of readnews.php?= . And yes, I do realize that the code is horribly wrong, but then again, I don’t know how to go about doing it. And then there’s the whole deal with setting it up for a button to load in the new .php to the dynamic text box.