If I understand you correctly, then no, getURL does not pass all
variables if you make a call using the javascript: pseudo-protocol
syntax because it's not generating the same kind of request.
-------------------------------
Example 1.
function reportEvent(e) {
var eType = e.type;
var eName = e.target.id;
var url = "javascript:catchClick('" + eName + "','" + eType +
"')";
getURL(url);
}
Here, getURL only passes the two variables to a specific JavaScript
function (in this case, catchClick()) in the wrapper because it's using
only javascript on the current page, so no request headers (read: no GET
or POST) are being set:
-------------------------------
Example 2.
var url;
function google() {
url = "http://www.google.com/search?hl=en&q=" + ta1.text;
getURL(url,"_blank","GET");
}
Here, getURL passes all of the root application's properties as well as
global variables (including the value of url) to the resulting page as a
GET request.
If you look at the request string, you'll see a lot of the app's
properties:
http://www.google.com/search?hl=en&q=fred&historyUrl=%2Fflex%2Fflex%2Din
ternal%3Faction%3Dhistory%5Fhtml&lconid=d357&liblist=&sizelist=&preloadO
bj=%5Bobject+Object%5D&width=undefined&height=undefined&nestLevel=0&focu
sManager=%5Flevel0%2EfocusManager&tabChildren=true&tabEnabled=false& ...
[snip]
-------------------------------
Example 3.
function queryGoogle() {
var query = createEmptyMovieClip(null,0);
url = "http://www.google.com/search?hl=en&q=" + ta1.text;
query.getURL(url,"_blank","GET");
}
Here, getURL only invokes the GET request with the raw url string. There
are no properties of the movieclip to add on since we create an empty
movieclip and invoke getURL off of that.
-------------------------------
HTH,
Matt Horn
Flex docs
________________________________
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt
Sent: Friday, May 20, 2005 3:40 PM
To: [email protected]
Subject: RE: [flexcoders] passing variables using getURL?
Does this only apply if the url is external? Do we get anything
if we
use getURL to call a javascript function in our html wrapper?
I have been building delimited strings to pass arguments up to
the
wrapper. Is there a better way?
Tracy
-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On
Behalf Of Abdul Qabiz
Sent: Friday, May 20, 2005 12:34 AM
To: [email protected]
Subject: RE: [flexcoders] passing variables using getURL?
Hi,
You can pass variable to external script using getURL(...),
getURL(..)
sends
all variable declared in current scope. Infact getURL(..) sends
all
variable
declared, that means it sends unwanted stuff also.
But I think, you can use LoadVars object for such kind of work.
LoadVars
gives more control and looks more clean. I am not sure why you
launching
external page and passing variable, but following example might
help
you.
##LoadVarsExample.mxml##
<mx:Application width="800" height="600"
xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script>
<![CDATA[
function sendVars()
{
//create LoadVars instance
var _lv:LoadVars = new LoadVars();
//create properties
_lv.name = "Abdul";
_lv.age = 24;
_lv.send("http://localhost/echo.asp","_blank",
"GET");
}
]]>
</mx:Script>
<mx:Button label="Send Vars" click="sendVars()"/>
</mx:Application>
More about LoadVars:
http://www.macromedia.com/support/flash/action_scripts/actionscript_dict
iona
ry/actionscript_dictionary427.html
Hope that helps...
-abdul
-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On
Behalf Of sbyrne_dorado
Sent: Friday, May 20, 2005 4:06 AM
To: [email protected]
Subject: [flexcoders] passing variables using getURL?
I'm having problems figuring out how to pass variables using
getURL.
The documentation that I can find seems to indicate that any
random
variable that you declare that's in some (unspecified) scope,
will be
appended (for GET) or passed (for POST) as parameters along with
the
URL.
So I have tried setting some typed local variables and invoking
getURL; no luck. No luck with either POST or GET.
What's the magic? Do the variables have to be in the top level
application? Do they have to be global within the the
containing
class? Does this functionality even work at all?
Yahoo! Groups Links
Yahoo! Groups Links
________________________________
Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms
of Service <http://docs.yahoo.com/info/terms/> .
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/