problem with function getCharIndexAtPoint

Hello

I encountered a strange problem using; It is a simple code that works well:

package

{

import flash.display.Sprite;

import flash.events.MouseEvent;

import fl.text.TLFTextField;

import flash.text.TextFieldType;

import flash.geom.Rectangle;

import flashx.textLayout.elements.Configuration;

import flashx.textLayout.elements.TextFlow;

import flashx.textLayout.conversion.TextConverter;

import flashx.textLayout.conversion.ConversionType;

public class scrollV extends Sprite

        {

private var tlf:TLFTextField = new TLFTextField;

private var str:String = "click on this text field. Compare the ' + '.

' difference between clicking without «+»»

'selection versus clicking and selecting text.';

public function scrollV()

           {

var config:Configuration = TextFlow.defaultConfiguration;         

config.manageTabKey = true; / / activate the tab key

addChild (tlf); tlf.width = 200;

tlf.text = str;

tlf.wordWrap = true;

tlf.type = TextFieldType.INPUT;

tlf.addEventListener (MouseEvent.CLICK, printCursorPosition);

trace (TextConverter.export (tlf.textFlow, TextConverter.TEXT_LAYOUT_FORMAT, ConversionType.STRING_TYPE) as String);

            }

printCursorPosition(e:*):void private function

            {

trace ("tank #:", tlf.caretIndex + "from:", tlf.selectionBeginIndex + "to:", tlf.selectionEndIndex);

var rett:Rectangle = tlf.getCharBoundaries (tlf.caretIndex);

trace ("char pos:" + rett.x +', ' + rett.y);

trace ("idx #:" + tlf.getCharIndexAtPoint (rett.x, rett.y));

           }

       }

}         

In this code, the function getCharIndexAtPoint works properly; then I wanted to try the same function but using textFlow and, using the export trace output, I wrote the following code:

package

{

import flash.display.Sprite;

import flash.events.MouseEvent;

import fl.text.TLFTextField;

import flash.text.TextFieldType;

import flash.geom.Rectangle;

import flashx.textLayout.elements.Configuration;

import flashx.textLayout.elements.TextFlow;

import flashx.textLayout.conversion.TextConverter;

import flashx.textLayout.conversion.ConversionType;

import flashx.textLayout.container.ContainerController;

public class scrollV extends Sprite

   {

private var tlf:TLFTextField = new TLFTextField;

private var str:String = '< TextFlow columnCount = "inherit" +

"columnGap ="inherit"+"

"columnWidth ="inherit"' + '.

' lineBreak = "explicit" paddingBottom = "inherit" +.

"paddingLeft ="inherit"' + '.

"paddingRight ="inherit"paddingTop ="inherit "+".

"renderingMode = 'normal' ' +"

"verticalAlign ="inherit"+"

"whiteSpaceCollapse ="preserve"' +"

                                         'xmlns=" http://ns.Adobe.com/TextLayout/2008 "> '+

' < p > < span renderingMode = "inherit" > "+

"Click on this text field. Compare the difference '.

"between clicking without selecting ' + '.

"versus clicking and text selection. '" +

' </span > < / p > ' +.

                                         '</TextFlow>';

scrollV() of the public service

          {

var config:Configuration = TextFlow.defaultConfiguration;         

config.manageTabKey = true; / / activate the tab key

addChild (tlf); tlf.width = 200;

tlf.textFlow = TextConverter.importToFlow (str, TextConverter.TEXT_LAYOUT_FORMAT);

control of the var: ContainerController = new ContainerController (tlf);

tlf.textFlow.flowComposer.addController (control);

tlf.textFlow.flowComposer.compose ();

tlf.textFlow.flowComposer.updateAllControllers ();

tlf.wordWrap = true;

tlf.type = TextFieldType.INPUT;

tlf.addEventListener (MouseEvent.CLICK, printCursorPosition);

trace (TextConverter.export (tlf.textFlow, TextConverter.TEXT_LAYOUT_FORMAT, ConversionType.STRING_TYPE) as String);

           }

printCursorPosition(e:*):void private function

          {

trace ("tank #:", tlf.caretIndex + "from:", tlf.selectionBeginIndex + "to:", tlf.selectionEndIndex);

var rett:Rectangle = tlf.getCharBoundaries (tlf.caretIndex);

trace ("pos:" + rett.x +', ' + rett.y);

trace ("idx #:" + tlf.getCharIndexAtPoint (rett.x, rett.y));

           }

     }

}         

in this code the getCharIndexAtPoint function gives the error #1009: cannot access a property or method of a null object reference.

Does anyone know how to tell me where the error in this code?

Thank you for all.

