all groups > flash actionscript > november 2004 >
You're in the

flash actionscript

group:

Recieving a parameter from php


Recieving a parameter from php Superjan
11/26/2004 9:33:26 PM
flash actionscript:
Hi.
I hate to ask this question, but don't have a clue what to do really.

I want to recieve a parameter sendt from php and test it in an
if/else-statement.

This is how I send the parameter:
value="calendar.swf?d=<?php echo $date; ?>"

Can anyone help me. And explain in the easiest way? :confused;

Or is it any other easy way to get parameters from server? (All I want is the
date...)
Re: Recieving a parameter from php mikepeloso
11/27/2004 1:48:37 AM
Re: Recieving a parameter from php J_o_h_n_n_y
11/27/2004 5:05:11 AM
You could do it, it just wouldn't be as simple as the line you used as an
example.

You could have a php file with:

<?php
header("content-type: text/xml");
echo "<returndata><date>".date("l dS of F Y h:i:s A")."</date></returndata>";
?>

Then use XML.load() with that file. You could use loadVariables too,but...
bleh.
Re: Recieving a parameter from php Superjan
11/27/2004 11:48:35 AM
Ok, I tried to do it in an easier way, but still I'm stuck

This looks easy, but I don't get it to work. I have been trying a couple of
tutorials with no luck

I want to get a simple string from my php-script so i can check the date in
mye christmas-calendar: If it's not the december 2nd, it won't open and so on.

So I have made an ease php-script that gets todays date and try to load this
by using 'loadVariables'.
Yes, and I'm on Flash 5.

So again: this is what I want to do:
Load a string from php: for example: 02.12.2004

And do an if/else in flash if(var eq "02.12.2004) go to(5)

A helping hand anyone?
A code-example would be very nice, cos as I said I'm close to going nuts
here...
Re: Recieving a parameter from php NSurveyor
11/27/2004 12:51:34 PM
You are trying to make a complex answer to a simple problem. Flash has built in
date functions. Here is a script that should work:

now = new Date();
nMonth = now.getMonth()+1;
nDate = now.getDate();
nYear = now.getFullYear();
if(nMonth == 2 && nDate == 12 && nYear == 2004){
gotoAndStop(5);
}
Re: Recieving a parameter from php Superjan
11/27/2004 1:43:35 PM
I don't think I make it more complex than I need to??
Cos I need to get the date from server and not from each computer. I don't
want the users to be able to "trick" my script and open the wrong days....

But thank you for your reply!!
Re: Recieving a parameter from php NSurveyor
11/27/2004 1:57:15 PM
Have you tried, just:
Re: Recieving a parameter from php Superjan
11/28/2004 1:01:51 PM
I tried that, but did not know how to recieve the parameter, so I have tried it
with the loadVariables instead.

And I now have managed to use this in the way that I get text from a txt-file
and then printing it to screen by using the loadVariable-command and giving the
input-textboxes the same name as the variables in the text-file. What I send is
this: header=Overskrift&theText=Scientists in Bali discovered... and som on.

Ok. This is good. Some progress at least, but not really what I want to do.
What I want is to send a variable from a PHP-file so I can test it.

This is my php-code:

<?php
$dagensd = date("d.m.Y", mktime(0,0,0, date('m'), date('d'),date('Y')));
echo ?&flashdate=$dagensd?;
?>

Is it ok?

Then I try to recieve this in flash and do an if/else test.
This is my code in flash:

on (release) {
loadVariablesNum ("datetest.php", 0, "GET");
if(flashdate=="28.11.2004"){
gotoAndStop (2);
}
else{
gotoAndStop (3);
}
}

But it do not work. What?s wrong?
Please help!! Anyone??

And a last question: how can I display the variable sendt to flash. In php
theres echo, but in flash we use...?

AddThis Social Bookmark Button