Click to See Complete Forum and Search --> : Pop-up from a Contentpane?
dniezby
12-18-2005, 03:01 AM
Anyone know if it's possible for me to launch a pop-up (for a Flash Webform) from a contentpane?
I put this into the content pane
<A HREF="javascript:popUp('./webforms/founders_form.html')">Open the Popup Window</A>
It shows up properly in the contentpane but doesn't open the form.
I put this code into the HTML page that needs to open.
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,men ubar=0,resizable=0,width=300,height=400');");
}
// End -->
</script>
blanius
12-18-2005, 10:02 AM
The popup javascript has to be in the link. Won't ever see it in the page. Try putting:
javascript:day = new Date();id = day.getTime();eval("page" + id + " = window.open('./webforms/founders_form.html', '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,men ubar=0,resizable=0,width=300,height=400');");
in your link instead. I think that will run the javascript in the CURRENT HTML page that your SWF is located. Thus it will open a new window(window.open)
dniezby
12-18-2005, 12:33 PM
Did you try getting this to work?
I put this into a contentpane...Is it what you meant?
<a href="javascript:day = new Date();id = day.getTime();eval("page" + id + " = window.open('./webforms/founders_form.html', '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,men ubar=0,resizable=0,width=300,height=400');");">Click this link</a>
What happens is a white box appears in the contentpane without any text.
The contentpane HAS HTML is checked.
Do you think it would make a difference if I link to an actual HTML page instead of actually typing the html into the box?...I'll try that and let you know the results. In the meantime if you can think of anything else, please let me know.
dniezby
12-18-2005, 12:52 PM
quick update - nope...
Tried putting the javascript code into an external HTML page that the contentpane loads and that didn't work either...In fact, none of the code or text showed up beyond the opening <a
Then I decided to try putting the script into the loaded html page and it looked like it was going to work but it didn't. The link DID show up this time but clicking the link did nothing.
One thing I did notice is that the contentpane seemed to translate the script into blank lines.
gusmus
12-18-2005, 12:55 PM
This is the same... but it's html/javascript, there is no way to do this within flash without making your movie huge with a long download time.
<SCRIPT TYPE="text/javascript">
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, 'width=400,height=200,scrollbars=yes');
return false;
}
//-->
</SCRIPT>
You must put this into the header tags in the html holder, on inside whatever html link you are using.
blanius
12-18-2005, 10:13 PM
Did some testing on my own. Looks like a no go.
dniezby
12-18-2005, 10:20 PM
Yeah, I've tried everything under the sun. It doesn't work from the contentpane.
I've moved on to trying to figure out if there is a way for the contentpane to signal that the user has scrolled to the end, then perform an action.
EG:
The user scrolls down reading the agreement. When the user scrolls down to the final line the condition results in true and now unhides a button. Sort of like some of the software license agreements where you can't continue with the installation until you've scrolled all the way down.
blanius
12-18-2005, 10:37 PM
I'm sure that can be done.
gusmus
12-18-2005, 10:56 PM
The pane accepts html but I think it ignores javascript,, there must be a way to do this in straight html without java script. In the mean time,, try putting this in the counterpane...
<A HREF="javascript:popup()">window.</A>
and this in the html of the window you want to open.
<SCRIPT language="JavaScript"><!--
function popup(){
cuteLittleWindow = window.open("page.html", "window", "location=no,width=320,height=200");
}
//--></SCRIPT>
I have my doubts and haven't tried this but,,,,,,, good luck
dniezby
12-18-2005, 10:59 PM
I'm sure that can be done.
Do you think I should create a new post to raise this question to the masses?
blanius
12-18-2005, 11:01 PM
had to dig around in Wilburt's code to find it (wish He's comment his code :) )
You can get the content pane's Max scroll with contentpane1.vs._max
and you can get the conent pane's Current scroll with contentpane1.vs._cur
Make sure it's loaded first, and then when _cur=_max you are there.
dniezby
12-18-2005, 11:04 PM
had to dig around in Wilburt's code to find it (wish He's comment his code :) )
You can get the content pane's Max scroll with contentpane1.vs._max
and you can get the conent pane's Current scroll with contentpane1.vs._cur
Make sure it's loaded first, and then when _cur=_max you are there.
Who's code?
blanius
12-18-2005, 11:06 PM
Wilburt is the Brants on the forum he wrote the code for the content pane.
But those work I just tested it.
blanius
12-18-2005, 11:22 PM
http://www.bretlanius.com/flash/ContentpaneScrollpostion.html
http://www.bretlanius.com/flash/contentpanescrollposition.fun
dniezby
12-18-2005, 11:22 PM
(post erased by dniezby)
dniezby
12-18-2005, 11:38 PM
Is the code supposed to be in a Movie Clip or did you just put it in there so it'd be easier to follow?
blanius
12-18-2005, 11:42 PM
I do that for code I want to execute all the time.. Just one way to do it.
blanius
12-18-2005, 11:45 PM
Dang Thought I had worked out the doing popup from content pane. Tried using a linked button from the symbol library, but it's not passing the mouse events to it.
Chris_Seahorn
12-19-2005, 12:53 AM
It's a syntax issue. This popup code also does not require any code in an html page so it's handy to hold onto.
http://sandbox.blogdns.com/FUNPOPUP.swf
Leave the :VOID(0) off and watch the difference.
<A HREF="javascript:window.open('http://sandbox.blogdns.com/PD-Logo.jpg,'newWin','width=310,height=310');void(0)">Open the Popup Window</A>
w.brants
12-19-2005, 01:09 AM
had to dig around in Wilburt's code to find it (wish He's comment his code :) )
Okay, to be exact it's Wilbert with an 'e' and yes, I'm the w.brants on this forum who coded the content pane and yes, I didn't comment a lot :).
There's no need to make it complicated. There's an event to signal scrolling that sends the position of both scrollers relative from 0 to 1. If a scroller isn't visible it returns NaN (not a number).
If you have a license agreement that scrolls vertically, you can signal the end like this
contentpane1.onScroll = function(hsPos,vsPos){
if (vsPos == 1){
// end reached
}
}
dniezby
12-19-2005, 01:20 AM
It's a syntax issue. This popup code also does not require any code in an html page so it's handy to hold onto.
http://sandbox.blogdns.com/FUNPOPUP.swf
Leave the :VOID(0) off and watch the difference.
<A HREF="javascript:window.open('http://sandbox.blogdns.com/PD-Logo.jpg,'newWin','width=310,height=310');void(0)">Open the Popup Window</A>
HOLY CRAP!!!
You did it...thanks for the help...this will make things MUCH easier for a project I'm working on.
dniezby
12-19-2005, 01:25 AM
Wilbert,
So, if I wanted a hidden button to show I would do it like this?
contentpane1.onScroll = function(hsPos,vsPos){
if (vsPos == 1) {
button1._visible = true;
}else{
button1._visible = false;
}
}
w.brants
12-19-2005, 01:35 AM
If I wanted a hidden button to show I would do it like this?
Yes, you got it.
blanius
12-19-2005, 01:49 PM
Sorry Wilbert :) I figured you'd have a better way. Without knowing the contentpane code I did the best I could :)
Okay, to be exact it's Wilbert with an 'e' and yes, I'm the w.brants on this forum who coded the content pane and yes, I didn't comment a lot :).
There's no need to make it complicated. There's an event to signal scrolling that sends the position of both scrollers relative from 0 to 1. If a scroller isn't visible it returns NaN (not a number).
If you have a license agreement that scrolls vertically, you can signal the end like this
contentpane1.onScroll = function(hsPos,vsPos){
if (vsPos == 1){
// end reached
}
}
blanius
12-19-2005, 01:50 PM
I'd leave out the entire Else that way once it's shown it stay showing.
Wilbert,
So, if I wanted a hidden button to show I would do it like this?
contentpane1.onScroll = function(hsPos,vsPos){
if (vsPos == 1) {
button1._visible = true;
}else{
button1._visible = false;
}
}
w.brants
12-19-2005, 02:10 PM
Sorry Wilbert :) I figured you'd have a better way. Without knowing the contentpane code I did the best I could :)
It's always nice to have people that do understand the internal code of the content pane. ;)
As for my solution, the onScroll event is mentioned in the api specification of the content pane. The implementation was a suggestion of Peter Herbrick. It can also be used to synchronize scrolling with something else like a changing picture or an object that changes color depending on the position of the scrollbar.
As for you other reply, I'd also leave the else out.
dniezby
12-19-2005, 04:28 PM
That's a good idea. I will leave it out. I don't want the agreement checkbox to appear and disappear. Once they've scrolled down the agreement, it should be assumed they've read the agreement, then they check off the agree option and the next page nav button appears...
Thanks for helping me with two issues in one thread.
flashkit.com
Copyright WebMediaBrands Inc., All Rights Reserved.