Yahooメッセンジャー、MSNとSkypeなどいろいろIMツールでチャットしてたら、可愛い絵文字が出ることができます。ネット上の掲示板でも、それと大体同じの機能があります。

自分のウェブアプリケーションにそのような絵文字が出るとCoolでしょう。今回紹介する「fosFORO」というものは、Flash中にテキスト文字を絵文字に変換するオープンソースのライブラリです。

以下のタグがサポートされています。

[b]Text[/b] : Display bold text

[u]Text[/u] : Display underlined text

[hl]Text[/hl] : Highlight text

[quote]Text[/quote] : Display quoted text (one level, what means you can’t quote a quoted text)

[code]Text[/code] : Display Colored Text as Code (use a modification of FlashTextFormatter Classes)

[url=link]Text[/url] : Used to put links (the old [url] tag is now [erl])

[img=url] : Display an image or a SWF (buggy at SWFv8)

[youtube=code] : Display a YouTube’s video, where “code” is the code of it.

デモ

fosFORO

それ以外、絵文字は以下の様で自分で追加できます。

  1. Fosforo.addEmo(":beer:","beer");

以下は使用例のソースコードです。

  1. //Import the Class
  2. import Fosforo;
  3.  
  4. class Test{
  5.  
  6.     public static function main() {
  7.  
  8.         // Add some emoticons
  9.         // Fosforo.addEmo(code,linkName);
  10.         Fosforo.addEmo("xD","chino");
  11.  
  12.         Fosforo.addEmo(":D","sonrisa");
  13.  
  14.         Fosforo.addEmo(":beer:","beer");
  15.  
  16.         Fosforo.addEmo(";)","guino");
  17.  
  18.         Fosforo.addEmo(":p","lengua");
  19.  
  20.         Fosforo.addEmo(":love:","love");
  21.  
  22.         Fosforo.addEmo(":ninja:","ninja");
  23.  
  24.         Fosforo.addEmo(":cc:","cristal_cannabis");
  25.  
  26.         // Create a MC that contents all the stuff       
  27.         _root.createEmptyMovieClip("fos",300);
  28.  
  29.         // Create fosFORO Object (MovieClip,x,y,width,relation,height)
  30.         _root.no = new Fosforo(_root.fos,30,30,490,4/3,400);
  31.  
  32.        
  33.         // Add some text (and parse it) to the fosFORO Object
  34.         _root.no.parseText('Lorem xD leifaerbfcaer uax reuixi rueauybae pede eu [b]rhoncus vestibulum[/b], eros pede hendrerit felis, eu commodo orci massa eget orci. ',"text");
  35.  
  36.  
  37.     }
  38.  
  39. }

関連リンク

http://fosforo.theninjabunny.com/demo.html デモURL
http://fosforo.theninjabunny.com/descarga.php ダウンロードURL

メインコンテンツEND ■
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Posted on Saturday, 9th May 2009 by admin

Tags: , , , ,
Posted in ActionScript, Flash Project | Comments (1) | 4,715 views

One Response to “fosFORO: Flash中にテキスト文字を絵文字に変換するオープンソースのライブラリ”

  1. Tweener: 画像を簡単に演出をつけるActionScriptのアニメーション用オープンソースのライブラリ | DigiTechLog Dot Com Says:

    [...] 前回紹介した「fosFORO: Flash中にテキスト文字を絵文字に変換するオープンソースのライブラリ」よりもっと便利なライブラリみたいです。 [...]

Leave a Reply