Hey guys, I’ve got a silly problem with actionscripting.
I have o button on stage, and I want to add an action to this button by actionscripting. The action will tell the button to open a webpage BUT the URL will be in a variable so the code is:[AS]button.onRelease = function() {
getURL(_root.mylink);
};[/AS]Now, I will set the value of the variable. The problem is that I want the URL to open in a “_blank” Window. I’ve tried this:[AS]_root.mylink = “http://www.sampleurl.com”, “_blank”;[/AS]… can somebody tell me what’s wrong with setting the variable? every time a click the button it takes me to the webpage, but in the main window - not in a pop.
If I were not using variables the code should be like this[AS]getURL(“http://www.sampleurl.com”, “_blank”);[/AS]:h:
Hi there
I couldn’t get it to work as a variable either. I’d throw in a javascript link
[AS]_root.mylink = "javascript:popUp(‘http://www.sampleurl.com’)"
button.onRelease = function() {
getURL(_root.mylink);
};
[/AS]
and the corresponding javascript in the html page
<script>
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=685,height=480,left = 192,top = 70');");
}
</script>
The javascript works in the variable. I don’t know why, but in my actionscript showing the variable in this post, is replacing the word 'javascript ’ with the word ‘about’! Who knows?
Or…
[AS]button.onRelease = function() {
getURL(_root.mylink, _root.mylinkwhere);
};
_root.mylink = “http://www.sampleurl.com”; //edit…
_root.mylinkwhere = “_blank”;
[/AS]
That’s a much better solution chubob!:ne: