By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 712 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

Flash, PHP & loadVariablesNum()

P: n/a
Ok...
I am having problems getting variables/values INTO Flash from an
external source (PHP).
I'm NOT having problems getting loadVariablesNum() to _SEND_ variables
via POST, but I _AM_ having difficulty reading back into Flash local
variables.

Say, for instance, I have a Flash page that has a number of typein
fields. Each of the typeins has a variable associated with it.

In the action script section, I have something like this for a "Save"
button:

on(release) {
var result = "unset";
loadVariablesNum("foo.php", 0, "POST");

if (result == "ok")
{
getURL("bar.html");
}
}
Now, foo.php runs fine and is able to see all of the typein variables
in its HTTP_POST_VARS array and works properly and outputs:
result=ok

The locally scoped 'result' variable never gets changed.
If, however, I create a typein field and give it a variable called
'result' (and get rid of the local 'result' variable declaration in
the action section), the text typein field displays "ok" after
clicking on the "save" button.

What gives?
How does one declare/create variables in Flash that are locally (or
globally, I don't really care) scoped variables that are NOT UI
elements, but DO work for reading values back from an external source
(PHP, Python, txt file, ...)?

I've done some reading of the Flash documentation, and
loadVariablesNum() and loadVariables() sections are too terse and the
examples aren't very useful.

Furthermore, there seems to be an awful lot of WRONG information out
on the various websites and Q&A sites.

Thanks.
-Ralph
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Ralph Seguin wrote:

Ok...
I am having problems getting variables/values INTO Flash from an
external source (PHP).
I'm NOT having problems getting loadVariablesNum() to _SEND_ variables
via POST, but I _AM_ having difficulty reading back into Flash local
variables.

Say, for instance, I have a Flash page that has a number of typein
fields. Each of the typeins has a variable associated with it.

In the action script section, I have something like this for a "Save"
button:

on(release) {
var result = "unset";
loadVariablesNum("foo.php", 0, "POST");

if (result == "ok")
{
getURL("bar.html");
}
}

Now, foo.php runs fine and is able to see all of the typein variables
in its HTTP_POST_VARS array and works properly and outputs:
result=ok

The locally scoped 'result' variable never gets changed.
If, however, I create a typein field and give it a variable called
'result' (and get rid of the local 'result' variable declaration in
the action section), the text typein field displays "ok" after
clicking on the "save" button.

What gives?
How does one declare/create variables in Flash that are locally (or
globally, I don't really care) scoped variables that are NOT UI
elements, but DO work for reading values back from an external source
(PHP, Python, txt file, ...)?

I've done some reading of the Flash documentation, and
loadVariablesNum() and loadVariables() sections are too terse and the
examples aren't very useful.

Furthermore, there seems to be an awful lot of WRONG information out
on the various websites and Q&A sites.

I made a portfolio using Flash MX, PHP and mySQL.

loadVariablesNum("http://www.mysite.com/scriptname.php?doit=getcats", 0);

"Scriptname.php?doit=getcats" produces the following output in plain text:

title=Logos%201,Logos%202,Logos%203,Brochures%201, Brochures%202,Posters,Outdoor%20Media,POS,Print%20 Ads,Direct%20Mail,Signs,Labels,Fleet%20Graphics,Pr omotional%20Items,Gift%20Certificates,Contests,Ill ustrations,Sales%20Presenter,

And that's all there is to it. make sure to url encode your variables.

Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.