Be a Supporter!

As: Popup Window With Flash

  • 4,781 Views
  • 12 Replies
New Topic Respond to this Topic
Ozcar
Ozcar
  • Member since: May. 12, 2002
  • Offline.
Forum Stats
Member
Level 32
Blank Slate
As: Popup Window With Flash Dec. 6th, 2005 @ 10:59 PM Reply

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'

pearuzi
pearuzi
  • Member since: Jul. 5, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to As: Popup Window With Flash Dec. 6th, 2005 @ 11:09 PM Reply

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

pearuzi
pearuzi
  • Member since: Jul. 5, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to As: Popup Window With Flash Dec. 6th, 2005 @ 11:11 PM Reply

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

authorblues
authorblues
  • Member since: Jun. 21, 2005
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to As: Popup Window With Flash Dec. 7th, 2005 @ 12:14 AM Reply

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
Ozcar
Ozcar
  • Member since: May. 12, 2002
  • Offline.
Forum Stats
Member
Level 32
Blank Slate
Response to As: Popup Window With Flash Dec. 7th, 2005 @ 03:39 PM Reply

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 ^_^'

iv00w
iv00w
  • Member since: Apr. 24, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to As: Popup Window With Flash Dec. 7th, 2005 @ 03:41 PM Reply

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

Daza
Daza
  • Member since: Nov. 7, 2004
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to As: Popup Window With Flash Dec. 7th, 2005 @ 04:59 PM Reply

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

Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to As: Popup Window With Flash Feb. 19th, 2006 @ 08:09 AM Reply

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
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to As: Popup Window With Flash Feb. 19th, 2006 @ 08:12 AM Reply

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

Skeik-Sprite
Skeik-Sprite
  • Member since: Jun. 19, 2005
  • Offline.
Forum Stats
Supporter
Level 16
Game Developer
Response to As: Popup Window With Flash Mar. 27th, 2006 @ 08:06 PM Reply

it doesnt work./

Zielak
Zielak
  • Member since: Sep. 21, 2005
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to As: Popup Window With Flash Jul. 4th, 2006 @ 07:45 AM Reply

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 ^^

LordOfKetchup
LordOfKetchup
  • Member since: May. 10, 2004
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to As: Popup Window With Flash Mar. 8th, 2007 @ 05:05 PM Reply

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


.

BBS Signature
thequackattack
thequackattack
  • Member since: Nov. 6, 2006
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to As: Popup Window With Flash Mar. 8th, 2007 @ 08:24 PM Reply

coolio! That's awesome