loadVariables

I have a JavaScript that generates a URL. The only thing left is to pass that “url” variable into Flash. I’m not sure if this is the right method I need to use or not, but these are the lines of ActionScript I’ve been working on…

on (release) {
loadVariablesNum (“index.html”, 0, “POST”);
getURL (url, “_self”, “POST”);
}

The JavaScript and Flash are both in index.html. I’ve tried several variations to get it to work, but still no luck. Anyone know what the ActionScript code should be to make Flash read the url variable and use that location (like a HTML form) to post it?

Well first of all you don’t need post in there. But I’m not all that sure why it wouldn’t work even with the post there. loadVariables should take every variable on the html and load it into Flash.

double check the addressing, double check your Java script

I have a JavaScript alert() showing the correct URL. I think the breaking point is Flash isn’t getting the variable (since I tried a test to have Flash output the URL in a text field and nothing is displayed). Any ideas?

on (release) {
loadVariablesNum (“index.html”, 0, “POST”);
getURL (url, “_self”, “POST”);
}

What is this getUrl at the end? What purpose does it serve?

When the user clicks on the button, Flash reads the URL in the loadVariables. Then the getURL uses that variable to process the form.

ok… well probebly the problem is you can’t use “url” as a variable name. I think it might be a proprietary word reserved by action script.

If that’s not the problem, then I’m going to have to experiment a little before I can answer this.

I thought that could be it too. So I tried changing it (to “posturl”), but it didn’t seem to make a difference. Though I tried again after you mentioned it just to be sure (using “urlvar”) and still no luck.

I just tried another test. I initialize the variable before I call the value with loadVariables with…

var urlvar= “test write”;

And the getURL posted “test write.” So the problem is with the loadVariables line in the middle not loading the value. Any ideas?

on (release) {
loadVariablesNum (“index.html”, 0);
getURL (url);
}

have you tried it this way?

I tried it but the url still doesn’t load into Flash. But this method has worked for you with JavaScript and Flash being on the same page?

I’m not all that handy with the javascript thing. I’m hoping that one of my contemporaries will jump in here soon. There are quite a few on this board who have more experience with this sort of thing than I.

bump

I finally found the answer using thisJavaScript to Flash communication example as a guide.

Thanks, though, for taking the time to try and help. I appreciate it.

Is there any way of taking the data from an input box in a seperate .swf file and using it in another .swf movie ?