root/as3/Chain/samples/ChainTest.as

リビジョン 221, 1.8 kB (コミッタ: munegon, コミット時期: 4 年 前)

--

Line 
1 package {
2         import com.voidelement.chain.Chain;
3        
4         import flash.display.DisplayObjectContainer;
5         import flash.events.MouseEvent;
6        
7         public class ChainTest {
8                 public function ChainTest( base:DisplayObjectContainer ) {
9                         Chain.wait(1).
10                         next( function():Chain {
11                                 trace("elapsed: " + this.data );
12                                 trace("wait start: 3000ms");
13                                 return Chain.wait( 3 ).execute();
14                         }).
15                         log("wait end").
16                         next( function():void {
17                                 trace("elapsed: " + this.data + "ms");
18                         }).
19                         loop( 3, function():Chain {
20                                 trace("loop: " + this.data );
21                                 return Chain.loop( 5, function():void {
22                                         trace("subloop: " + this.data );
23                                 }).
24                                 wait(1);
25                         }).
26                         load( { text:"http://twitter.com/", onStart:"load text: start", onComplete:"load text: complete"} ).
27                         parallel({
28                                 wait: { time:2, onStart:"wait: start", onComplete:"wait: complete"},
29                                 image: { delay:2, img:"http://s3.amazonaws.com/twitter_production/profile_images/40481852/mycat0_normal.jpg", onStart:"load image start", onComplete:"load image complete"},
30                                 binary: { binary:"3000.jpg", onStart:"load binary: start", onComplete:"load binary: complete"}
31                         }).
32                         next( function():void {
33                                 trace("elapsed: " + this.data.wait );
34                                 trace("image size: " + this.data.image.contentLoaderInfo.width + "x" + this.data.image.contentLoaderInfo.height );
35                                 trace("binary length: " + this.data.binary.bytesAvailable );
36                                
37                                 this.data.image.scaleX = this.data.image.scaleY = 10;
38                                 base.addChild( this.data.image );
39                                 base.alpha = 0;
40                         }).
41                         tweener( base, { alpha:1, time:1, transition:"linear"} ).
42                         log("wait click").
43                         listen( base, MouseEvent.CLICK ).
44                         next( function():void {
45                                 trace("click: " + this.data.localX + ", " + this.data.localY );
46                         }).
47                         tweener( base, { alpha:0, time:1, transition:"linear"} ).
48                         log("tween end");
49                 }
50         }
51 }
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。