13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Working with motion twe<strong>en</strong>s<br />

__motion_Leaf_1.initFilters(["flash.filters.ColorMatrix"], [0], -1, -1);<br />

__motion_Leaf_1.addFilterPropertyArray(0, "adjustColorBrightness", [0], -1, -1);<br />

__motion_Leaf_1.addFilterPropertyArray(0, "adjustColorContrast", [0], -1, -1);<br />

__motion_Leaf_1.addFilterPropertyArray(0, "adjustColorSaturation",<br />

[<br />

0,-0.589039,1.17808,-1.76712,-2.35616,-2.9452,-3.53424,-4.12328,<br />

-4.71232,-5.30136,-5.89041, 6.47945,-7.06849,-7.65753,-8.24657,<br />

-8.83561,-9.42465,-10.0137,-10.6027,-11.1918,11.7808,-12.3699,<br />

-12.9589,-13.5479,-14.137,-14.726,-15.3151,-15.9041,-16.4931,<br />

17.0822,-17.6712,-18.2603,-18.8493,-19.4383,-20.0274,-20.6164,<br />

-21.2055,-21.7945,22.3836,-22.9726,-23.5616,-24.1507,-24.7397,<br />

-25.3288,-25.9178,-26.5068,-27.0959,27.6849,-28.274,-28.863,-29.452,<br />

-30.0411,-30.6301,-31.2192,-31.8082,-32.3973,32.9863,-33.5753,<br />

-34.1644,-34.7534,-35.3425,-35.9315,-36.5205,-37.1096,-37.6986,<br />

38.2877,-38.8767,-39.4657,-40.0548,-40.6438,-41.2329,-41.8219,<br />

-42.411,-43<br />

],<br />

-1, -1);<br />

__motion_Leaf_1.addFilterPropertyArray(0, "adjustColorHue",<br />

[<br />

0,0.677418,1.35484,2.03226,2.70967,3.38709,4.06451,4.74193,5.41935,<br />

6.09677,6.77419,7.45161,8.12903,8.80645,9.48387,10.1613,10.8387,11.5161,<br />

12.1935,12.871,13.5484,14.2258,14.9032,15.5806,16.2581,16.9355,17.6129,<br />

18.2903,18.9677,19.6452,20.3226,21,22.4286,23.8571,25.2857,26.7143,28.1429,<br />

29.5714,31,32.4286,33.8571,35.2857,36.7143,38.1429,39.5714,41,42.4286,43.8571,<br />

45.2857,46.7143,48.1429,49.5714,51,54,57,60,63,66,69,72,75,78,81,84,87,<br />

90,93,96,99,102,105,108,111,114<br />

],<br />

-1, -1);<br />

Associating a motion twe<strong>en</strong> with its display objects<br />

Flash Player 9 and later, Adobe AIR 1.0 and later, requires Flash CS3 or later<br />

The last task is to associate the motion twe<strong>en</strong> with the display object or objects that it manipulates.<br />

The AnimatorFactory class manages the association betwe<strong>en</strong> a motion twe<strong>en</strong> and its target display objects. The<br />

argum<strong>en</strong>t to the AnimatorFactory constructor is the Motion object:<br />

var __animFactory_Wheel:AnimatorFactory = new AnimatorFactory(__motion_Wheel);<br />

Use the addTarget() method of the AnimatorFactory class to associate the target display object with its motion<br />

twe<strong>en</strong>. The ActionScript copied from Flash comm<strong>en</strong>ts out the addTarget() line and does not specify an instance<br />

name:<br />

// __animFactory_Wheel.addTarget(, 0);<br />

In your copy, specify the display object to associate with the motion twe<strong>en</strong>. In the following example, the targets are<br />

specified as gre<strong>en</strong>Wheel and redWheel:<br />

__animFactory_Wheel.AnimatorFactory.addTarget(gre<strong>en</strong>Wheel, 0);<br />

__animFactory_Wheel.AnimationFactory.addTarget(redWheel, 0);<br />

You can associate multiple display objects with the same motion twe<strong>en</strong> using multiple calls to addTarget().<br />

Last updated 6/6/2012<br />

342

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!