Get the selected text

Hi guys

I'm trying to format the selected text. I select text and want to make "BOLD". That's what I have so far:

<mx:Script>
    <![CDATA[
    
        private function taBold():void {
            // do something
        }
        
    ]]>
</mx:Script>

<mx:Button id="bold" label="bold" click="taBold()"/>

It would have been simple if an event has been registered for the selection of text because then I could use the setSelection and place the text in a textRange and do any update in shape that needed to be done. But as you can see the taBold() function is called, but no args are passed on it, which leads me to ask, how can I retrieve the text selection?

Hi there you can use TextRange, take a look at the tutorials

http://www.switchonthecode.com/tutorials/Flex-snippet-tutorial-using-the-TextRange-class

http://blog.flexexamples.com/2007/08/01/using-the-TextRange-class-to-Hightlight-text/

Tags: Flex

Similar Questions

  • How to get the selected text in a TextInput

    Hallo. I have a textinput, and when the event doubleclick on a part of the text is sent, I need to get the selected text, and then save it in a string... How can I do?

    THX

    Max

    Hi Maximist,

    Below is the code snippet to get the selected text in TextInput on double click event:

    http://www.Adobe.com/2006/mxml '.

    Layout = "vertical".

    verticalAlign = "middle".

    backgroundColor = "white" >

    Import mx.controls.Alert;

    private void textInput_doubleClick(evt:MouseEvent):void {}

    Alert.Show (String (evt.target.text) .slice (evt.target.selectionBeginIndex, evt.target.select ionEndIndex));

    }

    ]]>

    Text = "the Bullfighter is out the path of the bull charge at the last moment, drawing the cheers of the spectators."

    doubleClickEnabled = "true".

    doubleClick = "textInput_doubleClick (event); "/ >

    Hope this will help you.

    Thanks and greetings

    ------------------------------------------------------------------------------------

    Pooja Kuber | [email protected] | www.infocepts.com

    ------------------------------------------------------------------------------------

  • How to get the 'selected text '? leave a string

    If I highlight text in a text string, I want to be able to copy it to the Clipboard.

    I have already created an event that uses the Application of reference to 'write the Clipboard' now I need to give it the selected text.

    How do I do that?

    Here's a way to do it.

    Ben64

  • Cannot get the "&lt; FEFF &gt;" string in the selected text [indesign CS6]

    Hello world!

    I can't get the string to the selected text. The selected text contains several xml tags.

    In adobe indesign cc version of 2014, the selected text is bring the string «< FEFF >» tags

    In indesign adobe cs6 version cannot get the string "< FEFF >. they do ""-empty space.

    Screen Shot 2015-09-23 at 6.01.25 PM.png

    Are the above-selected text contains several xml tags.

    but I get content using script code can't get the string.

    Screen Shot 2015-09-23 at 6.02.51 PM.png

    the script gives the result, xml tags are converted to "". ""  I expect "< FEFF >.

    I expect the output is: "< FEFF > Applescript < FEFF > < FEFF > selected text < FEFF > < FEFF > < FEFF >."

    Please help me...

    Thank you

    John Peter.

    the script gives the result, xml tags are converted to "". ""  I expect to ''.

    The xml tags are not converted to "" but "\uFEFF" (zero-width space non-bec), it is the character used to represent the tags in a text frame. Looks like the apple script converts a hexadecimal representation unicode values.

  • Get the line number of the selected text

    Hi all

    Please tell me how to get the row number of the selected text in a page.

    for example

    Look, here's the page with text, I want to get the number of the line of the selected one (marked in red) text

    |-------------------------|

    | XXXXXXXXXXXXXX.

    | XXXXXXXXXX |
    | XXXXXXXXXXXXXX.

    | xxxxxxxxxxxxxx |

    | XXXXXXXXXX |

    | XXXXXXXXXXXXXX.

    | XXXXXXXXXXXXXX.

    ---------------------------

    Thanks in advance

    Shiv

    Hi Shiv,

    This thread of extraction. This will give you an idea.

    Always search the forum first before creating a new.

    Shonky

  • Retrieve the selected text

    Hello

    I just know how I can retrieve the text selected via the Menu:

    I add a MenuItem to the category system so that it is available everywhere:

    ... ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_SYSTEM,this);...
    

    Then after that I selected the text in the browser for example, I click on the Menu button:

    public Object run(Object context) {
      if ( context instanceof ) {
        //do something with the selected Text    ...
      }
    }
    

    It should allow me to do something with the text I've selected. What instance is that the text of selected?

    Can someone help me here?

    Thank you in advance!

            if (fld.isSelectionCopyable()){
                Clipboard cd = Clipboard.getClipboard();
                fld.selectionCopy(cd);
                Object s3 = cd.get();
            //(....)
    

    On the second reading of your code, you do not use the Clipboard correctly. Try the above.

  • can I get the full text of sql from aud$ data table

    Hi gems... good afternoon...

    We try to understand the name of the tables and actions associated with their subject (select, insert, update, delete) what we will do with our application.
    So I enabled the audit parameter audit_trail = db, extended. After that I can get the records required of the dba_audit_trail_view by the following query:
    select d.entryid, d.timestamp, d.obj_name, d.action_name, d.sql_text
    from dba_audit_trail d 
    where d.username='TEST_SCHEMA'
    and d.obj_name not like '%$%'
    and d.obj_name not in ('_CURRENT_EDITION_OBJ','ALL_OBJECTS','_ACTUAL_EDITION_OBJ','ALL_SYNONYMS','_ALL_SYNONYMS_TREE',
    '_ALL_SYNONYMS_FOR_AUTH_OBJECTS','_ALL_SYNONYMS_FOR_SYNONYMS','ALL_SYNONYMS','DBA_SYNONYMS','PLSQLDEV_AUTHORIZATION',
    'USER_OBJECTS','_ALL_SYNONYMS_FOR_AUTH_OBJECTS','DUAL','_BASE_USER','ALL_TAB_COLUMNS','ALL_COL_COMMENTS','ALL_TAB_COLS',
    'NLS_DATABASE_PARAMETERS','ALL_SOURCE','ALL_ERRORS')
    order by d.timestamp desc;
    I'm satisfactory output by that. But the problem is that some of the requests in hibernation is too large (maybe 10000 characters... "I'm not sure), these queries do not come completely. This is why I don't get some important information such as the WHERE the FROM clause condition, etc.
    There is no sql_id column in the table of $ aud.

    Is it possible to get the full text of sql... Please help...

    for this view sql_text column is different... try column sql_text a60000 and answer format which is the result

  • CS6: create a simple extension: how to copy the selected text in the extension?

    Hello

    with this tutorial http://www.DWfaq.com/Tutorials/Extensions/simple_object.asp

    I created a very simple extensions in Dreamweaver CS6.

    But I can't find out how to get the code/selected text "in" this extension.

    I want to reformat the selection with the javascript code for the extension and replace the selected text.

    Thank you!

    mtemp

    Thank you very much for your answer!

    I didn't know the difference between these two methods - my google search for 'extension' led me directly to the old tutorial mentioned...

    And, Yes, I had to search long enough to find the 'object' extension on the fly on the menu...

    Now, I adapted the code referred to in the dreamweaver_cs5_extending.pdf for the creation of such an extension of command - and, wow, it works... with 'copy' the text selected in the extension form.

    So, thanks again! Now I'm on the right track

  • Limits of the selected text in cs3, Javascript

    Hi all

    That someone has the idea of how to get the bounds(x,y,width,height) of the selected text in the document cs3 via javascript. If so, please. share it. Here need urgent on this basis.

    Thanks in advance,

    Valentine

    http://forums.Adobe.com/message/3188272#3188272

  • Acrobat 9 Pro: cannot copy the selected text unless I have a highlighting of the text

    I highlighted the text in a document. When I go to copy this text, it selects the whole sentence. I right click, the menu starts with "set status. There is no option "copy". No control-C is successful. When I paste then, he pastes a previously selected text, not the text I'm trying to copy in Acrobat. The only way I found to copy the selected text to the United Nations is a development and then copy it. Are there other solutions?

    Thank you!

    Play with the Shift key... you will get it.

  • How to get the whole text of value special hashi

    Hello

    can someone let me know how to get the full text of sql data hash_value in report statsapck...
    SQL> select SQL_TEXT from v$sql where HASH_VALUE=3102119461;

    SQL_TEXT
    --------------------------------------------------------------------------------

    SELECT ROWID,AR_DT,AR_TXN_CODE,AR_NO,AR_AMD_NO,AR_REF_FROM,AR_REF_TXN_CODE,AR_RE

    F_NO,AR_DAK_CODE,AR_DED_SYS_ID,AR_COMP_CODE,AR_ACNT_YR,AR_AMD_DT,AR_AMD_UID,AR_A

    MD_RES_CODE,AR_REF_SYS_ID,AR_STUD_SRN,AR_APPL_DT,AR_ISSUE_DT,AR_ENROL_FRM_COURSE

    ,AR_ENROL_DT,AR_JOURNAL_YN,AR_TYPE,AR_TITLE,AR_VACANCY_CODE,AR_MRH_MRN,AR_INDUST

    RY_FIRM,AR_DEED_FM_DT,AR_DEED_TO_DT,AR_IT_TR_YN,AR_IT_START_DT,AR_CONDN_YN,AR_RE

    MARKS,AR_IT_END_DT,AR_CONDN_DAYS,AR_CONDN_AMT,AR_CONDN_DT,AR_CONDN_BY,AR_46_FLAG

    ,AR_RE_REG_YN,AR_DOC_STATUS,AR_ART_TERM_COMPLN,AR_TERMN_COMPLNPLN_DT,AR_CORRES_A

    DDR_LINE_1,AR_CORRES_ADDR_LINE_2,AR_CORRES_ADDR_LINE_3,AR_CORRES_CITY_CODE,AR_CO

    RRES_ZIP_POSTAL_CODE,AR_CORRES_BR_CODE,AR_CORRES_REGION_CODE,AR_CORRES_STATE_COD

    E,AR_CORRES_COU_CODE,AR_CORRES_TEL,AR_CORRES_EMAIL,AR_CORRES_MOBILE,AR_PER_ADDR_

    LINE_1,AR_PER_ADDR_LINE_2,AR_PER_ADDR_LINE_3,AR_PER_ADDR_LINE_4,AR_PER_CITY_CODE


    SQL_TEXT
    --------------------------------------------------------------------------------

    ,AR_PER_ZIP_POSTAL_CODE,AR_PER_BR_CODE,AR_PER_REGION_CODE,AR_PER_STATE_CODE,AR_P

    ER_COU_CODE,AR_PER_TEL,AR_APPR_DT,AR_AP


    SQL>

    You can query V$ SQLTEXT or V$ SQLTEXT_WITH_NEWLINES

    Thus

    select sql_text
    from v$sqltext
    where hash_value='&hash_value'
    and address='&address'
    order by piece;
    

    Note: In 10g and more, you can use instead of HASH_VALUE SQL_ID and ADDRESS.

    Additonally, in 10g and above, you can also query V$ SQLSTATS where the text is stored in a CLOB called 'SQL_FULLTEXT', we must therefore DEFINE the LONG value when using SQLPlus.

  • How to search the selected text with a default search engine?

    Hello

    Before the recent update of the search bar, you can select your 'current' search engine, and a search for the selected text (right click on the selection) would use this engine.

    Now, it seems that you can only search for the selected text using the default engine. If that is correct, it's a big step backwards for me. For example, I can't have Google as my default search engine and the search for a text selected on eBay!

    Or am I missing something?

    Thank you!

    R.

    I find this extension very useful for selected items in the web pages. It offers all your search engines with select > right click.
    https://addons.Mozilla.org/en-us/Firefox/addon/context-search/?src=search

  • How to get the selected row in a programmatic table of the ADF (table generated from a bean)

    Hi all


    We use JDeveloper Studio Edition Version 12.1.3.0.0 and deployed on GlassFish Server Open Source Edition 3.1.2.2 (build 5) and connect to the SQLServer database.


    How to get the selected line in a programmatic (using a SortableModel custom not a display object) ADF table (generated from a bean)?


    We are trying to get the selected row in a bean of a programmatic ADF table to retrieve data based on the selected line.


    Any idea?

    Well, you can use selectionListener to set the selected line to a variable of bean (but this bean must be in extended view or some superiors)

    Something like this: http://www.awasthiashish.com/2015/07/get-selected-row-singlemultiple-from.html

    Dario

  • Replace the selected text with other content TextFrame

    Hello

    I am changing a text selected in something new, involving the movement of text and the paragraph style using a jsx script. At the present time, everything works beautifully:

    • I entered the select text
    • I have create a new temporary TextFrame
    • I build my new paragraphs and apply styles to them in the new TextFrame

    What I was not able to reach still is to replace the original selected text by temporary TextFrame content.

    Any help would be more than welcome

    A part of my script:

    myText = app.selection[0].contents;

     

    ... do some stuff


    var myDocument = app.documents.item(0);

    var myPage = myDocument.pages.item(0);

    var myTextFrame = myPage.textFrames.add();


    myTextFrame.geometricBounds = [0, -70, 150, 70];

    myTextFrame.contents = "Paragraph1\rParagraph2...";


    myTextFrame.paragraphs[0].appliedParagraphStyle = pStyleGroup.paragraphStyles.itemByName('Style1');

    myTextFrame.paragraphs[1].appliedParagraphStyle = pStyleGroup.paragraphStyles.itemByName('Style2');

    And now, in myTextFrame, I have my new paragraph formatted, and I would like to replace the original selected text with the contents of my TextFrame (keeping the paragraph styles).

    Hello

    Keep the logic of the code and edit utilities:

    var
        mSourceIdx = app.selection[0].index,
        mStory = app.selection[0].parentStory,
        mReplaceStuff = {
            elements: [
                ["Paragraph_1\r",  "Style_1"],
                ["Paragraph_2\r",  "Style_2"],
                ["Paragraph_X\r",  "Style_X"]
                ]},
        mTarget, cElement, cText, cParaStyle;
    
    while (cElement = mReplaceStuff.elements.pop()) {
        cText = cElement[0];
        cParaStyle = app.activeDocument.paragraphStyles.item(cElement[1]);    // modify if styleGroups present in a structure
      mTarget = mStory.insertionPoints.item(mSourceIdx);
        mTarget.contents = cText;
        mTarget.paragraphs[0].appliedParagraphStyle = cParaStyle;
         }
    
    app.selection[0].contents = "";
    

    MReplaceStuff allows to prepare stuff to replace

    Jarek

  • Dreamweaver CC: How to change the color of the selected text

    Maybe a stupid question, but I can't seem to figure it out, even with searches on the web.  I want to change the color of a single word in my HTML document.  Can anyone offer advice?

    I can change some styles of the selected text (bold, italic, etc.), but do not understand the color.

    Also, I know how to change the color of the different elements using CSS.  But for the selected text in an element, CSS here the simplest solution?

    Thanks in advance.

    carlg79335635 wrote:

    Thank you for that.  But I don't have a color option in my menu format.  It ends at some CSS Styles.  I have to allow him anywhere?  I use Dreamweaver CC.

    Yes.  I checked it and in CC DW, there is not a way to do as I suggested previously.  I was watching DW CS6 and he got it.

    Looks like you'll need to teach how them to manually code.  This will make them think about what they are doing and so concentrate better.

