Flashパブリッシュ設定「スクリプトの制限時間」をSWFメタタグで指定

by dkgkAs forked from scriptTimeLimit? (diff: 24)
メタデータタグSWF scriptTimeLimit を試す。
参考URL http://maglog.jp/lightbox/Article459511.html

効いてない?

Flash IDEでいうところの「スクリプトの制限時間」を3秒に設定
♥0 | Line 29 | Modified 2009-11-26 16:51:37 | MIT License
play

ActionScript3 source code

/**
 * Copyright dkgkAs ( http://wonderfl.net/user/dkgkAs )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/rqSX
 */

// forked from 3pt's scriptTimeLimit?
package {
        /*
        * メタデータタグSWF scriptTimeLimit を試す。
        * 参考URL http://maglog.jp/lightbox/Article459511.html
        * 
        * 効いてない?
        *
        */
	import flash.display.Sprite;
	import flash.events.*;
	import flash.text.TextField;
	import flash.utils.Timer;
	
	[SWF(scriptTimeLimit=3)] // Flash IDEでいうところの「スクリプトの制限時間」を3秒に設定
    public class FlashTest extends Sprite {
		
         private var sampleText:TextField;
         private var count:int;
		
        public function FlashTest():void
        {
            sampleText = new TextField();
            addChild(sampleText);
            sampleText.text = "click stage";
            
            stage.addEventListener(MouseEvent.CLICK, onClick);
        }

        private function onClick(e:MouseEvent):void
        {
            sampleText.text = "start";
            // "start"が表示されて3秒後にエラーが出ると思ったけどそうはならなかった。
            // なぜだろう?
            
            var array:/*int*/Array = [];
            for (var i:int = 0; i < 10000000; i++) 
            {
                 array.push(i * i); // 無駄にループ
            }
            
            sampleText.text = "end" + array[array.length - 1];
        }
    }
}