Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 121
Registered: ‎01-21-2011
My Device: Z10 LE #00055
My Carrier: Telus

Highlighting Text

A feature that users of app have been requesting a lot is the ability to highlight text (it's a bible reader app, and text is shown as labels within a scroller).  I've enabled selectable so that they can select and copy text to paste elsewhere.  I'm at a loss as to how to add the highlighting feature.  Are we able to capture what a user has selected?  Any possibility to add an extra button to the copy/paste menu?  Some suggestions on implementing this would be really appreciated.

VENTURCON
For BB10: e-Mmanuel Bible Reader, e-Mmanuel Audio Bible, PM Assist
For PlayBook: e-Mmanuel Bible Reader, Business Analysis Toolbox
Developer
Posts: 274
Registered: ‎11-01-2010
My Device: PlayBook?
My Carrier: WiFi

Re: Highlighting Text

I don't see any clean way of doing this, but there are certainly messy ways of achieving the effect.

 

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html?filter_...

Use selectionBeginIndex and selectionEndIndex as the starting point.

 

From there you have to decide how you want to implement the highlighting. Maybe add a mouseUp listener and then display an alert asking if they want to highlight the selection (play around with positioning, so it's not obscured by the copy/paste menu). Then maybe create new Sprits behind the text which will just draw a rectangle of the highlight color (use the selectionBeginIndex for positioning - e.g. getChartBoundaries(selectionBeginIndex).x)

 

I hope this gives you a starting point. You'll have to figure out how to bes implement it for your needs,

Highlighted
Developer
Posts: 121
Registered: ‎01-21-2011
My Device: Z10 LE #00055
My Carrier: Telus

Re: Highlighting Text

Thanks for the ideas! This certainly looks like it's going to be a bit of work. May have to put this lower on the list of priorities.
VENTURCON
For BB10: e-Mmanuel Bible Reader, e-Mmanuel Audio Bible, PM Assist
For PlayBook: e-Mmanuel Bible Reader, Business Analysis Toolbox