Keith,

OK, I missed something in the beginning then.
I was nearly suggesting not to lose sanity over a text area.  
And, yes, I love it when smart coders get triggered and show marvelous
solutions.
Even if it is a hassle. LOL.

I love this list!!!!

Kind regards
Cor


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Keith
Reinfeld
Sent: zondag 29 maart 2009 17:05
To: 'Flash Coders List'
Subject: RE: [Flashcoders] ?: how to prevent users to copy text from
aTextArea?

Cor, 

Well, I did suggest the TextField/Scrollbar thing before. Then I followed up
with my extend TextArea thing (then Muzak one-upped me.) In terms of
reusability I think it is a greater hassle to have to configure a
TextField/Scrollbar solution than to go the extended TextArea route. 

The code is already written, where's the hassle? 

Muzak, 

> So it's not really a bug, just a (very) bad decision. 

How is 'a (very) bad decision' not a bug when it impacts functionality like
this? 

Regards, 

-Keith 
http://keithreinfeld.home.comcast.net
 

> -----Original Message-----
> From: [email protected] [mailto:flashcoders-
> [email protected]] On Behalf Of Cor
> Sent: Sunday, March 29, 2009 6:59 AM
> To: 'Flash Coders List'
> Subject: RE: [Flashcoders] ?: how to prevent users to copy text from
> aTextArea?
> 
> Absolutely, I was following this along but at some given point I thought
> maybe they overlook the most simple way.
> Which is always good, otherwise we would maybe have square wheels...
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Anthony
> Pace
> Sent: zondag 29 maart 2009 13:45
> To: Flash Coders List
> Subject: Re: [Flashcoders] ?: how to prevent users to copy text from
> aTextArea?
> 
> In this situation I agree with you, that rolling your own would be
> pretty easy and could prove to be less of a hassle; however, he does
> present a nice solution to the problem at hand.
> 
> Cor wrote:
> > Just interested.
> > Is all this worth the hassle?
> > I mean instead using a TextArea, I would go for a normal TextField and a
> > custom scrollbar all in 1 movieclip.
> > And set the needs.
> >
> > Cor.
> >
> >
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]] On Behalf Of Muzak
> > Sent: zondag 29 maart 2009 1:20
> > To: Flash Coders List
> > Subject: Re: [Flashcoders] ?: how to prevent users to copy text from
> > aTextArea?
> >
> >
> > The problem seems to be that TextArea uses the "enabled" value to set
> the
> > inner textField's selectable property value.
> >
> >   protected function updateTextFieldType():void {
> >    textField.type = (enabled && _editable) ? TextFieldType.INPUT :
> > TextFieldType.DYNAMIC;
> >    textField.selectable = enabled;
> >    textField.wordWrap = _wordWrap;
> >    textField.multiline = true;
> >   }
> >
> > So each time the updateTextFieldType() method is called, no matter what
> you
> > set TextArea.textField.selectable to, it will revert to
> > the TextArea.enabled value.
> > That's why :
> >
> >     details_ta.textField.selectable = false;
> >
> > doesn't really work.
> >
> > So it's not really a bug, just a (very) bad decision.
> > Why it was done that way, who knows..
> >
> > To get the TextArea to work the way you want, you can extend it and
> override
> > the updateTextFieldType() method and add a selectable
> > property, like so:
> >
> > package {
> >
> >  import fl.controls.TextArea;
> >  import flash.text.TextFieldType;
> >
> >  public class TextArea2 extends TextArea {
> >
> >   private var _selectable:Boolean = true;
> >
> >   override protected function updateTextFieldType():void {
> >    textField.type = (enabled && _editable) ? TextFieldType.INPUT :
> > TextFieldType.DYNAMIC;
> >    textField.selectable = _selectable;
> >    textField.wordWrap = _wordWrap;
> >    textField.multiline = true;
> >   }
> >
> >   public function get selectable():Boolean {
> >    return _selectable;
> >   }
> >   public function set selectable(value:Boolean):void {
> >    _selectable = value;
> >    super.textField.selectable = value;
> >    updateTextFieldType()
> >   }
> >
> >  }
> > }
> >
> >
> > Tested with the code you provided earlier (normal TextArea on stage):
> >
> > package {
> >
> >  import flash.display.Sprite;
> >  import fl.controls.TextArea;
> >  import flash.text.TextField;
> >  import flash.events.Event;
> >  import TextArea2;
> >
> >  public class TestTextArea extends Sprite {
> >
> >   public var details_ta:TextArea;
> >   public var details2_ta:TextArea2;
> >
> >   public function TestTextArea() {
> >    addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
> >    init();
> >   }
> >
> >   private function init():void {
> >    trace("TestTextArea ::: init");
> >    details2_ta = new TextArea2();
> >    details2_ta.selectable = false;
> >    details2_ta.x = 220;
> >    details2_ta.y = 10;
> >    details2_ta.width = 200;
> >    details2_ta.height = 100;
> >    addChild(details2_ta);
> >   }
> >
> >   private function addedToStageHandler(evt:Event):void {
> >    trace("TestTextArea ::: addedToStageHandler");
> >    var msg:String = "<b>Lorem ipsum dolor sit amet,</b> consectetuer
> > adipiscing elit.";
> >    details_ta.htmlText = msg;
> >    details2_ta.htmlText = msg;
> >   }
> >
> >  }
> > }
> >
> > regards,
> > Muzak
> >
> > ----- Original Message -----
> > From: "Keith Reinfeld" <[email protected]>
> > To: "'Flash Coders List'" <[email protected]>
> > Sent: Saturday, March 28, 2009 10:11 PM
> > Subject: RE: [Flashcoders] ?: how to prevent users to copy text from
> > aTextArea?
> >
> >
> >
> >> Then again there is this:
> >>
> >> package{
> >> //imports
> >> import fl.controls.TextArea;
> >> import flash.text.TextField;
> >>
> >> public class CustomTextArea extends TextArea{
> >> //vars
> >> private var internalTextField:TextField;
> >>
> >> public function CustomTextArea(){
> >> super();
> >> internalTextField = TextField(this.textField);
> >> }
> >>
> >> public function set selectable(b:Boolean):void{
> >> internalTextField.mouseEnabled = b;
> >> this.editable = b;
> >> }
> >>
> >> public function get selectable():Boolean{
> >> return internalTextField.mouseEnabled;
> >> }
> >> }
> >> }
> >>
> >> Example usage:
> >>
> >> package{
> >> //imports
> >> import flash.display.MovieClip;
> >> import CustomTextArea;
> >>
> >> public class Application extends MovieClip{
> >> //vars
> >> private var customTA:CustomTextArea;
> >>
> >> public function Application(){
> >> init();
> >> //addEventListener(KeyboardEvent.KEY_DOWN,
> >> onUpArrow);
> >> }
> >>
> >> private function init():void{
> >> customTA = new CustomTextArea();
> >>
> >> addChild(customTA);
> >> customTA.x = 0;
> >> customTA.y = 0;
> >> customTA.width = 150;
> >> customTA.height = 90;
> >> customTA.htmlText = "<font color='#0000FF'><b>Lorem
> >> ipsum dolor sit amet,</b> consectetuer adipiscing elit.</font><font
> >> color='#0000FF'><b>Lorem ipsum dolor sit amet,</b> consectetuer
> adipiscing
> >> elit.</font><font color='#0000FF'><b>Lorem ipsum dolor sit amet,</b>
> >> consectetuer adipiscing elit.</font><font color='#0000FF'><b>Lorem
> ipsum
> >> dolor sit amet,</b> consectetuer adipiscing elit.</font>";
> >>
> >> trace("customTA.selectable =",customTA.selectable);
> >> customTA.selectable = false;
> >> trace("customTA.selectable =",customTA.selectable);
> >> }
> >> }
> >> }
> >>
> >> HTH
> >>
> >> Regards,
> >>
> >> -Keith
> >>
> >
> > _______________________________________________
> > Flashcoders mailing list
> > [email protected]
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > No virus found in this incoming message.
> > Checked by AVG - www.avg.com
> > Version: 8.5.278 / Virus Database: 270.11.31/2028 - Release Date:
> 03/28/09
> > 07:16:00
> >
> > _______________________________________________
> > Flashcoders mailing list
> > [email protected]
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> >
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.278 / Virus Database: 270.11.31/2028 - Release Date: 03/28/09
> 07:16:00
> 
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.278 / Virus Database: 270.11.31/2028 - Release Date: 03/28/09
07:16:00

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to