Damn formatting....
public function DistributorsForm () :void{
// sets styles ... set size =14 instead of default 16...
StyleFlair.snapOnTextArea(details_ta, {size:14});
details_ta.textField.selectable = false;
var details_ta_overlay:Sprite = new Sprite();
details_ta_overlay.graphics.beginFill(0xFFFFFF, 0);
details_ta_overlay.graphics.drawRect(details_ta.x, details_ta.y,
details_ta.width - details_ta.verticalScrollBar.width,
details_ta.height - details_ta.horizontalScrollBar.height);
details_ta_overlay.graphics.endFill();
addChild(details_ta_overlay);
}
On Fri, Mar 27, 2009 at 2:38 PM, Taka Kojima <[email protected]> wrote:
> Hey Peter,
>
> Hmm... i see the issue, very weird, probably classifies as a bug,
> here's how I got around it:
>
> public function DistributorsForm () :void {
> // sets styles ... set size =14 instead of default 16...
> StyleFlair.snapOnTextArea(details_ta, {size:14});
> details_ta.textField.selectable = false;
>
> var details_ta_overlay:Sprite = new Sprite();
>
> details_ta_overlay.graphics.beginFill(0xFFFFFF, 0);
> details_ta_overlay.graphics.drawRect(details_ta.x, details_ta.y,
> details_ta.width - details_ta.verticalScrollBar.width,
> details_ta.height - details_ta.horizontalScrollBar.height);
> details_ta_overlay.graphics.endFill();
>
> addChild(details_ta_overlay);
> }
>
>
> you could even extend TextArea to override the selectable setter to do
> this or something, I'm sure there is a better/cleaner way to implement
> this , but hey it works right?
>
> Hope this helps.
>
> - Taka
>
> On Fri, Mar 27, 2009 at 2:14 PM, <[email protected]> wrote:
>> Joel, Ian,
>>
>> I agree with you, because I thought I was doing it "by the book" (=AS3
>> Reference).
>>
>> Thanks, you are willing to look at the code. Code is included however it is
>> extracted from the source files and not a working standalone example.
>>
>> I extracted everything what is done with the details_ta TextArea-instance.
>> The details_ta is on the stage before the code is exectued. I compile all
>> code in Flex Builder 3 in a SWC-file which I link in as Library in Flash FLA
>> (Flash CS4), if that matters.
>>
>> Text in the details_ta, when Test movie is executed, can be selected and
>> copied. I'll hope the code can help.
>>
>> Code:
>>
>> package {
>>
>> import fl.controls.TextArea;
>> import flash.display.*;
>> import flash.events.*;
>> import flash.text.TextField;
>>
>> public class DistributorsForm extends ModuleTemplate {
>> public var details_ta:TextArea; // for displaying the list
>> public function DistributorsForm () :void {
>> // sets styles ... set size =14 instead of default 16...
>> StyleFlair.snapOnTextArea(details_ta, {size:14});
>> details_ta.textField.selectable = false;
>> }
>>
>> // MUTATOR for the information GUI widget...
>> public function set detailsWidget(s:String):void {
>> details_ta.htmlText = s;
>> };
>>
>> private function showDetails(distributors:Array) : void {
>> var s:String = "";
>> for each (var d:Distributor in distributors) {
>> s = s.concat( htmlFormat(d), "<BR><BR>");
>> }
>> detailsWidget = s; // display the data
>> }
>>
>> private function htmlFormat(d:Distributor):String {
>> var blueColorFont:String = "<FONT COLOR='#99CCFF'>";
>> var BREAK:String = "<BR>";
>> var endFont:String = "</FONT>";
>>
>> // format details ...
>> var details:String;
>> details = "<B>" + d.companyname + "</B>";
>> details += d.contactperson + BREAK;
>> details += d.address + BREAK;
>> details += d.city + BREAK;
>> details += d.telephone + BREAK;
>> return details;
>> }
>>
>> } // endof class
>> } // endof package
>>
>>
>>
>> class StyleFlair {
>>
>> public static function snapOnTextArea(ta:TextArea,
>> formatObj:Object=null):void {
>> // set default format values, or have them override with formatObj
>> var size:uint = 16;
>> var color:String = "0xFFFFFF";
>> if (formatObj != null) {
>> if (formatObj.size != null) size = formatObj.size;
>> if (formatObj.color != null) color = formatObj.color;
>> if (formatObj.font != null) font = formatObj.font;
>> }
>> ta.editable = false;
>> ta.enabled = false;
>> ta.setStyle("marginRight", 1);
>> ta.setStyle("marginLeft", 1);
>> var format:TextFormat = new TextFormat();
>> format.font = font ;
>> format.color = color;
>> format.size = size;
>> ta.setStyle("textFormat", format);
>> }
>> }
>>
>> class moduleTemplate is not shown but does do anything with details_ta, or
>> formatting components.
>>
>> Peter
>>
>> Citeren Joel Stransky <[email protected]>:
>>
>>> Somehow I doubt that.
>>> How about posting your code so there's no confusion.
>>>
>>> On Fri, Mar 27, 2009 at 3:36 PM, <[email protected]> wrote:
>>>
>>>> Joel,
>>>>
>>>> Thanks, however that didn't work.
>>>> (sorry if I was not clear in my response on Ian's hint, because what you
>>>> wrote was exactly what I did)
>>>>
>>>> Still no joy ...
>>>>
>>>> Peter
>>>>
>>>> Citeren Joel Stransky <[email protected]>:
>>>>
>>>>
>>>> Target the TextArea's TextField
>>>>>
>>>>> details_ta.textField.selectable = false;
>>>>>
>>>>> On Fri, Mar 27, 2009 at 2:39 PM, <[email protected]> wrote:
>>>>>
>>>>> Ian,
>>>>>>
>>>>>> thanks for replying. Unfortunately noop.
>>>>>>
>>>>>> I use the htmlText property of the TextArea instance instead of the
>>>>>> text
>>>>>> prioperty to display text (such as details_ta.htmlText = "<b>text
>>>>>> sample</b>"; and details_ta is an TextArea instance on the stage).
>>>>>>
>>>>>> Could that something have to do with it?
>>>>>>
>>>>>> Peter
>>>>>>
>>>>>> Citeren Ian Thomas <[email protected]>:
>>>>>>
>>>>>>
>>>>>> Try:
>>>>>>
>>>>>>> textArea.textField.selectable=false;
>>>>>>>
>>>>>>> HTH,
>>>>>>> Ian
>>>>>>>
>>>>>>> On Fri, Mar 27, 2009 at 4:38 PM, <[email protected]> wrote:
>>>>>>>
>>>>>>>
>>>>>>>> I'll have to prevent users to copy text from a TextArea. In Flex I
>>>>>>>> saw
>>>>>>>> you
>>>>>>>> do that bij setting a selectable attribute of the
>>>>>>>> mx.controls.TextArea
>>>>>>>> to
>>>>>>>> false.
>>>>>>>>
>>>>>>>> However, this seems not possible with the fl.controls.TextArea, which
>>>>>>>> is
>>>>>>>> used in Flash CS4 / AS3.
>>>>>>>>
>>>>>>>> Does someone has a tip or hint.
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>> PS. setting editable of the TextArea to false doesn't help, and
>>>>>>>> setting
>>>>>>>> the
>>>>>>>> enabled attribute of the TextArea to false gives a disabled look and
>>>>>>>> is
>>>>>>>> not
>>>>>>>> the intention.
>>>>>>>>
>>>>>>>> Peter van der Post
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Flashcoders mailing list
>>>>>>>> [email protected]
>>>>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>>
>>>>>>> Flashcoders mailing list
>>>>>>> [email protected]
>>>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Flashcoders mailing list
>>>>>> [email protected]
>>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> --Joel Stransky
>>>>> stranskydesign.com
>>>>> _______________________________________________
>>>>> Flashcoders mailing list
>>>>> [email protected]
>>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> --Joel Stransky
>>> stranskydesign.com
>>>
>>
>>
>>
>>
>> _______________________________________________
>> Flashcoders mailing list
>> [email protected]
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders