Flash Forum, Tutorials, Education & Training

 


Flash Tutorials


Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> * popup from flash, and onClick close popup.
chilli dude
post Feb 13 2005, 02:10 PM
Post #1


Webwasp Senior
Group Icon

Group: Members
Posts: 153
Joined: 26-January 05
From: The Netherlands
Member No.: 187



For preview check this:
http://www.hipheid.nl/tutorials/flash/popup/

Okay this is what i did. I have a button with the following action;
CODE
on (release) {

////don't edit this!

Movieclip.prototype.openWin1 = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable){

getURL("javascript:var myWin1;if (!myWin1 || myWin1.closed){myWin1=window.open('"+url+"', '"+winName+"', '"+"width="+w+", height="+h+", toolbar="+toolbar+", location="+location+", directories="+directories+", status="+status+", menubar="+menubar+", scrollbars="+scrollbars+", resizable="+resizable+", top='+0+', left='+150+'"+"')} else{myWin1.focus();};void(0);"); };



//okay here do you add the adress of your popup file.

address = "http://www.hipheid.nl/tutorials/flash/popup/popup.html";

//This is the name that you see in the Title bar

winName = "Popup";

//the with and height of your popup

width = 220;

height = 220;

//Set to 1 if you want to show the toolbar

toolbar = 0;

location = 0;

directories = 0;

status = 0;

//Set to 1 if you want to show the menubar

menubar = 0;

//Set to 1 if you want to show scrollbars

scrollbars = 0;

//Set to 1 if you want it to be resizable

resizable = 0;

//don't edit this!

openWin1(address,winName,width,height,toolbar,location,directories,status,menubar,scr
llbars,resizable); }


As you can see i explain how you can change the popup!
But, You MUST export the flash movie as Flash Player 6.0 and Actionscript 1, or else the popup won't work...i'm workin on fixen that.

okay now the part of the popup
just make your popup and make an invisible button on the top of your flashmovie, and give it the following action
CODE
on (release) {

    getURL("javascript:self.close()");

}


This action will say to the javascript what we used to open the popup to close it.

checked it on Mozilla Firefox 1.0 and I.E 6.0
Go to the top of the page
 
+Quote Post
Rabid Lemming
post Feb 13 2005, 07:51 PM
Post #2


Flash Student
Group Icon

Group: Root Admin
Posts: 3,139
Joined: 26-July 04
From: uk
Member No.: 3



Cheers for that although we do already have a tutorial on pup ups but handy all the same

What would be good is a tutorial using the same principle that work using images and not html page to hold the image pop up on. Many users want a pop up window that loads an image the same so they don’t have to have the image on a web page. Problem is in some browsers with out the html page the borders show up

A tutorial to fix that would be handy. I am going to do one my self when I eventually get time but any one who wants to do it for me is welcome to :wink:


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

I will wait for death with a smile and big stick!
Go to the top of the page
 
+Quote Post
chilli dude
post Feb 13 2005, 08:02 PM
Post #3


Webwasp Senior
Group Icon

Group: Members
Posts: 153
Joined: 26-January 05
From: The Netherlands
Member No.: 187



hmm well theire are several ways to close the popup

- With a timer
Use this code to get a popup window to close after a pre-determined amount of time. For example, set an advertisement popup window to remain open for 15 seconds, then it automatically closes.

This code is placed between the and tags within the window that is opened (the popup window).

CODE
<SCRIPT LANGUAGE="javascript" TYPE="TEXT/javascript">

var StayAlive = 15; // Number of seconds to keep window open

function KillMe(){

setTimeout("self.close()",StayAlive * 1000);

}



</SCRIPT>


- With a link
To get a popup window to close it is common to add a link that will allow the user to "Close Window".

Insert the following code between the and tags of the popup window.

CODE
<a href="javascript:window.close()">Close Window</a>


- With a button
To get a popup window to close it is common to add a button that will allow the user to "Close Window".

Insert the following code into the popup window where you want the link.

CODE
<form>

<input type="button" value="Close Window" onclick="window.close()">

</form>


- With a image
To get a popup window to close it is common to add an image link that will allow the user to "Close Window".

Insert the following code between the and tags of the popup window.

CODE
<a href="javascript:window.close()"><img border="0" src="imagename.gif"></a>
Go to the top of the page
 
+Quote Post
Rabid Lemming
post Feb 13 2005, 08:28 PM
Post #4


