Hello
I’m trying to do array button or simplify this code…
function popupWindow1(event:MouseEvent):void {
var desiredURL:URLRequest = new URLRequest("javascript:NewWindow=window.open('http://www.suziklinik.cz/radek/1.htm','newWin','width=750,height=300,left='+((screen.width/2)-(360))+',top='+(screen.height/2)+',toolbar=No,location=No,scrollbars=Yes,status=No,resizable=Yes,fullscreen=No'); NewWindow.focus(); void(0);");
navigateToURL(desiredURL, "_self");
trace ("buttone funguje");
}
day_1.addEventListener(MouseEvent.CLICK, popupWindow1);
function popupWindow2(event:MouseEvent):void {
var desiredURL:URLRequest = new URLRequest("javascript:NewWindow=window.open('http://www.suziklinik.cz/radek/den_2.htm','newWin','width=750,height=300,left='+((screen.width/2)-(360))+',top='+(screen.height/2)+',toolbar=No,location=No,scrollbars=Yes,status=No,resizable=Yes,fullscreen=No'); NewWindow.focus(); void(0);");
navigateToURL(desiredURL, "_self");
trace ("buttone funguje");
}
day_2.addEventListener(MouseEvent.CLICK, popupWindow2);
function popupWindow3(event:MouseEvent):void {
var desiredURL:URLRequest = new URLRequest("javascript:NewWindow=window.open('http://www.suziklinik.cz/radek/den_3.htm','newWin','width=750,height=300,left='+((screen.width/2)-(360))+',top='+(screen.height/2)+',toolbar=No,location=No,scrollbars=Yes,status=No,resizable=Yes,fullscreen=No'); NewWindow.focus(); void(0);");
navigateToURL(desiredURL, "_self");
trace ("buttone funguje");
}
day_2.addEventListener(MouseEvent.CLICK, popupWindow3);
what am I coding wrong?
function popupWindow(event:MouseEvent):void {
var desiredURL:URLRequest = new URLRequest("javascript:NewWindow=window.open('http://www.suziklinik.cz/radek/1.htm','newWin','width=750,height=300,left='+((screen.width/2)-(360))+',top='+(screen.height/2)+',toolbar=No,location=No,scrollbars=Yes,status=No,resizable=Yes,fullscreen=No'); NewWindow.focus(); void(0);");
navigateToURL(desiredURL, "_self");
}
var btns:Array = new Array(“day_1”, “day_2”, “day_3”);//instante name of buttons on the stage
for (var i:int = 0; i < btns.length; ++i){
btns*.addEventListener(MouseEvent.CLICK, popupWindow);
}