That´s right, because once you hitted the button, the selection is the button. You need to store the start/end index somewere and then, on the button, use that indexes instead of the Selection functions.

An easy way could be to assign into an onEnterFrame a function that checks if the selected item is the textfield and if is, store the start/end positions of the selection. Then, the button code should look like (assuming you stored the start/end indexes in startIndex and endIndex)
boldButton.onRelease = function () {
    my_txt.setTextFormat(startIndex, endIndex, arialBold);
}

Hope it helps...

On Wed, 12 Apr 2006 09:46:55 -0300, Magnus Askenbäck <[EMAIL PROTECTED]> wrote:

Hi all,
I'm trying to build a quite simple text editor in f8 and are currently having some problems with the Selecton class.
If anyone can give me some pointers it would be much apreciated.

Problem is that whenever I try to use my buttons I loose focus of the textField and the Selection doesn't trigger. Like so:

boldButton.onRelease = function () {
my_txt.setTextFormat(Selection.getBeginIndex(), Selection.getEndIndex(), arialBold);
}

Selection.getBeginIndex() and Selection.getEndIndex() only returns -1

And if someone has a live exemple (with code) that would be awesome. A component is not an option tho.

Tnx

.magnus

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



--
_____________
Marcelo Volmaro
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to