Flash and PHP actionscript

I have a login form (i have a mysql database and everything
set up) and the login button simply has the AS:
on (release) {
loadVariablesNum("login.php", 0, "POST");
but i don't know what else to add to make it so if you're a
registered user (which i already have a form of) then it will go to
the next frame, and if not registered, it keeps unregistered users
out.
please help, thanks

first off, i wouldn't put any code directly on a button. it
might seem easy to you now, but in the future you will probably
find yourself wondering where the code is. it's much better to have
all your code in a single frame on the main timeline.
second, don't use loadVariablesNum(). Try using
LoadVars.sendAndLoad() instead. Assuming you have given your login
button an instance name of 'loginButton', it might look something
like this:
var submitListener:Object = new Object();
submitListener.click = function(evt:Object) {
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
for (varName in result_lv) {
trace(varName + '=' + result_lv[varName]);
} else {
trace("Error connecting to server.");
var send_lv:LoadVars = new LoadVars();
send_lv.username = 'myUsername';
send_lv.password = 'myPassword';
send_lv.sendAndLoad("https://yourdomain.com/login.php",
result_lv, "POST");
loginButton.addEventListener("click", submitListener);

Similar Messages

  • Array data between Flash and PHP

    As the title suggests, I'm trying to find a good way of
    getting an ActionScript/Flash dynamic array into PHP, so I can
    serialize it and store it in a DB, then simply give back that same
    array when it's called. Are there any popular techniques? The array
    will always be a different size, containing different values -
    which is why I'd like to keep the array in tact, to minimise the
    amount of parameter transfers. If there's no good solution, I
    suppose I could pass in parameters and read them in, create an
    array and serialize that... but I'd much rather find a way of
    having my flasher serialize his own array and pass me the
    byte-code. Is this possible?
    PHP doesn't need to read the contents of the array, simply
    store it in a DB, so if there's some kind of flash method for
    serializing an array into bytecode that it can unserialize and read
    back later, that would be awesome.
    Thanks. =]
    [edit]
    I found this:
    http://sourceforge.net/projects/serializerclass/
    a serializer class. Is this the best method?

    Sorry, I should have explained, we already use XML for data
    transfers (though I personally find JSON much nicer with less
    overhead). So, in this project, we use XML for data transfer
    between flash and PHP/Database. The reason I wanted this
    functionality, is because the flash array, in this one case, will
    be completely dynamic and the PHP doesn't need to know the contents
    of the array at all. In fact, in this instance, PHP is just the
    mechanism used for storing the data. Becuase of the nature of the
    data, I wanted to serialize the flash array, store it in the
    database as Bytecode, then when the flash needs that information
    again, I can pass back the same bytecode, which can then be
    unserialized back into the original array.
    I think I've found the solution, the one I linked in the
    original post. I should know if it's as effective as I want it to
    be in the next couple of days when my flasher gives it a try. =]
    Thanks for the responses. If anyone has any other ideas,
    please throw them in here.

  • High Score Table: Writing a Simple Text File with Flash and PHP

    I am having a problem getting Flash to work with PHP as I need Flash to read and write to a text file on a server to store simple name/score data for a games hi score table. I can read from the text file into Flash easily enough but also need to write to the file when a new high score is reached, so I need to use PHP to do that. I can send the data from flash to the php file via POST but so far it is not working. The PHP file is confirmed as working as I added an echo to the file which displayed a message so I  could check that the server was running PHP - the files were also uploaded to a remote server so I  could test them properly. Flash code is as follows:
    //php filewriter
    var myLV = new LoadVars();
    function sendData() {
    //sets up variable 'hsdata' to send to php
    myLV.hsdata = myText;
    myLV.send("hiscores.php");
    I believe this sends the variable 'myText' to the php file as a variable called 'hsdata' which I want the php file to write into a text file. The mytext variable is just a long string that has all the scores and names in the hiscore. OK, XML would be better way of doing this but for speed I just want to get basic functionality working, so storing a simple text sting is adequate for now. The PHP code that reads the Flash 'hsdata' variable and writes it to the text file 'scores.txt' follows:
    <?php
    //assigns to variable the data POSTed from flash
    $flashdata = $_POST["hsdata"];
    //file handler opens file and erases all contents with w arg
    $fh = fopen("scores.txt","w");
    //adds data to file
    fwrite ($fh,$flashdata);
    //closes file
    fclose ($fh);
    echo 'php file is working';
    ?>
    Any help with this would be greatly appreciated - once I can get php to write simple text files I should be ok. Thanks.

    Thanks for your help.
    I have got Flash working to a certain extent with PHP using loadVars but have been unable to get flash to receive a variable declared in PHP. Here's my Flash code:
    var outLV = new LoadVars();
    var inLV = new LoadVars();
    function sendData() {
    outLV.hsdata = "Hello from Flash";
    outLV.sendAndLoad("http://www.mysite.com/hiscores/test23.php",inLV,"post");
    inLV.onLoad = function(success) {
    if (success) {
      //sets dynamic text box to show variable sent from php
      statusTxt.text = phpmess;
    } else {
      statusTxt.text = "No Data Received";
    This works ok and the inLV.onLoad function reports that it is receiving data but does not display the variable received from PHP. The PHP file is like this:
    <?php
    $mytxt =$_POST['hsdata'];
    $myfile = "test23.txt";
    $fh = fopen($myfile,'w');
    //adds data to file
    fwrite($fh, $mytxt);
    //closes file
    fclose ($fh);
    $mess = "hello there from php";
    echo ("&phpmess=$mess&");
    ?>
    The PHP file is correctly receiving the hsdata from flash and writing it to a text file, but there seems to be a problem with the final part of the code which is intended to send a variable called 'phpmess' back to Flash, this is the string "hello there from php". How do I set up Flash and PHP so that PHP can send a variable back to Flash using echo? Really have tried everything but am totally baffled. Online tutorials have given numerous different syntax configurations for how the PHP file should be written which has really confused me - any help would be greatly appreciated.

  • Flash and PHP contact form.

    Hi, I created a simple web site in flash cs4 with a contact form, however, when I press submit, no email is sent even though my site says it was successfully sent.  If anyone could give any advice on what I could possibly being doing wrong that would be great.
    Thanks, Anthony.
    Here is my actionscript and PHP:
    function submit(e:MouseEvent):void
    var variables:URLVariables = new URLVariables();
    variables.fromname = nameText.text;
    variables.fromemail = emailText.text;
    variables.frommessage = messageText.text;
    var req:URLRequest = new URLRequest("contact.php");
    req.data = variables;
    req.method = URLRequestMethod.POST;
    var loader:URLLoader = new URLLoader();
    loader.dataFormat = URLLoaderDataFormat.VARIABLES;
    loader.addEventListener(Event.COMPLETE, sent);
    loader.addEventListener(IOErrorEvent.IO_ERROR, error);
    loader.load(req);
    statusText.text = "Sending...Please wait.";
    function sent(e:Event):void
    statusText.text = "Your email has been sent.";
    nameText.text = emailText.text = messageText.text = "";
    function error(e:IOErrorEvent):void
    statusText.text = "Error, please try again.";
    sendButton.addEventListener(MouseEvent.CLICK, submit);
    PHP:
    <?php
    $sendTo = "[email protected]( I am aware this needs to be different)";
    $subject = "Email from Web site";
    $name = $_POST['fromname'];
    $from = $_POST['fromemail'];
    $message = $_POST['frommessage'];
    $message = stripslashes($message);
    $content = "Name: " . $name . "\n";
    $content .= "Email: " . $from . "\n\n";
    $content .= $message;
    if (mail($sendto,$subject,$content))
    echo 'response=passed';
    else
    echo 'response=failed';
    ?>

    I had the correct case in my code, so that was not the problem.  It appears that the there is no communication with the server.  Do you have any other ideas as to why the send button would not actually being contacting the server?
    Thanks for the help

  • Flash and PHP for login status

    Hello and thank you in advance for taking the time to read my question.
    I currently have a login utility that is the front end of a multi page site. The individual logs in and is then granted access to what ever their "authorization level" is.
    I wish to have my Flash website, request the users "authorization level" from our PHP server side script.
    I have already constructed a three page timeline, where depending on their "authorization level", they will be forwarded to the page that's matches that level however I'm having a heck of time finding a reasonable place to start.
    I have included a visual map of what i'm looking to accomplish as I've always found it easier to see what's being discussed.
    Again, thanks in advance for anyone that might be able to help. Additonally, i have attached the image to assist with review as well.
    Cheers

    You will need to send variables to PHP which will in turn send it to MySQL and check for the authorization level and then send back the result to Flash via PHP... I have a very general idea of this whole thing so I won't be able to help you much (I'm still a beginner in AS3), but you can check these places for some good video tutorials on the subject:
    http://www.developphp.com/Flash_tutorials/
    htttp://www.gotoandlearn.com
    and there's also some good tutorials on Cartoon Smart.
    Good luck!

  • Using databases with Flash and PHP

    Hi, everyone!
    I`m a PHP newbie. I just learned PHP so that I can use
    databases with Flash.
    I`ve got a .php script that contains html that loads up my
    .swf file. The .swf file is the core of my site. What I want to
    know is if I can call some PHP functions (that I have wrote in the
    .php script) from within the .swf file... This functions would
    perform the reading and updating of my database.
    The only way I know of to modify a database from Flash is
    using the POST and GET methods. But that opens up a new browser
    window in which the PHP script is called. And that only handles
    writing in the database. So, what if I just want to read from the
    database some values and insert them into a TextField in Flash? How
    do I do that?
    Thanks! Ardy

    1. Goggle "Flash and mySQL" and you'll get a listing of alot
    tutorials
    2. I'm also just learning. Here's a great URL to start:
    Building with Flash and MySQL
    That's right, a Flash-based blog — it sounds a little
    loony, but this blog pulls content from a MySQL database and feeds
    it into the dynamic Flash frontend ...
    www.webmonkey.com/programming/php/tutorials/tutorial2.html -
    20k - Cached -

  • Highscore list using Flash and PHP

    Hi,
    I want to make a highscorelist using AS3 and PHP(MySQL).
    I cant find a good tutorial on internet how to make something like that but I got this so far:
    import fl.controls.TextInput;
    import fl.controls.TextArea;
    var variables:URLVariables = new URLVariables();
    variables.name = "Wil";
    variables.final = 2000;
    var request:URLRequest = new URLRequest();
    ////insert in the location of the php script ////////////////
    request.url = "http://www.justenter.nl/script.php";
    request.data = variables;
    var loader:URLLoader = new URLLoader();
    loader.load(request); //sends the request
    //when the request is done loading, it goes to the completeWriting function
    loader.addEventListener(Event.COMPLETE, completeWriting);
    function completeWriting(event:Event):void {
        var writingCompleted:TextField = new TextField;
        writingCompleted.autoSize = "center";
        writingCompleted.x =200;
        writingCompleted.y= 200;
        writingCompleted.text = event.target.data;
        addChild(writingCompleted);
    He is sending the score and name to the database but he is doing that when i press ctrl-enter. He is sending the data I have given in:
    variables.name = "Wil";
    variables.final = 2000;
    I want a input textfield and a button. And When I fill in my name in the input textfield he send it to the database when I press the button.
    Is there someone that can help me out?
    Tnx

    import fl.controls.TextInput;
    import fl.controls.TextArea;
    var variables:URLVariables = new URLVariables();
    //variables.name = "Wil";
    //variables.final = 2000;
    var request:URLRequest = new URLRequest();
    ////insert in the location of the php script ////////////////
    request.url = "http://www.justenter.nl/script.php";
    request.data = variables;
    var loader:URLLoader = new URLLoader();
    submitBtn.addEventListener(MouseEvent.CLICK,submitF);  // where submitBtn is your button
    function submitF(e:Event){
    variables.name=nameTF.text; // where nameTF is your input texfield
    variables.final = score;  // where score is the variable you use to tally user score
    loader.load(request); //sends the request
    //when the request is done loading, it goes to the completeWriting function
    loader.addEventListener(Event.COMPLETE, completeWriting);
    function completeWriting(event:Event):void {
        var writingCompleted:TextField = new TextField;
        writingCompleted.autoSize = "center";
        writingCompleted.x =200;
        writingCompleted.y= 200;
        writingCompleted.text = event.target.data;
        addChild(writingCompleted);

  • Flash and PHP

    Hi, let's say I have a dynamic text field (variable name is "txt") that I wanted to read from a PHP file and output the contents from there.
    My AS code is:
    var myPHP:LoadVars = new LoadVars();
    myPHP.load("variables.php"); //my php file
    myPHP.onLoad = function(success:Boolean){
              if (success) {
                        txt= myPHP.msg; //displaying contents from php
    PHP code in variables.php:
    <?php
    // Define Variables
    $msg = ($_GET['msg']);
    // Send it to Flash
    echo "msg=$msg";
    ?>
    If I key in the url as follows and send something to the msg:
    variables.php?msg=Hello
    It will echo "msg=Hello", but the text field inside flash turns out to be empty, not undefined or anything. If however I hardcode the php file with:
    $msg = "Hello";
    It will still echo "msg=Hello" but the flash file will display the text accordingly.
    Can anyone tell me why? Thanks!

    if you want to read data, you'll use the load part of sendAndLoad.  and, if you're not sending any data, you'll need to hardcord your variables.  how else will you php assign variable values?
    but i'm pretty sure you want to be able to do both send variables and receive variables.
    so, use:
    var sendLV:LoadVars = new LoadVars();
    var receiveLV:LoadVars = new LoadVars();
    sendLV.send_msg="some message";
    sendLV.sendAndLoad("variables.php",receiveLV,"POST"); //my php file
    receiveLV.onLoad = function(success:Boolean){
              if (success) {
                        txt= this.return_msg; //displaying contents from php
    <?php
    // Define Variables
    $msg = ($_POST['send_msg']);
    // Send it to Flash
    echo "return_msg=$msg";
    ?>

  • Flash and PHP Code Alter

    I have a php code that talks back to my flash movie on "post"
    however I have recently added a more advanced feature and need some
    help altering the code to work.
    Right now the code is as such and works great because the
    message var. is located in the root of the movie:
    $message = $subscribe_message;
    But now I need the script to look in a MC called "newsPop"
    for the message var. I used a code similair to flash as such but
    did not work.
    $newsPop.message = $subscribe_message;
    Can someone please help me alter the code to work and look in
    the MC for the Var - remeber this is PHP code.
    Thanks in advance!

    don't change your php script.
    you can change your flash so your movieclip checks the _root
    timeline for the variable or change the way you call your php
    script so the variable is defined on your movieclip's
    timeline.

  • Help with flash and php prlblem

    the problem is flash receive the data back after send
    loadvars.but it always got it wrong.
    code in flash is:
    send_btn.onRelease = function() {
    myVars = new LoadVars();
    myVars.username = username_txt.text;
    myVars.phonenum = phonenum_txt.text;
    myVars.picktime = picktime_txt.text;
    myVars.email = email_txt.text;
    myVars.address = address_txt.text;
    myVars.shortmessage = shortmessage_txt.text;
    myVars.onLoad = function(success) {
    if (success) {
    if (this.order) {
    gotoAndStop(2);
    } else {
    gotoAndStop(3);
    delete myVars;
    myVars.sendAndLoad("sendorder.php", myVars, "POST");
    and code in php is:
    $username = $_POST['username'];
    $phonenum = $_POST['phonenum'];
    $picktime= $_POST['picktime'];
    $email = $_POST['email'];
    $address = $_POST['address'];
    $shortmessage= $_POST['shortmessage'];
    $result=mysql_query("insert into
    userinfo(email,username,phonenum,address,picktime,message)
    values('$email','$username','$phonenum','$address','$picktime','$shortmessage')");
    if($result){
    echo "order=1";
    }else{
    echo "order=0";
    flash reponse after receiving the varaible from php is always
    go to frame 3
    but the test of php is output order=1.
    what is wrong with it?please help::^_^

    interesting b, but i think i see something else here that is
    the reason you needed to add the '&'. You're passing back a
    number value (ie. 0/1) and treating it as a boolean (all fine)
    except that in the echo statement it's all inside quotes, so it's
    being interpreted as a complete String. to remedy, try writing the
    echo like this:
    if($result) {
    echo('order='.1);
    }else{
    echo('order='.0);
    and you're welcome :)

  • Remove duplicates using flash and php in a .csv file

    Hi all,
    I am trying to have a frontend in flash that uploads data
    from a csv file to a mysql database. A user selects the file to
    upload, the user enters the number of columns in the csv file into
    a input textbox in flash so that a databse can then be created
    dynamically in the mysql database according to the column size and
    then uploads the data. I am sure this is possible but i have tried
    and searched in vain. Do you have any knowhow about this?
    Much appreciated.

    No one answered so I did it on my own...will post it on my
    server after configuring it for it. I tried it with a file size of
    3 MBs and works fine. Considering that there are add-ins for excel
    to remove duplicates, i think mine is fine as long as the
    duplicates are in the first column...but that can be easily changed
    huh...:)

  • Listbox form using Flash and PHP

    Hi,
    I am trying to create a form that includes listboxes in
    Flash. The datas are then sent to an email through PHP.
    Thing is: i havent found any actionsript to do that with
    Listboxes.
    Can anyone help me?
    Cheers.

    >> Thing is: i havent found any actionsript to do that
    with Listboxes.
    Do you mean List components? There's no special script - it'd
    be the same
    for sending any data to PHP. You just need to use the methods
    of the
    component to first get out the data you want to send.
    Can you be more specific as to the problem?
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Flash and php score refresh

    Hi there, I'm wondering if anyone can help me with this php scoreboard.. our developers aren't being very helpful...
    So problem is the score board is shown at the beginning if requested and at the end to show your score when the game is finished. The problem I have is refreshing the scores (replacing the current text in the boxes) rather than just adding the text again into the dynamic text boxes..
    Here is my code :-
    var tab = "game1score";// update for each game // game2score, game3score....
    var filesend = "receive.php";
    var modesend = "post";
    //This is called when the high scores are viewed at the beginning of the game
    private function onHighScoresButtonClick(event:MouseEvent):void {
         var receptobjet = variableTransaction(filesend, modesend, tab, false, false);
         highScoresPage.rejouerButton.visible = false;
         highScoresPage.blueMan.visible = false;
         removeChildAt(0);
         addChildAt(highScoresPage, 0);
    function variableTransaction(fichier, modesend, tab, var1, var2) {
         var URLload = new URLLoader();
         var URLrequest = new URLRequest(fichier);
         var variables:URLVariables = new URLVariables();
         variables.tab = tab;
         variables.var1 = var1;
         variables.var2 = var2;
         if (modesend == "post") {
              URLrequest.method = URLRequestMethod.POST;
              } else if ( modesend == 'get') {
                   URLrequest.method = URLRequestMethod.GET;
               if (var1 == false && var2 == false) {
                   URLload.dataFormat = URLLoaderDataFormat.VARIABLES;
                   URLrequest.data = variables;
                   URLload.load(URLrequest);
                   URLload.addEventListener(Event.COMPLETE, modeComplet, false, 0, true);
                } else {
                    URLrequest.data = variables;
                    URLload.load(URLrequest);
                    //var receptobjet = variableTransaction(filesend, modesend, tab, false, false);
    function modeComplet(event:Event) {
                for (var p:uint = 1; p <= 10; p++) {
                    var currentPseudo:String = "pseudo" + p;
                    var currentScore:String = "score" + p;
                    if (event.target.data["pseudo" + p]) {
                        highScoresPage[currentPseudo].appendText(event.target.data["pseudo"+p]);
                        if (event.target.data["score" + p]) {
                            highScoresPage[currentScore].appendText(event.target.data["score"+p]);
                        } else {
                            highScoresPage[currentPseudo].appendText(" \n");
                            highScoresPage[currentScore].appendText(" \n");
            private function gameEnd(event:Event):void {
                var pseudo = highScoresPage.pseudo0.text;
                var score = highScoresPage.score0.text;
                var filesend = "send.php";
                var modesend = "post";
                variableTransaction(filesend, modesend, tab, pseudo, score);
                var persoArray:Array = [gamePage.a1, gamePage.a2, gamePage.a3, gamePage.a4, gamePage.a5];
                var animalArray:Array = [gamePage.b1, gamePage.b2, gamePage.b3, gamePage.b4, gamePage.b5];
                var persoHitArray:Array = [gamePage.h1, gamePage.h2, gamePage.h3, gamePage.h4, gamePage.h5];
                var animalHitArray:Array = [gamePage.h6, gamePage.h7, gamePage.h8, gamePage.h9, gamePage.h10];           
                for(var i:uint = 0; i < persoArray.length; i++) {
                    (persoArray[i]).removeEventListener(MouseEvent.MOUSE_DOWN,persoMouseDown);
                    (persoArray[i]).removeEventListener(MouseEvent.MOUSE_UP,persoMouseUp);
                    (persoArray[i]).buttonMode = false;
                for(var j:uint = 0; j < persoArray.length; j++) {
                    (animalArray[j]).removeEventListener(MouseEvent.MOUSE_DOWN,animalMouseDown);
                    (animalArray[j]).removeEventListener(MouseEvent.MOUSE_UP,animalMouseUp);
                    (animalArray[j]).buttonMode = false;
                for(var k:uint = 0; k < persoHitArray.length; k++) {
                    (persoHitArray[k]).visible = true;
                for(var l:uint = 0; l < animalHitArray.length; l++) {
                    (animalHitArray[l]).visible = true;
                buttons.rulesButton.removeEventListener(MouseEvent.CLICK,onRulesButtonClick);
                buttons.startGameButton.removeEventListener(MouseEvent.CLICK,onStartGameButtonClick);
                buttons.highScoresButton.removeEventListener(MouseEvent.CLICK,onHighScoresButtonClick);
                buttons.infoButton.removeEventListener(MouseEvent.CLICK,onInfoButtonClick);
                //completePage.linkButton.removeEventListener(MouseEvent.CLICK,onLinkButtonClick);
                mainTimer.removeEventListener(TimerEvent.TIMER,incrementCounter);
                countdownTimer.removeEventListener(TimerEvent.TIMER_COMPLETE,levelEnd);
                //countdownTimerEnd.removeEventListener(TimerEvent.TIMER_COMPLETE,gameEnd);
                //highScoresPage.rejouerButton.removeEventListener(MouseEvent.CLICK,onRejouerButtonClick) ;
                psuedoPage.goButton.removeEventListener(MouseEvent.CLICK,onGoButtonClick);
                gamePage = null;
                removeChildAt(0);
                addChildAt(highScoresPage, 0);
                highScoresPage.rejouerButton.visible = true;
                highScoresPage.blueMan.visible = true;

    I think the problem lies in the var in the last } else { statement below. I originally had this commented out because of the problem.
    On sending the variables to be added to the database it requests the scores again, but instead of 'refreshing' (i.e removing the old scores and replacing them with the updated scores) it is sending another request and just adding to the scores already in the boxes...
    Please don't hesitate to tell me if I'm not clear !
    function variableTransaction(fichier, modesend, tab, var1, var2) {
                var URLload = new URLLoader();
                var URLrequest = new URLRequest(fichier);
                var variables:URLVariables = new URLVariables();
                variables.tab = tab;
                variables.var1 = var1;
                variables.var2 = var2;
                if (modesend == "post") {
                    URLrequest.method = URLRequestMethod.POST;
                } else if ( modesend == 'get') {
                    URLrequest.method = URLRequestMethod.GET;
                if (var1 == false && var2 == false) {
                    URLload.dataFormat = URLLoaderDataFormat.VARIABLES;
                    URLrequest.data = variables;
                    URLload.load(URLrequest);
                    URLload.addEventListener(Event.COMPLETE, modeComplet, false, 0, true);
                } else {
                    URLrequest.data = variables;
                    URLload.load(URLrequest);
                    var receptobjet = variableTransaction(filesend, modesend, tab, false, false);

  • Actionscript 3 and PHP

    I'm trying to learn how to communicate between PHP and Flash and have run into a problem.  The PHP file loads albums and artists from a database.  I can get the PHP file to load okay, but I cannot access a certain variable from the PHP file.  Here is the PHP I am using:
    <?php
    $dbName = "database";
    $place = "localhost";
    $username = "username";
    $password = "password";
    $link = mysql_connect ($place, $username, $password);
    mysql_select_db($dbName, $link);
    $genreID = 4;
    $query = "SELECT g.name, a.artist, a.albumName";
    $query .= " FROM albums a, genre g";
    $query .= " WHERE a.genreID=g.id";
    $query .= " AND g.id=" . $genreID;
    $result = mysql_query($query);
    $response = "resp=loaded\n";
    $index = 0;
    while ($row = mysql_fetch_array($result)) {
         $response .= " artist " . " = " . $row['artist'];
         $response .= " album " . " = " . $row['albumName'];
         $response .= " genre " . " = " . $row['name']. "\n";
         $index++;
    $response .= "total= ".$index;
    echo $response;
    ?>
    The variable I am trying to trace in Flash from the PHP file is 'total'.  Here is the actionscript I am using:
    package
         import flash.display.*;
         import flash.net.*;
         import flash.events.*;
         import flash.text.TextField;
         public class Albums extends MovieClip
              var phpFile:String = "http://localhost/getAlbums.php";
              var displayText:TextField = new TextField();
              public function Albums()
                   // constructor code
                   var urlRequest:URLRequest = new URLRequest(phpFile);
                   var urlLoader:URLLoader = new URLLoader();
                   urlLoader.addEventListener(Event.COMPLETE, callServerHandler, false, 0, true);
                   urlLoader.load(urlRequest);
                   if (urlLoader)
                        trace("loaded url");
                   else
                        trace("error loading url");
              function callServerHandler(evt:Event):void
                   var loader:URLLoader = URLLoader(evt.target);
                   var dataObj:URLVariables = new URLVariables(loader.data);
                   trace ("Total Albums "+dataObj.total);
    When I trace this in the output window I get 'Total Albums undefined'.  Why would this be?   Also if I just trace 'trace ("Total Albums " +dataObj.total);' Then I get the information from the php file but where there should be spaces inbetween the information I get '%20',  how can I remove those?
    Thanks for any information offered.
    Ben.

    You might consider taking what is probably considered a more standard approach for interacting with a database, where you have the PHP file echo the output in XML format and have Flash  take care of parsing the XML. That way, the total can be determined by the size of the data that you collect as an array and you don't need to have PHP provide it... though you still could.
    I'd like to point you to a good AS3 tutorial for this, but I haven't found one (doesn't mean there isn't... you could try searching Google using "AS3 XML PHP tutorial").  When I started down this road I used an AS2 tutorial (http://www.gotoandlearn.com/play.php?id=20 ) to get the overall concept under my belt and followed up with an AS3 XML tutorial to deal with the different way than how AS2 processes XML.

  • Tutorial: Flash Builder 4 beta 2 and PHP Data/Services for beginners

    Hi fellas,
    I've written this tutorial for total beginners to get quickly to FB4 and PHP. Comments welcome
    Flash Builder 4 and PHP Data/Services for beginners
    http://www.flashrealtime.com/flash-builder-4-and-php-data-services/

    Hi,
    The first issue will be the pathing differences between wamp/mamp/xampp, some use www as root others htdoc you need to setup the php services on your local machine rather than importing a project.
    The created services will have a connection array declared at the top of the code that points to the mysql server, in the project default debug folder you will have the config file that has the zend and webserver path
    top of service file
    ============
    var $username = "root";
    var $password = "";
    var $server = "localhost";
    var $port = "3306";
    var $databasename = "zend";
    var $tablename = "clients";
    var $connection;
    amfconfig.ini
    =========
    [zend]
    ;set the absolute location path of webroot directory, example:
    ;Windows: C:\apache\www
    ;MAC/UNIX: /user/apache/www
    webroot =C:/wamp/www
    ;set the absolute location path of zend installation directory, example:
    ;Windows: C:\apache\PHPFrameworks\ZendFramework\library
    ;MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework/library
    ;zend_path =
    [zendamf]
    amf.production = false
    amf.directories[]=Zender-debug/services
    In your main project folder you have a .model folder the file there is an *.fml file that contains your channel endpoints etc.
    David.

Maybe you are looking for

  • Office 2013 is allways inuse

    I created Office2013 package with officedeploymenttool.exe, and its works otherwise nicely (app starts etc.) BUT when use get-appvclientpackage information it says my office package is allways inuse. Even i restart machine and login with admin, its a

  • How to integrate Java SSO with Oracle Weblogic

    Hi, I am new to Oracle weblogic, but i want to do something like below. I want to use Oracle weblogic as application server and want to integrate Java SSO into it. I think we can do it using Oracle access manager but since OAM itself is massive drop

  • Ports 139 and 445 dangerous on Mac OS X?

    I have a Mac OS X iBook that is sharing files with Windows XP PC using SMB. When I start up my Mac the Norton Firewall ask me whether or not I want ports 139 and 445 to connect. I know that port 139 should not be open for a Windows computer because o

  • Is there a listing of all Auth.Objects for SAP and the discription for them

    I would like to know if there is a listing of all the Auth.Objects  for SAP out there somewhere?? Thank you, Robert

  • How to STOP the IBM Websphere FAST

    Is there any way to restart or stop the IBM Webspehere FAST ?? It takes too long to stop. --Bhupendra Mahajan