[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Flash 8, Simple JavaScript POPUP Window from button

Posted on 2009-04-29
5
Medium Priority
?
2,431 Views
Last Modified: 2013-12-25
I am creating a Flash CD which will run from an autostart.  I am working in Flash 8.  At some point I will need to pass variables from an XML file that populate a scrolling MC.   These will be companies that are offering coupons.  Each company will have info about the company coming from the XML file.  There will be a Click to Print Coupon button next to each company.

For demonstration, I need to have the button open a pre-defined popup window which I will place the company info and a simple javascript print button.  Down the road I will need the popup to be populated by the variables in the MC.

Below is the action script code I have been monkeying with.  It doesn't open a popup it open a complete browser with no url (file name).

This popup function should have nothing to do with a browser.
on (release) {
getURL ("javascript:NewWindow=window.open('popup.htm','ne wWin','width=400,height=300,left=0,top=0,toolbar=N o,location=No,scrollbars=No,status=No,resizable=No ,fullscreen=No'); NewWindow.focus(); void(0);");
}

Open in new window

0
Comment
Question by:TecTaoMC
  • 3
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
ccarey earned 1000 total points
ID: 24265778
Unfortunately if you are running this as a projector then you won't have Javascript available to you so that window.open will not function as expected. Javascript runs inside a browser only.

If you are not worried about mac compatibility, your easiest way through is to use an HTA wrapper. This is effectively an HTML file which will run as an application - borderless, fullscreen, whatever. Because it's a browser you also get the benefit of being able to launch popups and utilise javascript.

The basic setup involves creating your HTML, embedding the SWF as usual and then adding a HTA tag near the top inside the <head> tag. The file extension needs to be .hta

Here's a primer from Microsoft:
http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx

Alternately you may want to explore AIR for a bit of cross-platform compatibility action:
http://www.adobe.com/devnet/air/ajax/articles/air_dreamweaver_for_js_02.html

The attached snippet is an HTA app stub - it's set to run fullscreen with no borders. Save the contents into a file called "test.hta" and you can double-click to run. Alter the code to embed your SWF inside the body and you're done.
<html>
	<HEAD>
		<TITLE>My Monster Application</TITLE>
		<HTA:APPLICATION ID="oMyApp" 
		  APPLICATIONNAME="monster" 
		  BORDER="none"
		  INNERBORDER="no"
		  CAPTION="no"
		  ICON="/graphics/creature.ico"
		  SHOWINTASKBAR="no"
		  SINGLEINSTANCE="yes"
		  SYSMENU="no"
		  SCROLL="no"
		  WINDOWSTATE="maximize">
		  
		 <!-- style the window -->
		 <style>
		 	html,body{margin:0;padding:0;}
		 	body,td{font-family:Arial;font-size:12px;}
		 </style>
		  
	</HEAD>
	
	<body>
		embed your swf here
	</body>
</html>

Open in new window

0
 

Author Comment

by:TecTaoMC
ID: 24266091
Thanks for getting back to me on this ccarey.  I read up on this and tried the code.  Didn't seem to work work after switching and making IE my default browser.  But with the limitation of only Microsoft and not Mac I'm going to have to look for another solution.

I believe it's not an HTML issue but a Flash Action Script issue that I need to explore.  The process for this CD is to allow a viewer to scroll particular businesses in a specific geo location.  The businesses for a particular category are loaded through an XML file containing the data.

Through a scrolling component, the viewer can look at all businesses.  Each business will offer savings through a printable coupon.  Next to the business is a button to print the coupon.

I've tried the popup which if I were doing this in PHP would be no problem.  I found and edited an action script that would load an external Movie Clip.

Any thoughts would be appreciated.

Thanks
0
 
LVL 8

Expert Comment

by:ccarey
ID: 24266444
The AIR solution will give you that cross-platform (mac/pc) functionality.

Without using a browser-based solution the closest you will get is

on (release) {
     getURL ('popup.htm','_blank');
}

Customising the window size and so forth requires javascript, which isn't available from a vanilla Flash projector. Calling just the URL you are interested in will at least give you the content you desire in a browser window.
0
 

Author Comment

by:TecTaoMC
ID: 24266962
ccarey, thanks again for your inmput.  I went back an re-read you notes from the first post and found I didn't save the html file as a HTA, when once I did, it opened to a full screen taking over my monitor window.  Had to such down and reboot since I couldn't get it to close.

I can see the following process.  There is an auto start on the CD that starts up a starter.exe file what auto starts and within a second opends the HTA html page with the flash swf files for the presentation.  Ihen useing javascript to open popups should work

Thanks for the time the now I have something new to familiarize myself with.

Thanks.
Mike
0
 
LVL 8

Expert Comment

by:ccarey
ID: 24267075
alt+F4 to close it, or you can put a button in that executes a javascript:window.close()

You can actually just use the HTA as the target for the autorun, without the need for another EXE
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question