1 Reply Latest reply on Nov 7, 2006 2:54 PM by jonnybennett

    sending variables to flash from php code

      I have this login form that works with a sql database. When a user submits login info, it is check against the database through a php doc. If the information matches, the php doc sends an ok to the flash doc to move to the next frame.

      This works fine.

      I am now trying to use the load movie function in flash on the next frame to load an external swf on level 10.

      basically this:

      ifFrameLoaded (1) {
      loadMovie(file.swf", 10);

      However, I would like to have the "file" in "file.swf" replaced by the users username:


      ifFrameLoaded (1) {
      loadMovie(userName+".swf", 10);

      My question is... How do I write the php code to send the 'user' or 'steve' variable to this frame in flash? and second... what do I need to do in the flash doc to make this work?

      Any help would be greatly appreciated... I have pasted the php code below.



      //connect to database
      if ($user && $pass){
      mysql_pconnect("dbhost","dbusername","dbpassword") or die ("didn't connect to mysql");
      mysql_select_db("dbname") or die ("no database");
      //make query
      $query = "SELECT * FROM login WHERE username = '$user' AND password = '$pass'";
      $result = mysql_query( $query ) or die ("didn't query");

      //see if there's an EXACT match
      $num = mysql_num_rows( $result );
      if ($num == 1){
      ///checklog= function in flash move. if checklog=1 then movie advances to next frame
      print "status=Connected&checklog=1";
      } else {
      print "status=Sorry, your user name and password are not valid.&checklog=2";


        • 1. Re: sending variables to flash from php code
          jonnybennett Level 1
          In your php add a variable for the successful username:


          print "status=Connected&checklog=1&userName=".$user;

          your A>s>

          sendUser=new LoadVars();
          recievedUser=new LoadVars();


          if (recievedUser.status=='Connected')
          loadMovie(userName+".swf", 10);}}

          Hope this helps.