Flex Components and Anchor Tags

On a current project I found a bug within a custom UIComponent. Hopefully my explanation is thorough enough to give you an understanding as to why I think this may be an implementation issue with components in the Flex framework itself:

The UIComponent added a child Sprite that contained a TextField child. The text field's htmlText property contained an anchor tag. By default the text field's selectable property was set to false. This is when it gets interesting.

The class which contained the TextField and extended from Sprite when included on the flash player stage worked correctly, meaning that the anchor tag located the browser correctly when clicked even though the selectable property was set to false. Seems like this should be the standard...

The bug was when this class' object reference was added as a child to a class extending UIComponent. When this occurred the anchor tag did not allow for left mouse click in turn locating the browser to the location specified in the anchor tag. Oddly enough, Flash allowed for right clicking on the link displaying the standard anchor tag options of open, open in new window, and copy link.

The workaround was to set the selectable property to true, though I may not want a user to select the text it was the only workaround with regard to adding a text field to a UIComponent. Please see examples below (view source is enabled).

Selectable set to false in component example.

Selectable set to true in component example.

Selectable set to false in sprite example.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Nice fix, great work!
# Posted By darin | 9/6/07 11:07 AM
[&] former peeps over at Yahoo just released 10 more components, 3 Flash and 5 Flex components. The also fixed some of the bugs [&]
# Posted By battery | 6/26/08 10:45 PM
Hi,
I have a custom component that extends <mx:Text> because i need to set a:hover and a:link CSS styles.
So...do you have any idea how can iimplement your solution with CSS styles for hover in anchor tag?

thanks,
Carlos
# Posted By Carlos Carvalhar | 3/30/09 3:25 PM
@Carlos, a couple of sites that are good references for this:

Snipplr:
http://tinyurl.com/dlhbz9

Drawlogic:
http://tinyurl.com/ccrgrc

Sorry for the slow reply.

Good luck!
# Posted By Jeff Bouley | 4/9/09 8:40 PM
ok thanks! i'll try it for sure.
# Posted By Carlos Carvalhar | 4/9/09 11:15 PM

Copyright Strikefish, Inc., 2005. All rights reserved.