Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Can't Select Text In A ComboBox



I've got an editable ComboBox and under certain conditions, I want to put specific text into the TextField and set the Selection to some of the characters. I've tried a number of approaches but the caret always goes right before the first character in the TextField of the ComboBox.

Here are some details. My goal is to reduce the elements in the dropdown menu to only ones that match what the user has typed in (the ComboBox is editable, don't forget). I'm using the filterFunc of a DataSet component to do this. When a enough is typed for a unique match, I want to copy the label into the TextField and select the text from the character that made it unique to the end, so that the user can enter a single backspace to get back to the list they had.

Here's an example. When I type "A" into the textfield, the dropdown opens and only displays items that begin with the letter "a". As I type in subsequent letters, the set of matching items gets smaller. When I've typed in "Abb", my dropdown has only two items: "Abbeville" and "Abbottville". When I type in the next "o" character, "Abbotville" is the unique match. At that point, I want to copy "Abbotville" into the textfield of the combobox and set the selection to be "otville". If the user hits backspace, the text value is back to "Abb" and both "Abbeville" and "Abbotville" show up in the menu.

Likewise, I want to select the appropriate characters when the characters in the text field no longer match any entries. E.g. "Abba" would close the menu and highlight the last "a".

I've put in lots of traces and have confirmed that the Selection object is correct. I used a focusListener to trace the Selection and focusIn and focusOut event listeners and it seems that Selection loses its beginIndex and endIndex almost immediately after the ComboBox change handler returns.

I don't really want to give the code out because I'm developing it under contract, but here the essential lines of code are this.


Code:
if (this_cb.length == 1)
{
// Only one selectable item. Copy it into the text field and close the box.
this_cb.close();
this_cb.selectedIndex = 0;
this_cb.textField.text = this_cb.dataProvider.getItemAt(0).city;
// Select any trailing characters.
Selection.setSelection(this_cb_value.length-1, this_cb.textField.length);
trace("Selection="+Selection.getFocus()
+"["+Selection.getBeginIndex()+","+Selection.getEndIndex()+"]:"
+typeof(Selection.getFocus()));
}
Right after typing "Abbo", the output window shows the expected data. The selected object is the text object and Selection thinks that characters 3 through 10 should be highlighted.

"Selection=_level0.quicktype_cb.text_mc.label [3,10]:string"

And the change handler returns.

Similar trace statements at the beginning of the focusIn and focusOut handlers show that the begin and end indexes aren't what was set right before.

"Selection=_level0.quicktype_cb.text_mc.label [-1,-1]:string"

And sure enough, the caret appears at the beginning of the text rather than highlighting characters 3 through 10. When debugging, I can see that the selection gets set properly for a moment and then the caret is moved to the beginning of the text.

Thanks for slogging through this post. Any ideas?
Please let me know if I can clarify anything.



SitePoint > Design Your Site > Flash and Actionscript
Posted on: May 30, 2007, 19:42


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Can't Select Text In A ComboBox
I've got an editable ComboBox and under certain conditions, I want to put specific text into the TextField and set the Selection to some of the characters. I've tried a number of approaches but the caret always goes right before the first character in the TextField of the ComboBox.

Here are some details. My goal is to reduce the elements in the dropdown menu to only ones that match what the user has typed in (the ComboBox is editable, don't forget). I'm using the filterFunc of a DataSet component to do this. When a enough is typed for a unique match, I want to copy the label into the TextField and select the text from the character that made it unique to the end, so that the user can enter a single backspace to get back to the list they had.

Here's an example. When I type "A" into the textfield, the dropdown opens and only displays items that begin with the letter "a". As I type in subsequent letters, the set of matching items gets smaller. When I've typed in "Abb", my dropdown has only two items: "Abbeville" and "Abbottville". When I type in the next "o" character, "Abbotville" is the unique match. At that point, I want to copy "Abbotville" into the textfield of the combobox and set the selection to be "otville". If the user hits backspace, the text value is back to "Abb" and both "Abbeville" and "Abbotville" show up in the menu.

Likewise, I want to select the appropriate characters when the characters in the text field no longer match any entries. E.g. "Abba" would close the menu and highlight the last "a".

I've put in lots of traces and have confirmed that the Selection object is correct. I used a focusListener to trace the Selection and focusIn and focusOut event listeners and it seems that Selection loses its beginIndex and endIndex almost immediately after the ComboBox change handler returns.

I don't really want to give the code out because I'm developing it under contract, but here the essential lines of code are this.

[CODE]
if (this_cb.length == 1)
{
// Only one selectable item. Copy it into the text field and close the box.
this_cb.close();
this_cb.selectedIndex = 0;
this_cb.textField.text = this_cb.dataProvider.getItemAt(0).city;
// Select any trailing characters.
Selection.setSelection(this_cb_value.length-1, this_cb.textField.length);
trace("Selection="+Selection.getFocus()
+"["+Selection.getBeginIndex()+","+Selection.getEndIndex()+"]:"
+typeof(Selection.getFocus()));
}
[/CODE]

Right after typing "Abbo", the output window shows the expected data. The selected object is the text object and Selection thinks that characters 3 through 10 should be highlighted.

"Selection=_level0.quicktype_cb.text_mc.label [3,10]:string"

And the change handler returns.

Similar trace statements at the beginning of the focusIn and focusOut handlers show that the begin and end indexes aren't what was set right before.

"Selection=_level0.quicktype_cb.text_mc.label [-1,-1]:string"

And sure enough, the caret appears at the beginning of the text rather than highlighting characters 3 through 10. When debugging, I can see that the selection gets set properly for a moment and then the caret is moved to the beginning of the text.

Thanks for slogging through this post. Any ideas?
Please let me know if I can clarify anything.

[MX04] Can't Select Text In A ComboBox
I've got an editable ComboBox and under certain conditions, I want to put specific text into the TextField and set the Selection to some of the characters. I've tried a number of approaches but the caret always goes right before the first character in the TextField of the ComboBox.

Here are some details. My goal is to reduce the elements in the dropdown menu to only ones that match what the user has typed in (the ComboBox is editable, don't forget). I'm using the filterFunc of a DataSet component to do this. When a enough is typed for a unique match, I want to copy the label into the TextField and select the text from the character that made it unique to the end, so that the user can enter a single backspace to get back to the list they had.

Here's an example. When I type "A" into the textfield, the dropdown opens and only displays items that begin with the letter "a". As I type in subsequent letters, the set of matching items gets smaller. When I've typed in "Abb", my dropdown has only two items: "Abbeville" and "Abbottville". When I type in the next "o" character, "Abbotville" is the unique match. At that point, I want to copy "Abbotville" into the textfield of the combobox and set the selection to be "otville". If the user hits backspace, the text value is back to "Abb" and both "Abbeville" and "Abbotville" show up in the menu.

Likewise, I want to select the appropriate characters when the characters in the text field no longer match any entries. E.g. "Abba" would close the menu and highlight the last "a".

I've put in lots of traces and have confirmed that the Selection object is correct. I used a focusListener to trace the Selection and focusIn and focusOut event listeners and it seems that Selection loses its beginIndex and endIndex almost immediately after the ComboBox change handler returns.

I don't really want to give the code out because I'm developing it under contract, but here the essential lines of code are this.


Code:
if (this_cb.length == 1)
{
// Only one selectable item. Copy it into the text field and close the box.
this_cb.close();
this_cb.selectedIndex = 0;
this_cb.textField.text = this_cb.dataProvider.getItemAt(0).city;
// Select any trailing characters.
Selection.setSelection(this_cb_value.length-1, this_cb.textField.length);
trace("Selection="+Selection.getFocus()
+"["+Selection.getBeginIndex()+","+Selection.getEndIndex()+"]:"
+typeof(Selection.getFocus()));
}
Right after typing "Abbo", the output window shows the expected data. The selected object is the text object and Selection thinks that characters 3 through 10 should be highlighted.

"Selection=_level0.quicktype_cb.text_mc.label [3,10]:string"

And the change handler returns.

Similar trace statements at the beginning of the focusIn and focusOut handlers show that the begin and end indexes aren't what was set right before.

"Selection=_level0.quicktype_cb.text_mc.label [-1,-1]:string"

And sure enough, the caret appears at the beginning of the text rather than highlighting characters 3 through 10. When debugging, I can see that the selection gets set properly for a moment and then the caret is moved to the beginning of the text.

Thanks for slogging through this post. Any ideas?
Please let me know if I can clarify anything.
Using Flash MX2004 and Flash 8.

ComboBox And Multiple Select?
Is there a way to get an FComboBox to allow multiple selections?

Unlike an HTML based select, you can't get all the selected items by looping through the number of entries to get which ones are selected. Selecting an item in the combo box sets THAT item as selected, even if you've selected more than one item.

Is there any way to allow multi-select other than stuffing the index in an array and checking if it's been selected/deselected? This seems like it would be a built in property for a combox box...

MX Combobox - Select Next Item ?
hi,

i'm using the combobox with FP 6, AS 1 and want to change the selecteditem via another button - like witching throungh the Cb items with back/forward buttons somewhere else on the satge.

with
Code:
getSelectedIndex()
i can get the number of the selected item - but how do I get the next item (with
Code:
selectedIndex = selectedIndex +1
) to be selected?

any suggestions?

cu
eve

Combobox Select Will Not Send To PHP
Hi,
I am trying to send an element of a combobox from Flash to PHP.
The code I have is:

It all works fine except when I select an item from the combobox, I do not get the item sent to PHP (and then emailed to me). What am I doing wrong ?

Thanks,
Paul







Attach Code

//FLASH CODE:
county_cb.addItem({data:1, label:"Galway"});
county_cb.addItem({data:2, label:"Clare"});
county_cb.addItem({data:3, label:"Mayo"});

//SELECT ITEM IN COMBOBOX
function change(evt){
var selectCombo= evt.target.selectedItem.label
}
county_cb.addEventListener("change", this);

temp_btn.onRelease = function () {
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
result_ta.text = result_lv.welcomeMessage;
} else {
result_ta.text = "Error connecting to server.";
}
};

var send_lv:LoadVars = new LoadVars();
send_lv.county = selectcombo;
send_lv.myname = name_it.text;
send_lv.email = email_it.text;
send_lv.comments = comment_it.text;
send_lv.sendAndLoad("http://www.mywebsite.com/viewsoccer.php", result_lv, "POST");
}


//PHP CODE:
<?php
$to="myemail@gmail.com";
$subject= 'Checking Combobox';
$msg="Name: ".$_POST['myname']."
Your Email : ".$_POST['email']."
Comments : ".$_POST['comments']."
From County: ".$_POST['county'];
$headers='From: J'."
".'Reply-To: myemail@hotmail.com'."
";
$msgforFlash=' Thank you your Message has been sent';

mail($to,$subject,$msg,$headers);
if(!mail($to,$subject,$msg,$headers))
{echo 'Error sending Mail ';
}else {
echo 'Mail Sent OK using Flash;
print ("&welcomeMessage=$msgforFlash");
}
?>

Select Item In Combobox By Value And Not By Index
hil the forum =)

