[flexcoders] getCharBounds not working on AIR?

2008-02-20 Thread b_alen
It seems a bit ridiculous but it's true. Not just that you have to use
all sorts of hacks to get access to good old TextField (IUITextField)
in Flex  in order to even think of accessing characters' Rectangles.
Once you do manage to cut your way through, you get a very nasty
disappointment that IUITextField.getCharBounds() works perfectly in
Flex Web apps, but returns some bizarre incorrect values when running
on AIR.

If anyone has any suggestion, I'd really appreciate it very much.
We're in terrible deadline and this is one of the crucial functionalities.


var tf:TextAreaExtended = new TextAreaExtended();
tf._textField.text = dsfsdf sfd sf dsf sfdsd fdsfdsfdsfdsfdsf fds;
addChild(tf);
var rect:Rectangle = tf._textField.getCharBoundaries(20);

// I get values for rect.left something like 0.5
// same goes for other rect properties, very weird.

// extended TextArea which gives access to TextField
package
{
import mx.controls.TextArea;
import mx.core.IUITextField;

public class TextAreaExtended extends TextArea
{
public function TextAreaExtended()
{
createChildren();

}

public function get _textField():IUITextField{
return textField;
}
}
}



Re: [flexcoders] getCharBounds not working on AIR?

2008-02-20 Thread Daniel Freiman
Try getting the rect later (Put a button somewhere and click it after
everything is finished loading) to make sure the UITextField doesn't just
need to be refreshed first.  If that doesn't work, I'd file a bug if I were
you.

- Dan Freiman

On Wed, Feb 20, 2008 at 10:20 AM, b_alen [EMAIL PROTECTED] wrote:

   It seems a bit ridiculous but it's true. Not just that you have to use
 all sorts of hacks to get access to good old TextField (IUITextField)
 in Flex in order to even think of accessing characters' Rectangles.
 Once you do manage to cut your way through, you get a very nasty
 disappointment that IUITextField.getCharBounds() works perfectly in
 Flex Web apps, but returns some bizarre incorrect values when running
 on AIR.

 If anyone has any suggestion, I'd really appreciate it very much.
 We're in terrible deadline and this is one of the crucial functionalities.

 var tf:TextAreaExtended = new TextAreaExtended();
 tf._textField.text = dsfsdf sfd sf dsf sfdsd fdsfdsfdsfdsfdsf fds;
 addChild(tf);
 var rect:Rectangle = tf._textField.getCharBoundaries(20);

 // I get values for rect.left something like 0.5
 // same goes for other rect properties, very weird.

 // extended TextArea which gives access to TextField
 package
 {
 import mx.controls.TextArea;
 import mx.core.IUITextField;

 public class TextAreaExtended extends TextArea
 {
 public function TextAreaExtended()
 {
 createChildren();

 }

 public function get _textField():IUITextField{
 return textField;
 }
 }
 }