Maybe you are looking for

  • Impossible to install Vista 64-bit SP2 as it says file doesn't have a digital signature?

    Hi have tried to download this several times but it goes on to say that the file doesn't have a valid digital signature, whereby it seems weird as its on the microsoft Web site.  Windows Update doesn't have the option to install from there, I had to

  • Quicken uninstalled after Windows Update

    After running Windows Update and install the updates, I discovered that Quicken software I had installed and used on my PC has been uninstalled. My OS is Windows Vista PremiumAfter installing updates with Windows Update I couldn't see Quicken to cont

  • install wondows 95 on a xp system, drive will not format or change NTFS in fat

    Hiya,Here are the current specifications for my computer, Microsoft windows xp professional,service pack 3 Intel pentium 4 cpu 3.00 GHz512 MB of RAM Basically, I want the computer to work with a windows 95 OS instead of xp, (I have a boot cd) I tried

  • I think someone hacked my computer.

    original title: pirate computer I think someone hacked my computer and I'm scanning for viruse only receive an error message # 0x0c600c03, can someone help me?

  • How can I manually select Tray 1 to print from?

    I have an Office Jet Pro 8600 and just install tray 2.  My computer is recognize tray 2 by default which I am fine with.  How can I manually select Tray 1 when I print something.  My hope is to put the new paper in tray 2 and (already printed on 1 si