i try to select an item from a combobox (component v2) by its value and not by its index... noway ?

for exemple here is a combo the name is mycomb:
item 1 : value "re" label : "coucou"
item 2 : value "r1" label : "hop la"
item 3 : value "ra" label : "test"
item 4 : value "rb" label : "france"

how to select directly the item who has the value : ra
mycomb.selectedindex("ra") doesn't work.

i know the ra value, but not its index position.

If someone can help me =)

CR

ComboBox Select Upload Location?
Hi I am making a flash form where the user uploads an image to one of the options in the ComboBox. The form sends and stores the information that the user has entered into a db.

All the options in the ComboBox have there own folder and table in the database. I need to know how I can get the ComboBox to recognize that if the user selects option "FOOTBALL" from the drop down menu that it will then send this information to database "FOOTBALL" and folder "FOOTBALL"!?

Please can someone help me!?

How Can I Prompt A Message To The Combobox Like “Please Select An Option...”
How can I prompt a message to the combobox like “Please select an option...”

I have tried this but it didn’t work
combomm.prompt = "Please select an option...";

Thank you

Keyboard Select In List Or Combobox Component
Hi folks,

I've found that the combobox component (well, actually the embedded list component) selects rows according to my keyboard input, but not completely satisfying.

For example, in my list of cities, I press S and the first city beginning with S is selected. I press S again and the next city on S is selected. Then i press Ö (on my Swedish keyboard) and expects to get the first city beginning with an Ö selected, but nothing happens. The selection is not changed, still on the S city.

