Flash, PHP & loadVariablesNum()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ralph Seguin

    Flash, PHP & loadVariablesNum()

    Ok...
    I am having problems getting variables/values INTO Flash from an
    external source (PHP).
    I'm NOT having problems getting loadVariablesNu m() 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";
    loadVariablesNu m("foo.php", 0, "POST");

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


    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
    loadVariablesNu m() 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
  • Shawn Wilson

    #2
    Re: Flash, PHP & loadVariablesNu m()

    Ralph Seguin wrote:[color=blue]
    >
    > Ok...
    > I am having problems getting variables/values INTO Flash from an
    > external source (PHP).
    > I'm NOT having problems getting loadVariablesNu m() 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";
    > loadVariablesNu m("foo.php", 0, "POST");
    >
    > if (result == "ok")
    > {
    > getURL("bar.htm l");
    > }
    > }
    >
    > 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
    > loadVariablesNu m() 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.[/color]


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

    loadVariablesNu m("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,Logo s%203,Brochures %201,Brochures% 202,Posters,Out door%20Media,PO S,Print%20Ads,D irect%20Mail,Si gns,Labels,Flee t%20Graphics,Pr omotional%20Ite ms,Gift%20Certi ficates,Contest s,Illustrations ,Sales%20Presen ter,

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

    Shawn
    --
    Shawn Wilson
    shawn@glassgian t.com

    Comment

    Working...