Flash Student
Group Icon

Group: Root Admin
Posts: 3,139
Joined: 26-July 04
From: uk
Member No.: 3



Hi,

To better improve the code use:

function closeme(){
window.opener = null;
window.close();
}

This stops the alert message you get in Netscape or IE asking if you’re sure you want to close the window

Cheers
Rabid Lemming


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

I will wait for death with a smile and big stick!
Go to the top of the page
 
+Quote Post
Russtar
post Jun 6 2005, 07:25 PM
Post #5


Newbie
Group Icon

Group: Members
Posts: 1
Joined: 4-June 05
Member No.: 498



QUOTE(chilli dude)
For preview check this:
http://www.hipheid.nl/tutorials/flash/popup/

Okay this is what i did. I have a button with the following action;
CODE
on (release) {

////don't edit this!

Movieclip.prototype.openWin1 = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable){

getURL("javascript:var myWin1;if (!myWin1 || myWin1.closed){myWin1=window.open('"+url+"', '"+winName+"', '"+"width="+w+", height="+h+", toolbar="+toolbar+", location="+location+", directories="+directories+", status="+status+", menubar="+menubar+", scrollbars="+scrollbars+", resizable="+resizable+", top='+0+', left='+150+'"+"')} else{myWin1.focus();};void(0);"); };



//okay here do you add the adress of your popup file.

address = "http://www.hipheid.nl/tutorials/flash/popup/popup.html";

//This is the name that you see in the Title bar

winName = "Popup";

//the with and height of your popup

width = 220;

height = 220;

//Set to 1 if you want to show the toolbar

toolbar = 0;

location = 0;

directories = 0;

status = 0;

//Set to 1 if you want to show the menubar

menubar = 0;

//Set to 1 if you want to show scrollbars

scrollbars = 0;

//Set to 1 if you want it to be resizable

resizable = 0;

//don't edit this!

openWin1(address,winName,width,height,toolbar,location,directories,status,menubar,scr
llbars,resizable); }


As you can see i explain how you can change the popup!
But, You MUST export the flash movie as Flash Player 6.0 and Actionscript 1, or else the popup won't work...i'm workin on fixen that.

okay now the part of the popup
just make your popup and make an invisible button on the top of your flashmovie, and give it the following action
CODE
on (release) {

    getURL("javascript:self.close()");

}


This action will say to the javascript what we used to open the popup to close it.

checked it on Mozilla Firefox 1.0 and I.E 6.0

Hi, Thanks for the pop-up code, it works, but I have some actionscript 2 functions in my website, so can't export my movie as actionscript 1. Is there any way to get a Pop-Up page to work for Flash MX 2004 using actionscript 2?
Russ
Go to the top of the page
 
+Quote Post
JosephLevin
post Jun 6 2005, 09:06 PM
Post #6


fat man coding
Group Icon

Group: Moderator
Posts: 579
Joined: 1-October 04
From: High Bridge, NJ, USA
Member No.: 36



Forgive my ignorance, folks, but it seems to me you ought to be able to have the javascript handle the window popup code, and then you just have Flash call the javascript function. Then it is independent of which AS you use, v1 or v2.

for example, if you wanted to launch a javascript function from within Flash. you might put this code on a button:

CODE
on(press) {

 getURL("javascript:makepopup(param1, param2,.....)");

}


--------------------
aLL yOuR fLaS aRe bELOnG To uS
(apologies to Eddie)

Go to the top of the page
 
+Quote Post
webwasp
post Jun 7 2005, 06:35 AM
Post #7


King of Kings
Group Icon

Group: Root Admin
Posts: 1,017
Joined: 26-July 04
From: Auckland, New Zealand
Member No.: 2



Sounds good to me.


--------------------
Phil Schulz - Site Editor.
Go to the top of the page
 
+Quote Post
Rabid Lemming
post Jun 16 2005, 07:16 AM
Post #8


Flash Student
Group Icon

Group: Root Admin
Posts: 3,139
Joined: 26-July 04
From: uk
Member No.: 3



lol noooo can't have that it's too easy lol

You can always use the pop up mangier in flash for AS version 2 :wink:


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

I will wait for death with a smile and big stick!
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 





> Webwasp Flash Forums
New Posts

RSS Lo-Fi Version Time is now: 1st October 2014 - 08:17 PM