Does anyone know a way to get the list component (and combobox) to react on characters other than A-Z?

Thanks!

Preserve The Select State Of A Combobox Between Two Keyframes
how to preserve the select state of a combobox between two keyframes?
I am trying to emulate tab-panels with two keyframes which each have to buttons to switch between frames (panels). Each frame has different form-elements and I would like to preserve value/select state of form-elements between frames. For textboxes this works by setting the 'variable name' instead of the 'instance name', but comboboxes don't have a variable name.
Does anybody know how to do this?

Thanks!

Select Item Into Combobox, Based On Label Condition
I want to select an item in my comboBox, depend on label condition.
How can be done?

Combobox "select Item"
I have done a combobox with 7 items in the list.

when I enter the scene I want the the combobox to say "select items"

When I click on it I don't want this displayed again in the below items, so it can't be picked again.

I am using this at the moment but I don't want it to be added in the below iteams

ChooseSize.addItem("select item");

Any ideas!

[as] [video] [comps] ComboBox To Select Video
I using Flash MX 2004 and I want to use a comboBox component to select diferent FLV movies to play in an embeded video clip or a MediaDisplay component (I don't know what's better).

I need some help with the ActionScript to manage the change event in the comboBox to select the FLV and play it.

Any suggestions?

Thanks!

