Pasting/inserting text into a TextArea

Doesd anyone know of a way, using Actionscript 2, to insert a string at the insertion point of a TextArea.
easiwriter45Asked:
Who is Participating?
 
julianopolitoConnect With a Mentor Commented:
This might help: Selection.getCaretIndex();
this static method returns in AS2 the position of the blinking cursor. Then you can split the string already there and put the tags into it.
0
 
section25Commented:
What exactly do you mean? Are you talking about ssing Dynamic text? What are calling the insertion point?
0
 
easiwriter45Author Commented:
I have a TextArea component (not a dynamic text item) into which the user can enter html text. This is one of the admin pages of a website - the html text is displayed WYSIWYG in the user pages. I want the admin user to be able to insert an image into the html - s/he could just type the text, but this assumes they understand how to. So, having chosen an image file (for upload to the server) I want to insert the image tags directly into the textArea at the correct place (the insertion point is the cursor position).

Does that make it clearer?
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
section25Commented:
To answer your question; sorry, but no not really. Maybe someone else will understand it better than me and can help.

This is what I get from your post:
- there is an admin page (which is strictly html based, no flash on the admin page)
- the admin page allows for an image to be uploaded.
- the image needs tags that the admin could type in but you want them added automatically somehow.
- the user page has the flash movie which contains and image and the textarea (the textarea contains the tags from the admin page)

Is this close?
What are you calling the "tags"? Are these description words for the image to be used for searching?
if not, what are the "tags"? Are the tags going to be displayed to the user?

Sorry, but I still don't know what the insertion point is. This tells me that the tags will be displayed to the user, but there is an area that the tags need to be in which is different from a normal, left-justified text field.

0
 
section25Commented:
I don't mean to belabor the issue, but could you give us walk through example? That may help.
0
 
easiwriter45Author Commented:
OK, I'll try again. The admin page contains a Flash document. The Flash document contains buttons and a TextArea component with the html property switched off. The admin user types raw html into the TextArea. The user can be expected to understand how to do simple formatting using <b> and <i> tags, but not how to insert  <img> tags. So, suppose the user is entering the text and wants to insert an image at the cursor position (aka known as the insertion point). S/he clicks a button, say, in the Flash document that prompts for the image file (using FileReference) and  uploads the file to the server. What I want to happen next is for the <img> tag to be automatically inserted into the TextArea at the cursor position (which you can's assume is at the end of the text - could be anywhere as with any editor).

The resultant html text is displayed to site users in a TextArea with the html property switched on.

Does that make it clearer - I can't see how it can be done, but I'm relatively new to Actionscript.
0
 
julianopolitoCommented:
in AS3 it would be easier to accomplish that. Just r the record the same functionality now in AS3 in the TextField.caretIndex instance property.
My only concern is that you are dealing with formatted html, so it might be not that easy to work with the caret position relative to the inside tags.
0
 
section25Commented:
ok, I understand.

Here is a sample.

http://www.section25.net/ee/easiwriter45/

The starting page is admin.cfm

You will need some soft of cgi to handle the actual upload of the file. Flash can't do that part. I am using ColdFusion. You will have to use either CF or something like php, asp, perl, etc.

You can download admin.fla and examine how it works.
0
 
section25Commented:
ok, I understand.

Here is a sample.

http://www.section25.net/ee/easiwriter45/

The starting page is admin.cfm

You will need some soft of cgi to handle the actual upload of the file. Flash can't do that part. I am using ColdFusion. You will have to use either CF or something like php, asp, perl, etc.

You can download admin.fla and examine how it works.
0
 
section25Commented:
ok, I understand.

Here is a sample.

http://www.section25.net/ee/easiwriter45/

The starting page is admin.cfm

You will need some soft of cgi to handle the actual upload of the file. Flash can't do that part. I am using ColdFusion. You will have to use either CF or something like php, asp, perl, etc.

You can download admin.fla and examine how it works.
0
 
section25Commented:
ok, I understand.

Here is a sample.

http://www.section25.net/ee/easiwriter45/

The starting page is admin.cfm

You will need some soft of cgi to handle the actual upload of the file. Flash can't do that part. I am using ColdFusion. You will have to use either CF or something like php, asp, perl, etc.

You can download admin.fla and examine how it works.
0
 
section25Commented:
ok, I understand.

Here is a sample.

http://www.section25.net/ee/easiwriter45/

The starting page is admin.cfm

You will need some soft of cgi to handle the actual upload of the file. Flash can't do that part. I am using ColdFusion. You will have to use either CF or something like php, asp, perl, etc.

You can download admin.fla and examine how it works.
0
 
section25Commented:
sorry for the multiple posts. The EE web site is giving me lots of trouble tonight. It keeps timing out on me. Apparently I can't delete or edit my multiple posts.
0
 
easiwriter45Author Commented:
Brilliant - I completely missed the Selection class - can't see the wood for the trees sometimes!
0
All Courses

From novice to tech pro — start learning today.