1 TLFTextField is a kind of Sprite (extends Sprite). So, your solution makes sense anyway. I suggest that you first ask the question again on the Sub-Forum related to Flash pro (or Flash authoring), because TLFTextField is under their control, rather than TLF.

2. more than details on TLF, you can see its codes, the docs and examples in http://sourceforge.net/adobe/tlf/home/

How to implement * getCharIndexAtPoint *.

TLF cursor may return its own position, which can also present the index of the char.

Example Code:
textFlow.interactionManager = new SelectionManager();

textFlow.interactionManager. activePosition

textFlow.interactionManager. anchorPosition

Tags: Adobe Open Source

Similar Questions

  • Problem with function "BD" in TestStand/LabWindows

    Hello, good day.

    I am having some problems with connection BD function I use in a personal function inside a DLL.

    I had a function called GetSensor , which I know it works because I have used and tested in the LabWindows environment.

    Its function is to return the value of an element in my database to give its input parameter, just that.

    My problem comes out when I tried to use this same feature in TestStand, it seems that the BD can only function in the same way of when used of LabWindows because always display a warning message, which is display only when the values of iHdbc are iHdbc is 11 or iHdbc is 10.

    The software that I use are:

    I know that TestStand is the opening of my DLL locks function it always enter, but failed the part then try to connect to the database.

    I think that this could be a problem of compatibility with LabWindows, TestStand, but I can't find where I can change some options to solve this problem.

    Thanks in advance. Any help you could give is welcome.

    I coud not answer before.

    The solution to my problem with the BD connection function should use NI TestStand 2014 (32-bit) instead of the version of NI TestStand 2014 (64-bit) that I used. Just that.

  • Problem with function "BD" in LabWindows/TestStand

    Hello, good day.

    I am having some problems with the connection BDfunction.

    I had a function called GetSensor , which I know it works because I have used and tested in the LabWindows environment.

    Its function is to return the value of an element in my database to give its input parameter, just that.

    My problem is that when I tried to use this same feature in TestStand, it seems that the BD can only function in the same way of when used of LabWindows because always display a warning message, which is display only when the values of iHdbc are iHdbc is 11 or iHdbc is 10.

    The software that I use are:

    Thanks in advance. Any help you could give is welcome.

    The solution to my problem with the BD connection function should use NI TestStand 2014 (32-bit) instead of the version of NI TestStand 2014 (64-bit) that I used. Just that.

  • Problem with function Set Destination

    I am adding bookmarks to subheadings in a pdf document in Adobe Pro XI and am having a problem with the function of the Destination defined in a specific case. I am attaching a video that shows the issue clearly, but I'll explain below as well in case some people have difficulties to display the video.

    I understand how to create a bookmark for a subtitle, and I understand how to use Set Destination to ensure that, when the user clicks on the bookmark in the Panel, the subtitle is displayed at the top of the screen.

    However, I ran into a problem. Some of my subtitles are run subtitles, which means that subtitles are part of the first line of the paragraph (this is common in the APA and some other editorial styles). When the running subtitle begins the last paragraph of a page and is towards the bottom of the page, the function of the Destination value does not work. Specifically, when I set the destination of such a chapter, when the user clicks on the bookmark in the Panel, it sends the user to the page after the bookmark. Is the closest I can come to get the subtitles to appear at the top of the page to set the location to the previous sentence, but this is obviously inaccurate. I work in professional contexts in which the bookmark should appear at the top or the documents of my clients will sometimes not be accepted for publication.

    Does anyone have an idea how to get these subtitles appear on the first line at the top of the page?

    Don't forget to turn off the continuous vision before you set bookmarks. Acrobat makes no sense "line active" for a link and links to the number of current page shown in the toolbar.

  • Problem with the getCharIndexAtPoint() method.

    Just try to set up a basic script to detect the text when the user clicks on it. The following code:

    trace (caesar_txt.getCharIndexAtPoint (300,300));

    GetCharacter();

    function getcharacter()

    {

    trace (caesar_txt.getCharIndexAtPoint (300,300));

    }

    Produced these results:

    42

    TypeError: Error #1009: cannot access a property or method of a null object reference.

    to fl.text::TLFTextField/getCharBoundaries()

    to fl.text::TLFTextField/getCharIndexAtPoint()

    at Untitled_fla::MainTimeline/getcharacter()

    at Untitled_fla::MainTimeline/frame1()

    If the first command the trace, the character index in this point (42) is returned, but as soon as the trace command is called in a function he faces a null object reference, apparently in the getCharBoundaries method. The field of text in question exist on the stage, it is not created in the code, but I doubt it would be a problem. Appreciate any help you could give me.

    I think you found a bug. I can reproduce it. The reason I think this is a bug is disable Word wrapping (select textfield, go to pass container and flow, defined behavior "Multiline no film"). The bug seems to only happen with active wordWrap.

    I produced the TLFTextField with code and also placed on stage to hand, the two error if the word wrapping is enabled.

    Disable word wrapping made your mistake disappear?

  • Satellite C850 - 1-5 - problem with function keys

    Good evening

    Since a few days, I noticed on my laptop that I could not do more as before, which is the volume with the button located at the top of the keyboard (F9 - F10) or the brightness. On the square, it's functions F1, F2, F3 etc. who went. I have already tried using parameters and setting key 'special functions' systems, but that worked again, then in "mode F1 - F12", still nothing and I challenged 'special functions', but again without success.

    How to solve this problem, please?

    Can you please tell us what model of laptop do you have?

  • Windows 8 problem with functionality of keyboard backlight radiance on HP envy 17

    Hello

    I upgraded my laptop HP Envy 17 to Windows 8.

    I went and applied all the updates driver provided here for use with Win8.

    The question (more than one gene) implies the radiance keyboard.

    Start-up lighting of the keypad is disabled. When I press the F5 key, the lighting of the keypad is disabled.

    When I press the button once again, lighting is turned on.

    Is there a setting (Panel or registry) I can modify to prevent that from happening.

    Thank you.

    EWO

    Hello Eyes - Wide - Open and jdubs. I understand that after your update of Windows 8 by pressing f (x) keys activate their functions Fn + F (X) instead of their main functions in f (x). Is this correct?

    Restart your laptop and enter the BIOS. Go to the section 'System Configuration '. You have enabled or disabled 'key Support Action '?

    When this option is simply to press the F key to activate action Fn + F (X). When it is disabled, you need to press Fn + F (X) for it to work. You want to disable it.

    After disabling and save your changes, restart the computer once more and then check if the problem has been resolved.

    Could Mslopar, you post your complete product for me number? Use this document to locate it.

    I hope everyone has a great day.

  • Problem with function bundle on a cluster of cursor

    Hi all

    I have some difficulties to change cursor properties using cluster bundle. I want to control whether cursors are placed and what they look like.

    As far as I understand reading the help file, it should be possible just change one or more of the elements in the cluster with the function of beam, or

    am I missing something?

    I have attached a VI that show my problem.

    I use Win 7 64 bit, with LabVIEW 2009 SP1 64 bit.

    Thank you

    -Tommy

    Hello again...

    Allright, I just added a table build and corrected a minor error in the property list, and now it works!

    Thanks a lot for the support guys!

    Good day!

    I have attached the final programme of work if anyone has the same problem as me.

    Concerning

    Tommy

  • Major problem with functions on the color Lumetri color tab

    For some reason that I can't access the color Lumetri functions under the label of color in the new Premier Pro update 2015. I can see fixed base, Creative... ect... ect and click on the link next to each, but when I try to expand an it shows me the section for a split second then closes to the top!  Sometimes when I restart the program I can expand these sections and play with them until they start to get blocked again. Can someone help me with this please? now something, I might be able to link to the situation (or maybe not) but when I go in the activity monitor and close the QT server) and then reopen first I am able to play with the color again for about 2 minutes before it all locks in place. I tried to do an uninstall and reinstall.

    Screen Shot 2015-06-17 at 12.32.11 AM.png

    I have a touchpad and it was a problem of mouse for some reason any when I tap it would be double tap...  When I tried a new mouse, it works beautifully. For a reason, it's the only part of the application it operated.

  • Problem with function. error() jQuery in 3.0

    As the title suggests, since the 3.0 update I had a problem using .error jQuery function. What I'm trying to do is to hide an image whenever the link is broken. My code that worked in previous versions no longer works and I even created a test with a simple structure file to test the code, and it doesn't seem to work. For the test, I copied the code directly from API jQuery and added a simple hide function, all the elements sit on the stage:

    $("slide1").error (function () {}

    $("slide1").hide ();

    });

    This does not work, and I can't understand why. Any suggestion would be appreciated! Thank you.

    Hi, TAEgner-

    Error() does not work in the latest version of edge animate because it has been deprecated in jQuery 1.8.  Animate it 3, we have improved our version of jQuery to 2.0.3.

    Instead, try this:

    SYM. $('diapo1') .one ('error', function() {}

    SYM.$('slide1'). Hide();

    });

    I hope this helps!

    -Elaine

  • Problem with functions on a Movie Clip

    Hi, I hope someone can help me with this problem!


    I have the clips

    _root. Inhalt.motivcontainer and another one is attached to this
    _root. Inhalt.motivcontainer.buttonLinksUnten

    now, I spend two video clips with:

    _root. Inhalt.motivcontainer.onPress = function() {}
    startDrag (_root.inhalt.motivcontainer, false, 230, 198, 75, 135);
    };
    _root. Inhalt.motivcontainer.onRelease = _root.inhalt.motivcontainer.onReleaseOutside = function () {}
    this.stopDrag ();
    };
    _root. Inhalt.motivcontainer.OnMouseMove = function() {}
    updateAfterEvent();
    };

    My problem is to get another function on the second clip?

    Perhaps one of you have a different solution to drag and too a video clip and have the opportunity to touch the clip on the corner on the scale.

    Sorry for my English.

    Thanks for your help René

    your movieclip parent (_root.inhalt.motivcontainer) intercepts all mouse events assigned to the child movieclip (_root.inhalt.motivcontainer.buttonLinksUnten).

    to solve or create an another movieclip on the timeline of parents who lies on a layer below any visible content buttonLinksUnten and assign managers above this 'new' child or use a hitTest for the parent or the child instead of two sets of managers of the mouse.

  • AR invoice print report is complemented by error - problem with function MLS

    Hi all

    When we submit AR invoice print program he finished in error with the following message
    for some Bill to the country.
    --------------------------------------------------------------------------------------------------------------------------------------------------------------
    ARP_RAXINV_MLS_PACKAGE of the language function call. ARP_RAXINV_MLS_FUNCTION: APRIL 29, 2010 04:32:43

    Language function returned the following languages: U.S.. : APRIL 29, 2010 04:32:43

    MLS request completed normally with result error
    --------------------------------------------------------------------------------------------------------------------------------------------------------------

    on change of country it works very well, do not know if it is related to the country

    Thank you
    Aurélie

    Bill for countries that had problems are added on a mission to the address window

    Thank you
    Aurélie

  • Problem with function of Disk Defragmenter

    Running Vista 64-bit Home Premium on desktop Dell 519.  As far as I KNOW, all updates and patches are installed.  Just found out that defrag does not work since Nov 2011.  Has been fixed for the weekly Defrag, but that order happening right now for some reason any.  Of course, the manual defragmentation at this stage took several hours.  The message box now looks like this after that I updated the date information:

    Note that the "next scheduled run' is 'never', but 'scheduled defragmentation is enabled.  If I uncheck and together the box "Run on a schedule (recommended)", the next scheduled run is correctly Tuesday, may 6, 2014.  However, when I 'OK' from the window, then re-open it, at the next run yet, said '' never. ''  Whenever I change anything in the box, the 'OK' button becomes usable and clicking on it clears the area of the screen.  This is what it looks like after that I décliqués and reclicked the button "Run on a schedule.

    It's what I expected to see, but it is up to the message 'never', as shown in the first screenshot when you click on the OK"" button.  Any wisdom out there on this?  (Please note that I'm not an expert at this and probably won't get a response of type techno)

    Thank you, Bill.

    I posted to this existing topic because I wasn't sure if the glitch was still part of the same program, or even if I had a hardware problem or software.  Thank you very much for these links, I was actually on the phone with Dell when your answer came to my email, and the agent told me to try running the boot CD > computer > DVD player, what has worked.

    I'll put all those links you posted, I think that I will need them while trying to fix my system.  For future questions, I will be careful to post correctly.  Thanks again for your help and your patience!

  • Problem with functions ctrl after using MS Keyboard Creator

    I used MS Keyboard Creator 1.4 to make a presentation in Windows 7 and it installed successfully for the most part, but the Ctrl basic functions behave as if I'm always typing in qwerty. I used the alternatives put forward without this problem, and I don't know what is happening. Any ideas?

    I found that I could save and edit directly the keyboard layout source file (.klc) before generating the installation package, and I noticed that (VK_) virtual key codes were in the wrong places. It is then a simple matter to reorganize them and build a new package.  The problem seems to be resolved now.

  • Problem with function ArrayItem in DRM

    Hello

    I have a list of values separated by a comma. I'm trying to get the first value in the list by using the function "ArrayItem.

    But when I give the delimiter as "," is considered a parameter and gives an error like *'DRM-25620: number of parameters for the function 'ArrayItem' invalid. 3 EXPECTED, found 4' *. But here, is actually a delimiter in my initial list of values.

    I tried to use, such as ',' and ',' but of no use... each form is treated as parameter and giving same error.

    Can you please let me know how we can specify the delimiter in the service.

    I hv same tried to use the ReplaceStr function to replace with another character in my watchlist, but there also, is considered as separator parameter in the function.

    Thanks in advance

    Hello

    On your delimiter, put the comma of Word inside the brackets []. It should look like this: [decimal]. It will take a comma as separator.

Maybe you are looking for