ComboBox, Select Item On Key Press "B" -> "British Columbia" (flash Cs3)
I have never noticed this before until now, but when i type a letter while the combobox is highlighted nothing happens, i want it to go to the first choice of that letter.

this is the norm for html comboboxes

it would be cool if typing 2 letters quickly took both into the choice.

does anyone know how to make this happen with a flash cs3 combobox?

Select Text File From Dropdown List, Content To Show In Swf Dynamic Text Field
I have a php page where there is a form with a dropdown list of all text files in my site. The name of the dropdown is $filename.

The action script in my swf is this:
loadVariablesNum("<?PHP echo $filename; ?>", 0);

but I get nothing. It displays correctly when I replace
<?PHP echo $filename; ?> with the actual value of $filename, for example:
loadVariablesNum("ui_websites.txt", 0);

Any ideas what I'm doing wrong?

Select ALL Text On Entry Into Dynamic Text Field
Is there a way to have ALL text selected when clicking into a dynamic text field? Tab works but i also need all the text to be highlighted when clicked on in the first place. Any ideas?

Still Trying To Select Text
I have a "textStyler.swf" loaded into the movieclip "styler_mc" which is on the main movie "editor.swf".

The objective is to highlight some text in an input text field called "edit_txt" which is also on the main movie "editor.swf" and to replace it with some other text

The following code (located on the "textStyler.swf"):
_level0.edit_txt.text = beginTag+_level0.edit_txt.text+endTag;

works fine to reference and replace some text in "edit_txt" on the main movie as long as it doesn't include having to read some selected text.

However, sometimes I want to replace some text in "edit_txt" that the user has selected with some other text. The problem is that I haven't been able to get anything but "-1" as the result for the following code:

var char1:Number = Selection.getBeginIndex();//first character index of selected text

var charLast:Number = Selection.getEndIndex();//first character index of selected text

(both return -1) no matter what text is selected. I've tried to use _level0.Selection.getBeginIndex() AND _root.Selection.getBeginIndex()but that doesn't work either. So how is it that "textStyler.swf" can reference "edit_txt" and change the text but Selection class doesn't see it?

