Prevent hyperlinks from opening the web browser

Publishing Print2Flash Documents embedding them in Flash movies
Post Reply
MaxK
Posts:5
Joined:Wed Mar 12, 2014 1:29 pm
Prevent hyperlinks from opening the web browser

Post by MaxK » Wed Mar 12, 2014 2:20 pm

Hi,

I'd like to create a standalone desktop flash application (AS3 with Flash CS6, published as an .exe projector). This app will load .swf files created with print2flash (trial version) from word documents.These Word documents contain hyperlinks. I want my application to get the url of the links clicked but I don't need any browser interaction.

Thanks to the comprehensive help section, I managed to do everything except that I cannot prevent the browser from opening when a link is clicked!

Here are the relevant parts of my code:

Code: Select all

public class ContentLoader {
	var loaderText:Print2FlashDoc3;
	var mcText:MovieClip;

	public function loadTextSWF (fileName:String,  parent:DisplayObjectContainer):void {
		loaderText = new Print2FlashDoc3(fileName,30,140,395,480,parent);
		loaderText.addEventListener(Print2FlashDoc3.ONLOADEVENT, OnLoaded);
	}

	private function OnLoaded(e:Event) {
	  mcText=loaderText.getDoc();
	  mcText.addEventListener("onLinkClicked", onLinkClicked);
	}
	private function onLinkClicked(e:Object): void {
		//Here I get "e.url". Job done, I don't need anything else but the browser always opens at this stage!!!
	}
}
I tried to:
  • • play with the "_blank", "_self", etc. hyperlink targets both in Word and in P2F conversion parameters
    • Enhance flash security settings so my app cannot get access to the Internet (I don't know how to do that)
    • Override the 'navigateToURL()' function that must be called somewhere in the swf file produced by P2F (no idea if this is possible)
Btw, the links give images names like "img1.png" that are loaded accordingly from a local subfolder (no need for an Internet connection here).

Any advice welcome!!!!

Thanks,
Max

staff
Posts:267
Joined:Sat Dec 15, 2007 4:48 pm

Re: Prevent hyperlinks from opening the web browser

Post by staff » Thu Mar 13, 2014 2:32 am

Please use a custom document template attached to this post. The documents created with this template will not open hyperlinks in browser but fire onLinkClicked event. To apply this template, you need to:
1. Unpack the attached template file to disk
2. Launch Print2Flash Application by choosing “All Programs/Print2Flash/Print2Flash Printing Application” from the Windows start menu
3. Choose Options/Default Document Options from the application menu
4. Switch to Output tab
5. Choose Custom Template option and pick the template file from disk
Attachments
print2flash.interface3.pro.zip
(93.77KiB)Downloaded 891 times

MaxK
Posts:5
Joined:Wed Mar 12, 2014 1:29 pm

Re: Prevent hyperlinks from opening the web browser

Post by MaxK » Thu Mar 13, 2014 6:27 am

This template works perfectly.

It's a big help, thank you very much. And thank you for the quick reply as well!

Max

Post Reply