<?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>nariyu memo &#187; Adobe AIR</title>
	<atom:link href="http://nariyu.playwell.jp/tag/adobe-air/feed/" rel="self" type="application/rss+xml" />
	<link>http://nariyu.playwell.jp</link>
	<description>メモ</description>
	<lastBuildDate>Wed, 18 Aug 2010 09:19:00 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Twitter クライアント始めました。</title>
		<link>http://nariyu.playwell.jp/2009/10/twitter-client-saezuri/</link>
		<comments>http://nariyu.playwell.jp/2009/10/twitter-client-saezuri/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 11:25:22 +0000</pubDate>
		<dc:creator>nariyu</dc:creator>
				<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Saezuri]]></category>
		<category><![CDATA[Twitter client]]></category>

		<guid isPermaLink="false">http://nariyu.playwell.jp/?p=487</guid>
		<description><![CDATA[Saezuri（さえずり）といいます。
Flex と Adobe AIR でこつこつ作っています。
http://www.playwell.jp/trac/Saezuri
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.playwell.jp/trac/Saezuri"><img alt="" src="http://www.playwell.jp/trac/Saezuri/chrome/site/app_image.png" title="Saezuri" class="alignnone" width="400" height="400" /></a></p>
<p>Saezuri（さえずり）といいます。<br />
Flex と Adobe AIR でこつこつ作っています。</p>
<p><a href="http://www.playwell.jp/trac/Saezuri">http://www.playwell.jp/trac/Saezuri</a></p>
]]></content:encoded>
			<wfw:commentRss>http://nariyu.playwell.jp/2009/10/twitter-client-saezuri/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Flex のロギング</title>
		<link>http://nariyu.playwell.jp/2009/05/flex-trace/</link>
		<comments>http://nariyu.playwell.jp/2009/05/flex-trace/#comments</comments>
		<pubDate>Thu, 28 May 2009 11:28:07 +0000</pubDate>
		<dc:creator>nariyu</dc:creator>
				<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[MXML]]></category>
		<category><![CDATA[ロギング]]></category>

		<guid isPermaLink="false">http://www.playwell.jp/blog/nariyu/?p=47</guid>
		<description><![CDATA[ずっと前から言われてることだけど、trace() の処理は重い。
かなり重い。とにかく重い。
一方 Flex のロギング API は軽い。trace() と比べると断然軽い。しかもリリースビルドして AIR にログを送る [...]]]></description>
			<content:encoded><![CDATA[<p>ずっと前から言われてることだけど、trace() の処理は重い。<br />
かなり重い。とにかく重い。</p>
<p>一方 Flex のロギング API は軽い。trace() と比べると断然軽い。しかもリリースビルドして AIR にログを送ることもできるので便利。</p>
<p>簡単な例を作ってみた。</p>
<p><a href="http://blog.playwell.jp/nariyu/wp-content/uploads/2009/05/flexlogger.png" class="highslide" onclick="return hs.expand(this);"><img class="alignnone size-full wp-image-68" title="flexlogger" src="http://blog.playwell.jp/nariyu/wp-content/uploads/2009/05/flexlogger.png" alt="flexlogger" width="451" height="326" /></a></p>
<p>AIR アプリ: <a href='http://blog.playwell.jp/nariyu/wp-content/uploads/2009/05/FlexLogger.air'>FlexLogger.air</a><br />
ソース: <a href='http://blog.playwell.jp/nariyu/wp-content/uploads/2009/05/FlexLogger.zip'>FlexLogger.zip</a></p>
<p>上の AIR アプリをインストールして、下のボタンを押すと押すとログが取得できます。</p>
<p>デモとソースは以下。<br />
<span id="more-47"></span></p>
<p>
<object width="400" height="200">
<param name="movie" value="http://blog.playwell.jp/nariyu/wp-content/uploads/2009/05/loggingtest.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="window"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowFullScreen" value="true"></param>
<embed type="application/x-shockwave-flash" width="400" height="200" src="http://blog.playwell.jp/nariyu/wp-content/uploads/2009/05/loggingtest.swf" quality="high" bgcolor="#FFFFFF" wmode="window" menu="false" allowFullScreen="true" ></embed>
</object>
</p>
<p>jp/playwell/logging/LoggingTarget.as</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> jp.playwell.logging
<span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">StatusEvent</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span>.<span style="color: #004993;">LocalConnection</span>;
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">import</span> mx.core.mx_internal;
    <span style="color: #0033ff; font-weight: bold;">import</span> mx.logging.ILogger;
    <span style="color: #0033ff; font-weight: bold;">import</span> mx.logging.Log;
    <span style="color: #0033ff; font-weight: bold;">import</span> mx.logging.LogEvent;
    <span style="color: #0033ff; font-weight: bold;">import</span> mx.logging.targets.LineFormattedTarget;
&nbsp;
    use <span style="color: #004993;">namespace</span> mx_internal;
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> LoggingTarget extends LineFormattedTarget
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #6699cc; font-weight: bold;">var</span> lc<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">LocalConnection</span>;
        <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #6699cc; font-weight: bold;">var</span> currLevel<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>;
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> LoggingTarget<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
            lc = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">LocalConnection</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
            lc.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">StatusEvent</span>.<span style="color: #004993;">STATUS</span>,
                lc_statusHandler<span style="color: #000000;">&#41;</span>;
            Log.addTarget<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> lc_statusHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">StatusEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #009900;">//if (event.level == &quot;error&quot;)</span>
            <span style="color: #009900;">//    trace(&quot;jp.playwell.logging.LoggingTarget: error&quot;);</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> logEvent<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span>LogEvent<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
        <span style="color: #000000;">&#123;</span>
            currLevel = event.<span style="color: #004993;">level</span>;
            <span style="color: #0033ff; font-weight: bold;">super</span>.logEvent<span style="color: #000000;">&#40;</span>event<span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
        override mx_internal <span style="color: #339966; font-weight: bold;">function</span> internalLog<span style="color: #000000;">&#40;</span><span style="color: #004993;">message</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
        <span style="color: #000000;">&#123;</span>
            localConnection.<span style="color: #004993;">send</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;_FlexLogger&quot;</span>,
                <span style="color: #990000;">&quot;log&quot;</span>, currLevel, <span style="color: #004993;">message</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>LocalConnection の接続名の先頭のアンダースコアが大切なのです。</p>
<p>LoggingTest.mxml</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span></span>
<span style="color: #000000;">    xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">    xmlns:logging=<span style="color: #ff0000;">&quot;jp.playwell.logging.*&quot;</span></span>
<span style="color: #000000;">    layout=<span style="color: #ff0000;">&quot;vertical&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.logging.ILogger;</span>
<span style="color: #339933;">            import mx.logging.Log;</span>
&nbsp;
<span style="color: #339933;">            private function getLogger():ILogger</span>
<span style="color: #339933;">            {</span>
<span style="color: #339933;">                return Log.getLogger(&quot;LoggingTest&quot;);</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;logging:LoggingTarget</span></span>
<span style="color: #000000;">        includeCategory=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">        includeLevel=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">        includeTime=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;logger.debug()&quot;</span> width=<span style="color: #ff0000;">&quot;150&quot;</span></span>
<span style="color: #000000;">        click=<span style="color: #ff0000;">&quot;getLogger().debug('デバッグよ')&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;logger.info()&quot;</span> width=<span style="color: #ff0000;">&quot;150&quot;</span></span>
<span style="color: #000000;">        click=<span style="color: #ff0000;">&quot;getLogger().info('情報です')&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;logger.warn()&quot;</span> width=<span style="color: #ff0000;">&quot;150&quot;</span></span>
<span style="color: #000000;">        click=<span style="color: #ff0000;">&quot;getLogger().warn('警告だ')&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;logger.error()&quot;</span> width=<span style="color: #ff0000;">&quot;150&quot;</span></span>
<span style="color: #000000;">        click=<span style="color: #ff0000;">&quot;getLogger().error('エラーだね')&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;logger.fatal()&quot;</span> width=<span style="color: #ff0000;">&quot;150&quot;</span></span>
<span style="color: #000000;">        click=<span style="color: #ff0000;">&quot;getLogger().fatal('致命的なエラーだぜ')&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></td></tr></table></div>

<p>今回は LocalConnection でログを送っているけど、AIR を使えばローカルファイルに保存したりも簡単にできる。べんり。</p>
<p>さあこれからは trace() よりも mx.logging.* を使おう。</p>
]]></content:encoded>
			<wfw:commentRss>http://nariyu.playwell.jp/2009/05/flex-trace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
