Welcome, Guest. Please login or register.
Did you miss your activation email?
02/07/12, 08:10
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  General
| |-+  Flash 8 (Moderators: Jorge Solis, ..:: Mazhar Hasan ::.., Andresss)
| | |-+  LoadVars object in comparing received variables
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: LoadVars object in comparing received variables  (Read 906 times)
Julia Y
Server what's that
*
Posts: 3


View Profile
« on: 05/20/10, 03:25 »

Hi. I need some help, please.
May I know if there is a way to compare the variables from php so that I could check the user's logged in status in flash?

My php echos:
Quote
<?php
   $logStatus="0";     //if user is logging in
   $logStatus="1";     //if user is not logging in

echo "&status=".$logStatus;
?>

I had used LoadVars object (which is executed in a button) to received the variables from php.
My actionscript 2.0:
Firstly, I would like to trace the loaded variable from php, and it works.
Quote
on(Press){
   myVar = new LoadVars();
   myVar.load ("user.php");
   myVar.onLoad = function (success)
  {
        if (success)
       {
             output.text = myVar.status;  //the output show 0 if I did log in the account
       }
   };
}

But once I changed it to compare the variable that I had received, it didn't work at all.
Quote
on(Press){
   myVar = new LoadVars();
   myVar.load ("user.php");
   myVar.onLoad = function (success)
  {
        if (success)
       {
              if(myVar.status == "0")
              {
                      nextFrame();      //so that user who logged in can continue to the swf, but it didn't work
              }
              else
             {
                      gotoAndStop(15);      //restrict the user to continue and stop at the last frame
              }
       }
   };
}

It will gotoAndStop at frame 15 no matter what status that I have received. The if condition seems like doesn't take action.
Am I wrong in coding the if condition? Can someone explain and give me some advices?
Logged

Newbie  Smiley
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6161


View Profile WWW Email
« Reply #1 on: 05/20/10, 12:37 »

did you check, if it was converted to a numeric 0?

in that case you have to compare $logStatus==0 Wink
Logged

happy flashing
Cool
Ronald
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything