Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
566 CHAPTER 17 Working with effects Setting effect durations All effects take the duration property that you can use to specify the time, in milliseconds, during which the effect occurs. The following example creates two new versions of the WipeLeft effect. The SlowWipe effect uses a two-second duration; the ReallySlowWipe effect uses an eight-second duration: <?xml version="1.0"?> <!-- behaviors\WipeDuration.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:WipeLeft id="SlowWipe" duration="2000"/> <mx:WipeLeft id="ReallySlowWipe" duration="8000"/> <mx:Button label="Slow Wipe" mouseDownEffect="{SlowWipe}"/> <mx:Button label="Really Slow Wipe" mouseDownEffect="{ReallySlowWipe}"/> </mx:Application> Using embedded fonts with effects The Fade and Rotate effects only work with text rendered using an embedded font. If you apply these effects to a control that uses a system font, nothing happens to the text. When you apply a Zoom effect to text rendered using a system font, Flex scales the text between whole point sizes. While you do not have to use embedded fonts when you apply a Zoom effect to text, the Zoom will appear smoother when you apply it to embedded fonts. The following example uses two Label controls, one that uses an embedded font and one that does not. Therefore, when you apply the Rotate effect to the Label control using the system font, nothing happens: <?xml version="1.0"?> <!-- behaviors\EmbedFont.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Style> @font-face { src:url("../assets/MyriadWebPro.ttf"); font-family: myMyriadWebPro; } </mx:Style> <mx:Rotate id="rotateForward" angleFrom="0" angleTo="180"/> <mx:Rotate id="rotateBack" angleFrom="180" angleTo="0"/> <mx:VBox> <mx:VBox borderStyle="solid"> <mx:Label id="l1"