Prev | Current Page 643 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

scaleX = 1.5;
mc.scaleY = 1.5;
mc.x = (Lib.current.stage.stageWidth - mc.width) / 2;
mc.y = (Lib.current.stage.stageHeight - mc.height) / 2;
// set the transition with its duration in seconds
easeOut(mc, 4);
current = (current == total - 1) ? 0 : current + 1;
}
private static function easeOut(mc : DisplayObjectContainer, time : Float)
{
var properties = [???alpha???, ???scaleX???, ???scaleY???, ???x???, ???y???];
var targetvalues = [1.0, 1.0, 1.0, 0, 0];
var originals = new Array();
var deltas = new Array();
for(i in 0...properties.length)
{
originals.push(Reflect.field(mc, properties[i]));
deltas.push(targetvalues[i]-Reflect.field(mc, properties[i]));
}
var start = Date.now().getTime();
var step = 0.0;
var duration = time * 1000;
var tollerance = 0.001;
// in this case you cannot assign the function body directly to the variable,
// otherwise its name will not available to be called recursively
var frameHandler;
frameHandler = function(e : Event)
(continued)
Chapter 12: Building Interactive Content with Flash
337
{
step = Date.


Pages:
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655