Monday, May 21, 2012

[Action Script] Actionscript & PHP May,2012

Hey guys,
I want to retrieve some values from my PHP file and put it in flash. So I've got the following PHP

PHP Code: $testID = 1;
$getTest_sql = mysql_query("SELECT testID, testText
                            FROM test
                            WHERE testID = '".mysql_real_escape_string($testID)."'");

if(mysql_num_rows($getTest_sql) > 0) {
    while($row_getTest = mysql_fetch_array($getTest_sql, MYSQL_ASSOC)) {
                echo stripslashes($row_getTest['testID']);
        echo stripslashes($row_getTest['testText']);
    }

Now I want to call it with flash, which actually works already. I use this code
Code: function mouse(e:MouseEvent) {
        var request:URLRequest = new URLRequest("[linkremoved].php");
        request.method = URLRequestMethod.GET;
       
        var loader:URLLoader = new URLLoader();
        loader.dataFormat = URLLoaderDataFormat.TEXT;
        loader.addEventListener(Event.COMPLETE, test);
        loader.load(request);
}

function test(e:Event) {
        testText.text = e.target.data;
}
So now there's one problem. I'm getting the testID and testText in one string. But I only want the testText. (now I know I can strike it from the PHP but that's not my point).

So I thought something like e.target.data.testText would work, but then flash gives me the following error: Property testText not found on String and there is no default value

So please help me, how do I get only the value of testText.
Actionscript & PHP

Related Post



0 comments: