00:00
00:00

As: Popup Window With Flash

5,861 Views | 12 Replies
New Topic Respond to this Topic

As: Popup Window With Flash 2005-12-06 22:59:26


AS: Main

This tutorial might be handy for those that have a website and want to mix some JavaScript with your Flash.

As you might know, Flash can work with other programing languages as PHP, as CGI. Well, it also works with Javascript.

Javascript is one of the easiest languages out there. In fact, it's almost as much easy as ActionScript is.

I'll try to post tutorials related to how to mix Flash with Javascript, since I'm good with it. :)

------------------------------------------
---------

Popup Window with Flash:

First, let's see the JavaScript code that will help us with it.

This code will go in the header of your page. ( Between the <head> </head> ) Open your HTM file with your HTML editor. You can even open it with your Notepad. I normally open it with this one, because it loads quick.

This is the code:


<SCRIPT LANGUAGE="JavaScript">
function popup() {
window.open('popup.html','','toolbar=no,lo
cation=no,directories=no,status=no,menubar
=no,scrollbars=no,resizable=no,width=550,h
eight=400,left=0,top=0');
}
</script>

This will "call" the page popup.html (Change the name for yours)

The page won't have menubar, toolbar, scrollbars and won't be resizable. It's perfect for a popup window where you want to put a Webcam or to launch an animation inside.

Now, the Javascript function is read. All what we need now is the "caller"

The caller in this case will be a Flash button.

Open your Flash, make a nice button for it and add it this Actionscript:

on (release) {
getURL("JavaScript:window();");
}

Now, add the Flash animation to the same page where we put the Javascript function.

Now, the caller is set and the work is done :)

If you have a question about this tutorial, feel free to post here and/or E-mail me. If you have more questions about ActionScript, check the 'AS: Main'

Response to As: Popup Window With Flash 2005-12-06 23:09:07


thank you for the help, this next post ill put it right aight?

Response to As: Popup Window With Flash 2005-12-06 23:11:58


oh also i read yur post about the psp, what two games you should get (according to me and gamespot) is lumines and burnout legends, you will spend countless hours on both

Response to As: Popup Window With Flash 2005-12-07 00:14:13


At 12/6/05 10:59 PM, Ozcar wrote: <SCRIPT LANGUAGE="JavaScript">
function popup() {
window.open('popup.html','','toolbar=no,lo
cation=no,directories=no,status=no,menubar
=no,scrollbars=no,resizable=no,width=550,h
eight=400,left=0,top=0');
}
</script>

on (release) {
getURL("JavaScript:window();");
}

i could be wrong, but did you mean to write:

on (release) {
getURL("JavaScript:popup();");
}


BBS Signature

Response to As: Popup Window With Flash 2005-12-07 15:39:59


At 12/7/05 12:14 AM, authorblues wrote: on (release) {
getURL("JavaScript:popup();");
}

You're right...

I was too tired to see that mistake... My bad ^_^'

Response to As: Popup Window With Flash 2005-12-07 15:41:40


why did you post this? evry1 knows to check AS:Main

Response to As: Popup Window With Flash 2005-12-07 16:59:19


COME ON!!!!!!!!!! where was this a month ago when I needed it >:(

Response to As: Popup Window With Flash 2006-02-19 08:09:54


Just a quick note: you can extend the functionality of this by adjusting the js function to allow input for window widths, heights, and names from within Flash - which will allow you to open different windows, and different sized windows, from the same swf file embedded in the same html page

Javascript:

<script language="javascript">
function popup(pURL, pWID, pHEI) {
window.open(pURL, '', "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no,resizable=no, width="+pWID+", height="+pHEI+", left=0, top=0");
}
</script>

Button AS:

on(press) {getURL ("javascript:popup ('popup.htm', '450', '450')", "_self") ;}

You could easily adapt it to specify other things like popup window position, scrollbars, menus etc too


- - Flash - Music - Images - -

BBS Signature

Response to As: Popup Window With Flash 2006-02-19 08:12:59


I don't see why you had to write a whole new function just for that, window.open can be called from javascript with all the needed parameters

Response to As: Popup Window With Flash 2006-03-27 20:06:58


it doesnt work./

Response to As: Popup Window With Flash 2006-07-04 07:45:25


At 12/7/05 12:14 AM, authorblues wrote:
At 12/6/05 10:59 PM, Ozcar wrote:
on (release) {
getURL("JavaScript:window();");
}
i could be wrong, but did you mean to write:

on (release) {
getURL("JavaScript:popup();");
}

Skeik_Sprite, here the reason ^^

Response to As: Popup Window With Flash 2007-03-08 17:05:54


Is there a way to open a pop up UNDERNEATH the current window?


.

BBS Signature

Response to As: Popup Window With Flash 2007-03-08 20:24:16


coolio! That's awesome