PDA

View Full Version : Dynamic Content Scroller (from XML) with Hover State


madcat
10-23-2009, 01:40 PM
Hey guys, I've been having a hell of a time trying to do this with a TextArea, so I thought I better try a different approach... any advice is appreciated. With some help I was able to get the links working as they should but i can find no way to get the hover effect (not even the doopingTextArea class)

I have content coming in through XML (a list of words and link)... I'm trying to create a menu where when you rollover the word the entire background area of that menu item changes color. Just like a CSS menu that creates a hover state that fills the entire background area of that item. Since the content is dynamic, it would need to have a scrollbar that expands/contracts etc.

If this was you, what might be an option or scenario to achieve such effect?

Again, any help appreciated!

laurits
10-23-2009, 02:45 PM
Hi,

I think I would make it into a TextField and set the TextField width and height to whatever is necessary according to the amount of text.

Put a Rectangle behind the TextField and add an eventListener to the TextField which does the MovieClip color change on MOUSE_OVER.

Does this make sense in your situation?

madcat
10-23-2009, 03:00 PM
Thanks laurits, I'm just wondering though... do you mean apply this to one large TextField... or each item from the XML goes into its own TextField?

Also, here's an example of my XML:

<data>
<word ID="1">
<copy>Link 1</copy>
<link>http://www.google.com</link>
</word>
<word ID="2">
<copy>Link 2</copy>
<link>http://www.cnn.com</link>
</word>

etc...
</data>


> Each link above is put into its own TextField, then the TextField is added to its own Movie Clip. The clips height & width is expanded so that the mouse rolls over it & an image is pulled from the library to create the hover. Everything works so far...

Now all of this is put into an MC called mcMenu.

Since mcMenu holds the XML ... it doesn't expand. My list gets cut off.

If I could figure a way to just add a scroll bar to mcMenu (created dynamically) I could go on with my life :)

I've found that the UIScrollBar can be added only to TextFields. Can't really wrap my ahead around why you can't do an MC as easily but ya know... nothing is easy I suppose.