Select All Text On Click In An Input Text
Hi, I want to create a form with input text. I want to enter a caption in this input text like "enter e-mail here" but if the user clicks on the input box to enter the email i want to earase this text so the user can enter the email.

If I could capture the event Click on the input text, i could change the text with mytextbox.text = "";

Any ideas?

Thanks in advance.





























Edited: 06/20/2007 at 12:34:31 PM by Reperger

Select A Text Field
Hi

I have a few text fields that the user types into

The text fields already have text in them - ie. name, email and message.

What I want to do is when the user clicks to type their name etc. the text that was there previously disappears and if the user doesn't type anything in and tabs to the next one the text re-appears.

Can anyone point me in the direction where I can find an answer for this?

Cheers

Select All Button For Text
i have a large text field i'm using as a results box on a form. I'd like to have a select all button so users don't have to manually select it to copy the text. is there a code for this?

Select All Text On Focus
this should be simple but i can't figure it out. i have a input TextField named "input_tf1". it has two characters in it.

the actionscript is as follows:

input_tf1.onSetFocus = function(oldFocus) {
trace("focus set on: " + this);
Selection.setSelection(0,1);
}

i want to select all the text in the textfield, when the user clicks on it. the onSetFocus event is properly received, but the text inside it does not get selected.

furthermore, if i have a second text field, named "input_tf2" , for some reason its text gets selected when input_tf1 gets the onSetFocus event.

what am i doing wrong?

thanks

PDF To SWF With FlashPaper Won't Select Text
I've had it! I have about 20 different trials for converting PDF to DOC or SWF, but still it doesent work...
... from the begginning...
untill yesterday I could swear that FlashPaper was the solution for converting PDF to the marvelous SWF Plash Paper display... but no.

I have a Client that needs selectable and searchable text, and they are handing me PDFs (you can select the text in Acrobat Reader). also the files are in Chinesse, so I can't mess with the originals. and conversion to DOC would be endless, because the total pages are around 2000...

I've heard that the macromedia Guys delivered the ColdFusion Reference Guide in Flash Paper, and they had it in PDF.

So, there must be a way...

please any help would be great.

Select Text On An Event
I have a search going and what I want is when they put something in the textfield and hit the button search I want to select what they have entered.

I hope this makes sense? If not you can call me bad names.

Select Text Problem
Hi guys! I have a question for u and i need some help!
Do you know how i can select some text (wich is in an input text) and transfer it with a button to another input text.I dont want to transfer all the value but only the selected value.
TNX !

Find And Select Text.
i know this was asked, but i can't find the answer anywhere.
Type a word in a text box and find it and highlight it.

Select All The Text In Textarea
Does anyone know how to select all the text in the textarea on a single click? For example, if I click on the textarea, I would like to select all the text in it or if I click on a button, I would like to select all the text in the textarea...

Thanks in advance...
Chris

Text Button No Select
I have tried everything I can think of to make this work.

If you will, go to www.tejaslanguages.com and mouseover the links at the top. You will notice that over the text, the cursor changes and the button is not selectable.

The text is a static text block that has been converted to a graphic which has been added to a movie clip which is embedded inside of a movie clip. There is even an invisible graphic in the movie clip on a layer above the text. I have tried everything I can think of to turn the text block into a graphic so that it won't be selectable like that.

You can access the .fla at www.tejaslanguages.com/tejaslanguagesred.fla.

Any help??

Thanks!
sogj

Dynamic Text Select All
Hi there

I want to make a dynamic text field so that when a user clicks on it all the contents of the text box are selected to avoid users having to click and drag to select the contents. Is there some actionscript to get make the textbox select all when focused?

Many thanks

Trev

Select Text Problem
Hi guys! I have a question for u and i need some help!
Do you know how i can select some text (wich is in an input text) and transfer it with a button to another input text.I dont want to transfer all the value but only the selected value.
TNX !

ComboBox Problem, Displays A "text Box Like" Object Instead Of A ComboBox
Hello friends,

A friend of mine is having a tough time getting a ComboBox integrated into an existing flash movie, to work right.

Here's the story so far.....

