Welcome, Guest
  • Author Topic: PHP + Flash  (Read 1959 times)

    zac

    • Server what's that
    • *
    • Posts: 5
      • View Profile
      • Email
    PHP + Flash
    « on: 07/16/02, 21:17 »
    All I'm trying to do is grab information from a SQL database via PHP and flash.  I have the PHP part down easily.  I can grab all of the records from the database etc.  The problem I am having is using Flash to grab the information FROM the PHP.  I've tried reading tutorials with no luck.

    I know that you have to create an object using loadvars, but beyond that I'm kind of lost.  Any suggestions/help would be greatly appreciated.

    My AIM is zseml and my MSN is zemmel5905@hotmail.com

    Thanks,

    zac

    Flash-db

    • Administrator
    • Systems Administrator
    • *****
    • Posts: 1876
      • View Profile
      • Flash-db.com
    Re:PHP + Flash
    « Reply #1 on: 07/16/02, 21:37 »
    Try reading this thread (about the 5th post down).

    It goes over it in some detail:

    http://www.flash-db.com/Board/index.php?board=18;action=display;threadid=1259


    I am working on an easier to follow and fixed up version of that explaination though.  It will be posted in the "Technical Reference Area" of this board when done.

    Basically when passing complex record sets from a database to a Flash Object - format is everything.  Then you just assign individual records to a dataProvider (which is a Object in itself).

    Remember Movie Clips and Objects in Flash are basically the same thing.

    Flash-DB

    zac

    • Server what's that
    • *
    • Posts: 5
      • View Profile
      • Email
    Re:PHP + Flash
    « Reply #2 on: 07/16/02, 22:23 »
    Hm, I've tried the following:


    http://www.fugoff.com/test.php =

    <?php
    echo "&test=hi mofo";
    ?>

    My flash file has this:

    on (press, release) {
       phpTest = new LoadVars();            // Initialize data Object..
       phpTest.load("http://www.fugoff.com/test.php");  // the file to Load..
       blah = phpTest.test;
    }

    Where blah is a dynamic text variable.  I am just trying to dynamically set the text of the variable from a PHP file.  What am I doing wrong?

    zac

    • Server what's that
    • *
    • Posts: 5
      • View Profile
      • Email
    Re:PHP + Flash
    « Reply #3 on: 07/16/02, 22:55 »
    Anyone have any ideas?  Im out of them and very frustrated!


    Thanks,

    zac

    Flash-db

    • Administrator
    • Systems Administrator
    • *****
    • Posts: 1876
      • View Profile
      • Flash-db.com
    Re:PHP + Flash
    « Reply #4 on: 07/16/02, 23:01 »
    1:  Give your Text field an Instance Name instead of a Variable Name.

    Call it something like  - myText

    Then you can use something like this:

    on (release) {
    myData = new LoadVars();
    myData.onLoad = addItems; // Function to call when loaded
    myData.load("myTextFile.txt");

    }

    ---------------------
    The AddItems Function
    --------------------
    function addItems() {

    myText.text = myData.test;

    }

    Now your Text Field with the instance myText - will contain the value for test (hi mofo) from the text file.

    You have to reference these things seperatly (they don't just automatically populate the text fields - when their contained in an object like 'myData'.

    Does that help?

    Flash-DB

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re:PHP + Flash
    « Reply #5 on: 07/30/02, 11:51 »
    Hi,
    what I am missing in your dexcription is the Textfield inside the Flashmovie.

    If you have only one level of movies, and you have a textbox with the variable name of "testtext", then your PHP-Script must output:

    _root.testtext=your text out of the database&other variables can follow in the same matter.

    Good luck
    Ron 8)
    happy flashing
    8)
    Ronald

    Jeancarlo

    • Server what's that
    • *
    • Posts: 1
      • View Profile
      • Email
    PHP + Flash???
    « Reply #6 on: 08/08/02, 17:59 »
    how can i get the right response, i mean if i did this:

    ///in Flash
    Data = new LoadVars();
    Data.onLoad = ShowData;
    Data.load("testing.php");

    function ShowData() {
    caption.text = Data.caption;               //caption is the textfield name/var
    }

    ///in PHP -- texting.php

    <?php
    $caption="Testing Flash and Php";
    echo "&caption=".$caption;
    ?>

    //RESULT in the flash textfield

    ------------------
    |.$caption;    |
    |?>        |
    |                |
    ------------------
    wrong!!!

    the right response shoul be this:

    -------------------
    |Testing Flash |
    | and Php        |
    |          |
    -------------------

    How can i get it???? ???