チェンジセット 536

差分発生行の前後
無視リスト:
コミット日時:
2008/05/28 01:02:22 (6 ヶ月前)
コミッタ:
yossy
ログメッセージ:

Thread(soumen): 新仕様にアップデートした TweenerThread? と、そのサンプル

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/Thread/branches/soumen/Thread.as3proj

    r532 r536  
    1818    <class path="samples\00.hello" /> 
    1919    <class path="samples\urlloader" /> 
     20    <class path="samples\tweener" /> 
    2021  </classpaths> 
    2122  <!-- Build options --> 
     
    6566  <!-- Class files to compile (other referenced classes will automatically be included) --> 
    6667  <compileTargets> 
    67     <compile path="samples\urlloader\Sample.as" /> 
     68    <compile path="samples\tweener\Sample.as" /> 
    6869  </compileTargets> 
    6970  <!-- Paths to exclude from the Project Explorer tree --> 
  • as3/Thread/branches/soumen/src/org/libspark/thread/threads/tweener/TweenerThread.as

    r141 r536  
    1 package org.libspark.tweener 
     1/* 
     2 * ActionScript Thread Library 
     3 *  
     4 * Licensed under the MIT License 
     5 *  
     6 * Copyright (c) 2008 BeInteractive! (www.be-interactive.org) and 
     7 *                    Spark project  (www.libspark.org) 
     8 *  
     9 * Permission is hereby granted, free of charge, to any person obtaining a copy 
     10 * of this software and associated documentation files (the "Software"), to deal 
     11 * in the Software without restriction, including without limitation the rights 
     12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     13 * copies of the Software, and to permit persons to whom the Software is 
     14 * furnished to do so, subject to the following conditions: 
     15 *  
     16 * The above copyright notice and this permission notice shall be included in 
     17 * all copies or substantial portions of the Software. 
     18 *  
     19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     25 * THE SOFTWARE. 
     26 *  
     27 */ 
     28package org.libspark.thread.threads.tweener 
    229{ 
    330        import caurina.transitions.Tweener; 
    431        import flash.display.DisplayObject; 
     32        import org.libspark.thread.IMonitor; 
     33        import org.libspark.thread.Monitor; 
    534        import org.libspark.thread.Thread; 
    635 
     36        /** 
     37         * @author      yossy:beinteractive 
     38         */ 
    739        public class TweenerThread extends Thread 
    840        { 
     
    1143                        _target = target; 
    1244                        _args = args; 
     45                        _monitor = new Monitor(); 
    1346                         
    1447                        args.onComplete = completeHandler; 
     
    1750                private var _target:Object; 
    1851                private var _args:Object; 
     52                private var _monitor:IMonitor; 
    1953                 
    20                 protected override function initialize():void 
     54                override protected function run():void 
    2155                { 
    2256                        if ('show' in _args && _args.show) { 
     
    3367                        Tweener.addTween(_target, _args); 
    3468                         
    35                         wait(); 
     69                        waitTween(); 
    3670                } 
    3771                 
    38                 protected override function execute():void 
     72                private function waitTween():void 
    3973                { 
    40                         terminate(); 
     74                        _monitor.wait(); 
     75                        // TODO: 割り込み処理。今は無視 
     76                        interrupted(waitTween); 
    4177                } 
    4278                 
     
    5490                        } 
    5591                         
    56                         notifyAll(); 
    57                 } 
    58                  
    59                 public override function toString():String 
    60                 { 
    61                         return '[Tweener]'; 
     92                        _monitor.notifyAll(); 
    6293                } 
    6394        }