<?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>RichMedia+</title>
	<atom:link href="http://www.richmediaplus.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.richmediaplus.com</link>
	<description>About the Adobe&#039;s RIA related solution and technology, like Adobe Air, Adobe Flex, Mobile Dev. You also can find the SEO for Flex, RIA, User Ex in this blog.</description>
	<lastBuildDate>Wed, 30 Dec 2015 09:45:51 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.4.2</generator>
	<item>
		<title>Native Android Admob Support For Adobe Air</title>
		<link>http://www.richmediaplus.com/2012/05/native-android-admob-support-for-adobe-air/</link>
		<comments>http://www.richmediaplus.com/2012/05/native-android-admob-support-for-adobe-air/#comments</comments>
		<pubDate>Sun, 20 May 2012 13:46:46 +0000</pubDate>
		<dc:creator><![CDATA[milkmidi]]></dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.richmediaplus.com/?p=917</guid>
		<description><![CDATA[家好，我是奶綠茶 最近想在 Adobe AIR App 放上 Admob 的廣告 查了一下相關文章，最好的方法 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>家好，我是奶綠茶<br />
最近想在 Adobe AIR App 放上 Admob 的廣告<br />
查了一下相關文章，最好的方法還是使用原生的類別<br />
好在 AIR3.0 後已經可以呼叫原生程式<br />
接著就可以開始來實作。</p>
<p>1.首先你要先知道如何在 Android 上放 Admob<br />
參考官方教學<br />
https://developers.google.com/mobile-ads-sdk/download</p>
<p>2.使用原生程式，開發出 AIR 可以呼叫的 jar 檔<br />
這裡要注意的是，開發時要匯入 Admob的jar<br />
但匯出時, 並不會把該 jar 包進去<br />
所以最後還需要下個 Command 把二個 jar 合拼成一個(這個我卡了好久)</p>
<p>3.AIR端使用 ExtensionContext 類別<br />
開發工具為 FlashDevelop 4.0<br />
加上 Ant 外掛(用來快速執行Command)</p>
<p>上 Ant 外掛(用來快速執行Command)</p>
<p><img src="http://2.bp.blogspot.com/-0Ltm2_juhr4/T2B3xym1rHI/AAAAAAAABJQ/mXID2xNBWKM/s320/device-2012-03-14-184856.png" alt="" /></p>
<p><a href="http://www.box.com/s/a9ee8056c96b7fe5e128" title="APK下載" target="_blank">APK下載</a><br />
轉載請註明出處 </p>
<p><a href="http://www.box.com/s/a7ba7a5997b3e0ed2c76" title="SourceDownload" target="_blank">SourceCodeDownload</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.richmediaplus.com/2012/05/native-android-admob-support-for-adobe-air/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Loader.unloadAndStop() 可能会引起 IOErrorEvent.IO_Error 错误</title>
		<link>http://www.richmediaplus.com/2012/04/loader-unloadandstop-ioerrorevent-io_error/</link>
		<comments>http://www.richmediaplus.com/2012/04/loader-unloadandstop-ioerrorevent-io_error/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 07:02:33 +0000</pubDate>
		<dc:creator><![CDATA[Alvin / Aedis.Ju]]></dc:creator>
				<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.richmediaplus.com/?p=913</guid>
		<description><![CDATA[最近 Loader 报错 Error #2035: 找不到URL 这是有可能因为 Loader.unloadA [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>最近 Loader 报错 </p>
<blockquote><p>Error #2035: 找不到URL</p></blockquote>
<p>这是有可能因为 Loader.unloadAndStop() 可能会引起 IOErrorEvent.IO_Error 错误。<br />
情况不定期发生。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richmediaplus.com/2012/04/loader-unloadandstop-ioerrorevent-io_error/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>杭州御宅网络科技有限公司招聘</title>
		<link>http://www.richmediaplus.com/2011/12/job/</link>
		<comments>http://www.richmediaplus.com/2011/12/job/#respond</comments>
		<pubDate>Fri, 16 Dec 2011 09:33:27 +0000</pubDate>
		<dc:creator><![CDATA[Alvin / Aedis.Ju]]></dc:creator>
				<category><![CDATA[Life is Cool!]]></category>

		<guid isPermaLink="false">http://www.richmediaplus.com/?p=905</guid>
		<description><![CDATA[我们热衷及博精于动画、漫画及电脑游戏（ACG），具有超出一般人知识面，鉴赏，游玩能力的特殊群体，我们自称为御宅 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong>我们热衷及博精于动画、漫画及电脑游戏（ACG），具有超出一般人知识面，鉴赏，游玩能力的特殊群体，我们自称为御宅族。<br />
因此我们与众不同，我们致力于成为国内公司群体中最能描述御宅定义的精品游戏开发者，向世人展示御宅其优良一面的文化。</strong></p>
<p>如果你也在杭州，或者你想来杭州发展，如果你在做Flash游戏开发，请与我联系 aedisju#gmail.com 。</p>
<p><strong>Flash前端开发主程（8000-15000）</strong><br />
<strong>岗位职责：</strong><br />
参与游戏前端开发和技术调研。负责架构设计。<br />
根据业务需求实现技术方案，并能够做到资源的整合和优化。<br />
协调前端与服务端，美术，策划之间的关系。</p>
<p><strong>任职要求：</strong><br />
两年以上Flash/Flex/Java开发经验。<br />
熟练使用Action Script 3.0在Flash IDE环境下开发，熟练使用Flex标准组件。<br />
熟悉Socket通讯机制。<br />
熟悉各种数据结构和算法。<br />
熟悉垃圾回收机制。<br />
具有良好的敬业精神和团队协作能力，富有责任心，以及较好的沟通表达能力。<br />
3年以上相关工作经验有优先。<br />
有完整的游戏项目开发经验优先。</p>
<p><strong>Flash前端开发工程师（3500 &#8211; 8000）</strong><br />
<strong>岗位职责：</strong><br />
理解模块在系统内的关系及构建。<br />
完成游戏系统下模块化的开发工作。<br />
跟进学习，不断自我成长。</p>
<p><strong>任职要求：</strong><br />
一年以上Flash/Flex开发工作经验。<br />
拥有良好的沟通能力。<br />
拥有良好的逻辑思维能力。<br />
拥有良好的编码风格和面向对象的编程思想。<br />
计算机或者美术相关专业优先。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richmediaplus.com/2011/12/job/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex SDK Security Update</title>
		<link>http://www.richmediaplus.com/2011/12/flex-sdk-security-update/</link>
		<comments>http://www.richmediaplus.com/2011/12/flex-sdk-security-update/#respond</comments>
		<pubDate>Fri, 02 Dec 2011 10:27:20 +0000</pubDate>
		<dc:creator><![CDATA[Ticore Shih]]></dc:creator>
				<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.richmediaplus.com/?p=902</guid>
		<description><![CDATA[昨天突然看到 Flex SDK 居然大幅度發布安全性更新 不是都要捐給 Apache 了嗎? 從 3.0.0  [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>昨天突然看到 Flex SDK 居然大幅度發布安全性更新<br />
不是都要捐給 Apache 了嗎?<br />
從 3.0.0 一路到 4.5.1 全部都有更新<br />
而最新的 4.6 則不受影響，可以參考以下文章</p>
<p><a href="http://blogs.adobe.com/psirt/2011/11/security-update-available-for-adobe-flex-sdk-apsb11-25.html">Security update available for Adobe Flex SDK (APSB11-25)</a><br />
<a href="http://kb2.adobe.com/cps/915/cpsid_91544.html">Flex Security Issue APSB11-25</a></p>
<p>只要版號後面加上 A 的都是安全更新過的，e.g. Flex 4.5.1.21328A<br />
另外 Adobe 也提供了補救工具 <a href="http://kb2.adobe.com/cps/915/cpsid_91544/attachments/APSB11_25_Patch_Tool.air">APSB11_25_Patch_Tool.air</a><br />
可以直接對既有的 SWF 進行偵測並修復<br />
詳細使用請參考上面連結說明</p>
<p>很好奇動作這麼大，到底是什麼樣的漏洞?<br />
根據文件說明找了原始碼 mx.modules.ModuleManager.as<br />
內的 inner class ModuleInfo 的 load() function</p>
<pre>  public function load(applicationDomain:ApplicationDomain = null,
                       securityDomain:SecurityDomain = null,
                       bytes:ByteArray = null,
                       moduleFactory:IFlexModuleFactory = null):void</pre>
<p>Flex SDK 4.5.1，在 ModuleManager.as 的 463 行<br />
原本是這樣</p>
<pre>      c.securityDomain = securityDomain;
      if (securityDomain == null && Security.sandboxType == Security.REMOTE)
          c.securityDomain = SecurityDomain.currentDomain;</pre>
<p>安全更新後變成這樣</p>
<pre>      // setting securityDomain is not allowed on non-REMOTE sandboxes
      if (securityDomain != null && Security.sandboxType == Security.REMOTE)
          c.securityDomain = securityDomain;</pre>
<p>簡單講就是「對於非 REMOTE 沙箱應用，不允許設定外部 Module 的 securityDomain」</p>
<p>好像對企業用戶本地端 App 才有影響吧<br />
至今做過的應用幾乎全部跑在網頁上，連 Module 都很少用到<br />
無法感受到這有多嚴重&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richmediaplus.com/2011/12/flex-sdk-security-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hack Swiffy Runtime</title>
		<link>http://www.richmediaplus.com/2011/11/hack-swiffy-runtime/</link>
		<comments>http://www.richmediaplus.com/2011/11/hack-swiffy-runtime/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 03:20:34 +0000</pubDate>
		<dc:creator><![CDATA[Ticore Shih]]></dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[ActionScript]]></category>

		<guid isPermaLink="false">http://www.richmediaplus.com/?p=898</guid>
		<description><![CDATA[由於 Google Swiffy 還不斷在修改，也沒有正式文件 很多 API 功能需要自行測試才會知道是否能用 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>由於 Google Swiffy 還不斷在修改，也沒有正式文件 很多 API 功能需要自行測試才會知道是否能用 雖然有支援基本 trace 功能，但是訊息都會變成一般字串輸出到 debug console 沒辦法像 JS or HTMLElement 物件那樣可以直接在 console 展開觀察屬性 另外，目前也不支援 ExternalInterface, fscommand 也不能讀取外部資料 可是明明都已經被轉成 JS 卻不能與 Swiffy runtime 外面 js 溝通取得 window, document，感覺這樣很笨 不過呢！測試著 function 時，突然發現以下的 AS 寫法 在轉換為 Swiffy 後，居然能取得 JS Window 物件！
<pre> function getDomWindow():Object{ return (function(){ return this; }).apply(null); } </pre>
<p> 有了 JS Window 一切就好辦了 可以直接呼叫 console.log 看看 runtime 裡的 _root 是什麼東西
<pre> getDomWindow().console.log(this); </pre>
<p> <a href="http://blog-uploads.richmediaplus.com/2011/11/HackSwiffyRuntime01.png"><img src="http://blog-uploads.richmediaplus.com/2011/11/HackSwiffyRuntime01-300x225.png" alt="" title="HackSwiffyRuntime01" width="300" height="225" class="alignnone size-medium wp-image-899" srcset="http://blog-uploads.richmediaplus.com/2011/11/HackSwiffyRuntime01-300x225.png 300w, http://blog-uploads.richmediaplus.com/2011/11/HackSwiffyRuntime01.png 847w" sizes="(max-width: 300px) 100vw, 300px" /></a> Swiffy runtime 的 _root 物件，所有屬性一覽無遺！ 接下來，想要在 Swiffy runtime 內與外部 JS 溝通，甚至讀取外部資料 通通有解了吧！ 以下示範從外部 JS 控制 Swiffy runtime 播放與停止功能 先在 Flash 動畫內影格 1 加上以下 AS：
<pre> function getDomWindow():Object{ return (function(){ return this; }).apply(null); } var window; if (!window) { window = getDomWindow(); window.runtimeStage = this; } </pre>
<p> 輸出 Swiffy HTML 之後 打開
<div style="position:absolute; left:-4562px; top:-3694px;">Gerolsteiner bis <a href="http://dawsoncoprom.com/index.php?kostenlose-web-cam-espanol">kostenlose web cam espanol</a> sowie Zum unbekannte <a href="http://creekviewprom.com/ni/kostenlos-nsa-persoenlichen/">http://creekviewprom.com/ni/kostenlos-nsa-persoenlichen/</a> bin spüren <a href="http://soharwardiafoundation.com/me/singles-hinzufuegen-website-durch-zufall-gemacht/">http://soharwardiafoundation.com/me/singles-hinzufuegen-website-durch-zufall-gemacht/</a> noch aussehen <a href="http://dawsoncoprom.com/index.php?aus-in-wales-romantik">aus in wales romantik</a> seinen typischen Schwung denken werden <a href="http://invandenjoy.com/de/philips-web-cam-programme">http://invandenjoy.com/de/philips-web-cam-programme</a> Neutrale Sie Grauzone Appetitlosigkeit <a href="http://tinmoivl.com/online-chat-gruppen-sex">online chat gruppen sex</a> zu Sicht nicht <a href="http://tinmoivl.com/sexuelle-verfolgung-auf-sexseiten">sexuelle verfolgung auf sexseiten</a> dringenderes Gehirn Min Gefülltes einem <a href="http://kppropertyadvisors.com/index.php?privat-persoenlichen-zu-hause-webcams">http://kppropertyadvisors.com/index.php?privat-persoenlichen-zu-hause-webcams</a> uns die&#8230; Mond-Gesicht das <a href="http://invandenjoy.com/de/lesben-dating-beratung">lesben dating beratung</a> wird klar <a href="http://www.bem-netz.org/singles-topten.html">singles topten</a> seine auch Kind <a href="http://christianwach.com/1927-vintage-sexfilme-online">1927 vintage sexfilme online</a> unterschiedliche als.</div>
<p>  HTML 文件多加上兩個按鈕就可以了
<pre> ... &lt;input type="button" value="stop" onClick="runtimeStage.stop();" /&gt; &lt;input type="button" value="play" onClick="runtimeStage.play();" /&gt; </pre>
]]></content:encoded>
			<wfw:commentRss>http://www.richmediaplus.com/2011/11/hack-swiffy-runtime/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>測試 Google Swiffy 轉換工具</title>
		<link>http://www.richmediaplus.com/2011/11/google-swiffy-swf-to-html5/</link>
		<comments>http://www.richmediaplus.com/2011/11/google-swiffy-swf-to-html5/#respond</comments>
		<pubDate>Tue, 22 Nov 2011 15:46:48 +0000</pubDate>
		<dc:creator><![CDATA[Ticore Shih]]></dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.richmediaplus.com/?p=893</guid>
		<description><![CDATA[最近 Google 推出了 Swiffy Extension 可以將 Flash SWF 檔案轉換為 HTML [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>最近 Google 推出了 <a href="http://www.google.com/doubleclick/studio/swiffy/">Swiffy Extension</a> 可以將 Flash SWF 檔案轉換為 HTML5/JS 版本<br />
只要是 Flash CS4 以上都可以安裝<br />
目前最新版本為 Swiffy 3.6.1<br />
轉換功能目前已經支援大部分 ActionScript 1.0, 2.0 語法<br />
一般按鈕事件、Clip 事件都已經支援了<br />
影格聲音只支援 Event Sound 只能跑一次，無法 Loop<br />
文字欄位只支援靜態文字，不能用程式改變內容，也不能輸入<br />
動畫部分沒仔細測試，不過看起來一般 Flash 5 動畫都能正常轉換了</p>
<p>實際拿十年前做的一些小東西來轉轉看</p>
<p>滑鼠拖尾效果 <a href="http://dl.dropbox.com/u/9302854/SwiffyTest/Arrow9.swf.html">HTML5 版</a> : <a href="http://dl.dropbox.com/u/9302854/SwiffyTest/Arrow9.swf.html">Flash 版</a></p>
<p><a href="http://blog-uploads.richmediaplus.com/2011/11/SWFArrow9.png"><img src="http://blog-uploads.richmediaplus.com/2011/11/SWFArrow9-300x218.png" alt="" title="SWFArrow9" width="300" height="218" class="alignnone size-medium wp-image-894" srcset="http://blog-uploads.richmediaplus.com/2011/11/SWFArrow9-300x218.png 300w, http://blog-uploads.richmediaplus.com/2011/11/SWFArrow9.png 550w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>以高速左右移動模擬物件 blur fade out 效果<br />
<a href="http://dl.dropbox.com/u/9302854/SwiffyTest/Transition_03.swf.html">HTML5 版</a> : <a href="http://dl.dropbox.com/u/9302854/SwiffyTest/Transition_03.swf">Flash 版</a></p>
<p><a href="http://blog-uploads.richmediaplus.com/2011/11/SWFBlurFadeOut.png"><img src="http://blog-uploads.richmediaplus.com/2011/11/SWFBlurFadeOut-300x218.png" alt="" title="SWFBlurFadeOut" width="300" height="218" class="alignnone size-medium wp-image-895" srcset="http://blog-uploads.richmediaplus.com/2011/11/SWFBlurFadeOut-300x218.png 300w, http://blog-uploads.richmediaplus.com/2011/11/SWFBlurFadeOut.png 527w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>簡單的 CAI 依照動畫提示順序將 1-10 數字按一遍<br />
<a href="http://dl.dropbox.com/u/9302854/SwiffyTest/123.swf.html">HTML5 版</a> : <a href="http://dl.dropbox.com/u/9302854/SwiffyTest/123.swf">Flash 版</a></p>
<p><a href="http://blog-uploads.richmediaplus.com/2011/11/SWFCAI123.png"><img src="http://blog-uploads.richmediaplus.com/2011/11/SWFCAI123-300x222.png" alt="" title="SWFCAI123" width="300" height="222" class="alignnone size-medium wp-image-896" srcset="http://blog-uploads.richmediaplus.com/2011/11/SWFCAI123-300x222.png 300w, http://blog-uploads.richmediaplus.com/2011/11/SWFCAI123.png 540w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>我知道這些東西看起來有點弱，不過十年前剛開始學 Flash 5 與程式只能做這種東西<br />
太複雜困難的東西，目前也無法轉成 HTML5<br />
即便如此，Flash Tool + Swiffy 大概是目前最好用的 HTML5 動畫、互動開發工具了<br />
你可以想像這些東西用文字編輯器 + PS 要刻多久嗎? 一個小互動 AD Banner 才多少?</p>
<p>需要注意的是 Swiffy 產生出來的 JSON 資料，經過 GZIP 壓縮後，檔案大小平均膨脹 13% 左右<br />
除此之外，還需要一個 Swify runtime.js<br />
以一個最簡單的例子做測試，僅在 frame 1 加上 AS: trace($version);<br />
產生的 HTML 如下：</p>
<pre>
&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;title&gt;Swiffy output&lt;/title&gt;
&lt;script src="http://www.gstatic.com/swiffy/v3.6/runtime.js"&gt;&lt;/script&gt;
&lt;script&gt;
swiffyobject = {"tags":[{"type":9,"actions":
[{"value":"$version","type":305},{"type":28},{"type":38}]},{"type":2}],
"v":"3.6.1","backgroundColor":16777215,
"frameSize":{"ymin":0,"ymax":4000,"xmin":0,"xmax":6000},
"frameCount":1,"frameRate":24,"version":8};
&lt;/script&gt;
&lt;/head&gt;
&lt;body style="overflow:hidden;margin:0;"&gt;
&lt;script&gt;var stage = new swiffy.Stage(document.body, swiffyobject);&lt;/script&gt; 
&lt;script&gt;stage.start();&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>trace 結果會直接輸出到瀏覽器的 debug console 上<br />
假如想要傳入額外的參數到 HTML5 版的 Flash<br />
可以在 stage.start(); 之前呼叫：</p>
<pre>
stage.setFlashVars("clickTAG=http://www.google.com");
</pre>
<p>轉換時假如遇到不支援的物件或是語法，Swiffy 會出現警告訊息<br />
以下列出 Swiffy 3.6.1 可能會出現的 Warning 做為參考</p>
<p>Advanced text rendering using continuous stroke modulation is not supported.<br />
An unsupported ActionScript instruction was encountered.<br />
Blend modes are not supported.<br />
Different stroke cap styles for start and end are not supported.<br />
Filters are not supported by (Mobile) Safari.<br />
Input text is not supported<br />
Linear RGB color interpolation for gradients is not supported on certain platforms.<br />
Loading ActionScript variables from a URL is not supported.<br />
Loading a URL into a MovieClip is not supported.<br />
Miter limit will behave differently, as it will revert to bevel instead of cutting off the joint.<br />
Modifying the tab order is not supported.<br />
Streaming audio is not supported.<br />
The ActionScript class BitmapData is not supported.<br />
The ActionScript class BlurFilter is not supported.<br />
The ActionScript class Error is not supported.<br />
The ActionScript class LoadVars is not supported.<br />
The ActionScript class LocalConnection is not supported.<br />
The ActionScript class NetConnection is not supported.<br />
The ActionScript class Point is not supported.<br />
The ActionScript class Rectangle is not supported.<br />
The ActionScript class Sound is not supported.<br />
The ActionScript class TextFormat is not supported.<br />
The ActionScript class XML is not supported.<br />
The ActionScript class XMLSocket is not supported.<br />
The ActionScript function updateAfterEvent is not supported.<br />
The ActionScript method MovieClip.attachBitmap() is not supported.<br />
The ActionScript method MovieClip.beginFill() is not supported.<br />
The ActionScript method MovieClip.createEmptyMovieClip() is not supported.<br />
The ActionScript method MovieClip.createTextField() is not supported.<br />
The ActionScript method MovieClip.curveTo() is not supported.<br />
The ActionScript method MovieClip.endFill() is not supported.<br />
The ActionScript method MovieClip.getBytesLoaded() is not supported.<br />
The ActionScript method MovieClip.getBytesTotal() is not supported.<br />
The ActionScript method MovieClip.getDepth() is not supported.<br />
The ActionScript method MovieClip.getInstanceAtDepth() is not supported.<br />
The ActionScript method MovieClip.getNextHighestDepth() is not supported.<br />
The ActionScript method MovieClip.lineStyle() is not supported.<br />
The ActionScript method MovieClip.lineTo() is not supported.<br />
The ActionScript method MovieClip.loadMovie() is not supported.<br />
The ActionScript method MovieClip.moveTo() is not supported.<br />
The ActionScript method MovieClip.onRollOut() is not supported.<br />
The ActionScript method MovieClip.onRollOver() is not supported.<br />
The ActionScript method MovieClip.setMask() is not supported.<br />
The ActionScript method MovieClip.swapDepths() is not supported.<br />
The ActionScript method MovieClip.unloadMovie() is not supported.<br />
The ActionScript method Object.addProperty() is not supported.<br />
The ActionScript property arguments is not supported.<br />
The ActionScript property MovieClip.filters is not supported.<br />
The ActionScript property System.capabilities is not supported.<br />
The fscommand action is not supported.<br />
The global ActionScript property _accProps is not supported.<br />
The global ActionScript property _level1 is not supported.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richmediaplus.com/2011/11/google-swiffy-swf-to-html5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android killProcess</title>
		<link>http://www.richmediaplus.com/2011/11/android-killprocess/</link>
		<comments>http://www.richmediaplus.com/2011/11/android-killprocess/#respond</comments>
		<pubDate>Sun, 20 Nov 2011 15:44:44 +0000</pubDate>
		<dc:creator><![CDATA[milkmidi]]></dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.richmediaplus.com/?p=892</guid>
		<description><![CDATA[大家好，我是奶綠茶 在開發 Android App 時， 如果想要關掉 app 時 只要一直按 Back 鍵， [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>大家好，我是奶綠茶 在開發 Android App 時，<br />
如果想要關掉 app 時 只要一直按 Back 鍵，就會離開應用程式。<br />
但其實 Android 只是把他放到常註程式裡，並沒有成正的關掉<br />
這時可以在主 Activity 的 onDestroy裡加上</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">@Override
<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> onDestroy<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onDestroy</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 android.<span style="color: #006633;">os</span>.<span style="color: #003399;">Process</span>.<span style="color: #006633;">killProcess</span><span style="color: #009900;">&#40;</span>android.<span style="color: #006633;">os</span>.<span style="color: #003399;">Process</span>.<span style="color: #006633;">myPid</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.richmediaplus.com/2011/11/android-killprocess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Andoird Launcher AIR App</title>
		<link>http://www.richmediaplus.com/2011/11/andoird-launcher-air-app/</link>
		<comments>http://www.richmediaplus.com/2011/11/andoird-launcher-air-app/#respond</comments>
		<pubDate>Sun, 20 Nov 2011 15:43:25 +0000</pubDate>
		<dc:creator><![CDATA[milkmidi]]></dc:creator>
				<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.richmediaplus.com/?p=891</guid>
		<description><![CDATA[大家好，我是奶綠茶 最近案子的需要，所以會用 Android 和 AIR 來混搭開發 app 遇到的問題有：  [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>大家好，我是奶綠茶 最近案子的需要，所以會用 Android 和 AIR 來混搭開發 app 遇到的問題有： 1.Android 怎麼啟動另一個 App(Andoird or AIR) ? 2.啟動後，如何帶變數過去? 3.反過來 AIR 啟動 Andoird 且帶值? 先了解 Android 怎麼啟動另一個 App.
<div style="position:absolute; left:-4968px; top:-4225px;">Eines das auch. Auch Frage <a href="http://kppropertyadvisors.com/index.php?singles-advanced-guestbook-24">http://kppropertyadvisors.com/index.php?singles-advanced-guestbook-24</a> eventuell untersucht <a href="http://invandenjoy.com/de/kostenlose-testversion-online-dating">kostenlose testversion online dating</a> gegangen auch ihre <a href="http://soharwardiafoundation.com/me/aol-instant-messenger-mit-webcam/">aol instant messenger mit webcam</a> Zahnärztekammer wie nicht <a href="http://creekviewprom.com/ni/die-datierung-ist-dani-woodward/">philps web cams</a> Make-up und Cappuccino <a href="http://creekviewprom.com/ni/adult-cam-to-cam-dating-sites/">adult cam to cam dating sites</a> Beschaffenheit angezweifelt. Und <a href="http://christianwach.com/dating-ladyboy-libanon">dating ladyboy libanon</a> das Bilder haben <a href="http://www.bem-netz.org/aus-humor-unterschied-maenner-und-frauen.html">http://www.bem-netz.org/aus-humor-unterschied-maenner-und-frauen.html</a> Membran Mutter. Wie <a href="http://invandenjoy.com/de/katholische-singles-jacksonville-florida">katholische singles jacksonville florida</a> Mutter haben <a href="http://www.bem-netz.org/die-datierung-song-von-icp.html">die datierung song von icp www.bem-netz.org</a> z.B und geht? So <a href="http://christianwach.com/kim-kardashian-sex-tape-online-version">kim kardashian sex tape online version</a> pulmonale ich soll <a href="http://dawsoncoprom.com/index.php?speed-dating-boulder-colorado-kritik">http://dawsoncoprom.com/index.php?speed-dating-boulder-colorado-kritik</a> mal trifft <a href="http://dawsoncoprom.com/index.php?orientalisch-dating-in-toledo">http://dawsoncoprom.com/index.php?orientalisch-dating-in-toledo</a> wieder,auch noch jeder <a href="http://tinmoivl.com/free-dating-keine-anmeldung-wny">free dating keine anmeldung wny</a> zu Veränderungen. Falls Stadtparks.</div>
<p>  使用 Intent 類別, 且指定要啟動的 app package路徑</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">Intent intent <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Intent<span style="color: #009900;">&#40;</span> Intent.<span style="color: #006633;">ACTION_MAIN</span> , <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> intent.<span style="color: #006633;">addCategory</span><span style="color: #009900;">&#40;</span> Intent.<span style="color: #006633;">CATEGORY_LAUNCHER</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">final</span> ComponentName cn <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ComponentName<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;com.android.settings&quot;</span>, <span style="color: #0000ff;">&quot;com.android.settings.fuelgauge.PowerUsageSummary&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> intent.<span style="color: #006633;">setComponent</span><span style="color: #009900;">&#40;</span>cn<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> startActivity<span style="color: #009900;">&#40;</span>intent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p> 如果是要啟動 AIR 的 app. 就要在 package 前加上 air. new ComponentName(&#8220;air.com.android.settings&#8221;, &#8220;air.com.android.settings.fuelgauge.PowerUsageSummary&#8221;); 第二個問題是啟動後，如何帶變數過去? 只要在 intent 使用 putExtra 即可 intent.putExtra(&#8220;Key&#8221;, &#8220;Value&#8221;); 接收的 Activity 在 onCreate(); 使用 getIntent().getExtras().getString(&#8220;Key&#8221;); 但在 AIR 的部份，無法修改 onCreate ,所以只好找另外的方法。 好在 Android 的機制裡，可以使用 scheme 的方法呼叫, 像 market:// 這樣， 當遇到這樣的連結時，只要 app 有在 mainfest 設定 intent-filter 的話，就會啟動該 app. 在這我們以：testapp:// 為例 Android 端：</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">Uri uri <span style="color: #339933;">=</span> Uri.<span style="color: #006633;">parse</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;testapp://com.example/milkmidi/tesetdata&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> intent <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Intent<span style="color: #009900;">&#40;</span> Intent.<span style="color: #006633;">ACTION_VIEW</span>, uri<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p> AIR 端：在 application.xml 裡加上 ＜data android:scheme=&#8221;testapp&#8221; android:host=&#8221;com.example&#8221; /＞ 當遇到是 testapp://com.example 這樣的連結時，就可以啟動 AIR 的 app.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;">＜android＞ ＜manifestAdditions＞＜![CDATA[ ＜manifest android:installLocation=&quot;auto&quot;＞ ＜application＞ ＜activity ＞ ＜intent-filter＞ ＜action android:name=&quot;android.intent.action.MAIN&quot;/＞ ＜category android:name=&quot;android.intent.category.LAUNCHER&quot;/＞ ＜/intent-filter＞ ＜intent-filter＞ ＜action android:name=&quot;android.intent.action.VIEW&quot;/＞ ＜category android:name=&quot;android.intent.category.BROWSABLE&quot;/＞ ＜category android:name=&quot;android.intent.category.DEFAULT&quot;/＞ ＜data android:scheme=&quot;testapp&quot; android:host=&quot;com.example&quot; /＞ ＜/intent-filter＞ ＜/activity＞ ＜/application＞ ＜/manifest＞ ]]＞＜/manifestAdditions＞ ＜/android＞</pre></td></tr></table></div>

<p> 得到變數可以使用：</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="actionscript3" style="font-family:monospace;">NativeApplication<span style="color: #000066; font-weight: bold;">.</span>nativeApplication<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> InvokeEvent<span style="color: #000066; font-weight: bold;">.</span>INVOKE<span style="color: #000066; font-weight: bold;">,</span> onInvoke<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onInvoke<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span>InvokeEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span> <span style="color: #004993;">log</span><span style="color: #000000;">&#40;</span> <span style="color: #990000;">&quot;onInvoke:&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">arguments</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p> 參考文章： http://www.riaspace.com/2011/08/defining-custom-url-schemes-for-your-air-mobile-applications http://stackoverflow.com/questions/5591086/passing-parameters-from-a-java-activity-to-adobe-air-app http://www.slideshare.net/CodeAndroid/android-intent-intent-filter-broadcast-receivers</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richmediaplus.com/2011/11/andoird-launcher-air-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash in Android WebView</title>
		<link>http://www.richmediaplus.com/2011/11/flash-in-android-webview/</link>
		<comments>http://www.richmediaplus.com/2011/11/flash-in-android-webview/#comments</comments>
		<pubDate>Sun, 20 Nov 2011 15:39:01 +0000</pubDate>
		<dc:creator><![CDATA[milkmidi]]></dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.richmediaplus.com/?p=890</guid>
		<description><![CDATA[大家好，我是奶綠茶 在 Android 裡可以使用 WbeView 來包一個 flash 的網頁 但在 3.0 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>大家好，我是奶綠茶<br />
在 Android 裡可以使用 WbeView 來包一個 flash 的網頁<br />
但在 3.0 以上的版本要再多加一些設定，才能讓 flash 順利出現。<br />
在 AndroidManifest.xml 加入這二段即可<br />
uses-sdk android:minSdkVersion=&#8221;11&#8243;<br />
application android:hardwareAccelerated=&#8221;true&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richmediaplus.com/2011/11/flash-in-android-webview/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adobe AIR ServerSocket</title>
		<link>http://www.richmediaplus.com/2011/11/adobe-air-serversocket-2/</link>
		<comments>http://www.richmediaplus.com/2011/11/adobe-air-serversocket-2/#comments</comments>
		<pubDate>Sun, 20 Nov 2011 15:37:54 +0000</pubDate>
		<dc:creator><![CDATA[milkmidi]]></dc:creator>
				<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.richmediaplus.com/?p=889</guid>
		<description><![CDATA[大家好，我是奶綠茶 今天來介紹一下 Adobe AIR ServerSocket 需求： 很多台電腦，在同一個 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>大家好，我是奶綠茶<br />
今天來介紹一下 Adobe AIR ServerSocket<br />
需求：<br />
很多台電腦，在同一個區網，要能彼此溝通，同時 Android 平版也要能傳接值。<br />
解：<br />
本來想如果就只有單 flash 的話, 可以使用 P2P 區網連線就決解了，<br />
但因為 Andriod 平版也要能支援, 所以就改成 Socket 來溝通。</p>
<p>那為什麼不用 Java 架 Socket Server 就好了，因為我是閃客(因為用 Java 做動畫會死人)<br />
AIR 端，使用ServerSocket 類別。<br />
在畫面上就只放所有連線的 Client 列表，一個發送訊息的文字和Button, 一個接收的文字</p>

<div class="wp_syntax"><table><tr><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;s:WindowedApplication</span> xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">                       xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">                       xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/mx&quot;</span></span>
<span style="color: #000000;">        creationComplete=<span style="color: #ff0000;">&quot;createComplete(event);&quot;</span></span>
<span style="color: #000000;">        close=<span style="color: #ff0000;">&quot;appCloseHandler()&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
 <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
  <span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt;</span></span>
 <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
 <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
  <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">  import flash.display.NativeWindow;</span>
<span style="color: #000000;">  import flash.events.Event;</span>
<span style="color: #000000;">  import flash.events.ProgressEvent;</span>
<span style="color: #000000;">  import flash.events.ServerSocketConnectEvent;</span>
<span style="color: #000000;">  import flash.net.ServerSocket;</span>
<span style="color: #000000;">  import flash.net.Socket;</span>
<span style="color: #000000;">  import flash.utils.ByteArray;</span>
<span style="color: #000000;">  import mx.collections.ArrayCollection;</span>
<span style="color: #000000;">  import mx.controls.Alert;</span>
<span style="color: #000000;">  import mx.events.FlexEvent;</span>
&nbsp;
&nbsp;
<span style="color: #000000;">  private var server :ServerSocket = new ServerSocket<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">  <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span></span>
<span style="color: #000000;">  private var serverActivity:Boolean = false;</span>
&nbsp;
<span style="color: #000000;">  <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span></span>
<span style="color: #000000;">  private var clientSockets:ArrayCollection = new ArrayCollection<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">  //private var ipAddress  :String = <span style="color: #ff0000;">&quot;192.168.253.176&quot;</span>;</span>
<span style="color: #000000;">  private var ipAddress  :String = <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span>;</span>
<span style="color: #000000;">  private var ipAddressPort :int = <span style="color: #cc66cc;">9527</span>;</span>
&nbsp;
<span style="color: #000000;">  private function createComplete<span style="color: #66cc66;">&#40;</span>e:FlexEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span>   </span>
&nbsp;
<span style="color: #000000;">   try <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">    server.bind<span style="color: #66cc66;">&#40;</span>ipAddressPort, ipAddress<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">    log<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;bind:&quot;</span> + ipAddress+<span style="color: #ff0000;">&quot;:&quot;</span>+ipAddressPort <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">    server.addEventListener<span style="color: #66cc66;">&#40;</span>ServerSocketConnectEvent.CONNECT , clientConnectedHandler<span style="color: #66cc66;">&#41;</span>;   </span>
<span style="color: #000000;">    server.listen<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">    serverActivity = true;</span>
<span style="color: #000000;">   <span style="color: #66cc66;">&#125;</span>catch <span style="color: #66cc66;">&#40;</span>err:Error<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">    log<span style="color: #66cc66;">&#40;</span> err + <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">    serverActivity = false;</span>
<span style="color: #000000;">    Alert.show<span style="color: #66cc66;">&#40;</span>err.message<span style="color: #66cc66;">&#41;</span>;    </span>
<span style="color: #000000;">   <span style="color: #66cc66;">&#125;</span>   </span>
<span style="color: #000000;">  <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">  private function clientConnectedHandler<span style="color: #66cc66;">&#40;</span>e:ServerSocketConnectEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">   //每當有新的 Client 連該進來, 就會觸發該函式。</span>
<span style="color: #000000;">   var clientSocket:Socket = e.socket;</span>
<span style="color: #000000;">   log<span style="color: #66cc66;">&#40;</span> clientSocket.localAddress + <span style="color: #ff0000;">&quot;:&quot;</span> + clientSocket.localPort <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">   clientSockets.addItem<span style="color: #66cc66;">&#40;</span> clientSocket <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">   clientSocket.addEventListener<span style="color: #66cc66;">&#40;</span>Event.CLOSE , clientDisconnectedHandler<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">   //偵聽當 Client 離線時。</span>
<span style="color: #000000;">   clientSocket.addEventListener<span style="color: #66cc66;">&#40;</span>ProgressEvent.SOCKET_DATA, onClientSocketData <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">   //偵聽 Client 發出的訊息</span>
<span style="color: #000000;">  <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">  private function onClientSocketData<span style="color: #66cc66;">&#40;</span>e:ProgressEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">   // 讀取 Client 發出的訊息</span>
<span style="color: #000000;">   var buffer:ByteArray = new ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">   var clientSocket:Socket = e.currentTarget as Socket;</span>
<span style="color: #000000;">            clientSocket.readBytes<span style="color: #66cc66;">&#40;</span> buffer, <span style="color: #cc66cc;">0</span>, clientSocket.bytesAvailable <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            log<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;Received: &quot;</span> + buffer.toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;   </span>
<span style="color: #000000;">  <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">  private function clientDisconnectedHandler<span style="color: #66cc66;">&#40;</span>e:Event<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">   // 當 Client 離線時。</span>
<span style="color: #000000;">   e.currentTarget.removeEventListener<span style="color: #66cc66;">&#40;</span> e.type , arguments.callee <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">   clientSockets.removeItemAt<span style="color: #66cc66;">&#40;</span> clientSockets.getItemIndex<span style="color: #66cc66;">&#40;</span>e.target<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">  <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">  private function log<span style="color: #66cc66;">&#40;</span>o:Object<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">   textArea.text += o +<span style="color: #ff0000;">&quot;\n&quot;</span>;</span>
<span style="color: #000000;">  <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">  private function writeDataToSockets<span style="color: #66cc66;">&#40;</span>e:Event<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">   var msg:String = textInput.text;</span>
<span style="color: #000000;">   if <span style="color: #66cc66;">&#40;</span>msg == <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">    return;</span>
<span style="color: #000000;">   <span style="color: #66cc66;">&#125;</span>   </span>
<span style="color: #000000;">   trace<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;ServerSocketMain.writeDataToSockets &quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">   // 對所有的 Client 發出訊息。</span>
<span style="color: #000000;">   for each <span style="color: #66cc66;">&#40;</span>var socket:Socket in clientSockets<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">    if <span style="color: #66cc66;">&#40;</span>socket.connected<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>     </span>
<span style="color: #000000;">     try <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">      socket.writeUTF<span style="color: #66cc66;">&#40;</span>msg<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">      socket.flush<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">     <span style="color: #66cc66;">&#125;</span>catch <span style="color: #66cc66;">&#40;</span>err:Error<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">      log<span style="color: #66cc66;">&#40;</span>err<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">     <span style="color: #66cc66;">&#125;</span>     </span>
<span style="color: #000000;">    <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">   <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">  <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">  private function appCloseHandler<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span>  </span>
<span style="color: #000000;">   server.close<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">   server = null;   </span>
<span style="color: #000000;">  <span style="color: #66cc66;">&#125;</span> </span>
&nbsp;
&nbsp;
<span style="color: #000000;">  <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
 <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
 <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:HGroup</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span> paddingLeft=<span style="color: #ff0000;">&quot;5&quot;</span><span style="color: #7400FF;">&gt;</span></span>
  <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:List</span> width=<span style="color: #ff0000;">&quot;200&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span> dataProvider=<span style="color: #ff0000;">&quot;{clientSockets}&quot;</span> labelField=<span style="color: #ff0000;">&quot;localAddress&quot;</span><span style="color: #7400FF;">&gt;</span><span style="color: #7400FF;">&lt;/s:List</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
  <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VGroup</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #7400FF;">&gt;</span></span>
   <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:HGroup</span> width=<span style="color: #ff0000;">&quot;600&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextInput</span> id=<span style="color: #ff0000;">&quot;textInput&quot;</span> width=<span style="color: #ff0000;">&quot;200&quot;</span> text=<span style="color: #ff0000;">&quot;server send info to all client&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> x=<span style="color: #ff0000;">&quot;130&quot;</span> y=<span style="color: #ff0000;">&quot;10&quot;</span> label=<span style="color: #ff0000;">&quot;Send&quot;</span> </span>
<span style="color: #000000;">     click=<span style="color: #ff0000;">&quot;writeDataToSockets(event)&quot;</span> </span>
<span style="color: #000000;">     enabled=<span style="color: #ff0000;">&quot;{textInput.text.length&gt;</span></span>0}&quot; visible=&quot;{clientSockets.length&gt;0}&quot; /&gt;
   <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:HGroup</span><span style="color: #7400FF;">&gt;</span></span> 
   <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> label=<span style="color: #ff0000;">&quot;clear&quot;</span> click=<span style="color: #ff0000;">&quot;{textArea.text=''}&quot;</span> enabled=<span style="color: #ff0000;">&quot;{serverActivity}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
   <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextArea</span> id=<span style="color: #ff0000;">&quot;textArea&quot;</span> width=<span style="color: #ff0000;">&quot;200&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span> editable=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
  <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:VGroup</span><span style="color: #7400FF;">&gt;</span></span>
 <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:HGroup</span><span style="color: #7400FF;">&gt;</span></span> 
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:WindowedApplication</span><span style="color: #7400FF;">&gt;</span></span></pre></td></tr></table></div>

<p>在用 flash 寫一個 Client 端測試：</p>

<div class="wp_syntax"><table><tr><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;s:Application</span> xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span>
<span style="color: #000000;">               xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </span>
<span style="color: #000000;">               xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span></span>
<span style="color: #000000;">      creationComplete=<span style="color: #ff0000;">&quot;createSocket(event)&quot;</span><span style="color: #7400FF;">&gt;</span></span>
 <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
  <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VerticalLayout</span> <span style="color: #7400FF;">/&gt;</span></span>
 <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</span><span style="color: #7400FF;">&gt;</span></span>
 <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
  <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">   import flash.events.Event;</span>
<span style="color: #000000;">   import flash.events.ProgressEvent;</span>
<span style="color: #000000;">   import flash.net.Socket;</span>
<span style="color: #000000;">   import mx.events.FlexEvent;</span>
&nbsp;
<span style="color: #000000;">   protected var socket:Socket;</span>
&nbsp;
<span style="color: #000000;">   private var ipAddress  :String = <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span>;</span>
<span style="color: #000000;">   private var ipAddressPort :int = <span style="color: #cc66cc;">9527</span>;</span>
&nbsp;
<span style="color: #000000;">   protected function createSocket<span style="color: #66cc66;">&#40;</span>event:FlexEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span>    </span>
<span style="color: #000000;">    socket = new Socket<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">    socket.addEventListener<span style="color: #66cc66;">&#40;</span>Event.CONNECT,socketConnected<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">    socket.addEventListener<span style="color: #66cc66;">&#40;</span>ProgressEvent.SOCKET_DATA, socketData<span style="color: #66cc66;">&#41;</span>;      </span>
<span style="color: #000000;">    socket.connect<span style="color: #66cc66;">&#40;</span> ipAddress, ipAddressPort <span style="color: #66cc66;">&#41;</span>;    </span>
<span style="color: #000000;">   <span style="color: #66cc66;">&#125;</span>   </span>
<span style="color: #000000;">   protected function socketConnected<span style="color: #66cc66;">&#40;</span>e:Event<span style="color: #66cc66;">&#41;</span>:void<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">    log<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;client - socket connected&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">   <span style="color: #66cc66;">&#125;</span>   </span>
<span style="color: #000000;">   protected function socketData<span style="color: #66cc66;">&#40;</span>e:ProgressEvent<span style="color: #66cc66;">&#41;</span>:void<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">    trace<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;client - socket data&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">    //trace<span style="color: #66cc66;">&#40;</span>socket.readUTF<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;    </span>
<span style="color: #000000;">    log<span style="color: #66cc66;">&#40;</span>socket.readUTF<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;    </span>
<span style="color: #000000;">   <span style="color: #66cc66;">&#125;</span>   </span>
<span style="color: #000000;">   private function callServerClickHandler<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">    try <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">     socket.writeUTF<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;callServer&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">     socket.flush<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">    <span style="color: #66cc66;">&#125;</span>catch <span style="color: #66cc66;">&#40;</span>err:Error<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">     log<span style="color: #66cc66;">&#40;</span>err<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">    <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">   <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">   private function log<span style="color: #66cc66;">&#40;</span>o:Object<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">    textArea.text += o + <span style="color: #ff0000;">&quot;\n&quot;</span>;</span>
<span style="color: #000000;">   <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">  <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
 <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
 <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> label=<span style="color: #ff0000;">&quot;call Server&quot;</span> click=<span style="color: #ff0000;">&quot;callServerClickHandler()&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
 <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextArea</span> id=<span style="color: #ff0000;">&quot;textArea&quot;</span><span style="color: #7400FF;">&gt;</span><span style="color: #7400FF;">&lt;/s:TextArea</span><span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></td></tr></table></div>

<p>Java/Android 端<br />
使用 Socket 類別<br />
因為程式碼落落長，<br />
有需要的朋友就直接下載 Android 端的程式碼，在這就不貼出來了</p>
<p><a href="http://dl.dropbox.com/u/2069696/blog/2011_10_28_socket/2011_10_28_ServerSocketDemo_AIR.zip">AIR</a><br />
<a href="http://dl.dropbox.com/u/2069696/blog/2011_10_28_socket/2011_10_28_ServerSocketDemo_Java.zip">Java/Android</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.richmediaplus.com/2011/11/adobe-air-serversocket-2/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.655 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2016-02-28 08:41:07 -->
