Category: ‘Flex’

Flex ブラウザのスクロールバーの表示制御

2014年9月4日 Posted by PURGE

覚え書き。

index.template.html CSSのbody width 記述を変更

<style type="text/css" media="screen">
    html, body  { height:100%; width:1232px;}
    body { margin:0; padding:0; 
           overflow:auto;
           text-align:center; 
           background-color: ${bgcolor}; 
           object:focus { outline:none; }
           #flashContent { display:none;}
</style>

表示制御をする場合。

    overflow:visible
    overflow:scroll
    overflow:hidden
    overflow:auto

※但しIEの場合、overflow:scrollに設定するとスクロールバーが2重になって表示される場合がある。

2014年4月11日 Posted by PURGE

久しぶりのFlexネタ。覚え書き。
下記のようなレイアウトをしたい場合、結構それぞれのコンポーネントの属性の設定の仕方を忘れる。

layout

	<s:Group width="100%">
		<s:HGroup>
			<s:Button label="A"/>
			<s:Button label="B"/>
		</s:HGroup>
		<s:HGroup right="10">
			<s:Button label="C"/>
			<s:Button label="D"/>
		</s:HGroup>
	</s:Group>

eclipse のコンソールで日本語の文字化け

2014年3月1日 Posted by PURGE

eclipse インストールフォルダにある eclipse.ini に下記を記述する。

-Dfile.encoding=UTF-8

解決。

Flex改行コード

2013年10月18日 Posted by PURGE

asファイル内での改行コード


\r\n

MXMLファイル内での改行コード


& # 13;

PureMVC for AS3

2013年6月23日 Posted by PURGE

元々Flexエンジニアだったので、PureMVCには以前から興味があったのだが、以前は時間の問題から諦めていた。PureMVCの本家サイトの情報も中々難解で、正直MVCの構造は理解できるのだが、フレームワークとしての定番の記述がよくわからず、具体的に記述でかなり迷っていた。

そこで改めてソースコードを整理してみた。但し、私のプログラムの記述が合っているとは思わないでほしい。

Main.mxml

  <s:WindowedApplication applicationComplete="facade.startup(this)">
  <fx:Script>
  <![CDATA[
    import com.whoocus.flex.ApplicationFacade;
    import mx.events.FlexEvent;
    // Initialize the PureMVC Facade
    private var facade:ApplicationFacade = ApplicationFacade.getInstance();			
  ]]>
  </fx:Script>

簡単に言うと、ApplicationFacadeのシングルトンクラスを呼び出す。
そのfacadeクラスのstartupメソッドででアプリをMainを登録して初期化処理が始まる。

ApplicationFacade.as

public class ApplicationFacade extends Facade
{
  /**
  * シングルトンのインスタンス生成取得メソッド
  */
  public static function getInstance( ) : ApplicationFacade 
  {
    if ( instance == null ) instance = new ApplicationFacade();
      return instance as ApplicationFacade;
    }
  /**
   * PureMVC アプリケーションのスタートアップメソッド 
   */
  public function startup( app:Main ):void
  {
    registerCommand( AppConstants.STARTUP, StartupCommand);
    sendNotification( AppConstants.STARTUP, app );
  }
}

startupメソッドのregisterCommandで、コマンドクラスを登録しsendoNotification通知を送信する。

StartupCommand.as

public class StartupCommand extends MacroCommand
{	
  override protected function initializeMacroCommand():void
  {
    addSubCommand(PrepareControllerCommand);
    addSubCommand(PrepareModelCommand);
    addSubCommand(PrepareViewCommand);
  }
}

StartupCommand内では、とりあえずcontroller/model/view の単位で登録するコマンドを小分けしている。

PrepareControllerCommand.as

public class PrepareControllerCommand extends SimpleCommand
{
  /**
   * Command登録処理
   */ 
  override public function execute(notification:INotification):void
  {
    //Command登録処理
    facade.registerCommand(AppConstants.HELLO, HelloCommand);
  }
}

PrepareControllerCommand.as

public class PrepareModelCommand extends SimpleCommand
{
  /**
   * Proxy登録処理
   */ 
  override public function execute(notification:INotification):void
  {
    //Proxy登録処理
    facade.registerProxy(helloProxy);
  }
}

PrepareViewCommand.as

public class PrepareControllerCommand extends SimpleCommand
{
  /**
   * Mediator登録処理
   */ 
  override public function execute(notification:INotification):void
  {
    //Mediator登録処理
    facade.registerMediator(new ApplicationMediator(app));
    facade.registerMediator(new HelloMediator(app.greeting));
  }
}

Flash Player の旧バージョン

2011年12月8日 Posted by PURGE

WindowsXP + IE7 で Flash Player11 が動作しないことがあった。
そんな時は、旧バージョンにダウングレードすること。 11 → 10.3

別バージョンのFlash Playerはこちら

Flash Builder 4.5 プラグインバージョン

2011年8月3日 Posted by PURGE

今まで開発の都合上で、純正eclipseに対し、スタンドアロンバージョンではなく、pluginバージョンのFlexBuilderをインストールしていた。
しかし、Flash Builder4.5には何故かpluginバージョンが見当たらない。しばらくスタンドアロンバージョンを使用していたが、やはり不便。と思ったら、

C:Program FilesAdobeAdobe Flash Builder 4.5Adobe Flash Builder 4.5 お読みください.pdf

に、pluginバージョンのインストール方法が記述してありました。