Search Tutorials
Adding Custom Functions and Effects to your popup windowTheir is really no limit to the amount of effects you can add to the popup window your opening. I'll try to go over a few relevant examples and what makes them work. Then you can create your own or use the Auto-Code Generator. Some effects are not cross browser compatible and some may not work when opening pages outside of the domain where your movie is located. Move window to new position 1000 milliseconds (1 second) after it loadson (release) {
getURL ("javascript:NewWindow=window.open('ShowPopup.php','newWin','width=400,height=300,left=0,top=0,
toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No'); NewWindow.focus();
setTimeout('NewWindow.moveTo(200,300)',1000); void(0);");
}
The above script allows you to 'move' the window to a new location at a certain time after it opens. The setTimeout part controls the time delay (in milliseconds) to wait until that part of the code is activated. The NewWindow.moveTo(200, 300) part tells the window where to go, the (200,300) part is the same as the X and Y coordinates of where you would like your window to move to. It is important to note that we always reference the popup window by the object name we gave it in the first part of the script 'NewWindow'. Display an Alert before window is opened then scroll to a specific point 3 seconds after it loadson (release) {
getURL ("javascript:NewWindow=window.open('ShowPopup.php','newWin','width=400,height=300,left=0,top=0,
toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No'); alert('Flash Rules'); NewWindow.focus();
setTimeout('NewWindow.scroll(0,400)',3000); void(0);");
}
The above code will open a new window with the various properties as indicated. Then display an Alert box that contains the text 'Flash Rules' before the window opens. The alert('Flash Rules'); is the code that will activate the alert. Then we add the code setTimeout('NewWindow.scroll(0,400)',3000); to Scroll the window down by 400 px - the (0,400) part represents the X and Y coordinates you want to scroll by. The setTimeout part adds a delay to the scroll, in this case the delay time is 3000 milliseconds or 3 seconds, before the scroll happens. It can be important at times to add a delay because you can't scroll a page that has not loaded. Open window, Resize it after 1 second, then Close it after 6 secondson (release) {
getURL ("javascript:NewWindow=window.open('ShowPopup.php','newWin','width=400,height=300,left=0,top=0,
toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No'); NewWindow.focus();
setTimeout('NewWindow.resizeTo(500,500)',1000); setTimeout('NewWindow.close()',6000); void(0);");
}
The above code opens a popup window, the resizes it after 1 second to the new dimensions of (500,500) instead of 400 x 300. This is done by the code: setTimeout('NewWindow.resizeTo(500,500)',1000);. Then it is closed after 6 seconds by the code setTimeout('NewWindow.close()',6000);. The most important thing to notice about the delay close code is the NewWindow.close() This is the basic code that will close a popup window. As you can see by now their is really no limit to the amount of effects that you can add. The main limitation is not with the JavaScript or Flash but with Browser compatibility. The resizeTo and scroll functions will not work with all browsers. You can get fairly creative by mixing and matching functions and portions of the code. The next section deals with manipulating and adding more effects to the Popup window you recently opened from the parent Flash movie.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|