[mtasc] "eq" sustitute and Focus problem

Rafael Guédez contacto at rafaelguedez.com
Wed Dec 14 18:26:21 CET 2005


Hi all,

I'm working in a simple text editor and I have a Button and TextArea  
components in the stage. Now, I notice that my listener of the Button  
change inmediatly the Focus and then I can't get the begin and the  
end of my selected text in the TextArea. For example:



	private function click (eventObj) {
		
		var buttonLabel:MovieClip = eventObj.target;

		switch (buttonLabel) {
			case bold_pb :
				begin = Selection.getBeginIndex();  // < -- dont work because the  
focus is now in the button
				end = Selection.getEndIndex();
				break;
		}
	}



I'm playing with the Selection Class and I can't get in any way the  
TextArea focus after press the button, anyone know some trick?


Now, I create a loop with a onEnterFrame function to get the  
"getBeginIndex" and "getEndIndex" but I need to know when the focus  
is in the TextArea, for example:


		target.onEnterFrame = function () {
			var focusTemp = Selection.getFocus();
			if (focusTemp eq this.classParent.field_ta) {
				this.classParent.begin = Selection.getBeginIndex();
				this.classParent.end = Selection.getEndIndex();
			}
		}


This work fine with MMC but "eq" is no supported by MTASC and "=="  
dont make correctly the comparation :(



Thanks in advance and sorry for my english ;)


Rafael




More information about the mtasc mailing list