-
Flash IDE not compiling my PHP code
Hi all.
I'm sure this question has been answered before, but I sure as heck can't find it anywhere.
I wrote a PHP script that takes a query from mysql and creates a string that Flash is supposed to be able to read in as variables. When I run the Flash movie in the web browser, it works just fine. However, when I run it in the IDE--even when the .swf, .fla, and .php are all in my xampp/htdocs directory (and yes, Apache is running)--it goes all wrong. Basically, it reads in the raw, uncompiled PHP code.
Is there some kind of setting in Flash CS4 that I have to change to make it compile the PHP code? I really don't want to have to run my movie in the browser every time I try and debug my flash movie!
At any rate, here's my code in case it helps:
PHP Code:
<?php
$hostname = "localhost";
$con = mysql_connect($hostname,root,password);
if (!$con) die('nv=didnotconnect');
mysql_select_db(test, $con) or die('nv=couldnotselectDB');
$result = mysql_query("SELECT student_number, student_name FROM students", $con) or die('nv=couldnotselectvalues');
$count = 1;
while($row=mysql_fetch_array($result))
{
echo "student_number$count=$row[student_number]&student_name$count=$row[student_name]&";
$count++;
}
echo "count=$count";
?>
Actionscript Code:
var loader:URLLoader = new URLLoader();
var urlRequest:URLRequest=new URLRequest("receive.php");
urlRequest.method=URLRequestMethod.GET;
// Read returned values from external source as variables loader.dataFormat=URLLoaderDataFormat.VARIABLES;
// Listen for completion loader.addEventListener(Event.COMPLETE, onComplete); loader.load(urlRequest);
function onComplete(evt:Event):void {
// Stop listening for completion loader.removeEventListener(Event.COMPLETE, onComplete); //I used the GUI to put a bunch of textfields on the stage trace(evt.target.data); studentNumber1.text=evt.target.data.student_number1; studentNumber2.text=evt.target.data.student_number2; studentNumber3.text=evt.target.data.student_number3; studentName1.text=evt.target.data.student_name1; studentName2.text=evt.target.data.student_name2; studentName3.text=evt.target.data.student_name3; }
And just to be clear: I even tried using the full path to the php file in my Actionscript, but I got the same results.
-
Hi,
you could change your AS to refer to http://localhost
Musicman
-
Originally Posted by Musicman
I actually tried that, but for some reason whenever I do, I get the following errors:
Error opening URL 'http://localhost/receive.php'
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL:http://localhost/receive.php at test_fla::MainTimeline/frame1()
I used the following code:
Actionscript Code:
var urlRequest:URLRequest = new URLRequest("http://localhost/receive.php");
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|