tnx for the tips all, been really helpful! =D
.m
Giles Taylor wrote:
I got round this this by adding a mouse listener to the textField and checking
onMouseDown that the mouse was pressed within the text area, if it was then
onRelease gets the selection (getCaret(), getBeginIndex() & getEndIndex()) and
stores it in variables so it can be recalled later.
This allows you to set the selection up again after a styling button has been
released, so the user doesn't have to re-select to apply some more styling (maybe
they want it bold & italic). It also allows you to setup a function to check
the styling of selected text and automatically put toggle buttons into the correct
state (if bold text is selected the bold button goes to the down state).
It all depends how far you want to take your "quite simple text editor" ;)
Giles
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Magnus Askenbäck
Sent: 12 April 2006 14:13
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Text editor - Selection trouble.
Tack Johan, that worked like a charm! =)
.m
Johan Karlsson wrote:
If I remember correctly using onRelease or even onPress is to late and
the selection is already gone. To store the selection indexes you need
to use the onMouseDown event.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Magnus
Askenbäck
Sent: den 12 april 2006 14:47
To: Flashcoders mailing list
Subject: [Flashcoders] Text editor - Selection trouble.
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
_______________________________________________
[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
--
*MAGNUS ASKENBÄCK | AD
NORMA COMMUNICATION AB*
T. +46 31 748 88 15
M. +46 736 79 48 97
[EMAIL PROTECTED]
www.norma.se
--
"It is better to fail in originality
than to succeed in imitation."
» Herman Melville (1819 - 1891)
_______________________________________________
[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