The ComboBox when tried out in a sample new file works absolutely fine, but when the same thing (see code below) is added to
an existing movie (which has a preloader in Scene 1) does not work at all. Instead, it displays a "text-box-like" object in place of a
ComboBox...


Code:


form = new Object();
form.change = function (evt){
trace(evt.target.selectedItem.label);
}
comboBox.addEventListener("change", form);



Now, is there a possibility that because a preloader exists in the movie, the ComboBox does not work, not sure on this reasoning!

If someone could help out here, I'd really appreciate it!

HELP. Text Field That Blanks On Select
Please... does anyone know how to have a input text field that says something eg: "submit email" but instantly clears when the field is selected?

is this solved by an onClipEvent?

Please help.

An example of it being done is on chaotic.co.uk

Thanks.
__________________

Select Text And Make Bold?
Hi,

I always thought this was impossible to do in flash until I saw this

It's a flash movie that let's your type in it just like Word. You can select text and click the 'bold' button and your text gets bold.

What I have achieved so far is this , a bit like this forum; a sort of script-prompt but the selecting way is so much nicer!

Can someone please explain me a method on how to do that?

Thanks!

Textfield Select Text On Focus
Hi All

How do I select all text in a textinput textfield on focus? I thought it would be something like this, but I just can't seem to get it to work!


Code:
myTextField.addEventListener(FocusEvent.FOCUS_IN, focusInHandler);

myTextField.alwaysShowSelection = true;

private function focusInHandler(e:FocusEvent):void
{
emailTextField.setSelection(0, 9);

}

Single Clicking Text To Select It All?
Heya,

I was trying to create a flash application with a text field that would automatically be selected with one left click. This is going to be for an 'Embed' like for youtube videos.

Any ideas?

Thanks,

kris

AS3: TextField - How Do Get Rid Of Text Select Cursor
SC3 - AS3

How do we turn off the text select cursor?

I have a button object that has dynamic text, and the hand cursor works fine outside of the text object but over the text object the cursor is changing to a text select cursor!

I am setting selectable to false for the text field.

Dynamic Text Select All Function
Hi there

I want to make a dynamic text box that when i click on it to focus it, it will select all the contents of the text box rather than having the user click and drag to select the contents. Is there some actionscript to get make the textbox select all when focused?

Many thanks

Trev

How To Do This Effect> Random Text Select ?
Hello ,

Sorry for a asking question again but i love want to learn flash , so here is >>

how to do randmon outputs of words till rights words matches the name , like this site >>

http://www.flipmo.co.uk/v2.html << Click on Contact , then you'll know what i am asking << this site is really to cool


Thanks a lot!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Select Text From Flash For Printing
hi! is there any way I could print selected text in flash??

Auto-select Text In Textfield? (AS2)
Curious if it's possible via an Actionscript 2 function to automatically have the text in a specified TextField selected.

Thanks. =]

InputField Select Text On Click
I have an inputfield which is prefilled with a numbers - in order to change the number currently i have to click inside the field, highlight the number and then replace it with the new one.. i want when i click inside the input field- current number gets selected and i then change it- is there anyway i can do that??

please help !!!!!!!!!!!!!!

Textfield Select Text Issues
I have an input textfield which users can add text to original, and also select portions of the text. But I want the users to be able to select text, then when the text is still selected, click on a button to copy selected text into another textfield.

The problem arises when clicking on the button, the focus changes and therefore I lose track of which parts of the text was selected.

So the solution is a way that selected text is remembered before losing focus.

Any ideas?
A computer always does what you tell it to, but rarely does what you want it to.....

Select Text By Highlighting And Assign To Var?
I have some text in a box which has been returned from a prolog prog via php.... Is there a way I can assign a section of it to a variable by having the user highlight the bit they want to assign?!

Select Doesn't Select. What Did I Screw Up?
I'm learning Flash from a book called "Essentials For Design:
Macromedia Flash 8"

THE SHORT STORY
Using the select tool, when I double-click an object to select it, it
doesn't. What happens is that it produces a light-blue square outline
surrounding the edge of the object and then "expands" or "explodes"
the outline to the limits of the stage. The object is not selected
yet.

