<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Yukun&#039;s Blog &#187; Flex</title>
	<atom:link href="http://www.yukun.info/blog/tag/flex/feed" rel="self" type="application/rss+xml" />
	<link>http://www.yukun.info</link>
	<description>難しいことは分かりやすく、簡単なことは面白く紹介</description>
	<lastBuildDate>Thu, 26 Jan 2012 03:33:59 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Flex: State、Transitionによる画面遷移 &#8211; ログイン画面</title>
		<link>http://www.yukun.info/blog/2012/01/flex-state-login-register.html</link>
		<comments>http://www.yukun.info/blog/2012/01/flex-state-login-register.html#comments</comments>
		<pubDate>Wed, 04 Jan 2012 15:00:19 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.yukun.info/?p=2117</guid>
		<description><![CDATA[FlexのStateの遷移によって表示するUIを変更することで、簡潔に画面遷移を実現する。その際のTransition効果(フェード)を付与する。今回はログインフォームを例に採り、ユーザーのログイン画面と新規登録画面の2 &#8230; <a href="http://www.yukun.info/blog/2012/01/flex-state-login-register.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2012/01/flex-state-login-register.html">Flex: State、Transitionによる画面遷移 &#8211; ログイン画面</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.yukun.info/wp-content/uploads/flex_login_state.png"><img src="http://www.yukun.info/wp-content/uploads/flex_login_state.png" alt="Flex: State、Transitionによる画面遷移 - ログイン画面" title="flex_login_state" width="267" height="177" class="alignnone size-full wp-image-2136" /></a></p>
<p>FlexのStateの遷移によって表示するUIを変更することで、簡潔に画面遷移を実現する。その際のTransition効果(フェード)を付与する。今回はログインフォームを例に採り、ユーザーのログイン画面と新規登録画面の2つの状態をStateによって切り替えるmxmlソースを下記に紹介する。</p>
<p><span id="more-2117"></span></p>
<h3>実行結果</h3>
<p>下記のリンクをご参照。</p>
<p><a href="http://www.yukun.info/labs/flex/login-sys/">ログイン・登録フォーム</a></p>
<h3>ソースコード</h3>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:Application xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
			   xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
			   xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot;
			   currentState=&quot;Login&quot;&gt;
	&lt;!-- 初期状態は&quot;Login&quot; --&gt;

	&lt;!-- 状態遷移エフェクト --&gt;
	&lt;s:transitions&gt;
		&lt;s:Transition fromState=&quot;*&quot; toState=&quot;*&quot;&gt;
			&lt;s:effect&gt;
				&lt;s:Parallel targets=&quot;{[registerLink, registerButton, loginLink, loginButton, confirm, email]}&quot;&gt;
					&lt;s:children&gt;
						&lt;s:Fade alphaFrom=&quot;0&quot; alphaTo=&quot;1&quot;/&gt;
					&lt;/s:children&gt;
				&lt;/s:Parallel&gt;
			&lt;/s:effect&gt;
		&lt;/s:Transition&gt;
	&lt;/s:transitions&gt;

	&lt;!-- 状態 --&gt;
	&lt;s:states&gt;
		&lt;s:State name=&quot;Login&quot;/&gt;
		&lt;s:State name=&quot;Register&quot;/&gt;
	&lt;/s:states&gt;
	&lt;fx:Declarations&gt;
		&lt;!-- 非ビジュアルエレメント (サービス、値オブジェクトなど) をここに配置 --&gt;
	&lt;/fx:Declarations&gt;

	&lt;!-- ログイン用パネル --&gt;
	&lt;s:Panel title=&quot;Login&quot; id=&quot;loginPanel&quot; includeIn=&quot;Login&quot; horizontalCenter=&quot;0&quot; verticalCenter=&quot;-2&quot;&gt;
		&lt;mx:Form id=&quot;loginForm&quot;&gt;
			&lt;mx:FormItem label=&quot;Username:&quot;&gt;
				&lt;s:TextInput/&gt;
			&lt;/mx:FormItem&gt;
			&lt;mx:FormItem label=&quot;Password:&quot;&gt;
				&lt;s:TextInput/&gt;
			&lt;/mx:FormItem&gt;
		&lt;/mx:Form&gt;
		&lt;s:controlBarContent&gt;
			&lt;mx:LinkButton label=&quot;Need to Register?&quot; id=&quot;registerLink&quot;
						   click=&quot;currentState=&#039;Register&#039;&quot;/&gt;
			&lt;mx:Spacer width=&quot;100%&quot; id=&quot;spacer1&quot;/&gt;
			&lt;s:Button label=&quot;Login&quot; id=&quot;loginButton&quot;/&gt;
		&lt;/s:controlBarContent&gt;
	&lt;/s:Panel&gt;

	&lt;!-- 新規登録用パネル --&gt;
	&lt;s:Panel title=&quot;Register&quot; id=&quot;registerPanel&quot; includeIn=&quot;Register&quot; horizontalCenter=&quot;0&quot; verticalCenter=&quot;-2&quot;&gt;
		&lt;mx:Form id=&quot;registerForm&quot;&gt;
			&lt;mx:FormItem label=&quot;Username:&quot;&gt;
				&lt;s:TextInput/&gt;
			&lt;/mx:FormItem&gt;
			&lt;mx:FormItem label=&quot;Password:&quot;&gt;
				&lt;s:TextInput/&gt;
			&lt;/mx:FormItem&gt;
			&lt;mx:FormItem id=&quot;confirm&quot; label=&quot;Confirm:&quot;&gt;
				&lt;s:TextInput/&gt;
			&lt;/mx:FormItem&gt;
			&lt;mx:FormItem id=&quot;email&quot; label=&quot;E-Mail:&quot;&gt;
				&lt;s:TextInput/&gt;
			&lt;/mx:FormItem&gt;
		&lt;/mx:Form&gt;
		&lt;s:controlBarContent&gt;
			&lt;mx:LinkButton label=&quot;Return to Login&quot; id=&quot;loginLink&quot;
						   click=&quot;currentState=&#039;Login&#039;&quot;/&gt;
			&lt;mx:Spacer width=&quot;100%&quot; id=&quot;spacer2&quot;/&gt;
			&lt;s:Button label=&quot;Register&quot; id=&quot;registerButton&quot;/&gt;
		&lt;/s:controlBarContent&gt;
	&lt;/s:Panel&gt;
&lt;/s:Application&gt;
</pre>
<p>※余談：<br />
フォルダを整理していたら古いFlexコードが出てきたので、この度当サイトに転記したもの。基本Tips系のコードはブログに載せてローカルには保存しないようにする予定。どうせその類のコードは一週間後には読まなくなるし、それ以降はソースの保管場所さえ忘れてしまう恐れもある為。</p>
<p>何かご質問等ありましたら、お気軽にコメントを頂ければと思います。</p>
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html" rel="bookmark" title="2008年12月17日">AIR: テキストファイルを非同期に読み込む &#8211; openAsync()、readMultiByte()</a></li>
<li><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-button.html" rel="bookmark" title="2008年10月14日">AS3でお絵かきFlashを作る (2)ボタン作成 &#8211; Flexコンポーネントの導入</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html" rel="bookmark" title="2008年12月18日">AIR: テキストファイルに書き込み &#8211; openAsync()、writeMultiByte()</a></li>
<li><a href="http://www.yukun.info/blog/2010/07/error-require-once-autoloader-php.html" rel="bookmark" title="2010年7月25日">解決例: 「ファイルから操作とエンティティを取得できません」 &#8211; Autoloader.php</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/amazocluster-bata-uncompleted.html" rel="bookmark" title="2008年12月15日">AmazoCluster: 一発で納得のいくものができればいいけれどね・・・</a></li>
</ul>
<p><!-- Similar Posts took 9.459 ms --></p>
<p><a href="http://www.yukun.info/blog/2012/01/flex-state-login-register.html">Flex: State、Transitionによる画面遷移 &#8211; ログイン画面</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2012/01/flex-state-login-register.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解決例: 「ファイルから操作とエンティティを取得できません」 &#8211; Autoloader.php</title>
		<link>http://www.yukun.info/blog/2010/07/error-require-once-autoloader-php.html</link>
		<comments>http://www.yukun.info/blog/2010/07/error-require-once-autoloader-php.html#comments</comments>
		<pubDate>Sat, 24 Jul 2010 15:00:18 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Exception]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.yukun.info/?p=1604</guid>
		<description><![CDATA[事象 Flex Builder 4でPHPとのデータコネクション設定を行う際に上図のエラーが発生。 使用したサンプルチュートリアル： connect to data &#8211; Flex Test Drive &#124; A &#8230; <a href="http://www.yukun.info/blog/2010/07/error-require-once-autoloader-php.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2010/07/error-require-once-autoloader-php.html">解決例: 「ファイルから操作とエンティティを取得できません」 &#8211; Autoloader.php</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.yukun.info/wp-content/uploads/error_require_autoloader.png"><img src="http://www.yukun.info/wp-content/uploads/error_require_autoloader-e1279985017921.png" alt="error_require_autoloader" title="error_require_autoloader" width="400" height="160" class="size-full wp-image-1605" /></a></p>
<h3>事象</h3>
<p>Flex Builder 4でPHPとのデータコネクション設定を行う際に上図のエラーが発生。<br />
使用したサンプルチュートリアル：<br />
<a href="http://www.adobe.com/devnet/flex/testdrive/articles/1_build_a_flex_app2.html" target="_blank">connect to data &#8211; Flex Test Drive | Adobe Developer Connection</a></p>
<p><span id="more-1604"></span></p>
<p><em>エラーメッセージ</em></p>
<pre>
Zend Framework が正しくインストールされていて、プロジェクトの出力フォルダーにある amf_config.ini ファイルでパラメーター "amf.production" が true に設定されていないことを確認してください。
Warning: Error parsing C:\Program Files (x86)\VertrigoServ\www\TestDrive\TestDrive-debug/amf_config.ini on line 5 in C:\Program Files (x86)\VertrigoServ\www\TestDrive\TestDrive-debug\gateway.php on line 12

Warning: require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory in C:\Program Files (x86)\VertrigoServ\www\TestDrive\TestDrive-debug\gateway.php on line 27

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader/Autoloader.php' (include_path='.;C:\Program Files (x86)\VertrigoServ\Smarty;C:/Program Files/ZendFramework/library') in C:\Program Files (x86)\VertrigoServ\www\TestDrive\TestDrive-debug\gateway.php on line 27
</pre>
<p><em>amf_config.ini</em></p>
<pre>
[zend]
;set the absolute location path of webroot directory, example:
;Windows: C:\apache\www
;MAC/UNIX: /user/apache/www
webroot =C:/Program Files (x86)/VertrigoServ/www

;set the absolute location path of zend installation directory, example:
;Windows: C:\apache\PHPFrameworks\ZendFramework\library
;MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework/library
;zend_path =

[zendamf]
amf.production = false
amf.directories[]=TestDrive/services
</pre>
<p><em>gateway.php</em></p>
<pre>
&lt;?php
ini_set(&quot;display_errors&quot;, 1);
$dir = dirname(__FILE__);
$webroot = $_SERVER[&#039;DOCUMENT_ROOT&#039;];
$configfile = &quot;$dir/amf_config.ini&quot;;

//default zend install directory
$zenddir = $webroot. &#039;/ZendFramework/library&#039;;

//Load ini file and locate zend directory
if(file_exists($configfile)) {
	$arr=parse_ini_file($configfile,true);
	if(isset($arr[&#039;zend&#039;][&#039;webroot&#039;])){
		$webroot = $arr[&#039;zend&#039;][&#039;webroot&#039;];
		$zenddir = $webroot. &#039;/ZendFramework/library&#039;;
	}
	if(isset($arr[&#039;zend&#039;][&#039;zend_path&#039;])){
		$zenddir = $arr[&#039;zend&#039;][&#039;zend_path&#039;];
	}
}

//
// Setup include path
	//add zend directory to include path
set_include_path(get_include_path().PATH_SEPARATOR.$zenddir);
// Initialize Zend Framework loader
require_once &#039;Zend/Loader/Autoloader.php&#039;;
</pre>
<p>include_pathの&#8217;.;C:\Program Files (x86)\VertrigoServ\Smarty;C:/Program Files/ZendFramework/library&#8217;から、&#8217;Zend/Loader/Autoloader.php&#8217;を開けませんというエラー。</p>
<p>include_path 先のフォルダ構成を確認すると確かに&#8217;Zend/Loader/Autoloader.php&#8217;がないのでエラーが発生するのは分かる。</p>
<h3>解決法</h3>
<p>amf_config.iniファイル中のwebrootパラメータをコメントアウトすると正常に設定が完了。<br />
変更前</p>
<pre>webroot =C:/Program Files (x86)/VertrigoServ/www</pre>
<p>変更後</p>
<pre>;webroot =C:/Program Files (x86)/VertrigoServ/www</pre>
<h3>原因</h3>
<p>本来はC:/Program Files (x86)/VertrigoServ/www/ZendFramework/library/Zend/Loader/Autoloader.phpを参照をすべき所を、C:/Program Files/ZendFramework/library/Zend/Loader/Autoloader.phpを参照しようとしてエラーとなった。<br />
webroot =C:/Program Files (x86)/VertrigoServ/wwwのはずが、どこで書き換わったのかな？</p>
<p>今回はサンプルを走らせるのを優先したので、原因究明はここで止めています＞＜；</p>
<h3>追記 &#8211; 2010/07/26</h3>
<p>以下のようなエラーメッセージが出力された場合も、上記の原因と同一である場合があります。</p>
<p><a href="http://www.yukun.info/wp-content/uploads/error_require_autoloader2.png"><img src="http://www.yukun.info/wp-content/uploads/error_require_autoloader2-e1280153443846.png" alt="error_require_autoloader2" title="error_require_autoloader2" width="400" height="281" class="size-full wp-image-1618" /></a></p>
<pre>
Send failed
Channel.Connect.Failed error NetConnection.Call.BadVersion: :
url: 'http://localhost/TestDrive_add_charts_PHP/gateway.php'
</pre>
<p>ご参考まで。</p>
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2008/11/actionscript-flash-load-server-image-file.html" rel="bookmark" title="2008年11月21日">ActionScript: 画像ファイルをダウンロードして表示 &#8211; Loaderクラス</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html" rel="bookmark" title="2008年12月17日">AIR: テキストファイルを非同期に読み込む &#8211; openAsync()、readMultiByte()</a></li>
<li><a href="http://www.yukun.info/blog/2012/01/flex-state-login-register.html" rel="bookmark" title="2012年1月5日">Flex: State、Transitionによる画面遷移 &#8211; ログイン画面</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html" rel="bookmark" title="2008年12月18日">AIR: テキストファイルに書き込み &#8211; openAsync()、writeMultiByte()</a></li>
<li><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-fill-layer.html" rel="bookmark" title="2008年10月25日">AS3でお絵かきFlashを作る (4)塗りつぶしと簡易レイヤーの操作</a></li>
</ul>
<p><!-- Similar Posts took 12.472 ms --></p>
<p><a href="http://www.yukun.info/blog/2010/07/error-require-once-autoloader-php.html">解決例: 「ファイルから操作とエンティティを取得できません」 &#8211; Autoloader.php</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2010/07/error-require-once-autoloader-php.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AIR: テキストファイルに書き込み &#8211; openAsync()、writeMultiByte()</title>
		<link>http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html</link>
		<comments>http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html#comments</comments>
		<pubDate>Wed, 17 Dec 2008 15:00:26 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[write]]></category>

		<guid isPermaLink="false">http://www.yukun.info/?p=1272</guid>
		<description><![CDATA[AIRコンポーネントではローカルのファイルにアクセスすることができます。下記のコードは日本語を含むマルチバイトの文字列をテキストファイルに書き込む処理をします。 処理の手順 FileStream#openAsync()か &#8230; <a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html">AIR: テキストファイルに書き込み &#8211; openAsync()、writeMultiByte()</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.yukun.info/wp-content/uploads/WriteTxtFile01_result.png"><img src="http://www.yukun.info/wp-content/uploads/WriteTxtFile01_result-e1273382752288.png" alt="AIR: テキストファイルに書き込み" title="WriteTxtFile01_result" width="400" height="328" class="size-full wp-image-1533" /></a></p>
<p>AIRコンポーネントではローカルのファイルにアクセスすることができます。下記のコードは日本語を含むマルチバイトの文字列をテキストファイルに書き込む処理をします。</p>
<h2>処理の手順</h2>
<ol>
<li>FileStream#openAsync()かopen()メソッドの引数にFileインスタンスとFileModeのプロパティを設定して実ファイルのパイプに接続</li>
<li>FileStream#writeMultiByte()でファイルに書き込み</li>
<li>FileStream#close()でストリームを閉じる</li>
</ol>
<h3>ソースコード</h3>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:WindowedApplication xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;absolute&quot; title=&quot;シンプルテキストメイカー&quot;&gt;
&lt;mx:Script&gt;
  &lt;![CDATA[
  import mx.controls.Alert;

  private var choDir:File = File.documentsDirectory; // ダイアログの初期ディレクトリ
  private var saveFile:File;
  private var stream:FileStream;

  private function onSaveFileBut():void {
    choDir.addEventListener(Event.SELECT, onSelectSaveFile);
    choDir.browseForSave(&quot;テキストファイルに保存&quot;);
  }

  private function onSelectSaveFile(e:Event):void {
    saveFile = e.target as File; // 選択されたファイル
    choDir.removeEventListener(Event.SELECT, onSelectSaveFile);
    try {
      stream = new FileStream();
      stream.addEventListener(IOErrorEvent.IO_ERROR, onIOErrorWriteFile);
      stream.openAsync(saveFile, FileMode.WRITE); // 書き込みmodeで開く(フツーのopen()でもOK)
      var str:String = txtArea_.text;
      // 改行文字と文字コードをOS標準のものに置き換えて書き込み
      str = str.replace(/\n/g, File.lineEnding);
      stream.writeMultiByte(str, File.systemCharset); // 実際に書き込み
    } catch (err:IOError) {
      progLab_.text = &quot;IOError : &quot; + err;
    } finally {
      if (stream != null) {
        stream.close();
      }
    }
  }

  // ファイル書き込みに失敗した場合
  private function onIOErrorWriteFile(e:IOErrorEvent):void {
    Alert.show(&quot;ファイルの書き込みに失敗&quot;, &quot;エラー&quot;, Alert.OK, this);
    if (stream != null) {
      stream.close();
    }
  }
  ]]&gt;
&lt;/mx:Script&gt;
  &lt;mx:VBox x=&quot;0&quot; y=&quot;0&quot; height=&quot;100%&quot; width=&quot;100%&quot;&gt;
    &lt;mx:HBox width=&quot;100%&quot;&gt;
      &lt;mx:Button label=&quot;ファイルに保存&quot; id=&quot;saveBut_&quot; click=&quot;onSaveFileBut();&quot;/&gt;
      &lt;mx:Label id=&quot;progLab_&quot;/&gt;
    &lt;/mx:HBox&gt;
    &lt;mx:TextArea width=&quot;100%&quot; height=&quot;100%&quot; id=&quot;txtArea_&quot;/&gt;
  &lt;/mx:VBox&gt;
&lt;/mx:WindowedApplication&gt;
</pre>
<h3>リファレンス</h3>
<ul>
<li><a href="http://help.adobe.com/ja_JP/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7e4a.html" title="Adobe AIR 1.5 * ファイルシステムの操作" target="_blank">Adobe AIR 1.5 * ファイルシステムの操作</a></li>
<li><a href="http://help.adobe.com/ja_JP/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7dc2.html" title="Adobe AIR 1.5 * ファイルの読み取りと書き込み" target="_blank">Adobe AIR 1.5 * ファイルの読み取りと書き込み</a></li>
</ul>
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html" rel="bookmark" title="2008年12月17日">AIR: テキストファイルを非同期に読み込む &#8211; openAsync()、readMultiByte()</a></li>
<li><a href="http://www.yukun.info/blog/2008/09/python-file-write-writelines.html" rel="bookmark" title="2008年9月6日">Python: テキストファイルに書き込み &#8211; write()、writelines()メソッド</a></li>
<li><a href="http://www.yukun.info/blog/2008/06/python-csv-write.html" rel="bookmark" title="2008年6月18日">Python: CSVファイルに書き込み &#8211; csv.writerオブジェクト</a></li>
<li><a href="http://www.yukun.info/blog/2008/09/python-add-line-number-to-text-file.html" rel="bookmark" title="2008年9月8日">Python: テキストファイルの行頭に行番号を追加</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/air-actionscript-sqlite-statement.html" rel="bookmark" title="2008年12月22日">AIR: SQLiteでデータの挿入と検索 &#8211; SQLConnection、SQLStatementクラス</a></li>
</ul>
<p><!-- Similar Posts took 13.953 ms --></p>
<p><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html">AIR: テキストファイルに書き込み &#8211; openAsync()、writeMultiByte()</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AIR: テキストファイルを非同期に読み込む &#8211; openAsync()、readMultiByte()</title>
		<link>http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html</link>
		<comments>http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html#comments</comments>
		<pubDate>Wed, 17 Dec 2008 03:30:27 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[read]]></category>

		<guid isPermaLink="false">http://www.yukun.info/?p=1269</guid>
		<description><![CDATA[AIRコンポーネントではローカルのファイルにアクセスすることができます。下記のコードは日本語を含むマルチバイトのテキストファイルを読み込み、画面い表示する処理を行います。 大まかな手順 FileStreamのコンストラク &#8230; <a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html">AIR: テキストファイルを非同期に読み込む &#8211; openAsync()、readMultiByte()</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.yukun.info/wp-content/uploads/ReadTxtFile01_result.png"><img src="http://www.yukun.info/wp-content/uploads/ReadTxtFile01_result-e1273382664744.png" alt="AIR: テキストファイル読み込みの実行結果" title="ReadTxtFile01_result" width="400" height="328" class="size-full wp-image-1531" /></a></p>
<p>AIRコンポーネントではローカルのファイルにアクセスすることができます。下記のコードは日本語を含むマルチバイトのテキストファイルを読み込み、画面い表示する処理を行います。</p>
<h2>大まかな手順</h2>
<ol>
<li>FileStreamのコンストラクタの引数に対象のファイルへのパスが設定されたFileインスタンスを渡す。</li>
<li>FileStream#openAsyncで実ファイルへのパイプ接続。</li>
<li>この時、非同期の読み込み完了／エラーを取得するためにイベントを登録しておく。</li>
<li>実際の文字の読み取り（どれだけ読むか、文字コードの変換など）はFileStream#readMultiByteで行う。</li>
<li>ストリームのインスタンスには接続時にpositionプロパティ（何処読んでいるかのポインタみたいなもの）からファイル末尾までのサイズ（bytesAvailable）を取得してるので、読み込みサイズにそれを指定。</li>
<li>FileStream#close()でストリームを閉じる</li>
</ol>
<h3>ソースコード</h3>
<pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:WindowedApplication xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;absolute&quot;
  title=&quot;テキストビュワー&quot;&gt;
  &lt;mx:Script&gt;
    &lt;![CDATA[
    import flash.filesystem.*;
    import mx.events.*;
    import mx.controls.Alert;

    private var choDir:File = File.documentsDirectory; // 開くディレクトリを指す
    private var curFile:File; // 選択されたファイル
    private var stream:FileStream;

    private function onOpenFileBut():void {
      choDir.addEventListener(Event.SELECT, onSelectFile);
      choDir.browseForOpen(&quot;開く&quot;); // ファイル選択ダイアログの表示
    }

    // ファイルが選択されたイベント
    private function onSelectFile(e:Event):void {
      txtArea_.text = &quot;&quot;;
      stream = new FileStream();
      curFile = e.target as File;
      stream.addEventListener(Event.COMPLETE, onCompleteReadFile);
      stream.addEventListener(IOErrorEvent.IO_ERROR, onIOErrorReadFile);
      stream.addEventListener(ProgressEvent.PROGRESS, onProgReadFile);
      stream.openAsync(curFile, FileMode.READ); // 非同期読み込み
      curFile.removeEventListener(Event.SELECT, onSelectFile);
    }

    private function onCompleteReadFile(e:Event):void {
      try {
        // OS標準の文字コードで読み込み
        var str:String = stream.readMultiByte(stream.bytesAvailable, File.systemCharset);
        // OS標準の改行文字への変換
        var pat:RegExp = new RegExp(File.lineEnding, &quot;g&quot;);
        str = str.replace(pat, &quot;n&quot;);
        txtArea_.text = str; // テキストエリアに表示
        stream.removeEventListener(Event.COMPLETE, onCompleteReadFile);
        stream.removeEventListener(IOErrorEvent.IO_ERROR, onIOErrorReadFile);
        stream.removeEventListener(ProgressEvent.PROGRESS, onProgReadFile);
      } catch (err:Error) {
        progLab_.text = &quot;IOError: &quot; + err;
      }
      finally {
        // パイプのクローズ
        if (stream != null) {
          stream.close();
        }
      }
    }

    private function onIOErrorReadFile(e:IOErrorEvent):void {
      Alert.show(&quot;ファイルを読み込み不可&quot;, &quot;Error&quot;, Alert.OK, this); // 第4引数には親オブジェトを渡す
      if (stream != null) {
        stream.close();
      }
    }

    private function onProgReadFile(e:ProgressEvent):void {
      progLab_.text = &quot;Progress: &quot; +  e.bytesLoaded + &quot; / &quot; + e.bytesTotal + &quot; bytes&quot;;
    }
    ]]&gt;
  &lt;/mx:Script&gt;
  &lt;mx:VBox x=&quot;0&quot; y=&quot;0&quot; height=&quot;100%&quot; width=&quot;100%&quot;&gt;
    &lt;mx:HBox width=&quot;100%&quot;&gt;
      &lt;mx:Button label=&quot;ファイルを開く&quot; id=&quot;openBut_&quot; click=&quot;onOpenFileBut();&quot;/&gt;
      &lt;mx:Label id=&quot;progLab_&quot;/&gt;
    &lt;/mx:HBox&gt;
    &lt;mx:TextArea width=&quot;100%&quot; height=&quot;100%&quot; id=&quot;txtArea_&quot;/&gt;
  &lt;/mx:VBox&gt;

&lt;/mx:WindowedApplication&gt;
</pre>
<h3>リファレンス</h3>
<ul>
<li><a href="http://help.adobe.com/ja_JP/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7dc8.html" title="Adobe AIR 1.5 * ファイルの読み取りと書き込みのワークフロー" target="_blank">Adobe AIR 1.5 * ファイルの読み取りと書き込みのワークフロー</a></li>
<li><a href="http://help.adobe.com/ja_JP/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7dac.html" title="Adobe AIR 1.5 * 読み取りバッファと FileStream オブジェクトの bytesAvailable プロパティ" target="_blank">Adobe AIR 1.5 * 読み取りバッファと FileStream オブジェクトの bytesAvailable プロパティ</a></li>
</ul>
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-write-text.html" rel="bookmark" title="2008年12月18日">AIR: テキストファイルに書き込み &#8211; openAsync()、writeMultiByte()</a></li>
<li><a href="http://www.yukun.info/blog/2008/06/python-csv-read.html" rel="bookmark" title="2008年6月17日">Python: CSVファイルの読み込み &#8211; csv.readerオブジェクト</a></li>
<li><a href="http://www.yukun.info/blog/2008/06/python-file.html" rel="bookmark" title="2008年6月9日">Python: テキストファイルの読み込み &#8211; read()、readlines()、readline()メソッド</a></li>
<li><a href="http://www.yukun.info/blog/2008/09/python-file-write-writelines.html" rel="bookmark" title="2008年9月6日">Python: テキストファイルに書き込み &#8211; write()、writelines()メソッド</a></li>
<li><a href="http://www.yukun.info/blog/2008/09/python-add-line-number-to-text-file.html" rel="bookmark" title="2008年9月8日">Python: テキストファイルの行頭に行番号を追加</a></li>
</ul>
<p><!-- Similar Posts took 12.275 ms --></p>
<p><a href="http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html">AIR: テキストファイルを非同期に読み込む &#8211; openAsync()、readMultiByte()</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2008/12/actionscript-air-async-read-text.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AmazoCluster: 一発で納得のいくものができればいいけれどね・・・</title>
		<link>http://www.yukun.info/blog/2008/12/amazocluster-bata-uncompleted.html</link>
		<comments>http://www.yukun.info/blog/2008/12/amazocluster-bata-uncompleted.html#comments</comments>
		<pubDate>Mon, 15 Dec 2008 11:00:26 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Graphics]]></category>

		<guid isPermaLink="false">http://www.yukun.info/?p=1265</guid>
		<description><![CDATA[タイトルは反語として読む。 Demo(Uncompleted): http://www.yukun.info/labs/flex/AmazoCluster01/ ※追記：2011年現在Amazonのサービス仕様の変更によ &#8230; <a href="http://www.yukun.info/blog/2008/12/amazocluster-bata-uncompleted.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2008/12/amazocluster-bata-uncompleted.html">AmazoCluster: 一発で納得のいくものができればいいけれどね・・・</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>タイトルは反語として読む。<br />
<a href="http://www.yukun.info/wp-content/uploads/amazon_cluster01.png"><img src="http://www.yukun.info/wp-content/uploads/amazon_cluster01-e1273382871204.png" alt="Amazon Cluster bata Uncompleted" title="amazon_cluster01" width="400" height="317" class="size-full wp-image-1535" /></a></p>
<p>Demo(Uncompleted): <a href="http://www.yukun.info/labs/flex/AmazoCluster01/" title="AmazoCluster bata Uncompleted" target="_blank">http://www.yukun.info/labs/flex/AmazoCluster01/</a><br />
※追記：2011年現在Amazonのサービス仕様の変更により上記のリンク先アプリは正常に動作しません<(_ _)></p>
<dl>
<dt>これは何？</dt>
<p>Amazon.co.jpの任意の商品の類似商品を線で結び関連付けを視覚化するアプリ。（見にくいね。まだ未完成だけど、暇を狙って完成させる）</p>
<dt>どうやって使うの？</dt>
<ol>
<li>商品画像をダブルクリックすると類似商品の画像が表示されます。またその画像をダブルクリックすると・・・以下ループ。</li>
<li>画像をドラッグすると線で結ばれた類似商品も納豆の糸のようについてきます。</li>
</ol>
<dt>今後直したい／追加したい機能は？</dt>
<ol>
<li>商品の検索フォーム</li>
<li>商品-類似商品間の距離調整だけでなく類似-類似間の調整も行う</li>
<li>各イベントによる処理のタイミングの調整</li>
<li>ドラッグ中の商品とその関連商品を結ぶ線の色と画像のサイズを変更
<ul>
<li>関連の深さによって色合いとサイズが変化</li>
</ul>
</li>
<li>商品をクリック／マウスオーバーしたときのアクションを増やす
<ul>
<li>タイトル等の商品の詳細情報を表示</li>
<li>Amazonページへのリンク</li>
</ul>
<li>関連度合いによるエフェクトの区別</li>
</li>
<li>3D表示：Z軸への意味付け（時間軸、ここでは出版年度なんかは最適かも？）</li>
</ol>
<dt>それができたら使うメリットはある？</dt>
<p>たぶん色々とある。作る前から作るべき明確なメリットを定義して作り始めるのがベターというかマストだけど。どちらにせよ仮説と検証の試行錯誤は必要。</p>
<dt>そういえば、なんで作ろうと思ったの？</dt>
<p>以前授業の課題で書いたX11でフラクタル描くコードと卒研のコードを読み直していたら今回のアプリを想像して「ん？これくらいならサクッと書けるかも」と思ったのが発端。また、「検索行動の典型」＝「フォームにキーワードをスペースはさんで入力→ポチっ→ページのリストから選択」とはひと味変った検索のメリットを見出したい、というのがメタ動機。その一例（にできればいいね）。</p>
<dt>作って勉強になったことは？</dt>
<p>一応作ることで、以前よりクラスの役割付け（機能の結合度合い）とデザパタの適応を以前よりスムーズにこなせるようにはなった。おおまかな設計→コーディングの速度も少し上がった（気のせい）。でもそれ以外は・・・うーん、今後の課題。<br />
今回はAmazonの商品を線で繋げたけれど、それをTwitter(つぶやき-つぶやき中のキーワード間、ユーザ-フレンド間)やDelicious(タグ-ブックマーク間、ユーザ-フレンド間)、WordPressブログ（タグ-記事間）に変更しても基本UIの部分はわずかな修正でいけるクラス群だと思う。もちろん、場合によっては類似度を算出する部分も用意する必要がある。</p>
<dt>最近ブログ書いてないね。</dt>
<p>卒研とバイトその他で詰まっているのは理由としては身も蓋もナフサ。単に私の生活の中でブログのプライオリティや使い道が変化してきているのかも。
</dl>
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-fill-layer.html" rel="bookmark" title="2008年10月25日">AS3でお絵かきFlashを作る (4)塗りつぶしと簡易レイヤーの操作</a></li>
<li><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-draw-tool.html" rel="bookmark" title="2008年10月19日">AS3でお絵かきFlashを作る (3)図形描画と配置選択ツールの追加</a></li>
<li><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-button.html" rel="bookmark" title="2008年10月14日">AS3でお絵かきFlashを作る (2)ボタン作成 &#8211; Flexコンポーネントの導入</a></li>
<li><a href="http://www.yukun.info/blog/2008/11/actionscript-flash-load-server-image-file.html" rel="bookmark" title="2008年11月21日">ActionScript: 画像ファイルをダウンロードして表示 &#8211; Loaderクラス</a></li>
<li><a href="http://www.yukun.info/blog/2008/11/actionscript-paint-flash-air-brush.html" rel="bookmark" title="2008年11月4日">AS3でお絵かきFlashを作る (5)エアーブラシ機能</a></li>
</ul>
<p><!-- Similar Posts took 8.484 ms --></p>
<p><a href="http://www.yukun.info/blog/2008/12/amazocluster-bata-uncompleted.html">AmazoCluster: 一発で納得のいくものができればいいけれどね・・・</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2008/12/amazocluster-bata-uncompleted.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3でお絵かきFlashを作る (4)塗りつぶしと簡易レイヤーの操作</title>
		<link>http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-fill-layer.html</link>
		<comments>http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-fill-layer.html#comments</comments>
		<pubDate>Fri, 24 Oct 2008 22:10:02 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[Paint]]></category>

		<guid isPermaLink="false">http://www.yukun.info/?p=1221</guid>
		<description><![CDATA[今記事で4回目ですねー。デモは以下のページに用意しました。 http://www.yukun.info/labs/flex/paint04/ 今回の主な追加機能は、前回の改善点にも含まれていた (1)長方形と楕円描画ツー &#8230; <a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-fill-layer.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-fill-layer.html">AS3でお絵かきFlashを作る (4)塗りつぶしと簡易レイヤーの操作</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>今記事で4回目ですねー。デモは以下のページに用意しました。<br />
<a href="http://www.yukun.info/labs/flex/paint04/" title="「ペイントツール的なもの(4)」です。" target="_blank">http://www.yukun.info/labs/flex/paint04/</a><br />
今回の主な追加機能は、<a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-draw-tool.html" title="AS3でお絵かきFlashを作る (3)図形描画と配置選択ツールの追加 - Yukun's Blog" target="_blank">前回</a>の改善点にも含まれていた<br />
(1)長方形と楕円描画ツールへの「塗りつぶし」機能<br />
(2)各描画図形間のレイヤー（重なり具合）移動機能<br />
です。あと少しインスタンスの生成を押さえた処理に変更したので若干パフォーマンスが上がっているかと思います（約1割弱）。</p>
<p>まず、(2)のオブジェクト間の階層（レイヤー）移動機能ですが、これは描画した図形上で右クリックを押すことで呼び出せるコンテキストメニューから使えます（下図）。</p>
<p><a href="http://www.yukun.info/wp-content/uploads/flex_paint04_child_move.gif"><img src="http://www.yukun.info/wp-content/uploads/flex_paint04_child_move.gif" alt="Flexのペイントツールのコンテキストメニュー（レイヤー移動）" title="flex_paint04_child_move" width="324" height="270" class="size-full wp-image-1537" /></a></p>
<p>この機能で図形の重なり順序を調節することが出来ます。また、「配置」ツールで図形を選択するとその図形は自動的に最前面レイヤーに移動されます。これによって、マウスイベントの発生源を図形毎に持たせても、重なり具合によるイベントの取りこぼしか無くなる利点があります。結果、OOPにある程度沿ったプログラミングを行うことを可能にします。</p>
<p>ちなみにこのレイヤー移動アクションは履歴には記録せずundo、redoの対象にはしませんでした（このレベルのアプリに対しては必要ないかと思ったので）。もし貼り絵のように絵を描きたく、またundoを利用していきたい場合はPhotoshopやGIMP等の明確なレイヤー機構を実装したほうがすっきりすると思います。内部機能の実装の手間はさほど掛かりませんが、ツールボックスのようなUIを作らなくてはいけないのが今の私にとってメンドイところです。しかしFlexコンポーネントを学ぶ良い機会でもあるのでさわりだけでもやってみようかな。</p>
<p>こう機能が増えてくるとユーザインターフェース(UI)にもしっかり取り組まなければならないんですが、UIはリリースするプラットフォーム（PCデスクトップ上、PCブラウザ上、モバイル、スマートフォン）に依存する部分が大きいのでまだ取り掛かるのはいいかなと思ったり（ぉぃ）。</p>
<p>さて、今回で基本的なブラシツール（ベクター以外）は揃ったかと思いますので、そろそろテキスト系の機能を実装していきたいと思います。初回に「頭の中のアイディアを楽しくまとめられるツールを作ってみたい」とのたまっていたので、ちょっとチャレンジしてみます。合わせてベクターツールも追加してみます。<br />
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-draw-tool.html" rel="bookmark" title="2008年10月19日">AS3でお絵かきFlashを作る (3)図形描画と配置選択ツールの追加</a></li>
<li><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-undo-redo.html" rel="bookmark" title="2008年10月11日">AS3でお絵かきFlashを作る (1)自由曲線のUndo、Redo</a></li>
<li><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-button.html" rel="bookmark" title="2008年10月14日">AS3でお絵かきFlashを作る (2)ボタン作成 &#8211; Flexコンポーネントの導入</a></li>
<li><a href="http://www.yukun.info/blog/2008/11/actionscript-paint-flash-air-brush.html" rel="bookmark" title="2008年11月4日">AS3でお絵かきFlashを作る (5)エアーブラシ機能</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/amazocluster-bata-uncompleted.html" rel="bookmark" title="2008年12月15日">AmazoCluster: 一発で納得のいくものができればいいけれどね・・・</a></li>
</ul>
<p><!-- Similar Posts took 9.008 ms --></p>
<p><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-fill-layer.html">AS3でお絵かきFlashを作る (4)塗りつぶしと簡易レイヤーの操作</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-fill-layer.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3でお絵かきFlashを作る (3)図形描画と配置選択ツールの追加</title>
		<link>http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-draw-tool.html</link>
		<comments>http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-draw-tool.html#comments</comments>
		<pubDate>Sun, 19 Oct 2008 10:20:18 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[Paint]]></category>

		<guid isPermaLink="false">http://www.yukun.info/?p=1220</guid>
		<description><![CDATA[作り込んでいく内に、Flashのレイアウトとファイルサイズが大きくなったので、下記のページに用意しました。 http://www.yukun.info/labs/flex/paint03/ 今回追加した機能は大きく分けて &#8230; <a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-draw-tool.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-draw-tool.html">AS3でお絵かきFlashを作る (3)図形描画と配置選択ツールの追加</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>作り込んでいく内に、Flashのレイアウトとファイルサイズが大きくなったので、下記のページに用意しました。<br />
<a href="http://www.yukun.info/labs/flex/paint03/" title="「ペイントツール的なもの(3)」です。" target="_blank">http://www.yukun.info/labs/flex/paint03/</a><br />
今回追加した機能は大きく分けてタイトルに書かれている2つです。</p>
<p>描画できる図形の種類を直線、長方形、楕円に増やしました。また、描いた図形を任意の場所に移動することが出来ます（「配置」ボタンをクリック後、図形をドラッグ＆ドロップ）。そして、配置移動も履歴に残しているのでUndo、Redoの対象になります。</p>
<p>以下は作成後の反省点の一部の走り書き。</p>
<h2>問題点や改善点</h2>
<ul>
<li>図形の描画やオブジェクトのD&#038;Dの際に、線分上に薄い青のエフェクトをかけると爽快感＋視認性が上がるかなぁと試してみたんですが、実装したら煩わしい感じになってしまいました。エフェクトのON/OFFのチェックボックスをつけておこう。</li>
<li>図形オブジェクトがD&#038;Dでキャンバスのサイズ外に出てしまう。Flexコンポーネントの親子関係や背景色の設定し忘れ等からくる問題だと推測。</li>
<li>描画ツールのボタンは押し込み式にして、選択しているツールを分かりやすくしよう。レイアウトいじるのは後回しになりがちだなぁ。</li>
<li>長方形と楕円ツールは塗りつぶし設定の追加やShift+ドラッグ描画で正方形と円を作成できるようにしておこうかな。</li>
<li>複数の図形が重なった際のドロップ処理の再考。</li>
</ul>
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-fill-layer.html" rel="bookmark" title="2008年10月25日">AS3でお絵かきFlashを作る (4)塗りつぶしと簡易レイヤーの操作</a></li>
<li><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-button.html" rel="bookmark" title="2008年10月14日">AS3でお絵かきFlashを作る (2)ボタン作成 &#8211; Flexコンポーネントの導入</a></li>
<li><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-undo-redo.html" rel="bookmark" title="2008年10月11日">AS3でお絵かきFlashを作る (1)自由曲線のUndo、Redo</a></li>
<li><a href="http://www.yukun.info/blog/2008/11/actionscript-paint-flash-air-brush.html" rel="bookmark" title="2008年11月4日">AS3でお絵かきFlashを作る (5)エアーブラシ機能</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/amazocluster-bata-uncompleted.html" rel="bookmark" title="2008年12月15日">AmazoCluster: 一発で納得のいくものができればいいけれどね・・・</a></li>
</ul>
<p><!-- Similar Posts took 9.048 ms --></p>
<p><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-draw-tool.html">AS3でお絵かきFlashを作る (3)図形描画と配置選択ツールの追加</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-draw-tool.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>AS3でお絵かきFlashを作る (2)ボタン作成 &#8211; Flexコンポーネントの導入</title>
		<link>http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-button.html</link>
		<comments>http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-button.html#comments</comments>
		<pubDate>Tue, 14 Oct 2008 14:30:08 +0000</pubDate>
		<dc:creator>yukun</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[Paint]]></category>

		<guid isPermaLink="false">http://www.yukun.info/?p=1219</guid>
		<description><![CDATA[undo、redoのボタンをFlexコンポーネントのButtonクラスを用いて作成してみました。 以前はボタンを作るのに直書きしていましたが、レイアウトの配置修正に手間取るのでFlexコンポーネントを使用することにしまし &#8230; <a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-button.html">Continue reading <span class="meta-nav">&#8594;</span></a><p><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-button.html">AS3でお絵かきFlashを作る (2)ボタン作成 &#8211; Flexコンポーネントの導入</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></description>
			<content:encoded><![CDATA[<p>undo、redoのボタンをFlexコンポーネントのButtonクラスを用いて作成してみました。<br />
<span id="more-1219"></span><br />
<!-- Copyright (C) yukun. --><!-- http://www.yukun.info/ --><embed src="http://www.yukun.info/labs/flash/paint02.swf" loop="false" quality="high" bgcolor="#ffffff" width="500" height="400"></p>
<p><a href="http://www.yukun.info/blog/2008/10/actionscript-xml-element-attribute.html" title="ActionScript: XMLの子要素の読み込み - XMLオブジェクトと「.. 」「[]」演算子 - Yukun's Blog" target="_blank">以前</a>はボタンを作るのに直書きしていましたが、レイアウトの配置修正に手間取るのでFlexコンポーネントを使用することにしました。</p>
<p>少し話し変わりますが、ActionScriptのGraphicsクラスは標準で適切なタイミングでスクリーンのバッファをとっているのかな。</p>
<p>Javaでは通常画面バッファをとっていない為ウィンドウ描画の度にチラつきがあり、書き手がその辺の面倒を見なければいけませんでした。</p>
<p>しかし、ASではそういった設定が無くともチラつきが無いので、Graphicsクラス内部でやってくれているのかなぁと推測してみました（まだ調べていません）。</p>
<p>また話し変わりますが、フレームワークに囚われるとその枠組みから離れるた場合に思考停止になる危険があるかも。フレームワークの利点欠点が見極められるようにならないとなぁ(自戒)。<br />
<h4>関連すると思われる記事：</h4>
<ul class="similar-posts">
<li><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-draw-tool.html" rel="bookmark" title="2008年10月19日">AS3でお絵かきFlashを作る (3)図形描画と配置選択ツールの追加</a></li>
<li><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-fill-layer.html" rel="bookmark" title="2008年10月25日">AS3でお絵かきFlashを作る (4)塗りつぶしと簡易レイヤーの操作</a></li>
<li><a href="http://www.yukun.info/blog/2008/11/actionscript-paint-flash-air-brush.html" rel="bookmark" title="2008年11月4日">AS3でお絵かきFlashを作る (5)エアーブラシ機能</a></li>
<li><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-undo-redo.html" rel="bookmark" title="2008年10月11日">AS3でお絵かきFlashを作る (1)自由曲線のUndo、Redo</a></li>
<li><a href="http://www.yukun.info/blog/2008/12/amazocluster-bata-uncompleted.html" rel="bookmark" title="2008年12月15日">AmazoCluster: 一発で納得のいくものができればいいけれどね・・・</a></li>
</ul>
<p><!-- Similar Posts took 9.179 ms --></p>
<p><a href="http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-button.html">AS3でお絵かきFlashを作る (2)ボタン作成 &#8211; Flexコンポーネントの導入</a> is a post from: <a href="http://www.yukun.info">Yukun&#039;s Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yukun.info/blog/2008/10/actionscript-paint-flash-flex-button.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

