A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: please help: flash & php simple question...

  1. #1
    Member of the Flashist Party
    Join Date
    Nov 2001
    Posts
    146

    please help: flash & php simple question...

    I know this must be simple but it is escaping my mind.

    on frame 1, I have a flash input form for last name and zip code.
    Then I send the variables to a php file which checks against a database to see if the user exists.

    What I need:

    I need php to send back a variable telling flash whether the user exists and if so, to move to frame 2.

    Please help me figure out how to do that.
    Your help is much appreciated. I am trying to finish a wedding website with an RSVP function to it.

    Thanks.
    If you can't convince them,
    confuse them...

  2. #2
    Senior Member
    Join Date
    Apr 2004
    Location
    Missouri
    Posts
    384
    Send the data to the PHP script using a LoadVars object. Use the function sendAndLoad(), and have the targetObject be the LoadVars object.

    You can then create a function like this.

    code:

    LoadVarsOb.onLoad = function( success ){
    if( success ){
    if( this.Data == 1 ){
    gotoAndStop(2);
    }
    }else{
    //Do something. Failed to send data.
    }
    }



    The php script would need to do a print "&Data=1"; if the user exists and print "&Data=0"; if the user doesn't exist. You may need to put quotes around the 1 in the if statement.

  3. #3
    Member of the Flashist Party
    Join Date
    Nov 2001
    Posts
    146
    Thank you, that worked great.

    Now I am having problems bringing the variable that the php script sent back.

    It spits back a number, and I want to goto frame 2 and display that number in a dynamic text box. I can't seem to get the resulting number to come over to frame 2.

    Doesn't the imported variable reside in the entire timeline of the MC and not just the frame?

    Any suggestions anyone???
    Last edited by FlashArrow; 05-28-2004 at 12:21 PM.
    If you can't convince them,
    confuse them...

  4. #4
    Member of the Flashist Party
    Join Date
    Nov 2001
    Posts
    146
    Anybody?

    (Things that go BUMP in the night...)
    If you can't convince them,
    confuse them...

  5. #5
    Member of the Flashist Party
    Join Date
    Nov 2001
    Posts
    146
    Alright.

    Me dummy!

    I forgot to set the text fields to embed all characters, so the variables weren't displaying.

    Sorry. Carry on... Nothing to read here...
    If you can't convince them,
    confuse them...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center