Selectable Text in a TextPanel

0 views
Skip to first unread message

tyler craft

unread,
May 1, 2009, 5:11:38 PM5/1/09
to bumpslide
I have a scrollable text panel set up, and I'm trying to set it up so
that the text can be highlighted (so the user can copy it if they
want).

I tried this:

copy = new TextPanel();
...
copy.textbox.content_txt.selectable = true;

However, I'm still not having luck. In fact, the mouse hand comes up
whenever I'm moused over the content. As though something is on top of
it. However, from looking at the code, I haven't been able to find the
right element to set mouseEnabled to false.

Any suggestions/ideas?

Thanks!

David Knape

unread,
May 1, 2009, 5:27:58 PM5/1/09
to bump...@googlegroups.com
you're so close... :)

copy.textbox.content_txt.mouseEnabled = true;
copy.textbox.content_txt.selectable = true;

TextBox sets those to false by default.

Demo:
http://demo.bumpslide.com/examples/misc/SelectableTextPanel.swf

Source:
http://bumpslide.googlecode.com/svn/trunk/as3/examples/misc/SelectableTextPanel.as

-dk

--
David Knape
Programmer / Consultant
http://bumpslide.com/

ty...@tylercraft.com

unread,
May 14, 2009, 12:12:49 PM5/14/09
to bumpslide
Thanks for the quick reply. I knew i was missing something simple!

One last (hopefully) question on the scroll panel:

How can I set the scroll handle to a fixed size?

I've removed the 9 slice scaling from the library clips.

I've also set the height and the fixed height like so:
scrollPanel.scrollbar.handle.height = 53;
scrollPanel.scrollbar.fixedHandleSize = 53;

It displays correctly initially, however as soon as I drag the handle
it scales it up (it looks like it's scaling it to the amount to
scroll).

Thanks in advance!
-tyler

On May 1, 4:27 pm, David Knape <tkd...@gmail.com> wrote:
> you're so close... :)
>
> copy.textbox.content_txt.mouseEnabled = true;
> copy.textbox.content_txt.selectable = true;
>
> TextBox sets those to false by default.
>
> Demo:http://demo.bumpslide.com/examples/misc/SelectableTextPanel.swf
>
> Source:http://bumpslide.googlecode.com/svn/trunk/as3/examples/misc/Selectabl...
>
> -dk
>
> --
> David Knape
> Programmer / Consultanthttp://bumpslide.com/

David Knape

unread,
May 14, 2009, 2:15:10 PM5/14/09
to bump...@googlegroups.com
This is a question I've been asked before. Sorry, but the
fixedHandleSize property only applies when the component is used as a
Slider. The solution I use for this is to override the handleSize
getter in a subclass.

-dk

--
David Knape
Programmer / Consultant
http://bumpslide.com/



ty...@tylercraft.com

unread,
May 14, 2009, 2:28:40 PM5/14/09
to bumpslide
Ahh.. gotcha.

That worked perfectly. Thanks!

On May 14, 1:15 pm, David Knape <tkd...@gmail.com> wrote:
> This is a question I've been asked before.  Sorry, but the
> fixedHandleSize property only applies when the component is used as a
> Slider.  The solution I use for this is to override the handleSize
> getter in a subclass.
>
> -dk
>
> --
> David Knape
> Programmer / Consultanthttp://bumpslide.com/
Reply all
Reply to author
Forward
0 new messages