|
Using_KitchenSync_with_Flex
Help with getting KitchenSync set up to use with Flex projects.
Using KitchenSync with Adobe FlexKitchenSync was designed to be a library for AS3 applications and was intentionally made independent of the Flex framework. Flex contains its own libraries for animation. It also handles validation of children and the display list internally which can cause unexpected results when using KitchenSync. Officially, KitchenSync does not support use with Flex at this point, however, just because it's not officially supported doesn't mean it cannot be used. Here are some tips to help you out. Tips
ExampleThis example uses a listener for the addedToStage event to move a Canvas and rotate it. <?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="500" height="500"
addedToStage="onAddedToStage(event)">
<mx:Script>
<![CDATA[
import mx.containers.Canvas;
import org.as3lib.kitchensync.*;
import org.as3lib.kitchensync.easing.*;
import org.as3lib.kitchensync.action.*;
protected function onAddedToStage(evnet:Event):void {
stage.frameRate = 50;
KitchenSync.initialize(this);
var box:Canvas = new Canvas();
box.setStyle("backgroundColor", 0x0000FF);
box.width = 100;
box.height = 100;
addChild(box);
var tweenX:KSTween = new KSTween(box, "x", 300, 0, "5s", "0.5s", Cubic.easeInOut);
var tweenY:KSTween = new KSTween(box, "y", 300, 0, "3s", "1.5s", Cubic.easeInOut);
var tweenR:KSTween = new KSTween(box, "rotation", 360, 0, "7s", 0, Cubic.easeInOut);
new KSParallelGroup( tweenX, tweenY, tweenR ).start();
}
]]>
</mx:Script>
</mx:Application>Links |
Sign in to add a comment