flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [45/50] git commit: [flex-asjs] [refs/heads/tlf] - Editor now works on SWF again. Focus issues on JS
Date Tue, 30 May 2017 19:48:20 GMT
Editor now works on SWF again.  Focus issues on JS


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ac122a51
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ac122a51
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ac122a51

Branch: refs/heads/tlf
Commit: ac122a516c3a845143eb8c15f5a3db215784ceb7
Parents: a3ec138
Author: Alex Harui <aharui@apache.org>
Authored: Tue May 30 11:35:33 2017 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Tue May 30 11:35:33 2017 -0700

----------------------------------------------------------------------
 manualtests/TLFEditTestFlexJS/src/TLFEditor.as | 104 +++++++++++---------
 1 file changed, 58 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ac122a51/manualtests/TLFEditTestFlexJS/src/TLFEditor.as
----------------------------------------------------------------------
diff --git a/manualtests/TLFEditTestFlexJS/src/TLFEditor.as b/manualtests/TLFEditTestFlexJS/src/TLFEditor.as
index 1e99f93..0437a43 100644
--- a/manualtests/TLFEditTestFlexJS/src/TLFEditor.as
+++ b/manualtests/TLFEditTestFlexJS/src/TLFEditor.as
@@ -57,15 +57,6 @@ public class TLFEditor extends UIBase
 	
 	public function TLFEditor()
 	{
-		addEventListener(FocusEvent.FOCUS_IN, onSetFocus);
-		addEventListener(FocusEvent.FOCUS_OUT, onLoseFocus);
-		COMPILE::SWF
-		{
-		addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, onMouseFocusChange);
-		Sprite($displayObject).tabEnabled = true;
-		Sprite($displayObject).mouseChildren = false;
-		}
-		
 		// Create the TLF TextContainerManager, using this component
 		// as the DisplayObjectContainer for its TextLines.
 		// This TextContainerManager instance persists for the lifetime
@@ -79,40 +70,21 @@ public class TLFEditor extends UIBase
 		_textContainerManager.addEventListener(
 			DamageEvent.DAMAGE, textContainerManager_damageHandler);
 		
-		COMPILE::SWF
-		{
-			// todo, see if this can be done in same place as for JS
-        var selectionManager:ISelectionManager = _textContainerManager.beginInteraction();
-		selectionManager.focusedSelectionFormat = new SelectionFormat(
-            0x000000, 1.0, "normal" /*BlendMode.NORMAL*/, 
-            0x000000, 1.0, "invert" /*BlendMode.INVERT*/);
-		}
-		/*
-		_textContainerManager.addEventListener(
-			Event.SCROLL, textContainerManager_scrollHandler);
-		
-		_textContainerManager.addEventListener(
-			SelectionEvent.SELECTION_CHANGE,
-			textContainerManager_selectionChangeHandler);
-		
-		_textContainerManager.addEventListener(
-			FlowOperationEvent.FLOW_OPERATION_BEGIN,
-			textContainerManager_flowOperationBeginHandler);
-		
-		_textContainerManager.addEventListener(
-			FlowOperationEvent.FLOW_OPERATION_END,
-			textContainerManager_flowOperationEndHandler);
-		
-		_textContainerManager.addEventListener(
-			FlowOperationEvent.FLOW_OPERATION_COMPLETE,
-			textContainerManager_flowOperationCompleteHandler);
-		
-		_textContainerManager.addEventListener(
-			StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGE, 
-			textContainerManager_inlineGraphicStatusChangeHandler);
-		*/
+		typeNames = "TLFEditor";
 	}
 
+	private var textSet:Boolean;
+	
+	public function get text():String
+	{
+		return _textContainerManager.getText();
+	}
+	public function set text(value:String):void
+	{
+		textSet = true;
+		return _textContainerManager.setText(value);
+	}
+	
 	override public function addedToParent():void
 	{
 		super.addedToParent();
@@ -129,13 +101,26 @@ public class TLFEditor extends UIBase
 		}
 		addBead(new DispatchTLFKeyboardEventBead());
 		
-		COMPILE::JS
+		addEventListener(FocusEvent.FOCUS_IN, onSetFocus);
+		addEventListener(FocusEvent.FOCUS_OUT, onLoseFocus);
+		COMPILE::SWF
 		{
+			addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, onMouseFocusChange);
+			Sprite($displayObject).tabEnabled = true;
+			Sprite($displayObject).mouseChildren = false;
+		}
+		
+		if (!textSet)
+			text = ""; // runs a bunch of code in _textContainerManager
+			
+		/*
 		trace("begin interaction");
 		var selectionManager:ISelectionManager = _textContainerManager.beginInteraction();
 		selectionManager.focusedSelectionFormat = new SelectionFormat(
-            0x000000, 1.0, "normal" /*BlendMode.NORMAL*/, 
-            0x000000, 1.0, "invert" /*BlendMode.INVERT*/);
+            0x000000, 1.0, "normal", //BlendMode.NORMAL
+            0x000000, 1.0, "invert"  //BlendMode.INVERT
+            );
+            
 		if (multiline)
 		{
 			if (!selectionManager.hasSelection())
@@ -149,8 +134,32 @@ public class TLFEditor extends UIBase
 		selectionManager.refreshSelection();
 		trace("end interaction");
 		_textContainerManager.endInteraction();
-		}
-
+		
+		*/
+		/*
+		_textContainerManager.addEventListener(
+			Event.SCROLL, textContainerManager_scrollHandler);
+		
+		_textContainerManager.addEventListener(
+			SelectionEvent.SELECTION_CHANGE,
+			textContainerManager_selectionChangeHandler);
+		
+		_textContainerManager.addEventListener(
+			FlowOperationEvent.FLOW_OPERATION_BEGIN,
+			textContainerManager_flowOperationBeginHandler);
+		
+		_textContainerManager.addEventListener(
+			FlowOperationEvent.FLOW_OPERATION_END,
+			textContainerManager_flowOperationEndHandler);
+		
+		_textContainerManager.addEventListener(
+			FlowOperationEvent.FLOW_OPERATION_COMPLETE,
+			textContainerManager_flowOperationCompleteHandler);
+		
+		_textContainerManager.addEventListener(
+			StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGE, 
+			textContainerManager_inlineGraphicStatusChangeHandler);
+		*/
 	}
 	
         //----------------------------------
@@ -181,6 +190,9 @@ public class TLFEditor extends UIBase
             {
 				trace("begin interaction");
                 var selectionManager:ISelectionManager = _textContainerManager.beginInteraction();
+				selectionManager.focusedSelectionFormat = new SelectionFormat(
+		            0x000000, 1.0, "normal" /*BlendMode.NORMAL*/, 
+		            0x000000, 1.0, "invert" /*BlendMode.INVERT*/);
 				if (multiline)
                 {
                     if (!selectionManager.hasSelection())


Mime
View raw message