A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Pass variables to my swf from a url link

  1. #1
    Senior Member
    Join Date
    Sep 2006
    Posts
    248

    Pass variables to my swf from a url link

    Hello everyone,
    I was wondering if there is a way to pass variables to my swf from a simple url link, like:
    http://www.whatever.com/myswf.swf?bla=123&bla2=456
    So on my swf i would get the values of bla and bla2.

    Kind regards,
    Leo.

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You need a php page, where your movie is embedded. Here is an example of such page, where the login data are transferred to the movie.
    PHP Code:
    <?php
    /************************************************************
    Payment.php
    *************************************************************/

    // variables from the movie

    $log $_GET['login'];

    echo 
    "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
    <head>
    <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
    <title>Mailing</title>
    <script language='javascript'>AC_FL_RunContent = 0;</script>
    <script src='AC_RunActiveContent.js' language='javascript'></script>
    </head>
    <body bgcolor='#ffffff'>
    <center>
    <script language='javascript'>
        if (AC_FL_RunContent == 0) {
            alert('This page requires AC_RunActiveContent.js.');
        } else {
            AC_FL_RunContent(
                'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
                'width', '900',
                'height', '750',
                'src', 'Payment',
                'quality', 'high',
                'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
                'align', 'middle',
                'play', 'true',
                'loop', 'true',
                'scale', 'showall',
                'wmode', 'window',
                'devicefont', 'false',
                'id', 'Payment',
                'bgcolor', '#ffffff',
                'name', 'Payment',
                'menu', 'true',
                'allowFullScreen', 'false',
                'allowScriptAccess','sameDomain',
                'movie', 'Payment?login="
    .$log."',
                'salign', ''
                ); //end AC code
        }
    </script></a>
    </center>
    </body>
    </html>"
    ;

    ?>
    Inside your movie you are asking for the loaderinfo:

    root.loaderInfo.parameters.login
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Senior Member
    Join Date
    Sep 2006
    Posts
    248
    Thanks a lot!
    Gonna work on it right away!

  4. #4
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    You don't need PHP. Swfobject has a built in method called getQueryParamVal
    http://clipboard.com/clip/LQXr7IQ1Zg...bsa1ydPdva3due
    http://code.google.com/p/swfobject/wiki/api

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center