Jump to content


Photo

Setting ActionScript variables from PHP


  • Please log in to reply
26 replies to this topic

#21 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 23 October 2006 - 01:51 PM

Excellent! Very glad to hear you got it working. Sorry I couldn't be much more help when you needed it, though ;)
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#22 Germaris

Germaris
  • Members
  • PipPipPip
  • Advanced Member
  • 97 posts
  • LocationCanada

Posted 23 October 2006 - 02:13 PM

Please, don't be sorry.
And, if you want to help me more, there is another little question:

Some variables n returned by the server are equal to 0, i.e. this variables are empty.
In Flash AS, is there a SIMPLE method to prevent empty fields to be populated with the word "undefined" and to have these fields populated with a zero instead?
;D

#23 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 23 October 2006 - 02:19 PM

I don't know of a way with actionscript, but you could run a simple check with PHP when you populate the string, and put in a zero instead of the empty string. If your variable is coming out empty from the database, just do an empty() check as you populate your string:
<?php
$n = empty($n) ? "0" : $n;
print("&$list=$n");
?>

Would that work? Hypothetically, that way, you always have a value (even if it's zero) returned to actionscript, and then you can deal with the zeros there.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#24 Germaris

Germaris
  • Members
  • PipPipPip
  • Advanced Member
  • 97 posts
  • LocationCanada

Posted 23 October 2006 - 02:34 PM

It doesn't work...
>:( :o :-\ ???

#25 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 23 October 2006 - 03:56 PM

It doesn't work...
>:( :o :-\ ???


Can you post an output string as it stands with some empty variables? That would help me see exactly what is getting returned to AS at this point. I'll review your initially posted code in the meantime.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#26 Germaris

Germaris
  • Members
  • PipPipPip
  • Advanced Member
  • 97 posts
  • LocationCanada

Posted 23 October 2006 - 04:26 PM

Problem solved!

mySearch.onLoad = function(ok) {
	if (ok) {
		mySearch.undefined == "0";
		_root.aiFld.text = mySearch.ai;
		_root.adFld.text = mySearch.ad;
		_root.auFld.text = mySearch.au;
		_root.errorMsg.text = "OK";
	}
	else {
		_root.errorMsg.text = "BAD";
	}
};

This AS leaves the dynamic fields blanks which is satisfactory...

;) ;) ;)

#27 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 23 October 2006 - 04:43 PM

Excellent. Glad you got it working! ;)
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users