Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-09-2005, 02:49 PM   #1
Registered User
Join Date: Jun 2005
Posts: 10
Default URL (with query string) not passing into flash

I have a flash movie that takes a set of variables and parses them into a new URL, which the flash movie will in turn retrieve.

My flash movie can return the variables and parse the correct NEW URL from a text file; however, it cannot do that when the variables are in the PHP file.

ActionScript Code:
on (press) {      var inURL = "test.txt";      var outURL = "http://www.ubcatering.com/nobodys_cold_nobodys_warm3.php";      lvTest = new LoadVars();      lvTestOut = new LoadVars();      lvTest.onLoad = function(success) {           if (success) {                trace("true from onLoad");                lvTestOut.aVariableSetByMe = "somecgifunction";                lvTestOut.isCallpage = this.isCallpage;                lvTestOut.isLevel = this.isLevel;                lvTestOut.callpage = this.callpage;                lvTestOut.offset = this.offset;                if (this.isCallpage != undefined) {                     lvTestOut.send(outURL,"_self", "get");                };           } else {                trace("false from onLoad");           }      };      lvTest.load(inURL); }

I need my inURL to be equal to the URL that is loaded when the PHP page is loaded by the user.

For example:

a user opens the page, the URL is: http://www.site.com/index.php?callpa...ome&level=full
the php page will then create the variables based on what the URL variables are

but the flash calls the URL:
www.site.com/index.php (with no query string because it doesn't know, and there's a ton of variations on it)
since it doesn't know whatthe header variables are that the user's browser retrieved, the flash calls plain old index.php without any variables, and therefore, the variables in index.php are undefined and the outURL does not work.
Aaronin is offline   Reply With Quote
Old 06-09-2005, 08:22 PM   #2
Registered User
Join Date: Jun 2005
Posts: 10

For everyone's future reference (if you from the future stumble upon this thread with a similiar problem), the solution is using the flashvars function to pass the variables along.

(Once I found out about flashvars, there was a goood number of other threads on the website there to help me out...)

PHP Code:
<div id=\"top\">
        <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"250\" height=\"59\" id=\"Untitled-1\" align=\"left\">
            <PARAM NAME=\"flashvars\" value=\"
            <param name=\"allowScriptAccess\" value=\"sameDomain\" />
            <param name=\"movie\" value=\"graphics/left_header.swf\" />
            <param name=\"quality\" value=\"high\" />
            <param name=\"wmode\" value=\"transparent\" />
            <param name=\"bgcolor\" value=\"#00ff66\" />
            <embed flashvars=\"
$flashheader\" src=\"graphics/left_header.swf\" quality=\"high\" wmode=\"transparent\" bgcolor=\"#00ff66\" width=\"250\" height=\"59\" name=\"Untitled-1\" align=\"left\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />
        <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"250\" height=\"59\" id=\"Untitled-1\" align=\"right\">
            <param name=\"allowScriptAccess\" value=\"sameDomain\" />
            <param name=\"movie\" value=\"graphics/right_header.swf\" />
            <param name=\"quality\" value=\"high\" />
            <param name=\"wmode\" value=\"transparent\" />
            <param name=\"bgcolor\" value=\"#00ff66\" />
            <embed src=\"graphics/right_header.swf\" quality=\"high\" wmode=\"transparent\" bgcolor=\"#00ff66\" width=\"250\" height=\"59\" name=\"Untitled-1\" align=\"right\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />

ActionScript Code:
on (press) {     //_global.offset = this.offset      var stringcallpage = "callpage=" + this.callpage;       trace(stringcallpage);      var inURL =  "http://www.ubcatering.com/index.php";      var outURL = "http://www.ubcatering.com/index.php?"+stringcallpage+"&level=full_service"+"&";      trace(inURL);       trace(outURL);      lvTest = new LoadVars();      lvTestOut = new LoadVars();      lvTest.onLoad = function(success) {           if (success) {                trace("true from onLoad");               //  lvTestOut.aVariableSetByMe = "somecgifunction";               // lvTestOut.isCallpage = this.isCallpage;               // lvTestOut.isLevel = this.isLevel;              //  lvTestOut.callpage = this.callpage;              //  lvTestOut.offset = this.offset;                lvTestOut.send(outURL,"_self", "get");           } else {                trace("false from onLoad");           }      };      lvTest.load(inURL); }

I'm not an actionscript expert, but I'm starting to have a much better understanding of how this stuff works.
Aaronin is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 02:13 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.