If I double-click again, it selects the object but it doesn't behave
as it should.

What is this blue outline and why isn't it selecting the object like
it's supposed to...on the first double-click?

THE LONG STORY
In the intro to objects it has you draw a square and a circle. You
double-click the circle and move it onto part of the square.
Deselect, then select the circle again. Move it off the square and it
takes the intersection away from the square. Fine and dandy.

I did a few more exercises, none of which seemed to modify any
preferences, and now when I try the same operation on the circle /
square, it doesn't work.

What's different is when I double-click to select an object, rather
than selecting it, it draws this light-blue line that bounds the outer
dimension of the object and "expands" this square outline outward.

If I double-click AGAIN it selects the object but doing the same
procedure of moving it has no effect on the shape of the square. The
circle doesn't take a chunk out of the square.

I hope this makes sense.
Help! How can I get FLASH working like I think it's supposed to?

thanks
- peq

To Select And Make Bold With HTML Text...
Hi,

I'm trying to make a text editor in flash but I'm having way too much trouble with it (my scripting is just too bad I guess)

What I'm trying to do is a 'bold' button. With this button I want selected text to be bold; if no text is selected I want the text that is inserted after 'bold' to be bold (sounds confusing but the same way as for example MS Word)

What I have now is this:

'bold' button:
code:
on(rollOver){
startSel = Selection.getBeginIndex();
endSel = Selection.getEndIndex();
oudeSelectie = Selection.getFocus();
if (endSel - startSel > 0){
selected = "true";
} else {
selected = "false";
}
}

on (release) {
if (selected eq "true"){
Selection.setFocus(oudeSelectie);
Selection.setSelection(startSel,endSel);
begin = tfield.slice(0,startSel);
z= tfield.slice(startSel,endSel);
end = tfield.slice(endSel,1000000);
output= begin add "<B>" add z add "</B>" add end;
tfield = output;
}
Selection.setFocus("textfield.text");
Selection.setSelection(100000,100000000);
}


When HTML formatting is set off to in the textfield it seems to work fine but as I turn it on all text is gone after selecting and pressing the button.

If I make trace 'output' I see a long string of HTML tags plus the two tags for bold but the bold tags(<b></b>) are at the wrong place.

Is there any way to go this way with HTML formatted text?

I would be most greatfull
(and happy)

Thanks,

Vincent

OnSetFocus Select The Text Inside The Textfield
I am tring to make it so when the cursor getFocus on a textfield that it will highlight the text inside that text field.

I am tring the Selection.setSelected but not sure how to get it to work.

Any ideas?

Input Text And SetSelection- Cant Select On GetFocus?
Im trying to select (highlight) all the text in a textfield which I have set as input text. I want the contents of the box to be highlighted when the box receieves focus.... I can highlight the content via code on the main timeline but i cant highlight it from within the onSetFocus handler.... heres what ive tried:

critScore.onSetFocus = function()
{
trace("got focus");
Selection.setFocus(this);
Selection.setSelection(0, this.text.length);
}

ideas?

Copy/paste/select All Text Button
Hey

I am trying to make these buttons.
1: Copy text i text felt
2: paste text
3: select all text

I have made the select all text, but I don´t know how to make the copy and paste buttons..

Here is my select all script.


PHP Code:



// my text felt is called txt_felt, and this script is put on a button
on(release){
Selection.setFocus("_root.txt_felt");
}




PLEASE help.

To Select The Last Line Text Of A Dynamic Textfield
can anyone plz tell me that how to determine the last line of a dynamic textfield and to fetch the text from the last line..

Select All Text In TextField When It Receives Focus
When an Input TextField receives Focus, I want it to select/highlight all of the editable text within the field via ActionScript, bit I don't know how to select text via ActionScript (I'm using Flash 8).


PHP Code:



myText.onSetFocus = function(oldFocus):Void {    // add text selection code here...}; 




Suggestions? Thanks ahead of time!
~Nate

Copyright © 2005-08 www.BigResource.com, All rights reserved