Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 06:17
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  General
| |-+  Flash and AS 3 (Moderators: papachan, kofi addaquay)
| | |-+  How to setTextFormat to selection within textArea component
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: How to setTextFormat to selection within textArea component  (Read 4385 times)
Pluda
Senior Programmer
****
Posts: 270


View Profile
« on: 11/05/08, 13:30 »

Hello,

Having one TextArea in stage using

Code:
var tf:TextArea = new TextArea();
tf.setSize(200,200);
tf.move(100, 100);

and then using this

Code:
tf.getTextFormat(tf.selectionBeginIndex, tf.selectionEndIndex);
trace("caretIndex:", tf.caretIndex);
trace("selectionBeginIndex:", tf.selectionBeginIndex);
trace("selectionEndIndex:", tf.selectionEndIndex);

why do I get this error?

1061: Call to a possibly undefined method getTextFormat through a reference with static type fl.controls:TextArea.
Logged
Jorge Solis
Administrator
Systems Administrator
*****
Posts: 14600


View Profile
« Reply #1 on: 11/06/08, 03:41 »

TextFormat apply to textfields no to textArea component

Jorge
Logged

Pluda
Senior Programmer
****
Posts: 270


View Profile
« Reply #2 on: 11/06/08, 06:13 »

hum... so it's not possible to make one rich text editor in flash using textArea and As3...

I've made my own a couple of years ago, but is as2 and I wanted to use as3

I'm trying this code and get this error

Code:
function funcoes_botoes(e:MouseEvent, b:String) : void {
trace(b);
if(b == "bold_btn") {
tf.textField.getTextFormat(tf.selectionBeginIndex, tf.selectionEndIndex);
trace("caretIndex:", tf.textField.caretIndex);
trace("selectionBeginIndex:", tf.textField.selectionBeginIndex);
trace("selectionEndIndex:", tf.textField.selectionEndIndex);
//
var fn:TextFormat = new TextFormat;
//
if (fn.bold) {
fn.bold = false;
} else {
fn.bold = true;
}
tf.textField.setTextFormat( fn,  tf.textField.selectionBeginIndex, tf.textField.selectionEndIndex);
}

}


and the error

Error #2006: The supplied index is out of bounds.
Logged
wynnlams
Server what's that
*
Posts: 1


View Profile
« Reply #3 on: 03/09/10, 22:44 »

tf.alwaysShowSelection = true;
« Last Edit: 03/10/10, 01:55 by wynnlams » Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!