Help identifying the highlighted word when creating a URL within an input Text Box

i am building a text editor with various function like (bullet, bold, italics, etc… ) i also built the URL functionality as well. When the user selects text and clicks a URL-Button, the code under (btn_URL) excutes and calls my ascript function as defined. The problem is that i want to trap and send the selected word as a parameter (the word that gets the anchor “&lta href’…’&gtthis word&lt/a&gt” tag??? any help is appreciated…

i have a mc with a input text box set for HTML with a button that will wrap the given text in an anchor

mc with 1st frame ascript(sets up the listener object to get the selected text)

//—the code—

//////////////////////////////////////
//asfunction capturs the sent params
function launchURL(param1) {
trace ("param1 " + param1);
}

/////////////////////////////////////
//sets up the listener object
var selectListener = new Object();
selectListener.onSetFocus = function(oldFocus, newFocus) {
if (oldFocus == _level0.mcExamPageHolder.mcPageProperties.txtPageBody) {
Selection.setSelection(iBegSel,iEndSel);
lastBegin = iBegSel;
lastEnd = iEndSel;
}
Selection.addListener(selectListener);

_root.onEnterFrame = function(){
getSelection();
}

function getSelection(){
iBegSel = Selection.getBeginIndex();
iEndSel = Selection.getEndIndex();
if (iBegSel == -1 && iEndSel == -1) {
iBegSel = lastBegin;
iEndSel = lastEnd;
}
}

//the ascript behind the button (btn_URL)

/////////////////////////////////////////////
//button to create a URL link on selected text
on (release) {
var tf = new TextFormat();
tf.target = “_blank”;
tf.underline = true;
tf.color = 0x0000FF;
tf.url = “asfunction:launchURL, ‘param1, param2’”
txtPageBody.setTextFormat(iBegSel, iEndSel, tf);
}

got it, for all who were interested:cool: i guess i was getting to tired, just required a little thought…

//–the code was

//return the selected text and pass on to the asFunction - launchURL
var sSelText = txtPageBody.text.substring(iBegSel, iEndSel);
tf.url = "asfunction:launchURL, " + sSelText;