View Full Version : geturl query
i need to be able to pass some variables thorugh the address bar using a get.
i thought this would be simple but the problem i have is that this is for a presentation runnning on a laptop with no internet access. so everything is relative. getURL seems to need the http:// to be able to pass the string.
im using this:
this.button1.onPress = function(){
a1 = "yes";
tracker = "page2.html?a1=" + a1 + "&a2=" + a2 + "&a3=" + a3;
send(tracker, "_self" , "GET");
}
but without the http:// in the url it doesnt pass the info ?... etc
please help :)
xxneon
07-13-2007, 03:04 PM
getURL takes variables and automatically appends them to your URL much like an html form does..
var arg1= "1";
var arg2= "2";
getURL("page.html", "_blank", "GET");
//your new window address would look like this..
// ../page.html?arg1=1&arg2=2
it almost looks like what your doing is manually making the GET string ..
tracker = "page2.html?a1=" + a1 + "&a2=" + a2 + "&a3=" + a3;
which if you do it this way i wouldnt think you would need "GET".. since you have the variables already in your url that you are sending ..
ive tried it with and without the "get" and ive tried doing like:
var lastName:String = "Richardson";
var age:Number = 92;
myBtn_btn.onRelease = function() {
getURL("www.adobe.com", "_blank", "GET");
};
as in the help files but with out the http:// it wont pass them.
it jsut opens the page with out the variables
i need to figure out how
xxneon
07-13-2007, 03:51 PM
grr... i got it to work when you play the swf .. but not when its in and html doc..
its a real pain as it seems such a simple thing:eek:
how did you get it to work from the swf?
xxneon
07-13-2007, 04:18 PM
create a path of the swf minus the filename .. and if your page is in the same location as the swf..
'... _global.path+"page.html ...'
its global so the path doesnt get attached as a get variable.. and then on release of a btn instance of btn1.. it opens an address of ..
'file:///C:/website/flash/xml/page.html?arg1=1&arg2=2'
var arg1= "1";
var arg2= "2";
_global.path = this._url.substr(0,this._url.lastIndexOf("/")+1);
trace(path);
btn1.onRelease = function() {
getURL(_global.path+"page.html","_blank","GET");
}
the weird thing is it only works when no other browser windows are open.
i might have to resort to installing something like wamp or easy php to run this through the browser like on a site. this is driving me nuts
quickly
07-13-2007, 05:39 PM
try this
lv = new LoadVars()
lv.lastName = "Richardson";
lv.age = 92;
myBtn_btn.onRelease = function() {
lv.send(your_url,"_blank","GET");
};
xxneon
07-13-2007, 05:45 PM
same problem...
it wont append the get string .. because it opens a local file showing the path to the local file .. without it being in url format..
'c:\myfiles\file.html'
it needs to look like this to append the get values .. which is the issue..
'file:///c:/myfiles/file.html?lastName=Richardson&age=92'
quickly
07-13-2007, 05:53 PM
Well I was hoping.
Hmmm I wonder if post would be the same.
Or if you passed it to a javascript function in the browser and had that send the info?
I agree with the above statement that it should be easy though...
xxneon
07-13-2007, 05:58 PM
my example seems to work fine in FF... but IE for some reason will not cooperate .. it always defaults to the basic file path .. not the url path..
hmm it cold be possible to use firefox instead of ie for the presentation. is there any chance you could post your fla here so i can see how you ave set it up?
thanks for the help :) this is somtihng that flash shold fix for the future i think if it is possible to fix.
xxneon
07-16-2007, 01:17 PM
its more of an IE issue i think ... its almost like IE 'autoconverts' file:/// paths to absolute paths .. probably because IE is so integrated into windows..
here is my example file .. publish and test in FF and you should see that it passes 2 arguments to the page.html included.
thanks for that i couldnt quite get it to work as it keeps opening ie even though my default is ff but thinking about it if its not running in a browser to begin with then how can i pass the variables back. think my best bet is to install xamp or get iis running on the laptop if that is possible. its a big shame but there you go. thanks for the help much appreciated :)
xxneon
07-16-2007, 02:39 PM
well when running inside a projector .. the url path has file:/// structure
so if you can get the projector to open FF instead of IE .. it should be able to pass the variables.. and as stated before ... i can get the above example to work as long as there is no IE windows currently open.. if Flash is opening the first IE window then it passes the variables ... very strange..
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.