Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-16-2009, 05:02 PM   PM User | #1
noob
New Coder

 
Join Date: Apr 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
noob is an unknown quantity at this point
Please check my code for pop ups in flash!

Hi,

I couldn't find a thread with my exact problem..basically I have this button in flash to popup a window:

on (release) {
//customize the window that gets opened
// 0 equals NO.
// 1 equals YES.
address = "/RG_Map.pdf", "_blank";
target_winName = "R G Community Map";
width = 700;
height = 700;
toolbar = 0;
location = 0;
directories = 0;
status = 0;
menubar = 0;
scrollbars = 0;
resizable = 0;
//sends data back to the function
openWinCentre(address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);
}

It works fine in Firefox, Safari and Chrome, but I cannot open it in IE7. Has anyone found a solution? The window simply won't popup. This has occured on many machines, so I don't think it's a blocker.

Thanks so much!
noob is offline   Reply With Quote
Old 04-19-2009, 08:40 PM   PM User | #2
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Do you have the code for the openWinCentre function?
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 04-20-2009, 01:52 PM   PM User | #3
noob
New Coder

 
Join Date: Apr 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
noob is an unknown quantity at this point
Thanks for your response.

Surprisingly (or stupidly) I don't have the code for openwincentre -it was a copy and paste from some button tutorial. I did a quick search on it and read that openwincentre must be on the _root first frame.

How would I input the _root code? (My popup windows are different sizes) or
Is the openwincentre necessary?

Thanks.
noob is offline   Reply With Quote
Old 04-20-2009, 03:05 PM   PM User | #4
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Do you have a link to this tutorial? I can't really help with this specific code without knowing more.
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 04-20-2009, 08:12 PM   PM User | #5
noob
New Coder

 
Join Date: Apr 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
noob is an unknown quantity at this point
I used the tutorial found here:

http://www.kirupa.com/developer/mx/centered_popup.htm

Thanks!
noob is offline   Reply With Quote
Old 04-20-2009, 09:34 PM   PM User | #6
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Ok yes that function is necessary, and you should place it on the first frame in the main timeline.

Its a bit complex, you could also just have

Code:
on (release) {
getURL ("javascript:NewWindow=window.open('ShowPopup.php','newWin','width=400,height=300,left=0,top=0,
toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  NewWindow.focus();
void(0);");
}
http://www.flash-db.com/PopUp/JavaSc...pUp.php?page=2
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 04-20-2009, 10:37 PM   PM User | #7
noob
New Coder

 
Join Date: Apr 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
noob is an unknown quantity at this point
Ok, I inputted that code into the first frame in the main timeline and it still doesn't work. This is what I put in:


_root.openWinCentre = function (url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {

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

}



I then tried your second recommendation and the Flash compiler identified a few errors that I couldn't fix.

What do you recommend?
noob is offline   Reply With Quote
Old 04-21-2009, 11:30 AM   PM User | #8
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Well the fact that it worked the first time around in all but IE, really does suggest that its a popup blocker. I just tested the file on the tutorial site and it blocked it on my IE. Are you 100% sure its not a blocker?
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 04-21-2009, 01:27 PM   PM User | #9
noob
New Coder

 
Join Date: Apr 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
noob is an unknown quantity at this point
I'm certain it's not. I downloaded the tutorial files into my domain and it worked. I then copied the exact code from the tutorial and pasted it into my flash file and it didn't work. The only thing I can think of is that that button is not on the main layer, as the tutorial button is?
noob is offline   Reply With Quote
Old 04-21-2009, 02:06 PM   PM User | #10
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
So we are still at square 1? It works in all but IE, can you load it onto a site so I can test it with my IE?
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 04-21-2009, 02:17 PM   PM User | #11
noob
New Coder

 
Join Date: Apr 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
noob is an unknown quantity at this point
My site is:

www.rossdalegreen.ca

I could send you the flash file as well.

Thanks!
noob is offline   Reply With Quote
Old 04-21-2009, 04:26 PM   PM User | #12
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
I'm getting JS errors. Honestly that function is a bit...much so lets cut it down. Also the winName probably should be one word.

Code:
on (release) {
//customize the window that gets opened
// 0 equals NO.
// 1 equals YES.
address = "/RG_Map.pdf", "_blank";
target_winName = "RGCommunityMap";
width = 700;
height = 700;

//sends data back to the function
openWinCentre(address, target_winName, width, height);
} 



_root.openWinCentre = function (url, winName, w, h) {

getURL ("javascript:window.open('" + url + "','" + winName + "','" + "width=" + w + ",height=" + h + ");");

}
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 04-21-2009, 05:08 PM   PM User | #13
noob
New Coder

 
Join Date: Apr 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
noob is an unknown quantity at this point
So, I tried your code and it still doesn't work.. I used the first part of the code for the button and the second part for the main frame. The only difference now is the newly coded button does not display a "Error on page." notice like the other buttons do.

I appreciate the help, Jeremy.
noob is offline   Reply With Quote
Old 04-22-2009, 08:36 AM   PM User | #14
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Well thats progress. The button is working, something with the javascript is not. Honestly its not my strength, perhaps you should ask there. Either way, you can test Javascript directly by putting it into the address bar. I am also guessing its possible one of our parameters is off?

Code:
address = "/RG_Map.pdf";
If you don't care to have a function for this, then just try this.

Code:
on (release) {
getURL ("javascript:window.open('/RG_Map.pdf','RGCommunityMap','width=700,height=700');");
}
Here is a reference for the window.open method

http://www.pageresource.com/jscript/jwinopen.htm
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 04-22-2009, 02:58 PM   PM User | #15
noob
New Coder

 
Join Date: Apr 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
noob is an unknown quantity at this point
It worked! It created another problem, though: the window pops up fine, but the main window goes white and displays this:

[object]

So close!
noob is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:06 PM.


Advertisement
Log in to turn off these ads.