ラベル ActionScript の投稿を表示しています。 すべての投稿を表示
ラベル ActionScript の投稿を表示しています。 すべての投稿を表示

2009/09/27

Flex SDK 3.4で遭遇したFocusManagerのバグ

Flex SDK 3.4でビルドするようになってからTabキーでフォーカスを移動した際に、以下のようなエラーが出る事はありませんか?
Flash Playerのデバッグ版でしか表示されないエラーなので、気付いていないかもしれません。
私はTabキーでフォーカスを移動し、画面上のコンポーネントを一周し、defaultButtonに指定したコンポーネントにフォーカスが合わさろうとした際に、このエラーに遭遇しました。
TypeError: Error #1009: null のオブジェクト参照のプロパティまたはメソッドにアクセスすることはできません。 at mx.managers::FocusManager/focusInHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\FocusManager.as:601] at flash.display::Stage/set focus() at mx.core::UITextField/setFocus()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UITextField.as:1525] at mx.controls::TextInput/setFocus()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\controls\TextInput.as:1832] at mx.managers::FocusManager/setFocus()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\FocusManager.as:553] at mx.managers::FocusManager/setFocusToComponent()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\FocusManager.as:1293] at mx.managers::FocusManager/setFocusToNextObject()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\FocusManager.as:1263] at mx.managers::FocusManager/keyFocusChangeHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\FocusManager.as:1758]
どうやらこれはFlex SDK 3.4のバグで、3.5ではFixされているようです。
バグレポートはこちらにあります(タイトルにはLiveCycleとありますがLiveCycle限定というわけではありません)。
[#SDK-21780] FocusManager RTE in defaultButton scenario. was: Navigating around LiveCycle Workspace results in an ActionScript null pointer error
https://bugs.adobe.com/jira/browse/SDK-21780

バグレポートに合った再現プログラムをシンプルにしたものがこちら。
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >
    <mx:VBox id="boo" defaultButton="{goo}" >
        <mx:Button id="goo" />
        <mx:Button id="foo" />
    </mx:VBox>
    <mx:VBox id="bee" >
        <mx:Button />
        <mx:Button />
    </mx:VBox>
    <mx:TextInput />
</mx:Application>

バグ回避コードがこちら。
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" defaultButton="{goo}" >
    <mx:VBox id="boo">
        <mx:Button id="goo" />
        <mx:Button id="foo" />
    </mx:VBox>
    <mx:VBox id="bee" >
        <mx:Button />
        <mx:Button />
    </mx:VBox>
    <mx:TextInput />
</mx:Application>
defaultButtonの指定位置が変わったことにお気付きでしょうか?
Flex SDK 3.5がリリースされるまでは、このようにして問題を回避できるようですよ。
私の環境ではこの手段で回避できました。
類似の現象に遭遇した方、ご確認ください。

2009/08/29

Flash Player 10.0.30.18のインストールがスムーズに(Chrome限定)

Flash Player 10.0.30.18をWindows Vista + Google Chrome環境にインストールした際に、何か違和感があったのですが、その時にはそれが何なのか気付いていませんでした。

下記の件について調べるために、Flash Player 10 リリースノートを見ていて、違和感がなんだったのかわかりました。

FlexのテキストコントロールにIMEでインライン入力不可 〜経過2〜
http://blog.air-life.net/2009/08/flash-player-10-ime.html

Flash Player 10 Release Notes
http://www.adobe.com/support/documentation/en/flashplayer/10/Flash_Player_10_Release_Notes.pdf

リリースノートの9/14ページに修正点の1つとして記載されているのですが、Google Chromeでは、Flash Playerのインストール時にブラウザのプロセスを終了させておく必要がなくなったのです。
小さいけど、ステキな改善!インストールがこれでさらに楽になりましたね。
こういった小さな改善をコツコツと続けてもらえると応援を続けたくなります。
Google Chrome で、ブラウザーを閉じることなくプラグインをインストールできるように、プラグインインスト ーラーを拡張します。(2310185)
Fixと言えば、wmode="transparent"を指定した際に日本語入力ができなくなってしまう下記の問題解決を強く強く望んでいます。

Cannot type non-English/foreign characters in Flex app when wmode set to 'opaque' or 'transparent'
http://bugs.adobe.com/jira/browse/FP-1877

2009/08/28

FlexのテキストコントロールにIMEでインライン入力不可 〜経過2〜

Windows Vista, XP + Flash Player 10環境で、FlexのTextInput, TextArea, ComboBox(editable), RichTextEditorコントロールにIMEによる日本語入力でインライン入力ができない現象に遭遇していたんだけれど、Flash Player 10.0.30.18で一部Fixされていました。
Flexではなく、Flash Playerの問題だったらしくJIRAで経過をチェックできず、気付くのが遅れました。

なお、この問題の再現方法としては2つありまして、修正されていることに気がついたのは下記のケース2に関してです。
ケース1はまだFixされていないようですので、チェックを継続していきます。

ケース1
テキストコントロール、またはその親コンテナのプロパティalphaに1未満の値、例えば0.99を設定し、Flash Player 10以降をターゲットとしてビルドした場合。

ケース2
テキストコントロールのプロパティwidthに親コンテナより大きな値を設定し、Flash Player 10以降をターゲットとしてビルドした場合。

FlexのテキストコントロールにIMEでインライン入力不可
http://blog.air-life.net/2008/12/ime.html

FlexのテキストコントロールにIMEでインライン入力不可 〜その2〜
http://blog.air-life.net/2008/12/flexime-2.html

FlexのテキストコントロールにIMEでインライン入力不可 〜経過1〜
http://blog.air-life.net/2009/01/flexime-1.html

2009/07/09

Wonderflっぽい? Flash MiniBuilder - Online AS3 IDE

Web上でActionScriptを書いてビルド、実行ができるオープンソースのツールみっけ。
実行するためには、Flash Player 10とJavaが必要です。

バイナリをこちらに配置してみました。
http://f.air-life.net/apps/FlashMiniBuilder/

Flash MiniBuilder: Online AS3 IDE - Part I
http://www.victordramba.com/?p=31

こちらのページ最下部でバイナリ(MiniBuilder-web-0.0.1.rar)を配布中です。
Flash MiniBuilder: Online AS3 IDE - Part II - Install it!
http://www.victordramba.com/?p=33

個人用のWonderflみたいな感じ?

2009/06/11

FlexUnit 4 - Testメタデータ

前回の「FlexUnit 4 - 進化したJUnit4ライクな単体テストフレームワーク」に引き続き、「Major New Features of FlexUnit 4」をベースに話を進めていきます。

Major New Features of FlexUnit 4
http://opensource.adobe.com/wiki/display/flexunit/FlexUnit+4+feature+overview

1. Testメタデータ
FlexUnit 4では新たにTestメタデータが提供されていて、テストメソッドにマーカーとして付ける。
以前のバージョンまでは、テストケースはTestCaseクラスを継承したクラスとして作り、さらにテストメソッドにはtestMax, testMinのようにtestというprefixが必要だったが、FlexUnit 4から不要になった。

比較のため、FlexUnit 0.9、JUnit4、FlexUnit 4の簡単なサンプルテストケースを紹介する。
このケースでは、最大値max、最小値minを求める計算をテストしている。

FlexUnit 0.9
package net.air_life
{
import flexunit.framework.*;

public class SampleTest extends TestCase
{
public function testMax():void
{
assertEquals(100, Math.max(0, 100));
}

public function testMin():void
{
assertEquals(0, Math.min(0, 100));
}
}
}

JUnit4
package net.air_life;

import static org.junit.Assert.*;
import org.junit.*;

public class MathTest {
@Test
public void max() {
assertEquals(100, Math.max(0, 100));
}

@Test
public void min() {
assertEquals(0, Math.min(0, 100));
}
}


FlexUnit 4
package net.air_life
{
import org.flexunit.Assert;

public class MathTest
{
[Test]
public function max():void
{
Assert.assertEquals(100, Math.max(0, 100));
}

[Test]
public function min():void
{
Assert.assertEquals(0, Math.min(0, 100));
}
}
}

このように、FlexUnit 4からはTestCaseクラスの継承、prefix(test)が不要になりJUnit4に本当にそっくりになってきた。

次回に続く...

2. Before, Afterメタデータ
3. BeforeClass, AfterClassメタデータ
4. 例外ハンドリング
5. Ignoreメタデータ
6. async
7. Hamcrest
8. Suiteメタデータ
9. ユーザー定義メタデータパラメータ
10. Theory, Datapoints, Assumptionsメタデータ
11. RunWithメタデータ
12. アダプタ
13. ユーザーインターフェースファサード



FlexUnit 4 - 進化したJUnit4ライクな単体テストフレームワーク
http://blog.air-life.net/2009/06/flexunit-4-unit-testing-framework-for.html

2009/06/09

FlexUnit 4 - 進化したJUnit4ライクな単体テストフレームワーク

FlexUnit 4 beta 1.0が公開され、正式リリースが近そうなので、今回から数回に分けてFlexUnit 4を紹介していきます。

FlexUnitはFlexやActionScript 3(AS3)で作られたアプリケーションやライブラリの単体テストを実装するためのJUnit4ライクなフレームワークです。

現在、Adobe Open Sourceで公開されています。
http://opensource.adobe.com/wiki/display/flexunit/FlexUnit

Flex、ActionScriptの単体テストフレームワークにはFlexUnit以外にもいくつか存在していますので、FlexUnitの前に、FluintとAS3Unitを簡単に紹介しましょう。

Fluint
http://code.google.com/p/fluint/

Digital Primates社製(現在はOSS)の単体テストフレームワーク。
以前はdpUInt(Digital Primates Unit and Integration)という名前でした。
非同期処理のテスト、Cairngormのテスト、CI等が可能な点が特徴です。

FlexUnit 4にはその一部(org.fluint.sequenseパッケージ, org.fluint.uiImpersonationパッケージ)が取り込まれています。
ライセンスはMIT Licenseで公開されています。

AS3Unit
http://www.libspark.org/wiki/yossy/AS3Unit

Spark projectが公開している国産の単体テストフレームワーク。
JUnit4の移植で、テストケースがPOJOによる実装が可能な点が特徴です。(AS3だから、POJOじゃなくてPOAO??こんな言葉ないですね・・)
ライセンスはApache License Version 2.0で公開されています。

ここからはFlexUnitに話を戻しましょう。
これまでFlexUnitはバージョン0.9が最新だったのですが、先月、メジャーバージョンアップを遂げて、FlexUnit 4 beta 1.0まで今のところリリースされています。

2009/05/04 FlexUnit 4 alpha 1.0
2009/05/11 FlexUnit 4 alpha 2.0
2009/05/18 FlexUnit 4 beta 1.0

FlexUnitは0.9から4へとバージョンアップしたことで、いくつか大きな機能追加があるので、まずはそれらを紹介していきましょう。
「Major New Features of FlexUnit 4」をベースに進めていきます。

Major New Features of FlexUnit 4
http://opensource.adobe.com/wiki/display/flexunit/FlexUnit+4+feature+overview

FlexUnit 4はJUnit 4ライクになっていますので、Javaエンジニアに分かりやすくするため、JUnit 4の単体テストコードと比較しながら説明していきます。

1. Testメタデータ
2. Before, Afterメタデータ
3. BeforeClass, AfterClassメタデータ
4. 例外ハンドリング
5. Ignoreメタデータ
6. async
7. Hamcrest
8. Suiteメタデータ
9. ユーザー定義メタデータパラメータ
10. Theory, Datapoints, Assumptionsメタデータ
11. RunWithメタデータ
12. アダプタ
13. ユーザーインターフェースファサード


次回へ続く。


FlexUnit 4 - Testメタデータ
http://blog.air-life.net/2009/06/flexunit-4-test-metadata.html

2009/05/24

twitterアカウントまとめ - ActionScript, Flex, AIRのフレームワーク関連

Mate FrameworkやHydra Frameworkのサイトを訪れると「Follow us on Twitter」のリンクを見かけたので、他にも興味のあるフレームワークがtwitterアカウントを持っていないか調べてみました。

今は新バージョンのリリース告知等をtwitterでも行うからアカウントを取得しているところが多いんですね。

Flash Platform
http://twitter.com/Flash_Platform

Flex Framework
http://twitter.com/flex

AIR
http://twitter.com/air

Degrafa
http://twitter.com/degrafa

Spring ActionScript
http://twitter.com/springas

PureMVC
http://twitter.com/puremvc

Mate Framework
http://twitter.com/MateFramework

Gaia Framework
http://twitter.com/gaiaframework

Hydra Framework
http://twitter.com/HydraFramework

Hydra MVC
http://twitter.com/HydraMVC

FlexUnit
http://twitter.com/FlexUnit

Adobeanのtwitterリスト
http://blog.air-life.net/2009/02/adobeantwitter.html

2009/05/01

AS3, Flex最適化テクニック&プラクティス総まとめ

InsideRIAで公開されていたSean Moore氏による記事「Round up of ActionScript 3.0 and Flex optimization techniques and practices」をだいぶ適当に訳してみた。

Round up of ActionScript 3.0 and Flex optimization techniques and practices
http://www.insideria.com/2009/04/51-actionscript-30-and-flex-op.html


AS3, Flex最適化テクニック&プラクティス総まとめ
1. Avoid the new operator when creating Arrays
Arrayを生成する際に、new演算子の使用は避ける。
var a = []; 

悪い例:
var a = new Array();


2. Arrays are expensive to create, do so conservatively
Arrayの生成コストは高いので、控える。
var vanityCollection01 : Array = new Array(); 
var vanityCollection02 : Array = new Array();
var vanityCollection03 : Array = new Array();
var vanityCollection04 : Array = new Array();


3. Fastest way to copy an array:
Arrayをコピーする最速の方法。
var copy : Array = sourceArray.concat(); 


4. Setting values in Arrays is slow
Arrayへの値の設定は遅い。
employees.push( employee ); 
employees[2] = employee;


5. Getting values from Arrays is twice as fast as setting
Arrayから値を取得するのは設定より2倍ほど速い。
var employee : Employee = employees[2]


6. Use static for properties methods that do not require an object instance
インスタンスを必要としないプロパティ、メソッドにはstaticを使う。
StringUtils.trim( "text with space at end " ); 
Class definition:
package
{
public final class StringUtils
{
public static function trim( s : String ) : String
{
var trimmed : String;
// implementation...
return trimmed;
}
}
}


7. Use const for properties that will never change throughout the lifecycle of the application
アプリケーションのライフサイクルを通して、変更の無いプロパティにはconstを使う。
public const APPLICATION_PUBLISHER : String = "Company, Inc."; 


8. Use final when no subclasses need to be created of a class
サブクラスを作成する必要がないクラスにはfinalを使う。
public final class StringUtils 


9. Length of method/variable names doesn't matter in ActionScript 3.0 (true in other langs)
メソッド名/変数名の長さはActionScript 3.0では問題にはならない。
someCrazyLongMethodNameDoesntReallyImpactPerformanceTooMuch(); 


10. One line assignments DO NOT buy any performance (true in other langs)
代入を1行にまとめたところでパフォーマンスは向上しない。
var i=0; j=10; k=200; 


11. No difference in memory usage between an if statement and a switch statement
if文とswitch文では、メモリ使用量に差はない。
if ( condition ) 
{
// handle condition
}

まったく同じ:
switch ( condition ) 
{
case "A":
// logic to handle case A
break;

case "B":
// logic to handle case B
break;
}


12. Rank your if statements in order of comparisons most likely to be true
if文の条件はtrueとなる可能性の高い順に並べる。
if ( conditionThatHappensAlot ) 
{
// logic to handle frequently met condition
}
else if ( conditionThatHappensSomtimes )
{
// handle the case that happens occaisonally
}
else
{
// handle the case that doesn’t happen that often
}


13. AVM promotes int to Number during calculations inside loops
(VM has been changing, from 9 to 10, so int, uint and number conversions aren't as slow as they used to be.)
AVMはループ内での計算中にintをNumberに変換する。(VMが9から10に代わって、int, uint, Numberの変換はそれほど遅くはなくなった。)

14. Resolve issues of promotion, unknown, or incorrect object types
変換、未知の型、不正な型の問題を解決すること

15. Use uint sparingly, it can be slow (VM has been changing, from 9 to 10, so int, uint and number conversions aren't as slow as they used to be.)
uintは慎重に使う。注意しないと遅くなることがある。(VMが9から10に代わって、int, uint, Numberの変換はそれほど遅くはなくなった。)
var footerHex : uint = 0x00ccff; 


16. Use integers for iterations
反復の判定にはintを使う。
(var i: int = 0; i < n; i++) NOT for (var i: Number = 0; i < n; i++) 


17. Don't use int with decimals
少数値を扱うためにintを使わない。
var decimal : Number  = 14.654; 

悪い例:
var decimal : int  = 14.654; 


18. Multiply vs. Divide: instead of 5000/1000 use: 5000*0.001
乗算 vs 除算: 5000/1000の代わりに、5000*0.001を使う。

19. Locally store function values in for and while statements instead of repeatedly accessing them
for、while内で繰り返し計算させるよりも、ループ外でローカル変数に入れておき、それを使用する。
for (..){ a * 180 / Math.PI; }  
declare: toRadians = a*180/Math.PI; outside of the loop


20. Avoid calculations and method calls in loops
ループの中で計算やメソッド呼び出しをしない。
var len : int = myArray.lengh;  
for (var i=0;i<len;i++){ }

悪い例:
for (var i=0;i< myArray.lengh;i++){ } 


21. Use RegEx for validation, use string methods for searching
バリデーションにはRegEx(正規表現)を使い、検索にはStringのメソッドを使う。
// postal code validation example using regular expressions 
private var regEx:RegExp = /^[A-Z][0-9][A-Z] [0-9][A-Z][0-9]$/i;
private function validatePostal( event : Event ) : void
{
if( regEx.test( zipTextInput.text ) )
{
// handle invalid input case
}
}

// search a string using String methods
var string : String = "Search me";
var searchIndex : int = string.indexOf( "me" );
var search : String = string.substring( searchIndex, searchIndex + 2 );


22. Reuse objects to maintain a “memory plateau” DisplayObjects, URLLoader objects
メモリ使用量を抑えるために、DisplayObject、URLLoaderオブジェクトは再利用する。

23. Follow the Flex component model:
Flexのコンポーネントモデルに従う。
createChildren(); 
commitProperties();
updateDisplayList();


24. Only use Datagrids as a last resort (make sure you can’t implement in a regular List first)
DataGridは最後の手段として使う。(まずは通常のListで実現できないか確かめる)

25. Avoid Repeaters for scrollable data
スクロールデータにRepeaterの使用は避ける。

26. Avoid the setStyle() method (One of the most expensive calls in the Flex framework)
setStyle()メソッドの使用は避ける。(setStyle()メソッドはFlexフレームワークの中で高コストな呼び出しの一つ)

27. Using too many containers dramatically reduces the performance of your application
使用するコンテナが多過ぎるとパフォーマンスが著しく低下する恐れがある。
<mx:Panel> 
<mx:VBox>
<mx:HBox>
<mx:Label text="Label 1" />
<mx:VBox>
<mx:Label text="Label 2" />
</mx:VBox>
<mx:HBox>
<mx:Label text="Label 3" />
<mx:VBox>
<mx:Label text="Label 4" />
</mx:VBox>
</mx:HBox>
</mx:HBox>
</mx:VBox>
</mx:Panel>


28. You do not need to always use a container tag as the top-level tag of components Totally valid component, no top level container needed:
コンポーネントのトップレベルに、常にコンテナを使う必要はない。
<mx:Image xmlns:mx="http://www.adobe.com/2006/mxml"  
source="avatar.jpg" width="200" height="200" />


29. Remove unnecessary container wrappers to reduce container nesting
コンテナのネストを減らし、不必要なコンテナを削除する。

30. Avoid: The VBox container inside an tag, (eliminates redundancy)
コンテナタグ内の無駄なVBoxの使用は避ける。
<mx:Panel> 
<mx:Label text="Label 1" />
<mx:Label text="Label 2" />
</mx:Panel>
<mx:Panel>
<mx:VBox>
<mx:Label text="Label 1" />
<mx:Label text="Label 2" />
</mx:VBox>
</mx:Panel>


31. Avoid: VBox container inside an mx:Application tag, (eliminates redundancy)
mx:Applicationタグ内の無駄なVBoxの使用は避ける。
<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx=http://www.adobe.com/2006/mxml>
<mx:Label text="Label 1" />
<mx:Label text="Label 2" />
</mx:Application>

悪い例:
<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx=http://www.adobe.com/2006/mxml>
<mx:VBox>
<mx:Label text="Label 1" />
<mx:Label text="Label 2" />
</mx:VBox>
</mx:Application>


32. Set the recycleChildren property to true to improve a Repeater object's performance (re-uses previously created children instead of creating new ones)
Repeaterオブジェクトのパフォーマンス向上のため、recycleChildrenプロパティにtrueを設定する。(新しいRepeater対象オブジェクトを生成する代わりに、前に生成されたオブジェクトを再利用する)
<mx:Script> 
<![CDATA[
[Bindable]
public var repeaterData : Array = ["data 1", "data 2"];
]]>
</mx:Script>

<mx:Repeater id="repeater" dataProvider="{repeaterData}">
<mx:Label text="data item: {repeater.currentItem}"/>
</mx:Repeater>


33. Keep framerate set at 60 fps or lower
フレームレートは60fpsかそれ以下にする。
<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
frameRate="45">
</mx:Application>


34. Avoid multiple display manipulations per frame
フレーム毎に複数の表示操作を行うのは避ける。

35. Code against ENTER_FRAME events instead of Timer events
Timerイベントの代わりに、ENTER_FRAMEイベントを使う。
public function onEnterFrame( event : Event ) : void 
{
}
private function init() : void
{
addEventListener( Event.ENTER_FRAME, onEnterFrame );
}

悪い例:
public function onTimerTick( event : Event ) : void 
{
}
private function init() : void
{
var timer : Timer = new Timer();
timer.start();
timer.addEventListener( TimerEvent.TIMER, onTimerTick );
}


36. To defer object creation over multiple frames use:
複数フレームに及ぶオブジェクト生成を遅らせる際に、"queued"を指定する:
<mx:Container creationPolicy="queued"/>


37. Alpha = 0 is not the same as visible = false (Objects marked invisible are passed over)
Alpha = 0は visible = falseと同等ではない。(非表示マークが付けられることではない)
loginButton.visible = false;

悪い例:
loginButton.alpha = 0; 


ここに挙げた以外にFlex/AIR, ActionScriptのパフォーマンス最適化についてまとめられている記事がいくつかあるのでリストしておきます。
Flex アプリケーションのパフォーマンス : クライアントアプリケーションのパフォーマンスチューンアップテクニック集
http://www.adobe.com/jp/devnet/flex/articles/client_perf.html

ActionScript 3.0におけるパフォーマンス向上のヒント
http://www.adobe.com/jp/devnet/flash/articles/ac3_performance.html

「Round up of ActionScript 3.0 and Flex optimization techniques and practices」記事の参照元
Sean Christmann: Optimizing Adobe AIR for Code Execution, Memory, and Rendering
http://www.craftymind.com/2008/11/20/max-2008-session-material/

Dennis Ippel: Some ActionScript 3.0 Optimizations
http://www.rozengain.com/blog/2007/05/01/some-actionscript-30-optimizations/

Shane McCartney: Tips on how to write efficient AS3
http://www.lostinactionscript.com/blog/index.php/2008/09/28/tips-on-how-to-write-efficient-as3/

Flex Application Performance: Tips and Techniques for Improving Client Application Performance
http://www.adobe.com/devnet/flex/articles/client_perf.html

Stephen Calender: ActionScript 3.0 Benchmarking
http://www.stephencalenderblog.com/?p=7

Grant Skinner: Types in AS3: ints not so fast, uints slow!
http://www.gskinner.com/blog/archives/2006/06/types_in_as3_in.html

Grant Skinner: Resource management strategies in Flash Player 9
http://www.adobe.com/devnet/flashplayer/articles/resource_management.html

Gary Grossman: ActionScript 3.0 and AVM2 Performance Tuning
http://www.onflex.org/ACDS/AS3TuningInsideAVM2JIT.pdf

Fastest way to copy an array
http://agit8.turbulent.ca/bwp/2008/08/04/flash-as3-optimization-fastest-way-to-copy-an-array/

Andre Michelle: AS3 optimations & suggestions
http://blog.andre-michelle.com/2005/as3-optimations-suggestions/

Package-level function closures in ActionScript
http://www.ericfeminella.com/blog/2008/05/06/package-level-function-closures-in-actionscript/

ActionScript 3 optimization techniques
http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/

AS3 Performance Tester
http://businessintelligence.me/projects/performance_tester/performanceTester.html

2009/04/29

AS2 to AS3 - ActionScript 3 migration cookbook

Adobe Developer Connectionにて、「ActionScript 3 migration cookbook」が公開されていました。

Migrating to ActionScript 3
http://www.adobe.com/devnet/actionscript/migration.html

ActionScript 3 migration cookbook
http://www.adobe.com/devnet/actionscript/articles/as3_migration_cookbook/as3_migration_cookbook.pdf

ActionScript 3から入った私のような人には必須ではないのですが、15分弱くらいで読める分量なのでさらっと目を通してみてはいかがでしょう?

2009/02/18

Flexの嫌みなやつ - Smartypants

Adobe Developer Connectionに下記のDI(Dependency Injection)ネタでSwizやPrana(Spring ActionScript)と一緒に紹介されていたSmartypants、この名前は知りませんでした。
SwizやSpring ActionScriptはSpringを参考にされているようだが、一方、SmartypantsはGoogle Guiceを参考にされているようです。

Flex Dependency Injection
http://www.adobe.com/devnet/flex/articles/dependency_injection.html

Smartypants
http://code.google.com/p/smartypants-ioc/

2009/02/15

HTTPStatusEventのstatusについて一言

詳説ActionScript 3.0を読んでいて、以前FlexでHTTPStatusEventのstatusを使いエラー有無を判別しようとして、とても残念な気持ちになったことを思い出した。

事実上、FlexではHTTPStatusEventは使い物にならないのだ。
その理由はリファレンスガイドを読むとわかるのだけど、ほとんどのブラウザではstatusは常に0になってしまうから。

HTTPStatusEvent - status
Flash Player または AIR がサーバーからステータスコードを取得できなかった場合、またはサーバーと通信できなかった場合、記述したコードにデフォルト値の 0 が渡されます。値 0 は、どのプレーヤーでも生成される可能性があります (例えば、正しくない形式の URL が要求された場合など)。また、特定のブラウザで実行される Flash Player プラグインでは、HTTP ステータスコードをプレーヤーに渡すことができないので、常に値 0 が生成されます。該当するブラウザには、Netscape、Mozilla、Safari、Opera および Internet Explorer for the Macintosh があります。

この記述の最後のところを見ると…。
該当するブラウザには、Netscape、Mozilla、Safari、Opera および Internet Explorer for the Macintosh があります。

つまり、Windows上のInternet Explorer以外はダメなんじゃ?
要件でそこまでブラウザを限定できるのならかまわないけど、それは厳しいだろうと思う。

HTTPStatusEventはAIR用だと考えておくことにする。


同じ残念な思いをした方が他にもいた。
http://d.hatena.ne.jp/funnystone/20071018/1192696222

2009/02/10

Server-Side JavaScript/ActionScript

Server-Side ActionScriptがAdobe MAX 2009で紹介されていて、「サーバーサイドもActionScriptで書けるんだぜー!」という感じのデモがされてました。
Tomcat上でActionScriptにより作られたHelloWorldが動いてて、スゲーと思ったものです。

クライアントサイド(Flex)はActionScriptで書いて、サーバーサイドはJavaで書いてってやってると、ついつい両方が混じってしまって、varつけ忘れたり、functionつけ忘れたり、型を変数の前に書いたり、よくFlex Builderにコンパイルエラーで叱られてしまいます。

クライアントサイドもサーバーサイドも同じ言語で書けると、確かにこういうイライラはなくなるのでしょうけど、言語仕様上の向き不向きってのもあると思います。
ActionScriptでマルチスレッドのコードが書けなかったりとか。
HelloWorld程度であれば、そんなことは意識しなくてもイイのでしょうけど。

そんなサーバーサイドのお話ですが、Server-Side JavaScript(ServerJS)というのがあるようですね。
Googleグループでは活発に様々な議論がなされています。
現時点のメンバー数260名、ディスカッションのメッセージ数は1月325件、2月現時点で609件です。
2月ってまだ10日ですけど?
もう追えません・・・。

2009/01/22

Spring ActionScript 0.7リリースですって

Spring ActionScript 0.7 Released
http://www.herrodius.com/blog/160

個人的にはSpring ActionScriptから分離した、as3reflectが使えそう。
as3reflect
http://code.google.com/p/as3reflect/

この2つを便利に使えるようにしてる印象。

import flash.utils.describeType;
import flash.utils.getDefinitionByName;

2008/12/12

Spring ActionScript - Prana 作者による紹介

Prana goes Spring - Introducing Spring ActionScriptと題したスライド資料を作者がブログで公開してくれてます。

Spring ActionScript at FlexCamp 2008 Belgium
http://www.herrodius.com/blog/158

サンプルコードを用いて紹介してくれているので、どんなもんかわかりやすいかと。

2008/12/10

AdobeとSpringSourceの蜜月、そしてPranaは変化

BlazeDSとの統合を目的としたSpring BlazeDS Integrationの開発が進められるらしい。

米AdobeとSpringSource、エンタープライズ向けJava RIAで提携
http://www.itmedia.co.jp/enterprise/articles/0812/09/news104.html

それとPrana frameworkがSpring ActionScriptに変わるようだ。
SpringOne Brings a New Tomcat Server, VMware Partnership, and ActionScript Offerings
http://www.infoq.com/news/2008/12/springone-2008
Spring/Adobe - The Spring ecosystem continued to broaden at SpringOne with two key Flex related announcements. The Prana framework was officially renamed Spring Actionscript. As part of the move the project gains official SpringFramework.org forums, JIRA access, and Fisheye integration. SpringSource also announced a partnership with Adobe integrating Spring with BlazeDS:

こちらはPranaの日本語紹介記事。
ActionScript 3 を使ったアプリケーション開発をサポートする Prana フレームワーク
http://www.infoq.com/jp/news/2008/11/prana-framework-actionscript-3