Skip to main content
Known Participant
July 27, 2010
Question

Blinking Cursor Issue

  • July 27, 2010
  • 1 reply
  • 1815 views

For some reason or another I can't seem to get the cursor to blink...   the setup is as follows

Inside of a class I create a selectionmanager, and an editmanager on instantaition of the class.  I build the text flow, and then assign the interaction manager of the textflow to be the editmanager.  I then  start coloring portions of the document with the editmanagers settextformat, once coloring is complete i set the interaction manager back to the pre constructed selectionmanager.   Under this scenario the cursor never blinks whenever i click into the document. 

I get no blinking love even after setting the selection formats via:

var objSelectionFormat:SelectionFormat = new SelectionFormat(0xFFFFFF, 1, BlendMode.DIFFERENCE, 0xFFFFFF, 1, BlendMode.DIFFERENCE, 300);

_objSelectionManager.focusedSelectionFormat = objSelectionFormat;

_objSelectionManager.unfocusedSelectionFormat = objSelectionFormat;

any ideas?

This topic has been closed for replies.

1 reply

JTtheGeekAuthor
Known Participant
July 27, 2010

For a little more info, inside the coloring routine I am am applying a textformat to the entire document with a transparent background, and coloring portions of the text with this method:

public static function SetRegionColor(objFlow:TextFlow, iStart:int, iEnd:int, iBackgroundColor:*, nBgAlpha:Number = 1):void

{

var objFormat:TextLayoutFormat = new TextLayoutFormat();

objFormat.backgroundColor = iBackgroundColor;

objFormat.backgroundAlpha = nBgAlpha;

var objSelection:SelectionState = new SelectionState(objFlow, iStart, iEnd);

if(objFlow.interactionManager == null || objFlow.interactionManager is EditManager == true)

{

var objManager:EditManager =  objFlow.interactionManager as EditManager;

objManager.applyFormat(objFormat, objFormat, objFormat, objSelection);

}

else

{

throw new Error("TextFlow is Not Editable");

}

}

Also, if i leave it on the editmanager afterwards, cursor blinks fine, but then of course the document is editable which i don't want.

Adobe Employee
July 28, 2010

From your description, I don't know why its not blinking. If you can abstract it into a small application, I can take a look at it. The important thing is the blinkRate in the SelectionFormat. For non-editable text, since it won't get focused, this will be the unfocussedSelectionFormat that is critical.

- robin

JTtheGeekAuthor
Known Participant
July 28, 2010

<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

   xmlns:s="library://ns.adobe.com/flex/spark"

   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="application1_creationCompleteHandler(event)">

<s:VGroup width="100%" height="100%" horizontalCenter="0">

<s:RichEditableText width="400" height="100%" id="ucRichText">

<s:textFlow>

<s:TextFlow>

<s:p paragraphStartIndent="200" textIndent="-200"><s:span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec dignissim tristique tellus, sit amet mattis leo vehicula id. Quisque varius pulvinar ligula quis pellentesque. Duis ac turpis id purus euismod sagittis. Aliquam ultrices ultricies accumsan. Nullam vitae porta orci. Nam velit orci, convallis sit amet hendrerit sit amet, pulvinar aliquam erat. Sed dignissim nibh ac elit interdum lacinia. Integer dictum arcu quis nunc hendrerit vel vestibulum justo mollis. Suspendisse tempus justo ut sapien pulvinar iaculis. Integer sem leo, porttitor sed porta vel, vulputate at libero.</s:span>

</s:p>

</s:TextFlow>

</s:textFlow>

</s:RichEditableText>

</s:VGroup>

<fx:Script>

<![CDATA[

import flashx.textLayout.conversion.ConversionType;

import flashx.textLayout.conversion.TextConverter;

import flashx.textLayout.edit.EditManager;

import flashx.textLayout.edit.SelectionManager;

import flashx.textLayout.edit.SelectionState;

import flashx.textLayout.formats.TextLayoutFormat;

import mx.events.FlexEvent;

protected function application1_creationCompleteHandler(event:FlexEvent):void

{

var objEditManager:EditManager = new EditManager();

var objSelectionManager:SelectionManager = new SelectionManager();

ucRichText.textFlow.interactionManager = objEditManager;

var objFormat:TextLayoutFormat = new TextLayoutFormat();

objFormat.backgroundColor = 0x0000ff;

objFormat.backgroundAlpha = .2;

var objSelection:SelectionState = new SelectionState(ucRichText.textFlow, 0, ucRichText.textFlow.textLength-1);

objEditManager.applyFormat(objFormat, objFormat, objFormat, objSelection);

ucRichText.textFlow.interactionManager = objSelectionManager;

}

]]>

</fx:Script>

</s:Application>

There... no blinky...