Steep Freaks
05-15-2006, 11:06 AM
Hi All
In the past I have found it unnecessary to post by simply making use of the search feature because virtually every question I can think of has been asked before. In this case I cannot find an answer either here or on phpfreaks or tizag. I am using Flash 5, if that makes a difference here?
My question is this: What format is a variable in when it comes from PHP to flash?
The background is this: I am having PHP evaluate if a cookie is set and then set a variable in flash. Flash then needs to evaluate that if the variable is set then it needs to load a movie into level 3.
The debugging is this: I have tested the PHP and it returns &language=yes. From there I put a dynamic text box on the stage with the variable _level0.language and the text box displays yes when loaded from the server. It also does not display yes when the cookie is not loaded. So I know flash is getting the variable, I know the variable is only set when the cookie is. I have tried adding and removing the quotes around "yes" and adding and removing spaces and even changing it to != and none of that has changed anything. I have been able to get the cookieset.swf to load by simply loading it so I know my path and everything to that are correct.
I now need to be able to evaluate if the language variable is set or if is equal to or not equal to a given value.
I have included all the pertinent code below (I think):
This is what I want to do: (not working)
loadVariablesNum ("/test/cookieset.php", 0);
if (_level0.language == "yes") {
loadMovieNum ("cookieset.swf", 3);
}
cookieset.php contains this:
<?php
if($_COOKIE['language'] == "english"){
include_once "cookieset2.php";
}elseif($_COOKIE['language'] == "french"){
include_once "cookieset2.php";
}elseif($_COOKIE['language'] == "german"){
include_once "cookieset2.php";
}elseif($_COOKIE['language'] == "italian"){
include_once "cookieset2.php";
}elseif($_COOKIE['language'] == "spanish"){
include_once "cookieset2.php";
}else
?>
and cookieset2.php contains this:
<?php
echo "&language=yes";
?>
I would appreciate no smart-ass comments on my horrible syntax, as I suck at writing code and typically end up debugging and patching things together. For example I know I can use isset rather than all the elseif statements but it seems to work better and I'm not sure if I have to use the include_once but flash seemed to not read it properly otherwise.
Thanks very much for taking the time to read my unnecessarily long post and any and all help is much appreciated.
Steep Freaks Gear
In the past I have found it unnecessary to post by simply making use of the search feature because virtually every question I can think of has been asked before. In this case I cannot find an answer either here or on phpfreaks or tizag. I am using Flash 5, if that makes a difference here?
My question is this: What format is a variable in when it comes from PHP to flash?
The background is this: I am having PHP evaluate if a cookie is set and then set a variable in flash. Flash then needs to evaluate that if the variable is set then it needs to load a movie into level 3.
The debugging is this: I have tested the PHP and it returns &language=yes. From there I put a dynamic text box on the stage with the variable _level0.language and the text box displays yes when loaded from the server. It also does not display yes when the cookie is not loaded. So I know flash is getting the variable, I know the variable is only set when the cookie is. I have tried adding and removing the quotes around "yes" and adding and removing spaces and even changing it to != and none of that has changed anything. I have been able to get the cookieset.swf to load by simply loading it so I know my path and everything to that are correct.
I now need to be able to evaluate if the language variable is set or if is equal to or not equal to a given value.
I have included all the pertinent code below (I think):
This is what I want to do: (not working)
loadVariablesNum ("/test/cookieset.php", 0);
if (_level0.language == "yes") {
loadMovieNum ("cookieset.swf", 3);
}
cookieset.php contains this:
<?php
if($_COOKIE['language'] == "english"){
include_once "cookieset2.php";
}elseif($_COOKIE['language'] == "french"){
include_once "cookieset2.php";
}elseif($_COOKIE['language'] == "german"){
include_once "cookieset2.php";
}elseif($_COOKIE['language'] == "italian"){
include_once "cookieset2.php";
}elseif($_COOKIE['language'] == "spanish"){
include_once "cookieset2.php";
}else
?>
and cookieset2.php contains this:
<?php
echo "&language=yes";
?>
I would appreciate no smart-ass comments on my horrible syntax, as I suck at writing code and typically end up debugging and patching things together. For example I know I can use isset rather than all the elseif statements but it seems to work better and I'm not sure if I have to use the include_once but flash seemed to not read it properly otherwise.
Thanks very much for taking the time to read my unnecessarily long post and any and all help is much appreciated.
Steep Freaks Gear