Adobe Dreamweaver Forums



Last 10 THreads :         DIV in Table not working. (Last Post : Jay Jay - Replies : 12 - Views : 13 )           »          Library is missing names from splitter bar (Last Post : Mad Dog - Replies : 11 - Views : 12 )           »          pop up blocker jacking my login (Last Post : Jay Jay - Replies : 5 - Views : 6 )           »          Can Anyone Help With Sub Menus (Last Post : drafted - Replies : 7 - Views : 8 )           »          Why is this not working!!! (Last Post : Boxing Boom - Replies : 11 - Views : 12 )           »          CF8 Enterprise gives 500 errors (Last Post : BJFranz - Replies : 0 - Views : 1 )           »          cfimage error (Last Post : masoud_amen - Replies : 0 - Views : 1 )           »          Flash Controls Not Displaying in Embedded File (Last Post : QADesign - Replies : 4 - Views : 5 )           »          Scollbar theme (Last Post : vcorey - Replies : 0 - Views : 1 )           »          Scollbar theme (Last Post : vcorey - Replies : 0 - Views : 1 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 12-01-2008, 11:53 PM
tdigennaro
 
Posts: n/a
Diggs:
Default Detect mouse over for each word in Text

For large text components, I must detect mouse events (over, out, click)
separately for each word (or even for each letter) in a text component.
Which of the text components should I use?
Can I use mouseMove events? If so, how do I know where the words are?
"getLineMetrics" is close, but pretty tedious, since I'd have to do a LOT of
bookkeeping.
Thanks.




Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-02-2008, 01:23 AM
myIP
 
Posts: n/a
Diggs:
Default Re: Detect mouse over for each word in Text

I believe the best way would be to create a hyperlink and assign it to a
textField. Such as:

theTextField.htmlText = ?<a href=?event:linkContent?>linkText</a>?;

theTextField.addEventListener(TextEvent.LINK, linkListener);

private function linkListener(e:TextEvent):void
{
}


?The linkContent string typically identifies an ActionScript operation to be
carried out when the link is clicked.?
? Essential ActionScript 3.0 p.577

Reply With Quote
  #3 (permalink)  
Old 12-02-2008, 10:53 PM
tdigennaro
 
Posts: n/a
Diggs:
Default Re: Detect mouse over for each word in Text

Thanks for the reply. This wil provide one link for the whole textField. I
want to avoid creating a textField for each word, since it's probably slow and
I'll have to do the work that the text renderer usually does, including word
spaces, line wrap, etc.
I want to use a small number of textfields for many lines of text, and then
detect which word the mouse moved over.
Any ideas?


Reply With Quote


  #4 (permalink)  
Old 12-03-2008, 12:03 AM
rtalton
 
Posts: n/a
Diggs:
Default Re: Detect mouse over for each word in Text

I like myIP's idea. You assign a link to each word and add the whole thing to
the HTMLtext property. Don't think you could make individual words or letters
clickable without them being HTMLtext. This would result in a lot of html tags,
though I see no other way. Plain text have no events associated with them.

getLineMetrics returns a line of text, not individual letters or words.

Consider giving us more details about what you are trying to accomplish by
having the text 'clickable', and someone may have an idea for you.


Reply With Quote
  #5 (permalink)  
Old 12-03-2008, 01:25 AM
myIP
 
Posts: n/a
Diggs:
Default Re: Detect mouse over for each word in Text

"This wil provide one link for the whole textField"
It could if you want it to be that way. It can also provide one link for each
word or letter.

Remember you can add multiple <a> tags to a textfield. Such as below:

theTextField.htmlText = ?<a href=?event:linkContent?>Adobe</a><a
href=?event:linkContent?>Flex</a>?<a href=?event:linkContent?>Builder</a> 3";

Does that help? "Adobe", "Flex" and "Builder" has their own links. The "3"
does not have a link. Then you can have unique "linkContents" for each word, so
that the listener will know what word or letter was clicked.

I am not sure if this text will be loaded on a flat(static) or dynamic file.
If its flat you could manually add each <a> tag where its needed. If its
dynamic you would need to write a function or class to insert <a> tags where
its needed.

Let me know how it goes.

Reply With Quote
  #6 (permalink)  
Old 12-03-2008, 08:13 PM
tdigennaro
 
Posts: n/a
Diggs:
Default Re: Detect mouse over for each word in Text

This is dynamic text, or even text provided via a remote object.
And yes, I can make each word into a hypertext link. It's a bit clumsy and
may have worse performance.
This application is text-heavy, so it matters.

Yes, "line metrics" describes the bounding box of a line of text, so it's only
part of the solution, if there is one.

I'm investigating all of the properties and methods of the TextArea component.
The Text component won't do it.

What I really want to do is catch "mouse move" events, and then "look up" in
the underlying text object, what word or is under the cursor.

I'll report my results.


Reply With Quote


Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 11:02 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk