RE: [Flashcoders] Prevent Multiline Selectable TextFieldfromscrolling?

2006-06-05 Thread Tom Lee
Tried that... creates this nasty jumping effect as it snaps back into
place.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Martin
Weiser
Sent: Monday, June 05, 2006 4:37 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Prevent Multiline Selectable
TextFieldfromscrolling?

onScroll event method, and revert the scroll value back to some saved 
value...

MW


- Original Message - 
From: Tom Lee [EMAIL PROTECTED]
To: 'Flashcoders mailing list' flashcoders@chattyfig.figleaf.com
Sent: Monday, June 05, 2006 10:27 PM
Subject: RE: [Flashcoders] Prevent Multiline Selectable TextField 
fromscrolling?


 Oddly enough, I am - but it still scrolls.  It's almost as though there's 
 an
 extra newline or something in there.

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Michael
 Bedar
 Sent: Monday, June 05, 2006 4:23 PM
 To: Flashcoders mailing list
 Subject: Re: [Flashcoders] Prevent Multiline Selectable TextField
 fromscrolling?

 Only thing I can think of right now is always showing all of the
 text, and masking the portion you want to hide...


 On Jun 5, 2006, at 4:05 PM, Tom Lee wrote:

 This should be a trivial problem, but for some reason I'm not
 seeing an
 obvious and clean solution (one of those Mondays).  What I want to
 do is
 prevent a TextField from scrolling when the user selects the text.
 Essentially, have the text be selectable but locked in place,
 regardless of
 the height of the text field.



 I've tried:



 TextField.onScroller = function(tf){

 tf.scroll = 0;

 }



 This works ok, but not cleanly.  The text is still allowed to
 scroll, it
 just jumps back into place when the user releases the mouse.  There
 oughtta
 be a TextField.scrollable:Boolean.



 Ideas?

 ___
 Flashcoders@chattyfig.figleaf.com
 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

 ___
 Flashcoders@chattyfig.figleaf.com
 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


 ___
 Flashcoders@chattyfig.figleaf.com
 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 

___
Flashcoders@chattyfig.figleaf.com
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


___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] Prevent Multiline Selectable TextFieldfromscrolling?

2006-06-05 Thread Derek Vadneau
There's no simple property for this but I was able to put together an 
example that works (check below for the caveats):

var o;
var i:Number;
var tf = t.getTextFormat();
var linesOfText:Number = 2;

var originalText:String = t.text;

for (i=0; ioriginalText.length; i++)
{
o = tf.getTextExtent(originalText.substr(0, i));

if (o.width  2 * t.textWidth  o.width  linesOfText * t.textWidth - 
20)
{
t.text = originalText.substr(0, i);
break;
}
}

It's a little funky, but extending Flash textfield seems to always be like 
that.

What it does is store the original text and populate the textfield with 
text only up until it would scroll.

Here are the caveats:
1. The number in the if condition (20) is a guess. If I had the time to 
spend on this I would calculate the size before the next word. As it is 
now 20 seemed to work for the text that I had.
2. The text will be from the 0 character onwards. If you have a scrollbar, 
or other means of scrolling, the scrollPosition will not be taken into 
account.

Again, if I had the time this could probably be made to compensate for the 
caveats.

Hope it helps.


Derek Vadneau

- Original Message - 
From: Tom Lee [EMAIL PROTECTED]
To: 'Flashcoders mailing list' flashcoders@chattyfig.figleaf.com
Sent: Monday, June 05, 2006 4:05 PM
Subject: SPAM-LOW: [Flashcoders] Prevent Multiline Selectable TextField 
from scrolling?


This should be a trivial problem, but for some reason I'm not seeing an
obvious and clean solution (one of those Mondays).  What I want to do is
prevent a TextField from scrolling when the user selects the text.
Essentially, have the text be selectable but locked in place, regardless 
of
the height of the text field.



I've tried:



TextField.onScroller = function(tf){

tf.scroll = 0;

}



This works ok, but not cleanly.  The text is still allowed to scroll, it
just jumps back into place when the user releases the mouse.  There 
oughtta
be a TextField.scrollable:Boolean.



Ideas?


___
Flashcoders@chattyfig.figleaf.com
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


RE: [Flashcoders] Prevent Multiline Selectable TextFieldfromscrolling?

2006-06-05 Thread Tom Lee
Interesting approach, Derek.  I've actually done something similar in the
past for paginating purposes, but it didn't occur to me to do it for this.
Of course, it gets really hairy if you're dealing with HTML, but still
doable.

Thanks!


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Derek
Vadneau
Sent: Monday, June 05, 2006 4:48 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Prevent Multiline Selectable
TextFieldfromscrolling?

There's no simple property for this but I was able to put together an 
example that works (check below for the caveats):

var o;
var i:Number;
var tf = t.getTextFormat();
var linesOfText:Number = 2;

var originalText:String = t.text;

for (i=0; ioriginalText.length; i++)
{
o = tf.getTextExtent(originalText.substr(0, i));

if (o.width  2 * t.textWidth  o.width  linesOfText * t.textWidth
- 
20)
{
t.text = originalText.substr(0, i);
break;
}
}

It's a little funky, but extending Flash textfield seems to always be like 
that.

What it does is store the original text and populate the textfield with 
text only up until it would scroll.

Here are the caveats:
1. The number in the if condition (20) is a guess. If I had the time to 
spend on this I would calculate the size before the next word. As it is 
now 20 seemed to work for the text that I had.
2. The text will be from the 0 character onwards. If you have a scrollbar, 
or other means of scrolling, the scrollPosition will not be taken into 
account.

Again, if I had the time this could probably be made to compensate for the 
caveats.

Hope it helps.


Derek Vadneau

- Original Message - 
From: Tom Lee [EMAIL PROTECTED]
To: 'Flashcoders mailing list' flashcoders@chattyfig.figleaf.com
Sent: Monday, June 05, 2006 4:05 PM
Subject: SPAM-LOW: [Flashcoders] Prevent Multiline Selectable TextField 
from scrolling?


This should be a trivial problem, but for some reason I'm not seeing an
obvious and clean solution (one of those Mondays).  What I want to do is
prevent a TextField from scrolling when the user selects the text.
Essentially, have the text be selectable but locked in place, regardless 
of
the height of the text field.



I've tried:



TextField.onScroller = function(tf){

tf.scroll = 0;

}



This works ok, but not cleanly.  The text is still allowed to scroll, it
just jumps back into place when the user releases the mouse.  There 
oughtta
be a TextField.scrollable:Boolean.



Ideas?


___
Flashcoders@chattyfig.figleaf.com
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


___
Flashcoders@chattyfig.figleaf.com
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