2009-04-01から1ヶ月間の記事一覧

0以上n未満の乱数

function randomInt(n:int):int { return Math.floor(Math.random() * n); }

try~catchは負けらしい

try { hogehoge(); //エラーが発生する可能性のある処理 } catch (error:Error) { //エラーの型 エラーが発生したときに行う処理 } finally { 最後に必ず実行される処理(必要に応じて記述) }

右クリックでコンテクストメニューを非表示にした as3編

as2でコンテクストメニュー非表示、IE7の拡大縮小機能に追従させる場合は Stage.showMenu = false; Stage.scaleMode = "exactfit"; でしたが as3では同様の内容は stage.showDefaultContextMenu=false; stage.scaleMode = StageScaleMode.EXACT_FIT; と書け…

スクリーンの状態をイベントとして取得

ついでに。 import flash.events.FullScreenEvent; stage.addEventListener(FullScreenEvent.FULL_SCREEN, MyfullScreen); function MyfullScreen(event:FullScreenEvent):void{ if (event.fullScreen) { //フルスクリーンのときのメソッドはここ } else { /…

フルスクリーンにする方法

これでOK switch (stage.displayState) { case StageDisplayState.NORMAL: stage.displayState = StageDisplayState.FULL_SCREEN; // フルスクリーン break; case StageDisplayState.FULL_SCREEN: default: stage.displayState = StageDisplayState.NORMAL; …

as3でflashからJacvascriptを呼び出す

こない書けばOK(IE6はダメっぽい。。) import flash.external.ExternalInterface; MovieBtn.buttonMode = true; MovieBtn.addEventListener(MouseEvent.CLICK, hoge); function hoge(e:MouseEvent):void { ExternalInterface.call("alert", "Hello!!"); };

mc.mouseEnabledとmc.mouseChildren

AS2の mc.enabled=Boolean は、 AS3では mc.mouseEnabled、mc.mouseChildren がそれにあたるらしい。 mc.mouseEnabled=Boolean; オブジェクトがマウスメッセージを受け取るかどうかを指定 mc.mouseChildren=Boolean; そのオブジェクトのすべての子に関する m…