FindMatch

Package:
Class:
biz.flashscript.text
public class FindMatch
The FindMatch class is a text class and will find matches in a TextField. Those matches will be marked with a Sprite or MovieClip on top of them. Use the constructor new FindMatch() and add parameters as desired.
Public Methods
Method Defined By
FindMatch()
Creates a new instance of the FindMatch class.
FindMatch
markText(myField:TextField, myPattern:String):void
Initiates the word search.
FindMatch
Constructor Detail
FindMatch ()  Constructor
public function FindMatch()
Intializes a new FindMatch instance.
Method Detail

markText ():void  method
public function markText(myField:TextField, myPattern:String):void

This method will initiate the word search.

Parameters

  • myField:TextField ____ Specifies the TextField to search for a pattern.
  • myPattern:String ____ The pattern usually a search word.
Examples
Create a new fla file and name it FindMatch.fla. Place the fla in the same folder as the biz folder. Place a TextField of size 320x240 with Arial size 10 selected on the main timeline and name it "myText". Place an Input TextBox, name it "myInput" and a button and name it "subMit". Then create an Actionscript file, name it Blurs.as and place this script.
package 
{
	import flash.display.Sprite;
	import flash.display.MovieClip;
	import fl.controls.Button;
	import flash.events.MouseEvent;
	import biz.flashscript.text.FindMatch;

	public class FindmatchExample extends Sprite
	{
		public var subMit:Button;
		private var newMark:FindMatch;
		public function FindmatchExample ():void
		{
			myText.border = true;
			myText.wordWrap = true;
			myText.htmlText = 'Yesterday I got a letter from my aunt Mary.  At least the return address said so.  But I was suspicious because one has to be careful with letters, Bioterrorism, you know?  I looked at the letter from all sides.  Yeah, there it was, a bulge, most probably powder: ANTHRAX! My God, I was frightened.  I put the letter down immediately and washed my hands and rushed to get latex gloves.  Horrible thoughts went through my mind about the bugs in the letter and how they are multiplying in my bloodstream, Yuk.  Should I call 911 or better the FBI?  Who else knew my aunts address?  But most important of all, why and why me?  Who hated me so much to send me a letter with deadly bacteria?  Actually I am a popular guy.  Yeah, thats it.  Somebody is jealous about my popularity, somebody with a microbiology background or a connection to foreign terrorists.  I dont know any more, I dont know. Stay calm, just stay calm.  I took the letter very carefully and put it in a plastic bag. Then I drove to a nearby river and.....got rid of it, haaaa. (Cell phone rings.) Hello, aunt Mary.....for my birthday.....200 bucks in cash!';

			newMark = new FindMatch ();
			addChild (newMark);
			subMit.label = "SUBMIT";
			subMit.addEventListener (MouseEvent.CLICK, searchWord);
		}
		private function searchWord (ev:MouseEvent):void
		{
			var pattern:String = myInput.text;
			newMark.markText (myText,pattern);
		}
	}
}
			
Get Adobe Flash player