RichTextEditor with image
I need to put in a Rich Text Editor which should be able to insert a picture and my user need开发者_Python百科s to control the position of placing the image anywhere in the editor without damaging the text already entered.It will be okay if user can at least move the image around the editor. Can anyone help me, have some example?
Any help would be great..
many thanks
You can easily enter images in a RichTextEditor with the following code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
[Bindable]
public var Str:String = '<img src="assets/allBtn_hover.png"/>'
]]>
</mx:Script>
<mx:RichTextEditor id="rte" x="33" y="27" title="Title"
htmlText="{Str}">
</mx:RichTextEditor>
<mx:Text x="397" y="27" text="{Str}" width="270" height="238"/>
</mx:Application>
But moving the image around , is something which might be problematic. With the above , it might be possible to move the image up and down by placing the wrapped text image at different positions inside the RTE, but incase you want to give absolute control , Id suggest creating a new image object, with absolute layout and allow user to move it around.
But that would involve writing a lot of code , to create the logic of hiding the image, showing part of the image, when a scroll happens and the image is not supposed to be shown on the screen.
精彩评论