Welcome, Guest. Please login or register.
Did you miss your activation email?
02/03/12, 23:50
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)
| | |-+  How to use variables from php to load movie in flash?
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: How to use variables from php to load movie in flash?  (Read 1779 times)
Julia Y
Server what's that
*
Posts: 3


View Profile
« on: 01/28/10, 12:30 »

Hi, I am a newbie in flash and action script.
Just wondering how can I use the variables (which is imported from a php file) to load a movie in flash.
In my php file, I have echo the variables so that Flash can read it.
<?php
echo "&user=".$userStatus;
?>
I have defined two variables i.e. $user=1 and $user=0.
If $user=0, the user could continue to the main movie as he/she is logging in.
if $user=1, the user couldn't continue to the main movie as he/she is not logging in.

I am using action script 2.0, level 2 in order to load my main movie.
Action Script 2.0 Button:
on(Release)
{
lvIn = new LoadVars();
lvIn.load("userStatus.php");
lvIn.onLoad = function(success)
{
    if (success)
    {
           if(lvIn.user==0)
           {
           loadMovieNum("mainMovie",1);
           }
           else
           {
           loadMovie("logout.php", "_self");
           }
     }
    else
    {
           loadMovie("logout.php", "_self");
    }
};
}

Am I on the right track in doing this? Can somebody help me to correct it and give me some advices, please?
Thanks!
Logged

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


View Profile WWW Email
« Reply #1 on: 01/28/10, 14:02 »

Hi Julia,
and welcome to the boards.

If you want to load a movie, it should be a movie, and not a php script.

You can use any movie name you like, as long as the movie resides at the same domain.

You can even send this link to the movie dynamicly by the php script.

I suppose, that is what you wanted.

in this case, your IF-Structure could go into the php side.

Code:
<?php
....
if(
$userStatus==0){
   
$nextMovie="mainMovie.swf";
}else{
   
$nextMovie="bye.swf";
}

echo 
"user=".$nextMovie;
?>


at the flash side, it is only a single line Wink

if(success) loadMovie(lvIn.user);
Logged

happy flashing
Cool
Ronald
Julia Y
Server what's that
*
Posts: 3


View Profile
« Reply #2 on: 02/01/10, 06:09 »

Thanks so much.
I think my problem is solved.
 Wink
Logged

Newbie  Smiley
findppm
Server what's that
*
Posts: 3


View Profile Email
« Reply #3 on: 02/08/10, 11:30 »

Thanks for your valuable information regarding how to use variables from php to load movie in flash. I was searching out a solution of that. Now I can load movie in flash easily.
Logged

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