Changing text color on mouseEnter

February 17th, 2006

When people first begin learning Lingo it is very common to do things such as sprite(21).visible = 0 or member(155).color = color(200,0,0). However, it is always advantageous to create behaviors that don’t make use of “hard coded” numbers so that the behavior can be reused in the future without having to adjust the sprite or member numbers or names.

When I first started playing with Lingo my code was full of these hard coded things. Now when I look back at stuff from a decade ago it kills me. Of course, when under pressure I’ll slip in a few of those things at the very end of a project. I always wish I could avoid it, but time pressures often cause the brain to ignore reason.

On the Adobe Director Forum a question was raised about changing the color of text on a mouseEnter event without having to recode each behavior for different member numbers. A very simple way to do this is to write a behavior that allows you to choose the color you want as you drop the behavior on each text member that you apply the behavior to.

Sample file: text_color_rollover.zip

Once you have written a good behavior, you end up using it for many years and many projects.

Entry Filed under: Basic Lingo,Demo Files,Quick answer

2 Comments Add your own

  • 1. Aaron Christian  |  November 30th, 2007 at 2:52 pm

    Thanks a lot, Used for a school project. Great Code!

  • 2. John  |  January 11th, 2008 at 2:53 am

    To make it the behaviour which allows you to choose colour which you want as you lower behaviour on each text participant to whom you apply behaviour should write very simple way.

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Director Sites

Calendar

February 2006
M T W T F S S
    Mar »
 12345
6789101112
13141516171819
20212223242526
2728  

Archives

Recent Posts

Recent Comments