TextArea - insert an image to the position selected by the user

I am developing a feature where I can insert a picture at a specific position in the text box to help ActionScript .
I can get the position of the cursor of the user using the selectionAnchorPosition property.
I can create the image using InlineGraphicElement I can add to the method addChild TextFlow text box, but that adds the image at the end of the content.
It is also addChildAt method allows me to add the paragraph with this image in TextFlow to a specific index. But to do this, you must know the index.
How can I find the index of the child to the location of the cursor? In addition, addChildAt to add a paragraph. How can I add this image within an existing paragraph?
Please help... Thank you!

Your code can be simplified as follows. Pay attention to * addImageButton_clickHandler *.


<>
"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" = "600" minHeight
creationComplete = "application1_creationCompleteHandler (event)" "
>
   
       
   

   
   
   
   
        <>
horizontalAlign = "center".
paddingTop = "20".
/>
   

   
    <>
ID = 'richText '.
Width = "800".
Height = "300".
horizontalCenter = "0".
Red = '0 '.
textFlow = "{textFlow}.
/>
    <>
ID = "addImageButton".
label = 'add images '.
Click = "addImageButton_clickHandler (Event)" "
/>
   
   
   
   
        Import flashx.textLayout.edit.IEditManager;
Import flashx.textLayout.elements.InlineGraphicElement;
Import flashx.textLayout.elements.ParagraphElement;
Import flashx.textLayout.elements.TextFlow;
Import flashx.textLayout.formats.WhiteSpaceCollapse;
           
Import mx.events.FlexEvent;
           
Import spark.utils.TextFlowUtil;
           
           
           
[Bindable]
private var inputString:String = "the Dow Jones industrial average lost more than 100 points Tuesday, after the Japan raised the seriousness of the nuclear crisis and Alcoa Inc. said disappointing sales. A decline in the price of oil fell by stocks of energy. « ;
[Bindable]
private var textFlow:TextFlow;
           
[Embed(source="assets/images/math.png")]
[Bindable]
public var imgCls: Class;
           
           
protected function application1_creationCompleteHandler(event:FlexEvent):void {}
textFlow = TextFlowUtil.importFromXML (XML (inputString), WhiteSpaceCollapse.PRESERVE);
}

protected function addImageButton_clickHandler(event:MouseEvent):void {}
var editManager:IEditManager = textFlow.interactionManager as IEditManager;
editManager.insertInlineGraphic (imgCls, 174, 44, null, editManager.getSelectionState ());
               
}
]]>
   

Tags: Adobe Open Source

