顯示具有 AS3 標籤的文章。 顯示所有文章
顯示具有 AS3 標籤的文章。 顯示所有文章

2010年11月17日 星期三

Text to Speech Bug Fix in Chrome / IE / Safari

當 Flash 使用 google translate API - "http://translate.google.com/translate_tts" 時, 如果用 FireFox 以外的Browser 會有 Proxy 問題, 導致讀取 "http://translate.google.com/translate_tts"時, 變了 404 Error
在 Flash run in browser 時會拋出 Stream Error #2032

解決方法:
開一個 php File (translate.php), 寫以下 Code,
$url = $_POST["url"];
$content = file_get_contents($url);
echo $content;


AS3:
var url:String="http://translate.google.com/translate_tts?tl=en&" + "q=" +encodeURI(_input.text);
req = new URLRequest(url);           
var urlRequest:URLRequest = new URLRequest("translate.php");
var urlLoader:URLLoader = new URLLoader();
var urlVars:URLVariables = new URLVariables();
urlVars.url = url;
urlRequest.data = urlVars;
urlRequest.method = URLRequestMethod.POST;
         
snd = new Sound();
snd.addEventListener(Event.COMPLETE, onComplete);
snd.addEventListener(IOErrorEvent.IO_ERROR, onIOError);

// 讀取 php 從Google取回來的Sound Data
snd.load(urlRequest);




参考:
http://blog.onebyonedesign.com/actionscript/googles-text-to-speech-engine-in-flash/

2010年5月26日 星期三

多人連線 Flash 遊戲伺服器: SmartFoxServer

SmartFoxServer是相當強大的多人伺服器,以Flash Socket為基礎,可實現多人應用程式及MMO Game,由於是Java base開發,在Windows、Linux及MacOS都可運行,而且client端支援AS1、AS2、AS3語法,專業版還能跨防火牆,功能相當強 大。

還提供完整的 Server side package 及 Client side API, 不需要重寫 server side code, 就可以輕鬆完成多玩家遊戲

BlueBox: 讓玩家避開網絡限制(防火牆, 代理) 來進行多玩家遊戲,而不犧牲連接速度. 因為API 會自動在”幕後“選擇最好的連接系統.    

RedBox:  免費開源的附加軟件,使在SmartFoxServer的框架中集成了音頻/視頻流的能力, 並簡化了A/V應用的開發難度. 

官方首頁:http://www.smartfoxserver.com/

2010年5月4日 星期二

Written Javascript like as flash action script

HTML5 javascript API for developing Web and Mobile Application such as iPhone web apps. The use of API is like flash programming (as3).

The API Code in MIT License, written by me~~~:
http://code.google.com/p/keylib-js-to-as3/

Examples are avaliable too.

2010年1月28日 星期四

Blender AS3 Library

由 Papervision3D 的 core developer Tim Knip 寫成的 AS3Blender Library - 可以讓 Blender export 出來的 .blend file 直接給 Flash 使用
它 使用 Embed 的方法, 再call 一個 blend file parser 就可以 load 3D model to flash.

Details:
http://drawlogic.com/2010/01/27/asblender-library-to-use-blender-files-directly-in-flash/

2010年1月16日 星期六

AS3 Event.Added 與 MovieClip goto Frame 之錯誤使用

最近打算自己整一個 ScrollPane
用了 Event.ADDED & Event.REMOVED 來計算最新的高度
在 ScrollPane中, 有 MovieClip 的物件
當我在 MovieClip 上使用 gotoAndStop(2), 發現了會 dispatch Added & Removed Event
一陣子研究之下, 發現原來 當 MovieClip change frame 時 timeline frame 入面的東西
也會不斷 add & remove

範例:


Source

2010年1月1日 星期五

2010虎年快樂!!!

送個Effect給大家, 點點Pixel砌出來的中文字

//首先創造一個文字
var tf:TextField = new TextField();
tf.text = "Hello World";

//之後再打散成BitmapData
var bd:BitmapData = new BitmapData(tf.width, tf.height, false, 0xF2D8FF);
bd.draw(tf);

//每一點進行運算
for (var i:int = 0; i < bd.width; i++)
{
   for (var j:int = 0; j < bd.height; j++)
   {
        // 創造任何東西都可以啦 
   }
}



Source

2009年12月20日 星期日

MinimalComps: Minimal AS3 UI Component Set

MinimalComps 是一個小型,輕便的介面元件
完全係純AS3 code, 不像 Flash IDE 的元件那麼消耗資源
好處是不用重新寫一個  Button, Slider 之類麻煩元件
用來做一個簡單的範例作測試是最好不過

轉載範例:
CheckBox, PushButton, HSlider, VSlider, InputText, ProgressBar, RadioButton, ColorChooser (text input only) and Panel.


Meet the Meter, Rotary Selector, and Indicator Light

Google Code Source:
http://code.google.com/p/minimalcomps/

You can download the source here:
http://www.bit-101.com/minimalcomps/

轉載自:
http://www.bit-101.com/blog/?p=1126
http://www.bit-101.com/blog/?p=1217 

2009年12月16日 星期三

在Flash上使用 Text to Speech

1.) 使用 Google Text to Speech 實例 (只限英文):


外部連接 URL
var url:String = "http://translate.google.com/translate_tts?tl=en&q=";

參考自: http://wonderfl.net/code/889012d47932563048d9273c899485cf1961e468

2.) 日文語音發聲引擎實例:


 外部連接 URL
var url:String = "http://api.satoru.net/text2voice/?text=";

參考自: http://wonderfl.net/code/4fd4e48c6017d08c887bb0ad8804db2cb9f59ebb

2009年12月13日 星期日

一個webcam 多個program 共用

最近做一個Research Project 關於 Motion Tracking.
用到 OpenCV 做計算部份, 介面就是用到 Flash.
問題來了, 當同時用到同一個 webcam 時, 開啟不能 !!!!! OMG
因為 Driver 不支援
所以在網上找了一個Software 可以令多個 Program 都可以使用一個webcam

http://www.manycam.com/
這個非常好用
還有預計的 火炎效果, Face Detection, Motion Detection.....etc

2009年12月12日 星期六

[AWAY3D] Particle System

Away3D 在眾多 Flash 3D engine 當中,  表現上都比較快速及穩定
不過就是欠缺了重要的 Particle System.
為了填補這空缺, Away3D 推薦了一個  3rd Party 的 Particle System engine
FLiNT particle system 這是一個 AS3 寫成的 engine, 所以可以相容其他 2D and 3D engine.

以下是 FLiNT 的 Source cdoe
http://code.google.com/p/flint-particle-system/

2009年12月11日 星期五

[Cast3D]3D Animation

3D Boxman (四葉妹妹紙箱人) Demo by using PV3D and Cast3D
The 3D Boxman is created in 3DMax and converted to xc3 by Cast3D

Remark: Cast3D is an 3D animation framework for flash. It supports 3dmax and maya aniamtion.

[AWAY3D]Matching Card in 3D

4 faces Matching Cards Game
It is a quick demo by using plane & line in 3D flash
The 3D engine is using Away3D and ASWING GUI Button.