Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Variables through a link when not using a server model

Status
Not open for further replies.

bgreenhouse

Technical User
Feb 20, 2000
231
CA
Hi Folks

I'm trying to pass variables to a flash movie. I have it working on a web server, where I use JS to pull a query string variable and put it into the object tag that references the Flash object. Now I need to figure out a way to do it for a CD. The problem is that I can't use the same method as if I put filename.html?ID=23 in the URL when it's on a disc, it actually looks for a file called "filename.html?ID=23", not filename.html. Of course that file doesn't exist. Right now I'm thinking perhaps a function that sets a cookie when you click on a link and then pulls that cookie down and puts the value in the object tag. My experience with cookies is rather slim though, and I'm not sure that this will work. Any comments, thoughts or ideas?

Thanks

Ben
 
if you have filename.html on your disk, but use on another page url that sounds like filename.html?ID=23 it should work in any browser correctly. filename.html will be loaded and URL in browser will contain filename.html?ID=23.

After that you can take your ID using document.location.search and put it as a param to your flash movie.

Regards,
Sergey Smirnov
Ask me directly at
 
Hey Sergey

It does work correctly when the browser is running off a server. I need to figure out how to make this work when it's not running off a server - such as when the whole application is put on a CD. At that point it looks for "filename.html?id=123" as an entire filename rather than looking for filename.html and understanding that there's a query string after it...

Thanks,

Ben
 
i've had this happen, and then it works correctly if you remove the "file://" protocol from the addressbar.

i think it happens when you let your form submit using "GET". i think i've overcome this by preventing the form from submitting (forcing return false) and manually getting/setting vars in the querystring.

=========================================================
while (!succeed) try();
-jeff
 
...or maybe it's the other way around: having file:/// seems to work, not having it doesn't...

can you provide an example for us to test?
=========================================================
while (!succeed) try();
-jeff
 
Thanks Jeff

I tried you suggestion and it doesn't seem to work. There is no "file://" in the address bar, simply "C:\directory\...". I should probably clarify where the query string variables are coming from. The reason for doing this is to allow hyperlinks from HTML documents to specific points within my .swf. I have a actionscript function within my .swf that reads the variable that is passed and then goes to the appropriate place. The query string variable is manually set into hyperlinks in HTML documents.

So, if I wanted to set a hyperlink to place "a", I'd actually hard code the href for the anchor tag as "default.html?id=XX", where XX is the appropriate ID that causes the internal function (in the .swf) to move to place "a", and default.html is the html document that holds my Flash object.

thanks,

Ben
 
hmm...seems to work fine for me:

i have a link in page1 to "page2.html?key=val", and it opens the link normally and page2 recognizes the vars in the querystring.

=========================================================
while (!succeed) try();
-jeff
 
Hmm...You're right - it works if there is file://...

Thanks.

B
 
Hm...
It is really hard to make this simple call unworkable. I put "file:///" prefix, I called second page from form with using GET method. It works perfect always and with using any browser.

May be you use absolute URL path, istead of relative one? Only relative URL should be used on CD
 
It looks like I posted my message at the same time as you did.
Actually, When I click on html file on the disk or run it from CD with autostart program, there are no "file:" prefix there. URL starts with name of the disk. (I mean MS Windows of course)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top