| Lesson 7: Properties |
|
|
Goal In this exercise you will learn more about sprite properties and how to alter sprite property values to create interesting visual effects and rollovers. The table below lists some of the more common sprite properties that you may encounter in Director. Some of these properties are easier to figure out than others, but all of these properties, and more, are available for use in your Director movies. If you see a property you don't recognize you should search the online Help System in Director to find out how you might use that property. Some of the easiest properties to work with visibly alter the appearance of a sprite. For example, width, height, and blend. Other properties will be more challenging to understand because they are more abstract, or require a more thorough understanding of Director, Lingo, and other related properties.
When you select a sprite on the stage (as shown in the above image on the left side), its properties appear in the Property Inspector window (shown in the above image on the right side). From the Property Inspector window we can see most of the properties that can be altered for the selected sprite. Each of these properties is available for any authoring purpose you choose using Lingo, once you know how to refer to the desired property. For example, we can see from the Property Inspector window that the selected sprite is 143 pixels wide and has a height of 219 pixels. Using Lingo, we may either examine these properties or change them. The easiest way to experiment is to use the Message Window. If you enter the following statement into the Message Window with the balloon sprite in channel 1, you will see the width of the sprite displayed. trace(sprite(1).width) If you want to change the width of the sprite you can assign it a different value. For example, we could make the width of the sprite 300 pixels wide. Type the following into the Message Window to change sprite 1 so it is 300 pixels wide. Your movie will need to be running for the change to appear. sprite(1).width = 300
-- toggle the width of the sprite when it's rolled over on mouseLeave me The above handler adds '10' to the current width of the sprite when it's rolled over, then subtracts that amount when the mouse is rolled way. This slight enlargement works as a rollover effect without requiring two different pieces of artwork. The handler below uses the same 'mouseEnter' and mouseLeave' messages to alter the 'blend' property of a sprite. This can also be a good rollover effect. -- dim the sprite -- bring the sprite to full opacity To see these Lingo script examples and others in action, download this movie. Try each behavior with the balloon sprite to see the effects of different messages working in conjunction with different sprite properties. Look at each script to see which specific properties and messages are being used. Exercise: Based on the example movies and information provided , create a movie with a sprite that uses some of the properties listed at the top of the exercise. Try combinations of properties to see what happens. Hopefully, when you're finished playing in the "pixel playground" you will have a better understanding of how to use sprite properties in your own movies.
Set as favorite
Bookmark
Email this
Hits: 1296 Trackback(0)
Comments (0)
![]() Write comment
|





