SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting variables from PHP to Flash

    I have a problem. I want to use PHP variables in Flash movie, but i don't know how to get those variable values into Flash.
    And how to get values from tags
    Code:
    <param name="param_name" value="param_value">
    Now, how do i get the value "param_value"?

  2. #2
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found this on a Dutch site:

    PHP Code:
    <?

        
    class flashvarbox {
            var 
    $vararray;
            
            function 
    dovar($name,$value) {
                
    $this->vararray[$name]    = $value;
            }

            function 
    countelements() {
                return 
    count(array_keys($this->vararray));
            }
        
            function 
    send() {
                
    $i             0;
                while(list(
    $name,$value) = each($this->vararray)) {
                    
    $i++;
                    echo 
    $name."=".urlencode($value);
                    if(
    $i<count($this->vararray)) {
                        echo 
    "&";
                    }
                }
            }
        }

    ?>

    <?
        $flashpoll        
    = new flashvarbox();
        
    $flashpoll->dovar('0','0');
        
    $flashpoll->dovar('mail','ibram007@localhost');
        
    $flashpoll->dovar('name','ibram007');
        
    $flashpoll->send();

    ?>
    First frame in your movie:

    Code:
    loadVariablesNum ("http://path/to/phpvars.php", 0);
    Make a text field in flash, change it in text-options to 'dynamic text' and enter by 'variable' this for the var name: '_level0.naam' (without ').

    Worked fine for me, but I didn't use it in one of my site. Only for local testing.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •