|
-
-
I found this in flashkit, here you go:
Sometimes the swf file is not that much big to fit the browser's window and you know how ridiculous is a 300x450 swf file inside a maximized window with toolbar, status bar, address bar, all kinds of buttons and so many other unnecessary stuffs around it. You certainly have seen those cool popup windows that exactly fit what they have inside them. I am trying to tell you the secret behind these popups, step by step. Well, It is only a small JavaScript that does everything. Let's get started.
Step 1. Create a button symbol in flash and attach this code to the instance on stage:
on (release) {
getURL ("JavaScript op();");
}
This code calls a JavaScript function -pop- that is inside the html file hosting it. That means when the button is released the JavaScript function pop will be executed.
Step 2. Save your fla file and name it opener.fla. publish your file (Press F12) and open the HTML file that has just been created where you had saved the current fla file. Insert the JavaScript Code below, between the <Head> </Head> tags.
IMPORTANT NOTE : DON'T COPY AND PASTE THIS CODE. REWRITE IT.
<SCRIPT LANGUAGE="JavaScript">
function pop() {
window.open("popup.html","","height=200,width=200, left=0,top=0");
}
</script>
Step 3. Now you have your button that will open a popup window named popup.html and it is the time for you to create another HTML file named popup.html that will be opened as I mentioned above. Ok this HTML file can also contain a swf file or whatever you put inside it But this HTML file will be opened with height and width you specify in the JavaScript code. That means you have to adjust what popup.html contains with your JavaScript code.
Settings. You can adjust the popup's height (200 in the example)
You can adjust the popup's width (200 in the example)
You can specify the popup's position (x=0 & y=0 in the example)
Troubleshooting. The opener.swf must be executed inside it's HTML file. I mean if you simply double click the opener.swf it opens your windows flash player not the Browser's window. The second thing is that you must specify the complete address of the page you want to open in the JavaScript code for example:
window.open("http://www.2advanced.4t.com/popup.html", . . . .
-
by the way, that smiley face is :
: (followed by) p
-
-
-
oh
Also if its not too much.. Eyedea, where can i go or how can i do it to set up a form for the site i dont know how to configure the CGI file and the sort of stuff.. THANK!!
-
hi,
dont know exactly what r u doin but for sure your script
at the html page its wrongh
<script language="JavaScript">var PUpage="76001072"; var PUprop="geocities";
replace with
<script language="JavaScript">
var PUpage="76001072";
var PUprop="geocities";
</script>
hope this helps
trolljanz
-
-
-
still no result... ;(
hello again, guys....
just a quick update really, I said I'd let you know - still can't solve the problem completely... got a bit further though using this tutorial http://www.flashkit.com/tutorials/Ac...08/index.shtml
It's the first one that worked straight away! Worth a look!
I set up a quick experimental page, just to test it but can't get it to work 100%, as you can see : http://www.graphiceyedea.f2s.com/exp...erimental.html
I am stuck on one thing now... all the buttons only open up one and the same pop up window, even though I've got the other 3set up. The thing I just can't get to work is the different links... it will only open up the one html, stated in the html bit, head tag. I've tried several different options, going into the AS in Flash, changing bits in the html (at one point on clicking any button all the pop up opened up at once, aaaarrgghhhh! )... I just can't figure it out... So close - yet still so far...
Any more thoughts or tips on this would be great as Im almost there........
oOCADOo, you asked me where to go for the CGI stuff - I wouldn't know sorry... the contactmecard site was divided into 2 - I was doing the design and someone else was doing the database stuff, I'm not cut out for any of that - as you can tell with my difficulties solving the pop up problem! Sorry....
Happy flashin' everybody 
Prisca
-
OK guys....this works for every purpose imaginable I believe. I wrote this sucker from a compilation of tons of variations of javascripts about popups and it is fully customizable from flash the flash button on how you want your window....size, menubar, address bar, status bar, etc. Everything. It is even centered! Now don't get all worked up about how complicated it looks...it is not. There may be an easier way, but this works everytime for every site I've done and that works for me...
Here we go....
THIS GOES INTO YOUR HTML DOCUMENT IN THE <HEAD> (DON'T TOUCH ANYTHING) IT WORKS AS IS...
-----------------------------------------------
<script language="javascript" type="text/javascript">
<!--
var win=null;
function NewWindow(mypage,myname,w,h,scroll,menubar,toolbar ,location,status,resizable,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math .floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Mat h.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(scr een.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPositi on+',left='+LeftPosition+',scrollbars='+scroll+',m enubar='+menubar+',toolbar='+toolbar+',location='+ location+',status='+status+',resizable='+resizable +',directories=no';
win=window.open(mypage,myname,settings);}
// -->
</script>
THIS GOES ONTO YOUR BUTTON IN FLASH
-----------------------------------
on (release) {
getURL ("javascript:NewWindow('http://www.timsantor.com','name','800','600','no','no','n o','no','no','no','center')");
}
NOW IT LOOKS LIKE ALOT BUT HERE IS YOUR CUSTOMIZABILITY:
These are in order from left to right:
1ST SETTING: The URL you want to open..a relative or absolute path (example:http://www.timsantor.com)
2ND SETTING: The NAME of the window to open...can anything you want it to be.
3RD SETTING: The WIDTH
4TH SETTING: The HEIGHT
5TH SETTING: SCROLLBARS (yes or no)
6TH SETTING: MENUBAR (yes or no)
7TH SETTING: TOOLBAR (yes or no)
8TH SETTING: LOCATION (yes or no)
9TH SETTING: STATUS (yes or no)
10TH SETTING: RESIZABLE (yes or no)
11TH SETTING: POSITION (center or random)
THAT SHOULD DO IT FOR ALL YOUR NEEDS! HAVE FUN!
-
Hi all,
I have been using this javascript function for a while now but have noticed a problem..
i can open the pop-up windows and they will always replace each other i.e. if one is already open the new url will open in same pop-up window. - but my prob. is that if a pop-up is already open when I replace it - i.e. click on the pop-up link on my main window - the new pop-up will open behind the main window -
is there a way within this javascript code to open always on top??
cheers
beezer
-
-
FINALY!!, that script worked perfectly... thanks alot for the script Viper. Im a new-b with flash and was just working on this thing http://www.geocities.com/nextstagecs/main.html .If any of you are kind enough to send me maybe a fla. file or something of a full flash site that would be great. I still dont know how u people do it that good. Viper your site is Awsome.. How do you do it? THANKS SO MUCH FOR EVERYTHING!!! e-mail: [email protected] AIM: o0CAD0o
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|