Skip to main content
Participant
December 22, 2011
Question

Not able to select image while using float property

  • December 22, 2011
  • 1 reply
  • 1438 views

When i using float property in image ... i am not able to select the image. If i am not using the float property i am able to select image. In red color line is my problem when i using the float property of image.

My code:

public function selectionChangeListener(event:SelectionEvent):void

{

    

          var cTF:TextFlow = event.selectionState.textFlow;

           

            // slect the correspondent managers for this selection

            if( selectManagersByTextFlow( cTF ) == false )

                return;

         

selectionState = event.selectionState;

            selectedElementRange = ElementRange.createElementRange(selectionState.textFlow, selectionState.absoluteStart, selectionState.absoluteEnd);

       

            characterFormat = textFlow.interactionManager.activePosition == textFlow.interactionManager.anchorPosition ? textFlow.interactionManager.getCommonCharacterFormat() : selectedElementRange.characterFormat;

            paragraphFormat = selectedElementRange.paragraphFormat;

            containerFormat = selectedElementRange.containerFormat;

           

            var linkString:String = "";

            var linkTarget:String = "";

            var linkEl:LinkElement = selectedElementRange.firstLeaf.getParentByType(LinkElement) as LinkElement;

            if (linkEl != null){

                var linkElStart:int = linkEl.getAbsoluteStart();

                var linkElEnd:int = linkElStart + linkEl.textLength;

                if (linkElEnd < linkElStart){

                    var temp:int = linkElStart;

                    linkElStart = linkElEnd;

                    linkElEnd = temp;

                }

               

                var beginRange:int = selectedElementRange.absoluteStart;

                var endRange:int = selectedElementRange.absoluteEnd;

               

                var beginPara:ParagraphElement = selectedElementRange.firstParagraph;

                if (endRange == (beginPara.getAbsoluteStart() + beginPara.textLength)){

                    endRange--;

                }

               

                if ((beginRange == endRange) || (endRange <= linkElEnd)){

                    linkString = LinkElement(linkEl).href;

                    linkTarget = LinkElement(linkEl).target;

                }

            }

           if(selectedElementRange.firstLeaf is InlineGraphicElement){

                var inlineGraphElement:InlineGraphicElement = selectedElementRange.firstLeaf as InlineGraphicElement;

              

                showHideImageHandles(selectedElementRange.absoluteStart);

            }

            else{

               

              

                dispatch(new ImageHandlesEvent(ImageHandlesEvent.HIDE, -1, 0));

            }

}

Thanx in advanced.

This topic has been closed for replies.

1 reply

Adobe Employee
January 9, 2012

Hi dineshmgkvp ,

No matter image in textflow is set as float or inline graphic, the structure of the textflow will never be changed. That is to say, if you set float="left", it does not mean image is the first leaf of select range when you select from the left edge to right.

Participant
January 9, 2012

Thanx Jin,

How can i identify that clicked element is InlineGraphicElement or not in SelectionEvent?

Please give some hint.. what i doing wrong in my code.

Thanx in advanced...

Adobe Employee
January 10, 2012

There are several DisplayObjects located at the shown place of float image,

1. InlineGraphicElement.graphics is a flash.display.Loader

2. (InlineGraphicElement.graphics as Loader).content is a flash.display.Bitmap

3. if you use namespace tlf_internal, InlineGraphicElement.placeholderGraphic is a flash.display.Sprite

I think you can take advantage of those objects to implemement your feature.