Because of the constant attack by the wiki spam bots, accounts that are created and not used will be deleted. If you are a legitimate user, and your IP was blocked, please contact any active administrator - look at Special:RecentChanges and see who is busy fighting spam.

How do I highlight text in the SWF?

From SWFTools
Jump to: navigation, search

Firstly, you must ensure that fonts are embedded within your SWF. To do this, the "-f" and "-F" switches are necessary:

pdf2swf -F $YOUR_FONTS_DIR$ -f input.pdf -o output.swf

This will produce a file where all available fonts from your fonts folder are embedded into the SWF.

Next, you'll need to write up some code to do the search itself. Here is a sample:

private var snapText:TextSnapshot;
private function doSearch(event:Event):void {
	if (snapText == null)
		snapText = activeDoc.textSnapshot;
	if (searchTI.text != '' && searchTI.text.length > 1) {
		var textPos:int = snapText.findText(0, searchTI.text, false);
		snapText.setSelected( 0, snapText.charCount, false );
		if (textPos != -1) {
			do {
				snapText.setSelectColor( 0xFFEF00 );
				snapText.setSelected( textPos, textPos + searchTI.text.length, true );
				textPos = snapText.findText(textPos + searchTI.text.length, searchTI.text, false);
			while (textPos != -1)
		else { "Not found.", "Information" );         		
	else {
		snapText.setSelected( 0, snapText.charCount, false );	            	
Personal tools