Forum Topic: As: Popup Window With Flash

(3,351 views • 13 replies)

This topic is 1 page long.

<< < > >>
None

Ozcar

Reply To Post Reply & Quote

Posted at: 12/6/05 10:59 PM

Ozcar EVIL LEVEL 32

Sign-Up: 05/12/02

Posts: 33,336

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'


None

pearuzi

Reply To Post Reply & Quote

Posted at: 12/6/05 11:09 PM

pearuzi NEUTRAL LEVEL 08

Sign-Up: 07/05/05

Posts: 492

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


None

pearuzi

Reply To Post Reply & Quote

Posted at: 12/6/05 11:11 PM

pearuzi NEUTRAL LEVEL 08

Sign-Up: 07/05/05

Posts: 492

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


None

authorblues

Reply To Post Reply & Quote

Posted at: 12/7/05 12:14 AM

authorblues FAB LEVEL 12

Sign-Up: 06/21/05

Posts: 6,360

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();");
}

GENERATION 1-i: The first time you see this, copy it into your sig on any forum. Square it, and then add i to the generation.

BBS Signature

None

Ozcar

Reply To Post Reply & Quote

Posted at: 12/7/05 03:39 PM

Ozcar EVIL LEVEL 32

Sign-Up: 05/12/02

Posts: 33,336

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


None

iv00w

Reply To Post Reply & Quote

Posted at: 12/7/05 03:41 PM

iv00w EVIL LEVEL 08

Sign-Up: 04/24/05

Posts: 376

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


None

SpamBurger

Reply To Post Reply & Quote

Posted at: 12/7/05 03:44 PM

SpamBurger NEUTRAL LEVEL 15

Sign-Up: 07/12/05

Posts: 4,747

At 12/7/05 03:41 PM, iv00w wrote: why did you post this? evry1 knows to check AS:Main

Dumb Fuck. This hasnt been posted yet in AS: Main so he decided to make it.

"However, the game received only two orders, one of which Molyneux speculated was from his mother." -Peter Molyneux's first game The Entrepreneur


None

Daza

Reply To Post Reply & Quote

Posted at: 12/7/05 04:59 PM

Daza EVIL LEVEL 13

Sign-Up: 11/07/04

Posts: 1,098

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


None

Denvish

Reply To Post Reply & Quote

Posted at: 2/19/06 08:09 AM

Denvish DARK LEVEL 46

Sign-Up: 04/25/03

Posts: 16,229

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

None

Inglor

Reply To Post Reply & Quote

Posted at: 2/19/06 08:12 AM

Inglor NEUTRAL LEVEL 17

Sign-Up: 01/26/03

Posts: 10,948

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


None

Skeik-Sprite

Reply To Post Reply & Quote

Posted at: 3/27/06 08:06 PM

Skeik-Sprite LIGHT LEVEL 15

Sign-Up: 06/19/05

Posts: 1,399

it doesnt work./


None

Zielak

Reply To Post Reply & Quote

Posted at: 7/4/06 07:45 AM

Zielak FAB LEVEL 17

Sign-Up: 09/21/05

Posts: 865

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


None

LordOfKetchup

Reply To Post Reply & Quote

Posted at: 3/8/07 05:05 PM

LordOfKetchup FAB LEVEL 17

Sign-Up: 05/10/04

Posts: 1,064

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

.

BBS Signature

Happy

thequackattack

Reply To Post Reply & Quote

Posted at: 3/8/07 08:24 PM

thequackattack EVIL LEVEL 08

Sign-Up: 11/06/06

Posts: 420

coolio! That's awesome


All times are Eastern Standard Time (GMT -5) | Current Time: 08:55 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!