Similar Questions

  • When I insert an image in the body of my email, it is replaced with an attachment when the recipient gets (also using OE).

    I use outlook express 6 on windows xp pro.

    When I Insert an image in the body of my email, it is replaced with an attachment when the recipient gets (also using OE).
    I did use the option of fixing , I used to Insert.  The reverse also occurs.  When someone using OE sends me an email with
    a peak inside the body of the email, it appears in the box and not in the body of the email. This happens only when they concern the
    my program.  Others using OE does this experience between them.

    My mail sending format is HTML and in its settings, I checked "send pictures with messages. In addition, in the tools of internet explorer, advanced, multimedia.
    I 'send photos' checked also, in the email window, under 'format', ' Rich Text (HTML) "checked.

    I have recently reinstalled cleanly win xp to address a system idle in general.  All updates are in place and tested it with antivirus and anti-malware programs.

    That is what it is?

    [Transferred from Internet Explorer]

    Original title: outlook express

    Tools | Options | Read. Read all messages in plain text it is checked? This it will make become an attachment.

  • Inserting an image change the layout and spacing of my code - how do I prevent this?

    Mode code in Dreamweaver, whenever I insert an image via the "Insert" menu, the surrounding code layout changes (sometimes significantly). See the image below.  It's really annoying to have to go back and add tabs and fix the spacing each time I have insert a picture.  Is there a way I can avoid this?  I use Dreamweaver CC and it was always a problem.

    image_code.png

    Instead of using the 'Insert image' command, drag the image to your files/project manager in the code instead. It will retain the formatting of the code. And speeds up the workflow as well.

    Don't ask me why the command changes your code formatting, while you drag an image does not work. There are the devs forgot to take the tail missing the tag image account.

  • When I insert an image in the sequence. the photo that it is expanded

    I am currently using Adobe PREMIERE PRO CS6. And I'm doing a video for school. I tried to insert an image of the main sequence. but the image were bigger so big that only part of the picture is visible. This is because the size of the image were too big. How can I solve this problem. same thing with the video, when I insert the video, the video was really small. and with a black space around it. I change the size of the screen adjustment of 100%, but the resolution of the video no longer so clear. I tried to do the same with the image, such as change the adjustment to certain % screen size. but it does nothing. the image remains on this certain task was be amplified. and if I spend 20%, only got smaller image with black spaces around it. How can I solve this problem. I do the video for school so it is really important that I get this fixed a problem.

    Smilyfrowned wrote:

    Thank you very much. I did what you said and it worked. Is there a more effective way instead of scaling? as the photo would automatically put the scale itself

    Put scale by default to fit the size of the image in the preferences, its general slot.

    If nature does not have the same proportions that the sequence you will have small black highlight and then you will always have to scale.

  • Only windows 7 can set the image of the user that appears in the start menu you can not change it. True or false?

    Is true or false. Only windows 7 can set the image of the user that appears in the start menu you can not change it.

    Set to false.

    Type the user accounts in the start search box.

    Press ENTER.

    Select change your image.

    Browse the picture than what you want.

  • No screen, no image of the user, not dell, no stand-by and no hibernation

    Hello.

    I have a Dell Latitude E6400 running Microsoft Windows XP Professional 2002 service pack 3.

    I recently had to recreate the image on my computer a virus. I have more access to the screen of welcome to all. I tried to change the settings to enable the Welcome screen, but everything happens with , it is "a recently installed program has disabled the Welcome screen and the fast user switching. To restore these features, you must uninstall the program. "The following file name can help you identify the program that made the change: msgina.dll '

    I can't recreate the image with the disks of origin of installation through computers of my work. These computers were purchased in bulk and of Microsoft Office is installed on the re-imaging utility.

    My second problem, which I think has something to do with the first is there is no image of the user for all users of the start menu. I checked was not in classic mode, it appears that it is.

    The basic software that comes with all Dell computers seems to be disabled. I tried the discs re - install for the sensor of ambient light, the sound card and many other functions of basic dell. Nothing Dell associate does not work. I think that it may have been blocked by the system.

    My fourth and fifth question has to do with the closing of my computer. Because it is a laptop, I can normally, close the cover and she would be on stand-by until I again to open the lid. There is more to this. When I open the lid again now, it indicates that the computer is running, but the screen does not show anything. I had a problem similar to this in the past to do with the ambient light sensor, but saw that I can not install the drivers, I doubt very much that this error has nothing to do with them. Hibernation seems to freeze my computer when he's preparing for the hibernation. Then, of course, I had to be manually turned off and when I start again, I get the Blue Screen Of Death treatment.

    I would be grateful any suggestions to solve these problems, and I confess that dell may also be responsible for some of these flaws. There are many more problems, but I won't bore you to their topic. And all of these problems stem from a system repair.

    MVP Ramesh: http://windowsxp.mvps.org/ginadll.htm
    MS - MVP - Elephant Boy computers - don't panic!

  • DOES SUPPORT THUNDERBIRD, INSERTING AN IMAGE IN THE BODY OF THE TEXT BY EMAIL?

    TO DO THIS, RTF AND BEFORE I DOWNLOAD THIS EMAIL PROGRAM, I WOULD LIKE TO KNOW IF THUNDERBIRD SUPPORTS.

    Rich Text is a Microsoft format. With Thunderbird, you can choose to compose messages in HTML format (as opposed to plain text). With HTML, you can insert images in the body of an email.

    There is no need to write in capital LETTERS. It is generally regarded as yelling.

  • BlackBerry Smartphones to insert an image in the message

    I have a picture of the screen in form .pdf or .jpg.

    How can I insert it into a message?

    I see the icon "Insert an Image" but requires a url.

    I don't understand this.

    What I'm really after is, what the little symbol that looks like a dollar bill or maybe a way to tape cassette?

    I have never seen anything like the lack of documentation for a device such as that I am having with this BB 8330.

    Of course, my (large) company provided. Maybe they kept the documentation themselves.

    WelCme the supprt frums!


    H2Omelon wrote:

    I have a picture of the screen in form .pdf or .jpg.

    How can I insert it into a message?

    Are you talking about here on the frums? If then you go to your image, you are eager to copy - right click, and then click COPY IMAGE LOCATION = when you press the little tree this forum - insert image - stick.

    I see the icon "Insert an Image" but requires a url.

    I don't understand this.

    What I'm really after is, what the little symbol that looks like a dollar bill or maybe a way to tape cassette?

    Search tape little is a voicemail.  It appears when someone has left you a message VM.

    I have never seen anything like the lack of documentation for a device such as that I am having with this BB 8330.

    Of course, my (large) company provided. Maybe they kept the documentation themselves.

    I have the 8330 - takes a little time to get used to and I am always finding new things and shortcuts on it.  This forum is a great resource to find your answers! I hope this has been helpful!

  • Insert an image in the pdf (Adobe Acrobat Pro DC) using javascript

    So, basically, what I want to do:

    .this.getField('imageField').importImage('path_to_img');

    I know that this code is not correct, but is there a way to do this? I couldn't find the solution in the Acrobat documentation.

    Most of the issues I found referred to the problem when the user selects an image at the click of a button. I don't want that.

    I need something like what I wrote above, because path_to_image is a variable I'm pulling from a database...

    Do you actually fix layout of the button to "Icon?" only

  • First Pro CC insert unique image in the exported files

    I've never had this problem before now.

    A project I've been compiling works for several months has been exported using TEA via PPCC.

    Previous exports this question came not to the top at all.

    Here's the problem:

    Screen Shot 2014-02-21 at 1.53.40 PM.png

    Videos of fondues (using Apple ProRes 422 HQ, QT H.264 and MPEG2 DVD) have a single image insert between two stills in a montage.

    The previous record, he appeared on a different photo seconds later in the program, like this:

    Screen Shot 2014-02-21 at 2.08.10 PM.png

    Again, these are artifacts one untraceable image in the timeline to the MPCC. They appear only as 'flash frames' in the exported video.

    Anyone else seeing this? Is there a solution?

    Thank you

    Jeremy Praegitzer

    Adobe Premiere Pro CS5/CS6 certified associate

    The TV Department Manager - love a child, Inc..

    Hi Jeremy,.

    Please post on the Adobe forums,

    Please provide us with details of your systems:

    What is the operating system and version?

    What is the graphics card installed on the system?

    How much RAM do you have?

    You use any external hard drive?

    and if you use the on Open CL GPU acceleration, you can these question on export.

    Please enable GPU acceleration on software only mode, (if you use the card active cuda then Cuda)

    Kind regards

    Sandeep

  • Image display the user selected using FileReference

    I use FileReference to allow users to choose an image of their hard drive. Once the user selects the image I would like the image to display in the .swf before they download it.

    I tried this:

    fileRef = new FileReference();
    ....
    var bmpData:BitmapData = BitmapData (fileRef);
    var bm = new Bitmap (bmpData, "auto");
    screenHolder.addChild (WB);

    and this:

    var loader: Loader = new Loader();
    var request: URLRequest = new URLRequest (fileRef);
    Loader.Load (request);
    screenHolder.addChild (loader);

    but these don't work.

    does anyone have any suggestions? What I do is it possible? Or do I have to use a server?

    Thank you!

    Thanks Kglad, you are always so useful, even if the news is bad :)

  • As a person in the main video takes the floor, I want to insert an image, while the audio stays...

    I have one main video where a woman takes the floor. In his speech, I would like to continue talking while using different images that makes her disappear, but not the audio... How do I with IMovie on my IPhone?

    See iMovie for iOS (iPhone, iPod touch): organize audio clips. You should be able to detach the original clip audio but keep them lined up, allowing you to adjust the video and then move on to still images while the audio continues to play.

    TT2

  • Insert an image in the control bar

    Hello:

    Does anyone know that it is a way to add an image to the control bar?

    Thank you very much.

    RAQ.

    If you are referring to the playback bar then yes it is possible. There you have access to the Adobe's Flash and know how to use it. You can find the source fla files in the directory of Files\Adobe\Adobe Captivate 4\Templates\PlaybackFLA.  (the path may be different on your system).

    / Michael

    Click here to visit the blog of www.captivate4.com

  • Question about the image of the user interface of the Script

    Hello world

    We can insert a picture into script

    Like this:

    var l is new window ('dialog', 'Testing');.

    var pictures = w.add ('image', undefined, the record ("" ~ / Desktop/mingxing2.jpg ""));

    w.Show ();

    But is it possible to say the script if you do not find the photo, we have the second choice

    Like this:

    var l is new window ('dialog', 'Testing');.

    var pictures = w.add ('image', undefined, of the file ("~ / Desktop/mingxing2.jpg" |)) (("" ~/Desktop/mingxing3.jpg "));

    w.Show ();

    or third choice...

    Thank you

    Respect of

    Teetan

    Hi Teetan,

    Why not call a function that returns the file you need?

    var getImageFile = function () {}

    var f = file (Folder.desktop+"/monImage.jpg');

    ! f.exists & f = file (Folder.desktop+"/image.jpg');

    ! f.exists & f = not defined;

    return f;

    }

    var l is new window ('dialog', 'Missing Image?');.

    flowers of the var = w.add ('image', the undefined, getImageFile());

    w.Show ();

    HTH,

    Loïc

  • Background image on the User Interface

    I'm trying to place a background behind my screen of the application image. So instead of the usual white, there would be a "background.png". I am following this thread with the blackberry API set

    http://supportforums.BlackBerry.com/T5/Java-development/drawing-bitmap-in-mainScreen-background/m-p/...

    So far, I tried to apply it within my own application, with the code to start as follows:

    final class UserInterfaceScreen extends MainScreen {
        HorizontalFieldManager _fieldManagerTop;
        VerticalFieldManager _fieldManagerMiddle;
        HorizontalFieldManager _fieldManagerBottom;
        BitmapField _bitmap;
        Bitmap _canadaImage, _ukImage, _usImage, _backgroundBitmap, _fieldBitmap;
        LabelField _label;
        BasicEditField _input;
        String _canadaCapital, _ukCapital, _usCapital, _capital;
        int displayed = 0;
    
        public UserInterfaceScreen() {
            super();
            LabelField title = new LabelField("User Interface Sample",
                    LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
            setTitle(title);
    
            HorizontalFieldManager _horizontalFieldManager = new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH | HorizontalFieldManager.USE_ALL_HEIGHT){
    
                //Override the paint method to draw the background image.
                public void paint(Graphics graphics)
                {
                    //Draw the background image and then call paint.
                    graphics.drawBitmap(0, 0, 640, 900, _backgroundBitmap, 0, 0); //240
                    super.paint(graphics);
                }            
    
            };
            _backgroundBitmap = Bitmap.getBitmapResource("background.png");
            _fieldManagerTop = new HorizontalFieldManager();
            _fieldManagerMiddle = new VerticalFieldManager();
            _fieldManagerBottom = new HorizontalFieldManager();
    
                add(_horizontalFieldManager);
                add(_fieldManagerTop);
                add(new SeparatorField());
                add(_fieldManagerMiddle);
                add(new SeparatorField());
                add(_fieldManagerBottom);
    

    Basically, I'm trying to combine the thread above with the user interface tutorial.

    http://supportforums.BlackBerry.com/T5/Java-development/user-interface/Ta-p/442781

    The question is when I run the code, I just get the background image, none of the other content is displayed in the foreground. I am this approach correctly?

    I'm not sure the solution you received one will work - it may well do, but the approach is different from what I do.  I based my image of background processing around comments in this article:

    http://supportforums.BlackBerry.com/T5/Java-development/MainScreen-explained/Ta-p/606644

    But if you look at what you said your screen, you will see why you don't see all your real fields.

    The first thing that you add to your screen is as follows:

    HorizontalFieldManager _horizontalFieldManager = HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH | nouveau HorizontalFieldManager.USE_ALL_HEIGHT) {}

    You said this Manager to use the full height and width.  Then what place is left for any other Manager/field.

    You only add this option to provide abackground.  So actually, to do this, you must you add all your fields and managers in this HFM.  Otherwise that will expose after this one (which, as noted way they have no space to display in). I think you'll see something, if you replace this:

    Add (_horizontalFieldManager);
    Add (_fieldManagerTop);
    Add (new SeparatorField());
    Add (_fieldManagerMiddle);
    Add (new SeparatorField());
    Add (_fieldManagerBottom);

    with

    Add (_horizontalFieldManager);
    _horizontalFieldManager.Add (_fieldManagerTop);
    _horizontalFieldManager.Add (new SeparatorField());
    _horizontalFieldManager.Add (_fieldManagerMiddle);
    _horizontalFieldManager.Add (new SeparatorField());
    _horizontalFieldManager.Add (_fieldManagerBottom);

    But it probably won't be good, so you should follow the advice given in the previous Post or see the KB article.

Maybe you are looking for

  • HP Color LaserJet CP1518ni - COLORS NOT ALIGNED

    Has anyone solved this ridiculous question, where all the colors are not aligned when printed?  Black text prints perfectly. But when the printing of the images, the colors are not aligned. Question lasts for months and YES I did the following: Calib

  • U41-70 laptop flashing screen white/black

    my screen on my laptop u41-70 flashes black when the screen up and down moving (no problem while the screen is stable, but want to solve the problem before he gets really bad) Leif, Norway

  • Collect data from specific frequency of the power spectrum

    Hello I want to know how to collect data from specific frequency of power spectrum file. I'm trying to separate data from specific frequency of the original file.

  • Error number 80070641

    Windows Update encounter an unknown error when trying to install .NET Framework 3.5.  I am running Vista

  • renovated in 4 or 5 times now not ativate xp

    I had several problems lately with my pc because both couple and hardwareissues move... reformatted 4 or 5 times once after each shot and once after the replacement cable nd once after replacing battery now this time microsoft will not error code giv