Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How? Open .swf in closable popup window 2

Status
Not open for further replies.

mjstone323

Technical User
Jan 11, 2002
57
US
Hi there! I'm stuck.

I've been trying to use this ASP and Javascript together to open a new window when a user clicks a button in my Flash movie. I start by putting this ASP code in my .fla:

on (release) {
getURL ("javascript:eek:penNewWindow('my_popup.html','height=675,width=500,toolbar=no,scrollbars=no')");
}

I publish my movie using "Flash Only" settings. Then I edit the .html file using this code in the head:

<script language=&quot;JavaScript&quot;>
function openNewWindow(URLtoOpen, windowName, windowFeatures) { newWindow=window.open(URLtoOpen, windowName, windowFeatures); }
</script>

saving the .html file.
When I test the movie, it opens a browser window, but it's empty, with an &quot;object expected&quot; error. The file that &quot;my_popup.html&quot; represents does exist. What am I doing wrong?

Thanks!
Marianne
 
have you tried using the full address to your my_popup.html?

Code:
on (release) {
    getURL (&quot;javascript:openNewWindow('[URL unfurl="true"]http://www.mywebspace.com/my_popup.html','height=675,width=500,toolbar=no,scrollbars=no')&quot;);[/URL]
}
Ya' Gotta Love It!
sleepyangelsBW.jpg
 
The movie has to be tested through the html. It won't work from testing this in the Flash application itself! Although as a matter of fact, it work's partly, since it does open up a browser window!
Outside the Flash application, assuming your movie is in the same folder than the html, double-click your html and see what happens!

Of course, if you use the full path, you'll have to be connected for it to work!

Regards,
new.gif
 
The file is on my computer in the same folder as the rest of the site (I haven't uploaded anything yet). There's no &quot; yet. Could that be the problem?
Marianne
 
Should have written this in the previous - the html doesn't work either. Ay caramba.
MS
 
I recommend putting the Jvascript function in the flash movie such as

Code:
on (release) {
    getURL (&quot;javascript:myPopup()&quot;);
{

Then define the address and options within your HTML.

Look at faq250-697 for more explanation

Ya' Gotta Love It!
sleepyangelsBW.jpg
 
If Tulsa's suggestion doesn't work out, you can allways e-mail me your .fla & html at tektiper@hotmail.com

Regards,
new.gif
 
Hi guys -
I figured it out - sorry I didn't follow up right away -

TulsaJeff's suggestion was correct - except I should add that there was a bit more to it. Just before he posted I found a similar (partial) solution, provided by Peyman Hooshmandi Raad who posted at FlashKit. His document only included script for one button instance. Here's what worked for me:

In the first button instance in the .fla, I placed this code:

on (release) {
getURL (&quot;JavaScript:pop1();&quot;);
}

For the second:

on (release) {
getURL (&quot;JavaScript:pop2();&quot;);
}

and so on.

I published the .fla. I opened the resulting .html doc (after creating and publishing the docs I want my buttons to open) in code editing mode & entered (typed CAREFULLY; cutting & pasting *does not work*) this between the <HEAD> and </HEAD> markers:

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
function pop1() {
window.open(&quot;doc_I_want_first_button_to_open.html&quot;,&quot;&quot;,&quot;height=500,width=750,left=0,top=0,scrollbars=1,resizable=1&quot;);
}
function pop2() {
window.open(&quot;doc_I_want_second_button_to_open.html&quot;,&quot;&quot;,&quot;height=350,width=400,left=0,top=0,scrollbars=1,resizable=1&quot;);
}
</script>

For the 'scrollbars' & 'resizable', the &quot;1&quot; represents &quot;yes&quot;. &quot;0&quot; would represent &quot;no&quot;.

BTW - this also works for opening .pdfs.

Each time the .fla is changed & republished, the info has to be entered in the .html doc again.

I also discovered that if I forget to put underscores between the words of the names of the docs I want to have opened, not only will the JavaScript not work, but I have to republish those docs with the underscores in the names before the JS will open them. Renaming the docs by right-clicking on the name with the mouse doesn't work. D'oh. *<|:)

(I know you guys probably already know this - I'm putting all this info in for people like me who flip out when it isn't completely laid out for them! X-) )

Now I have to figure out how to use tell target to keep my fun button animation from aborting & boomeranging back to the &quot;Up&quot; state on release... grrrrrrrr. There's a tech tip for it... I'll muddle through for awhile before I bugs yiz again. :-D

Thanks!
Marianne
 
Don't touch tellTarget! It's deprecated in Flash 5! Go for the dot syntax right away! It easier if you didn't go through tellTarget!

Regards,
new.gif
 
I'm gonna start a new thread - can you walk me through how? Pretty please?
Marianne
 
<Each time the .fla is changed & republished, the info has to be entered in the .html doc again.>

Go to File/Publish Settings:

If you will uncheck the html option under the Formats Tab, you will only be updating the .fla file and the HTML file will remain untouched with the popup functions intact. Ya' Gotta Love It!
sleepyangelsBW.jpg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top