all groups > flash actionscript > april 2007 >
You're in the

flash actionscript

group:

geturl() doesn't work with variable


geturl() doesn't work with variable bvillanyi
4/9/2007 10:08:24 PM
flash actionscript: I have a button which does two things:
First, it opens a new Flash movie in a new window, using the line:


getURL("javascript:OpenBrWindow('/movie2.asp','MyMovie','status=0,scrollbars=1',
'865','690','true')");

then it redirects the original window to a different URL using the line:

getURL("http://www.mydomain.com")

This works fine when the two lines are combined in a button instance as
follows:

on (release) {

getURL("javascript:OpenBrWindow('/movie2.asp','MyMovie','status=0,scrollbars=1'
,'865','690','true')");
getURL("http://www.mydomain.com")
}

But if I define a variable to contain the first url, and replace the url with
the variable, the new window never opens.

Here's the new code:
This is set in frame 1:
myurl =
"javascript:OpenBrWindow('/movie2.asp','MyMovie','status=0,scrollbars=1','865','
690','true')";

This is the new code behind the button instance:
on (release) {
getURL(myurl);
getURL("http://www.mydomain.com")
}

The second command, the redirect, works, but a new window never opens for the
other movie.

Any ideas?

Thanks,
Beth

Re: geturl() doesn't work with variable bvillanyi
4/9/2007 10:43:22 PM
Okay - with some trial and error I figured it out. I found out that the
variables declared and populated in the timeline don't get copied to the button
unless they are set up as global variables. Calling my variable _global.myurl
did the trick.
AddThis Social Bookmark Button