Click to See Complete Forum and Search --> : Using HTML Parameters
Trevor
10-17-2003, 03:58 PM
I have a webpage that starts up and has a flash movie play. At the end of the flash movie are some buttons that can be used to access the documents that follow.
What I need to do is, when someone goes from the other documents back to the first HTML page, there needs to be a variable passed so I can tell the flash movie to skip the intro.
I only want the intro to play when the user enters the site the first time.
The code I am looking for is the "Address Line" ie: http://mypage.com?variable=1 --- I'm not sure if this is correct.
The other is the HTML code I need to recognize this variable. I know how to send variables to Flash Movies but I don't know how to send the variable I want.
Thanks
S1L3NC3
10-17-2003, 04:27 PM
I dont thin its possible to pass info from pages into the core of the flash, however, i do think that javascript can be utilized in flash. So maybe there is a way.
Why dont you just make the intro on an intro page, then make a new page with the buttons on it?
Phil Karras
10-17-2003, 04:38 PM
You can do that but if the first window opened the others then you have direct access to vars in the parent/window.opener.
window.opener.VanName = 5;
will set VarName in the parent window to 5 just before you close your child window by clicking that button IF you have your button call a JS function to do this before you use window.close();
IF the parent window did NOT open a child window and the child is calling the original file as you indicate, then yes, pass a var in, in that way.
Every page can access its own URL line, then split it on "=" and if there is a value in element [1] then you have come back & you're not to run the flash.
use something like:
var tmp = ""+document.location; // to convert it to a string
var Vars = tmp.split('='); // To split on '='
alert(Vars[1]); // Display element 1
to see the value.
Trevor
10-17-2003, 06:41 PM
So, if there are multiple parameters, ie: http://mysite.com?var1=no&var2=what&va3=hello, then no, what and hello will be stored in the Vars[1..3]?
And by the code, I assume that document.location is the current window address, as appears at the top.
Thanks
Can you set it so that one of the variables is the value of a form text box?
Trevor
10-17-2003, 08:23 PM
There is no form. What form are you referring to?
The only variable is what is being sent to the HTML. It will be blank, play intro, or 1, skip intro. All I need to know is the Java Script code to read in the variable from the Address bar so the "if statement" can run the correct code.
I ment in general not just for your problem.
Sorry i should have been clearer.
Phil Karras
10-19-2003, 12:21 PM
So, if there are multiple parameters, ie: http://mysite.com?var1=no&var2=what&va3=hello, then no, what and hello will be stored in the Vars[1..3]?
And by the code, I assume that document.location is the current window address, as appears at the top.
Thanks
No, here's the breakdown:
Vars[#] Value
0 http://mysite.com?var1
1 no
2 var2
3 what
4 va3
5 hello
Does that help?