It accually doesn't use any extra textfields, it stores the htmlText value
of a textfield and gets the coordinates, it then resets the tf to the
original value. I am thinking of making this a subroutine; assigning a
textfield some value dynamically would be done through a special function
that gathers spacial data before assigning the value.

Right now the the total operation is written in 300 lines of algorithmic
code. I am frequently coming up with optimizations, so this number is
droping... I will make it open source when it's finished because I
finddevelopers and designers are often upset about not being able to measure
rendered textfields.

I figure this can be used for more than just text hover states. This will
get you a rectangle of text, and it will also get you line metrics so I am
thinking it will allow for some creative possibilities with typographic
animation. It could be that a function defines the rectangle of all letters
in a sequence for use with just words or short sentences. I suggest words
and short sentences as any large body of text would cost too much in system
resource with too many rectangles =]

The dude at quasimondo.com tried mimicking the getLineMetrics function from
Flex using bitmapData and getColorRect to measure the width of lines. It
fails with custom anti aliasing, maybe even anti aliasing for animation. For
some reason converting anti aliased text to bitmap data results in a blank
bitmapData object...

I wanted to run with his code but I found that it became far too elaborate
as I was having to put the textfield in movieclips to get it to convert to
bitmap data. This solution would fail too when image tags are used.

It's a great theoretical solution but not a good practical solution.

On 6/10/06, GregoryN <[EMAIL PROTECTED]> wrote:

Hello elibol,

> Were your textfields multiline?
No, they were just a row of links.

What you're trying to do is really interesting :-).

As I can guess, to work with non-monospace fonts, your getWordRect
function should be quite smart...

Also, the only way I can imagine so far (in about 15 min) must
probably use a lot of duplicate textfields to get all these
dimensions.

What do you think, how often the need for hover event in html text
arises?


--
Best regards,
GregoryN
================================
http://GOusable.com
Flash components development.
Usability services.


> ------- elibol wrote:
> Hi Greg,
>
> Yea, really is funny... Were your textfields multiline?
>
> I've tried the img tag solution, the problem is that it does not snuggle
> between text, the tag must be either left or right justified so it's
never
> where it should be.
>
> So far I've built a function that gets the x/y ( relative to textfield )
and
> w/h of a string from a textfield.
>
> getWordRect(textField, searchString)
>
> This returns a rectangle object that describes the word rectangle. I am
> planning to use this with a mouse hotspot class I've written a while
ago.
> This will allow me to pass the rectangle objects and create a hover
entity
> that will broadcast the entity {id,x,y,w,h} to the hover event handler.
>
> It's pretty fricken elaborate. I think this functionality will be useful
as
> Flex does not even support these kinds of functions so I will post this
> stuff on my site soon.
>
> I plan to implement a getLineMetrics style function as the base code
that
> the getWordRect is driven with will allow me to do this relatively
easily.
>
> I plan to build a sub function of getWordRect that will get all word
> rectangles of a searchString.
>
> Word to the Adobe developers, I think this is functionality the
TextField
> class in Flex should implement.
>
> I also think htmlText for TextField Objects should have a realtime DOM.
>
> M.
>
> On 6/9/06, GregoryN <[EMAIL PROTECTED]> wrote:
>>
>> well,
>>
>> The only solution I can suggest (and I've used it several times) is to
>> make each of your links embedded into separate mc.
>>
>> But I was making just quite short html texts dynamically at runtime.
>>
>> Depending on situation you may have to embed an SWF within IMG tag and
>> use some kind of flashvars to set it's behavior .
>> Funny, isn't it?
>>
>>
>> --
>> Best regards,
>> GregoryN
>> ================================
>> http://GOusable.com
>> Flash components development.
>> Usability services.
>>


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to