PDA

View Full Version : popup window and pass variables


toke
01-31-2002, 06:10 PM
I know a lot of people already ask about this question but I am not clear. I went through all the popup windows tutorial available in this site but something is not working right for me. ok, enough talking.

here are the problems

I have created two movies one called "test1.fla" and another called "test2.fla." In "test1", I created a button that once release it should popup "test2." I specified in the button like this


on (release) {
getURL ("javascript:openNewWindow('test2.html','win','heigh t=100,width=250,toolbar=no,scrollbars=yes')", "_blank");
}

This code opened "test2.html" all right but I also get the javascript:openWindow('test2.html','win','...') in the browser address, which I don't want. Is there anyway that I can get rid of this?

Second..., is there anyway without using any backend scripts to pass the variable, says, "testvar" to the second movie (test2.html)?

thanks

Jesse
02-01-2002, 04:28 AM
Don't use the _blank reference, also you shold ad a semi colon at the end, within the quotes, as it's a JavaScript statement:
on (release) {
getURL ("javascript:openNewWindow('test2.html','win','heigh t=100,width=250,toolbar=no,scrollbars=yes');");
}
You can pass variable like this:
on (release) {
getURL ("javascript:openNewWindow('test2.html?testVar=bleh' ,'win','height=100,width=250,toolbar=no,scrollbars =yes');");
}
Note the ? after the URL. That's how you pass variables for PHP and other scripting languages and I believe it's the same for HTML but of course you wont be able to do anything with the variable in plain HTML. You will have to use PHP or Javascript. See the passing variables aroudn tutorial.

toke
02-01-2002, 05:01 PM
thank you Jesse.

Another question... what if the "testVar" is the variable that will recieve an input from the user? Can I just leave it blank ...

getURL ("javascript:openNewWindow('test2.html?testVar=/"/"','win','height=100,width=250,toolbar=no,scrollbar s=yes');");

instead of

getURL ("javascript:openNewWindow('test2.html?testVar=bleh' ,'win','height=100,width=250,toolbar=no,scrollbars =yes');");

Can I do that? Since I have no idea what the user will put into that "testVar" variable.

Jesse
02-02-2002, 07:59 AM
Tehn you use the standard Flash concatenate symbol. If I have a variable called dog which has the value "Joe" and I write:
sentence = "My dog " + dog + " smells";
Sentence will become "My dog Joe smells", so you should use the same method to add the value of your variable to the string... I think that's discussed in the passing varuables aroudn tutorial. Or perhaps hte loadVariables interaction.

toke
02-04-2002, 06:52 PM
Jesse,

I still cannot pass the variable to another movie. Help please.

toke
02-04-2002, 07:36 PM
Here are the movies file I was talking about. can you point out what I did wrong?