SlideShare uma empresa Scribd logo
1 de 49
Baixar para ler offline
April 18, 2009
Ruby Business Commons
     Reiji Nenoki
Adobe Flexのサンプルを改造して・・・
http://examples.adobe.com/flex3/devnet/dashboard/main.html




                                                             2
↓のデスクトップ・アプリケーションを作ります。




                          3
作るのは、赤枠の部分です。




                4
 第2部の目的は、以下の2点です。

①Google Maps API for Flashを使ってみよう!

②第1部で作成したRailsアプリケーションと
 連携させて、食べログの情報や自分で登録
 した情報を画面に表示しよう!



                                     5
 Adobe Systems が開発する、デスクトップ・リッチ
 インターネットアプリケーション (RIA) を開発・
 実行するための複数のオペレーティングシステム
 に対応したランタイムライブラリである。

 ※リッチインターネットアプリケーション
   ⇒ウェブブラウザなどのクライアントの機能を活かした、柔軟な
    インターフェースをもつウェブアプリケーションのこと。

                           (Wikipediaより)




                                           6
 リッチインターネットアプリケーションの統合開発
環境とSDK。
デザインにはMXML(Macromedia Flex Markup
Language. Macromedia Flexのプレゼンテーションを
記述するためのXML言語)を利用し、プログラムに
はActionScriptを利用し、Flash Player上で実行する
swfファイルを生成する。
Flex3からはAIR上でも実行可能。
                                      (Wikipediaより)

 統合開発環境(IDE)としてはFlex Builderが有名ですが、
 今回はIDEを使用せずにコマンドラインで開発します。
                                                      7
 AIRは実行環境、Flexは開発環境。
 Flexで提供されるMXMLとAction Scriptを使って開発
  を行う。
  ※MXMLで画面をデザインする。
   Action Scriptでプログラムを書く。
 コンパイルしてswfファイルを作る。
 デスクトップ・アプリケーションはAIR上で実行。
  WebアプリケーションはFlash Player上で実行。



                                       8
 プロジェクトを作成する。
 検索結果位置情報画面を表示する。
 検索結果一覧画面を表示する。
 各イベントのアクションを実装する。
   ①検索ボタンをクリック
   ②地図上のマーカーをクリック
 AIRパッケージを作成する。
                      9
 プロジェクトを作成する。
 検索結果位置情報画面を表示する。
 検索結果一覧画面を表示する。
 各イベントのアクションを実装する。
   ①検索ボタンをクリック
   ②地図上のマーカーをクリック
 AIRパッケージを作成する。
                      11
 プロジェクトを作成する。
まずは、プロジェクトを作成しましょう。
 ※本当は、
   ・AIRアプリケーション記述ファイルの作成
   ・Google Maps API for Flashを使う為の準備
  等が必要ですが、今回は時間の都合上、事前に準備した
  プロジェクトを使います。
また、開発環境・実行環境が正しく構築できて
いるか確認してみましょう。

                                       12
 配布資料のIketeruGourmetフォルダをCドライブ
 直下にコピーしてください。




 時間の都合上、事前に準備したプロジェクトを使用して
 進行していきます。

                                  13
 コンパイルしましょう。
amxmlc src/IketeruGourmet.mxml -output src/IketeruGourmet.swf



    コマンドプロンプトを起動後、
    C:¥IketeruGourmetに移動して
    コマンドを実行してください。



設定ファイル quot;D:¥develop¥Adobe¥flex_sdk_3¥frameworks¥air-
config.xmlquot; をロードしています
C:¥IketeruGourmet¥src¥IketeruGourmet.swf (486726 bytes)

                                      このメッセージが表示されたら、
                                          コンパイルOK。




                                                                14
 C:¥IketeruGourmet¥src直下 にIketeruGourmet.swf
 が作成されます。

    コンパイル実行前                  コンパイル実行後




                                                15
コマンドプロンプトで
→のコマンドを実行
             adl application.xml
  すると・・・

                                   ↓の画面が表示されます。




                                                  16
 プロジェクトを作成する。
 検索結果位置情報画面を表示する。
 検索結果一覧画面を表示する。
 各イベントのアクションを実装する。
   ①検索ボタンをクリック
   ②地図上のマーカーをクリック
 AIRパッケージを作成する。
                      17
 検索結果位置情報画面を表示する。
Google Maps API for Flashを使って、地図を
表示する画面を作りましょう。

                          こんな画面を表示
                           しましょう。




                                     18
その1
 src/rbc/view/GoogleMaps.mxml

 <?xml version=quot;1.0quot; encoding=quot;utf-8quot;?>
 <PodContentBase                                                                 赤色の部分を追加
                                                                                  してください。
     xmlns=quot;rbc.view.*quot;
     xmlns:maps=quot;com.google.maps.*quot;
     xmlns:mx=quot;http://www.adobe.com/2006/mxmlquot;
     width=quot;100%quot; height=quot;100%quot;>

     <maps:Map
         id=quot;mapquot;
         width=quot;100%quot;
         height=quot;100%quot;
         url=quot;http://localhost/quot;
         key=quot;ABQIAAAA3hk8tSWJBtrv7SdGaRNVahT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSwJelIuU1E96KfDhGIXqqayaU9HAquot;
         mapevent_mapready=quot;displayMap(event)quot;
     />
 </PodContentBase>
                                                                                                        19
その2
 src/rbc/view/GoogleMaps.mxml
   <mx:Script>                      前ページの<PodContentBase>タグと<maps>
   <![CDATA[                        タグの間に全て追加してください。

      import com.google.maps.*;
      import com.google.maps.controls.*;

      private function displayMap(event:MapEvent):void {
          map.setCenter(
                 new LatLng(35.690137,139.692836),
                 16,
                 MapType.NORMAL_MAP_TYPE);

         map.addControl(new ZoomControl());
         map.addControl(new PositionControl());
         map.addControl(new MapTypeControl());
      }
   ]]>
   </mx:Script>
                                                                     20
 コンパイルしましょう。
amxmlc src/IketeruGourmet.mxml -output src/IketeruGourmet.swf -
library-path+=libs/map_flex_1_9.swc


    コマンドプロンプトを起動後、
    C:¥IketeruGourmetに移動して
    コマンドを実行してください。



設定ファイル quot;D:¥develop¥Adobe¥flex_sdk_3¥frameworks¥air-
config.xmlquot; をロードしています
C:¥IketeruGourmet¥src¥IketeruGourmet.swf (486726 bytes)

                                      このメッセージが表示されたら、
                                          コンパイルOK。




                                                                  21
コマンドプロンプトで
→のコマンドを実行
             adl application.xml
  すると・・・

                                   ↓の画面が表示されます。




                                                  22
 プロジェクトを作成する。
 検索結果位置情報画面を表示する。
 検索結果一覧画面を表示する。
 各イベントのアクションを実装する。
   ①検索ボタンをクリック
   ②地図上のマーカーをクリック
 AIRパッケージを作成する。
                      23
 検索結果一覧画面を表示する。
MXMLを使って、Railsアプリケーションから
取得したデータを一覧表示する為の画面を作
りましょう。
                  こんな画面を表示
                   しましょう。




                             24
 src/rbc/view/SearchResult.mxml
 <?xml version=quot;1.0quot; encoding=quot;utf-8quot;?>
 <PodContentBase
                                                                                 赤色の部分を追加
    xmlns=quot;rbc.view.*quot;
                                                                                  してください。
    xmlns:mx=quot;http://www.adobe.com/2006/mxmlquot;
    width=quot;100%quot; height=quot;100%quot;>

    <mx:DataGrid id=quot;dataGridquot; width=quot;100%quot; height=quot;100%quot;>
       <mx:columns>
           <mx:DataGridColumn headerText=quot;名称quot;                dataField=quot;restaurant_namequot;   visible=quot;truequot; width=quot;180quot;/>
           <mx:DataGridColumn headerText=quot;URLquot;               dataField=quot;tabelog_urlquot;       visible=quot;falsequot;/>
           <mx:DataGridColumn headerText=quot;総合評価quot;              dataField=quot;total_scorequot;       visible=quot;truequot; width=quot;45quot;/>
           <mx:DataGridColumn headerText=quot;料理・味quot;              dataField=quot;taste_scorequot;       visible=quot;truequot; width=quot;45quot;/>
           <mx:DataGridColumn headerText=quot;サービスquot;              dataField=quot;service_scorequot;     visible=quot;truequot; width=quot;45quot;/>
           <mx:DataGridColumn headerText=quot;雰囲気quot;               dataField=quot;mood_scorequot;        visible=quot;truequot; width=quot;45quot;/>
           <mx:DataGridColumn headerText=quot;シチュエーションquot;          dataField=quot;situationquot;         visible=quot;falsequot;/>
           <mx:DataGridColumn headerText=quot;価格(夜)quot;             dataField=quot;dinner_pricequot;      visible=quot;truequot; width=quot;90quot;/>
           <mx:DataGridColumn headerText=quot;価格(昼)quot;             dataField=quot;lunch_pricequot;       visible=quot;truequot; width=quot;90quot;/>
           <mx:DataGridColumn headerText=quot;カテゴリquot;              dataField=quot;categoryquot;          visible=quot;falsequot;/>
           <mx:DataGridColumn headerText=quot;最寄り駅quot;              dataField=quot;stationquot;           visible=quot;falsequot;/>
           <mx:DataGridColumn headerText=quot;住所quot;                dataField=quot;addressquot;           visible=quot;falsequot;/>
           <mx:DataGridColumn headerText=quot;電話番号quot;              dataField=quot;telquot;               visible=quot;falsequot;/>
           <mx:DataGridColumn headerText=quot;営業時間quot;              dataField=quot;business_hoursquot;    visible=quot;falsequot;/>
           <mx:DataGridColumn headerText=quot;休日quot;                dataField=quot;holidayquot;           visible=quot;falsequot;/>
           <mx:DataGridColumn headerText=quot;緯度quot;                dataField=quot;latitudequot;          visible=quot;falsequot;/>
           <mx:DataGridColumn headerText=quot;経度quot;                dataField=quot;longitudequot;         visible=quot;falsequot;/>
           <mx:DataGridColumn headerText=quot;メモquot;                dataField=quot;memoquot;              visible=quot;falsequot;/>
           <mx:DataGridColumn headerText=quot;画像quot;                dataField=quot;image_urlquot;         visible=quot;falsequot;/>
       </mx:columns>
    </mx:DataGrid>
 </PodContentBase>
                                                                                                                          25
 コンパイルしましょう。
amxmlc src/IketeruGourmet.mxml -output src/IketeruGourmet.swf -
library-path+=libs/map_flex_1_9.swc


    コマンドプロンプトを起動後、
    C:¥IketeruGourmetに移動して
    コマンドを実行してください。



設定ファイル quot;D:¥develop¥Adobe¥flex_sdk_3¥frameworks¥air-
config.xmlquot; をロードしています
C:¥IketeruGourmet¥src¥IketeruGourmet.swf (486726 bytes)

                                      このメッセージが表示されたら、
                                          コンパイルOK。




                                                                  26
コマンドプロンプトで
→のコマンドを実行
             adl application.xml
  すると・・・

                                   ↓の画面が表示されます。




                                                  27
 プロジェクトを作成する。
 検索結果位置情報画面を表示する。
 検索結果一覧画面を表示する。
 各イベントのアクションを実装する。
   ①検索ボタンをクリック
   ②地図上のマーカーをクリック
 AIRパッケージを作成する。
                      28
 各イベントのアクションを実装する。
 ①検索ボタンをクリック
Action Scriptを使って、検索ボタンをクリック
した時に動作するプログラムを書きましょう。
 ※検索ボタンをクリックすると、以下のことができるように
  します。
   ・検索条件をRailsに渡して、検索してもらう。
   ・検索結果の店舗の場所を地図上に表示する。
   ・検索結果を一覧表示する。

                               29
その1
 src/rbc/view/SearchCondition.mxml


   <mx:Script>
   <![CDATA[
      import mx.collections.ArrayCollection;
      import mx.controls.Alert;                赤色の部分を追加
                                                してください。
      import mx.rpc.events.FaultEvent;
      import mx.rpc.events.ResultEvent;
      import mx.rpc.http.HTTPService;
      import mx.utils.ObjectProxy;
      import data.SearchConditionData;
      import rbc.managers.SharedVariable;

                                                          30
その2
 src/rbc/view/SearchCondition.mxml


     private function onClickBtnSearch(e:MouseEvent):void {
         var httpService:HTTPService = new HTTPService();
         httpService.url = quot;http://localhost:3000/restaurants.xmlquot;;
         httpService.resultFormat = HTTPService.RESULT_FORMAT_E4X;
         httpService.addEventListener(ResultEvent.RESULT, resultHandler);
         httpService.addEventListener(FaultEvent.FAULT, faultHandler);

         var parameters:Object = new Object();
         parameters.Prefecture = cboPrefecture.selectedItem.data;
         parameters.SortOrder = cboSortOrder.selectedItem.data;
         parameters.PageNum     = cboPage.selectedItem.data;
         parameters.ResultSet = quot;largequot;;

         httpService.send(parameters);
     }                                                     赤色の部分を追加
                                                           してください。


                                                                            31
その3
 src/rbc/view/SearchCondition.mxml


                                             前ページのonClickBtnSearchの後に
                                             全て追加してください。



     private function resultHandler(e:ResultEvent):void {
         var itemList:XMLList = e.result.items.item;
         sharedVariable.searchResult = this.xmlListToArrayCollection(itemList);
     }

     private function faultHandler(e:FaultEvent):void {
         Alert.show(quot;通信エラーが発生しました!¥nquot; + e.toString());
     }




                                                                                  32
その1
 src/rbc/view/GoogleMaps.mxml



   <mx:Script>
   <![CDATA[                                 赤色の部分を追加
      import com.google.maps.*;               してください。


      import com.google.maps.controls.*;
      import com.google.maps.overlays.Marker;
      import com.google.maps.overlays.MarkerOptions;
      import mx.collections.ArrayCollection;
      import mx.events.PropertyChangeEvent;
      import mx.utils.ObjectProxy;

                                                        33
その2
 src/rbc/view/GoogleMaps.mxml
    override protected function onChangeSharedVariable(e:PropertyChangeEvent):void {
       map.clearOverlays();

        var result:ArrayCollection = sharedVariable.searchResult;
        for(var i:Number=0; i<result.length; i++) {
           if(i==0) {
               map.setCenter(
                      new LatLng(result[i].latitude, result[i].longitude),
                      16,
                      MapType.NORMAL_MAP_TYPE);
           }
                                                                        displayMapの後に全て
           this.addMarker(result[i], i);
                                                                        追加してください。
        }
    }

    private function addMarker(result:ObjectProxy, index:Number):void {
        var marker:Marker
              = new Marker(
                     new LatLng(result.latitude, result.longitude),
                     new MarkerOptions({draggable:true, hasShadow:true}));
        map.addOverlay(marker);
    }
                                                                                          34
 src/rbc/view/SearchResult.mxml



                                                   <mx:DataGrid>タグの前に
                                                   全て追加してください。

   <mx:Script>
   <![CDATA[
       import mx.events.PropertyChangeEvent;

       override protected function onChangeSharedVariable(e:PropertyChangeEvent):void {
           dataGrid.dataProvider = sharedVariable.searchResult;
       }
   ]]>
   </mx:Script>




                                                                                          35
 コンパイルしましょう。
amxmlc src/IketeruGourmet.mxml -output src/IketeruGourmet.swf -
library-path+=libs/map_flex_1_9.swc


    コマンドプロンプトを起動後、
    C:¥IketeruGourmetに移動して
    コマンドを実行してください。



設定ファイル quot;D:¥develop¥Adobe¥flex_sdk_3¥frameworks¥air-
config.xmlquot; をロードしています
C:¥IketeruGourmet¥src¥IketeruGourmet.swf (486726 bytes)

                                      このメッセージが表示されたら、
                                          コンパイルOK。




                                                                  36
adl application.xml

    コマンドプロンプトで
                      検索ボタンをクリックすると・・・
     ↑のコマンドを実行
      して画面を表示




検索結果が表示されます。




                                         37
 プロジェクトを作成する。
 検索結果位置情報画面を表示する。
 検索結果一覧画面を表示する。
 各イベントのアクションを実装する。
   ①検索ボタンをクリック
   ②地図上のマーカーをクリック
 AIRパッケージを作成する。
                      38
 各イベントのアクションを実装する。
 ②地図上のマーカーをクリック
地図上に表示されたマーカーをクリックすると、
該当の店舗情報が吹き出しに表示されるように
しましょう。
 ※吹き出しに表示するのは、
   ・食べログの情報:店名、住所、電話番号、URL
   ・第1部にて自分で登録した情報:メモ、画像
  の6項目です。

                             39
 src/rbc/view/GoogleMaps.mxml
 private function addMarker(result:ObjectProxy, index:Number):void {
     var marker:Marker = new Marker(
                                                                                                    赤色の部分を追加
         new LatLng(result.Latitude, result.Longitude),
                                                                                                     してください。
         new MarkerOptions({draggable:true, hasShadow:true}));

     marker.addEventListener(MapMouseEvent.CLICK,
        function(event:MapMouseEvent):void {
            var infoWindowOptions:InfoWindowOptions = new InfoWindowOptions();
            infoWindowOptions.contentHTML
                    = quot;店名:quot;+ result.restaurant_name                                                 + quot;<br/>quot; +
                        quot;住所:quot;+ result.address                                                       + quot;<br/>quot; +
                        quot;TEL:quot;+ result.tel                                                          + quot;<br/>quot; +
                        quot;URL:quot;+ quot;<a href='quot; + result.tabelog_url + quot;'><b>ココをクリック!</b></a>quot; + quot;<br/>quot;;
            if(result.memo != null && result.memo != quot;quot;) {
                infoWindowOptions.contentHTML
                    = infoWindowOptions.contentHTML + quot;メモ:quot; + result.memo + quot;<br/>quot;;
            }
            if(result.image_url != null && result.image_url != quot;quot;) {
                infoWindowOptions.contentHTML
                    = infoWindowOptions.contentHTML + quot;画像:quot; + quot;<a href='quot; + result.image_url + quot;'><b>ココをクリック!</b></a>quot;;
            }
            infoWindowOptions.width = 350;

            marker.openInfoWindow(infoWindowOptions);

            map.setCenter(new LatLng(result.latitude, result.longitude), 16, MapType.NORMAL_MAP_TYPE);
        }
     );
     map.addOverlay(marker);
 }
                                                                                                                          40
 コンパイルしましょう。
amxmlc src/IketeruGourmet.mxml -output src/IketeruGourmet.swf -
library-path+=libs/map_flex_1_9.swc


    コマンドプロンプトを起動後、
    C:¥IketeruGourmetに移動して
    コマンドを実行してください。



設定ファイル quot;D:¥develop¥Adobe¥flex_sdk_3¥frameworks¥air-
config.xmlquot; をロードしています
C:¥IketeruGourmet¥src¥IketeruGourmet.swf (486726 bytes)

                                      このメッセージが表示されたら、
                                          コンパイルOK。




                                                                  41
adl application.xml

    コマンドプロンプトで
     ↑のコマンドを実行
      して画面を表示

                                  マーカーをクリックすると・・・




                 該当マーカーが地図の中央に移動して、
                 吹き出しが表示されます。




                                                    42
 プロジェクトを作成する。
 検索結果位置情報画面を表示する。
 検索結果一覧画面を表示する。
 各イベントのアクションを実装する。
   ①検索ボタンをクリック
   ②地図上のマーカーをクリック
 AIRパッケージを作成する。
                      43
 AIRパッケージを作成する。
AIRでは、インストールファイルを作ることが
できます。
今回作成したアプリケーションでインストール
ファイルを作り、実際にインストールしてみま
しょう。



                         44
 AIRパッケージを作成しましょう。
adt -package -storetype pkcs12 -keystore IketeruGourmet.p12 -
storepass iketeru IketeruGourmet.air application.xml icons libs src


     コマンドプロンプトを起動後、
     C:¥IketeruGourmetに移動して
     コマンドを実行してください。



C:¥IketeruGourmet>

                              次のプロンプトが表示
                               されたら、OK。




                                                                      45
 C:¥IketeruGourmet直下に IketeruGourmet.airが
 作成されます。

     コマンド実行前                  コマンド実行後




                                             46
②インストーラが起動するので、
                    「インストール」をクリック




① IketeruGourmet.air
 をダブルクリック




                  ③「続行」をクリック



                                     ④インストールが
                                      完了すると・・・
                                                 47
⑤↓の画面が表示されます。




                48
20090418 イケテルRails勉強会 第2部Air編

Mais conteúdo relacionado

Mais procurados

技術トレンディセミナー サルでも分かるAndroidに見るGoogleの戦略
技術トレンディセミナー サルでも分かるAndroidに見るGoogleの戦略技術トレンディセミナー サルでも分かるAndroidに見るGoogleの戦略
技術トレンディセミナー サルでも分かるAndroidに見るGoogleの戦略
terada
 
Windows 7兼容性系列课程(5):Windows 7徽标认证
Windows 7兼容性系列课程(5):Windows 7徽标认证Windows 7兼容性系列课程(5):Windows 7徽标认证
Windows 7兼容性系列课程(5):Windows 7徽标认证
Chui-Wen Chiu
 
【13-A-2】 「Delphi for PHP のエバンジェリストが、日本の PHP エバンジェリストと、 PHP と IDE の今と未来を語る」~Em...
【13-A-2】 「Delphi for PHP のエバンジェリストが、日本の PHP エバンジェリストと、 PHP と IDE の今と未来を語る」~Em...【13-A-2】 「Delphi for PHP のエバンジェリストが、日本の PHP エバンジェリストと、 PHP と IDE の今と未来を語る」~Em...
【13-A-2】 「Delphi for PHP のエバンジェリストが、日本の PHP エバンジェリストと、 PHP と IDE の今と未来を語る」~Em...
devsumi2009
 
Dynamic Language による Silverlight2 アプリケーション開発
Dynamic Language による Silverlight2 アプリケーション開発Dynamic Language による Silverlight2 アプリケーション開発
Dynamic Language による Silverlight2 アプリケーション開発
terurou
 
Windows 7兼容性系列课程(1):Windows 7兼容性概述
Windows 7兼容性系列课程(1):Windows 7兼容性概述Windows 7兼容性系列课程(1):Windows 7兼容性概述
Windows 7兼容性系列课程(1):Windows 7兼容性概述
Chui-Wen Chiu
 
Understanding Web Services
Understanding Web ServicesUnderstanding Web Services
Understanding Web Services
aru85
 
JBoss Application Server 入門 ~ Seasar2を動かして見よう!~ on Seasar Conference 2009 White
JBoss Application Server 入門~ Seasar2を動かして見よう!~ on Seasar Conference 2009 WhiteJBoss Application Server 入門~ Seasar2を動かして見よう!~ on Seasar Conference 2009 White
JBoss Application Server 入門 ~ Seasar2を動かして見よう!~ on Seasar Conference 2009 White
bose999
 
技術トレンディセミナー フレームワークとしてのTrac
技術トレンディセミナー フレームワークとしてのTrac技術トレンディセミナー フレームワークとしてのTrac
技術トレンディセミナー フレームワークとしてのTrac
terada
 
【12-B-4】 並列処理開発を支援するコンパイラの機能
【12-B-4】 並列処理開発を支援するコンパイラの機能【12-B-4】 並列処理開発を支援するコンパイラの機能
【12-B-4】 並列処理開発を支援するコンパイラの機能
devsumi2009
 
Understanding Web Services
Understanding Web ServicesUnderstanding Web Services
Understanding Web Services
aru85
 
20090323 Phpstudy
20090323 Phpstudy20090323 Phpstudy
20090323 Phpstudy
Yusuke Ando
 
Zurich2007 MySQL Query Optimization
Zurich2007 MySQL Query OptimizationZurich2007 MySQL Query Optimization
Zurich2007 MySQL Query Optimization
Hiệp Lê Tuấn
 
Sciencecafe Niigata(20090913)
Sciencecafe Niigata(20090913)Sciencecafe Niigata(20090913)
Sciencecafe Niigata(20090913)
真 岡本
 

Mais procurados (20)

Что такое ASP.NET MVC?
Что такое ASP.NET MVC?Что такое ASP.NET MVC?
Что такое ASP.NET MVC?
 
PHP超入門@LL温泉
PHP超入門@LL温泉PHP超入門@LL温泉
PHP超入門@LL温泉
 
技術トレンディセミナー サルでも分かるAndroidに見るGoogleの戦略
技術トレンディセミナー サルでも分かるAndroidに見るGoogleの戦略技術トレンディセミナー サルでも分かるAndroidに見るGoogleの戦略
技術トレンディセミナー サルでも分かるAndroidに見るGoogleの戦略
 
Windows 7兼容性系列课程(5):Windows 7徽标认证
Windows 7兼容性系列课程(5):Windows 7徽标认证Windows 7兼容性系列课程(5):Windows 7徽标认证
Windows 7兼容性系列课程(5):Windows 7徽标认证
 
【13-A-2】 「Delphi for PHP のエバンジェリストが、日本の PHP エバンジェリストと、 PHP と IDE の今と未来を語る」~Em...
【13-A-2】 「Delphi for PHP のエバンジェリストが、日本の PHP エバンジェリストと、 PHP と IDE の今と未来を語る」~Em...【13-A-2】 「Delphi for PHP のエバンジェリストが、日本の PHP エバンジェリストと、 PHP と IDE の今と未来を語る」~Em...
【13-A-2】 「Delphi for PHP のエバンジェリストが、日本の PHP エバンジェリストと、 PHP と IDE の今と未来を語る」~Em...
 
Dynamic Language による Silverlight2 アプリケーション開発
Dynamic Language による Silverlight2 アプリケーション開発Dynamic Language による Silverlight2 アプリケーション開発
Dynamic Language による Silverlight2 アプリケーション開発
 
Glass Fish Portfolio Launch(Japanese)
Glass Fish Portfolio Launch(Japanese)Glass Fish Portfolio Launch(Japanese)
Glass Fish Portfolio Launch(Japanese)
 
Windows 7兼容性系列课程(1):Windows 7兼容性概述
Windows 7兼容性系列课程(1):Windows 7兼容性概述Windows 7兼容性系列课程(1):Windows 7兼容性概述
Windows 7兼容性系列课程(1):Windows 7兼容性概述
 
20210119 OCIJP#14 オラクル大橋資料
20210119 OCIJP#14 オラクル大橋資料20210119 OCIJP#14 オラクル大橋資料
20210119 OCIJP#14 オラクル大橋資料
 
Understanding Web Services
Understanding Web ServicesUnderstanding Web Services
Understanding Web Services
 
JBoss Application Server 入門 ~ Seasar2を動かして見よう!~ on Seasar Conference 2009 White
JBoss Application Server 入門~ Seasar2を動かして見よう!~ on Seasar Conference 2009 WhiteJBoss Application Server 入門~ Seasar2を動かして見よう!~ on Seasar Conference 2009 White
JBoss Application Server 入門 ~ Seasar2を動かして見よう!~ on Seasar Conference 2009 White
 
技術トレンディセミナー フレームワークとしてのTrac
技術トレンディセミナー フレームワークとしてのTrac技術トレンディセミナー フレームワークとしてのTrac
技術トレンディセミナー フレームワークとしてのTrac
 
【12-B-4】 並列処理開発を支援するコンパイラの機能
【12-B-4】 並列処理開発を支援するコンパイラの機能【12-B-4】 並列処理開発を支援するコンパイラの機能
【12-B-4】 並列処理開発を支援するコンパイラの機能
 
Understanding Web Services
Understanding Web ServicesUnderstanding Web Services
Understanding Web Services
 
20090323 Phpstudy
20090323 Phpstudy20090323 Phpstudy
20090323 Phpstudy
 
セキュリティとアジャイル開発のいい関係について考える
セキュリティとアジャイル開発のいい関係について考えるセキュリティとアジャイル開発のいい関係について考える
セキュリティとアジャイル開発のいい関係について考える
 
Zurich2007 MySQL Query Optimization
Zurich2007 MySQL Query OptimizationZurich2007 MySQL Query Optimization
Zurich2007 MySQL Query Optimization
 
Sciencecafe Niigata(20090913)
Sciencecafe Niigata(20090913)Sciencecafe Niigata(20090913)
Sciencecafe Niigata(20090913)
 
CSS Nite In Ginza, Vol.36
CSS Nite In Ginza, Vol.36CSS Nite In Ginza, Vol.36
CSS Nite In Ginza, Vol.36
 
spring_jiaocheng
spring_jiaochengspring_jiaocheng
spring_jiaocheng
 

Destaque

Hack For Iwate Vol.3 20120115
Hack For Iwate Vol.3 20120115Hack For Iwate Vol.3 20120115
Hack For Iwate Vol.3 20120115
Akiko Iwakiri
 

Destaque (7)

勉強会へ行こう!
勉強会へ行こう!勉強会へ行こう!
勉強会へ行こう!
 
20090418 イケテルRails勉強会 第1部Rails編
20090418 イケテルRails勉強会 第1部Rails編20090418 イケテルRails勉強会 第1部Rails編
20090418 イケテルRails勉強会 第1部Rails編
 
208 peter libby
208 peter libby208 peter libby
208 peter libby
 
186 4th vulnerable plaque symposium
186 4th vulnerable plaque symposium186 4th vulnerable plaque symposium
186 4th vulnerable plaque symposium
 
WiiリモコンでMacBookを操る
WiiリモコンでMacBookを操るWiiリモコンでMacBookを操る
WiiリモコンでMacBookを操る
 
PHP使いから見たRuby(Talking about PHP & Ruby)
PHP使いから見たRuby(Talking about PHP & Ruby)PHP使いから見たRuby(Talking about PHP & Ruby)
PHP使いから見たRuby(Talking about PHP & Ruby)
 
Hack For Iwate Vol.3 20120115
Hack For Iwate Vol.3 20120115Hack For Iwate Vol.3 20120115
Hack For Iwate Vol.3 20120115
 

Semelhante a 20090418 イケテルRails勉強会 第2部Air編

【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法
【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法
【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法
devsumi2009
 
20090313 Cakephpstudy
20090313 Cakephpstudy20090313 Cakephpstudy
20090313 Cakephpstudy
Yusuke Ando
 
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
devsumi2009
 
090608-TogoWS REST
090608-TogoWS REST090608-TogoWS REST
090608-TogoWS REST
ocha_kaneko
 
How To Create Custom DSLs By PHP
How To Create Custom DSLs By PHPHow To Create Custom DSLs By PHP
How To Create Custom DSLs By PHP
Atsuhiro Kubo
 
Five Minutes Introduction For Rails
Five Minutes Introduction For RailsFive Minutes Introduction For Rails
Five Minutes Introduction For Rails
Koichi ITO
 

Semelhante a 20090418 イケテルRails勉強会 第2部Air編 (20)

【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法
【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法
【12-D-6】 Silverlight によるハイグレードなLOB/BI実現のためのコンポーネント活用法
 
20090313 Cakephpstudy
20090313 Cakephpstudy20090313 Cakephpstudy
20090313 Cakephpstudy
 
ブラウザでMap Reduce風味の並列分散処理
ブラウザでMap Reduce風味の並列分散処理ブラウザでMap Reduce風味の並列分散処理
ブラウザでMap Reduce風味の並列分散処理
 
20090522 Candycane
20090522 Candycane20090522 Candycane
20090522 Candycane
 
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
【13-C-4】 「もう業務はとまらない!オフライン機能を使った業務アプリケーションの実例と最新 Curl 情報」
 
Development toolsforteamdevelopment
Development toolsforteamdevelopmentDevelopment toolsforteamdevelopment
Development toolsforteamdevelopment
 
090608-TogoWS REST
090608-TogoWS REST090608-TogoWS REST
090608-TogoWS REST
 
Where20 2009report
Where20 2009reportWhere20 2009report
Where20 2009report
 
P2P Bug Tracking with SD
P2P Bug Tracking with SDP2P Bug Tracking with SD
P2P Bug Tracking with SD
 
【13 C 2】デベロッパーに贈る!M-V-VMパターンで造るWPFアプリケーション
【13 C 2】デベロッパーに贈る!M-V-VMパターンで造るWPFアプリケーション【13 C 2】デベロッパーに贈る!M-V-VMパターンで造るWPFアプリケーション
【13 C 2】デベロッパーに贈る!M-V-VMパターンで造るWPFアプリケーション
 
Apache Tapestry
Apache TapestryApache Tapestry
Apache Tapestry
 
How To Create Custom DSLs By PHP
How To Create Custom DSLs By PHPHow To Create Custom DSLs By PHP
How To Create Custom DSLs By PHP
 
優雅與摩登的使用docker container和資料庫建立部落格.
優雅與摩登的使用docker container和資料庫建立部落格.優雅與摩登的使用docker container和資料庫建立部落格.
優雅與摩登的使用docker container和資料庫建立部落格.
 
Webken 03: Project Design for Optimaizing User Experience
Webken 03: Project Design for Optimaizing User ExperienceWebken 03: Project Design for Optimaizing User Experience
Webken 03: Project Design for Optimaizing User Experience
 
Seize The Cloud
Seize The CloudSeize The Cloud
Seize The Cloud
 
Five Minutes Introduction For Rails
Five Minutes Introduction For RailsFive Minutes Introduction For Rails
Five Minutes Introduction For Rails
 
Grails紹介
Grails紹介Grails紹介
Grails紹介
 
Oracle Cloudで実現できる High Performance Computing 最新情報
Oracle Cloudで実現できる High Performance Computing 最新情報Oracle Cloudで実現できる High Performance Computing 最新情報
Oracle Cloudで実現できる High Performance Computing 最新情報
 
Linuxユーザーのための Windows 管理入門
Linuxユーザーのための Windows 管理入門Linuxユーザーのための Windows 管理入門
Linuxユーザーのための Windows 管理入門
 
Revisited
RevisitedRevisited
Revisited
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

20090418 イケテルRails勉強会 第2部Air編

  • 1. April 18, 2009 Ruby Business Commons Reiji Nenoki
  • 5.  第2部の目的は、以下の2点です。 ①Google Maps API for Flashを使ってみよう! ②第1部で作成したRailsアプリケーションと 連携させて、食べログの情報や自分で登録 した情報を画面に表示しよう! 5
  • 6.  Adobe Systems が開発する、デスクトップ・リッチ インターネットアプリケーション (RIA) を開発・ 実行するための複数のオペレーティングシステム に対応したランタイムライブラリである。 ※リッチインターネットアプリケーション ⇒ウェブブラウザなどのクライアントの機能を活かした、柔軟な インターフェースをもつウェブアプリケーションのこと。 (Wikipediaより) 6
  • 7.  リッチインターネットアプリケーションの統合開発 環境とSDK。 デザインにはMXML(Macromedia Flex Markup Language. Macromedia Flexのプレゼンテーションを 記述するためのXML言語)を利用し、プログラムに はActionScriptを利用し、Flash Player上で実行する swfファイルを生成する。 Flex3からはAIR上でも実行可能。 (Wikipediaより) 統合開発環境(IDE)としてはFlex Builderが有名ですが、 今回はIDEを使用せずにコマンドラインで開発します。 7
  • 8.  AIRは実行環境、Flexは開発環境。  Flexで提供されるMXMLとAction Scriptを使って開発 を行う。 ※MXMLで画面をデザインする。 Action Scriptでプログラムを書く。  コンパイルしてswfファイルを作る。  デスクトップ・アプリケーションはAIR上で実行。 WebアプリケーションはFlash Player上で実行。 8
  • 9.  プロジェクトを作成する。  検索結果位置情報画面を表示する。  検索結果一覧画面を表示する。  各イベントのアクションを実装する。 ①検索ボタンをクリック ②地図上のマーカーをクリック  AIRパッケージを作成する。 9
  • 10.
  • 11.  プロジェクトを作成する。  検索結果位置情報画面を表示する。  検索結果一覧画面を表示する。  各イベントのアクションを実装する。 ①検索ボタンをクリック ②地図上のマーカーをクリック  AIRパッケージを作成する。 11
  • 12.  プロジェクトを作成する。 まずは、プロジェクトを作成しましょう。 ※本当は、 ・AIRアプリケーション記述ファイルの作成 ・Google Maps API for Flashを使う為の準備 等が必要ですが、今回は時間の都合上、事前に準備した プロジェクトを使います。 また、開発環境・実行環境が正しく構築できて いるか確認してみましょう。 12
  • 13.  配布資料のIketeruGourmetフォルダをCドライブ 直下にコピーしてください。 時間の都合上、事前に準備したプロジェクトを使用して 進行していきます。 13
  • 14.  コンパイルしましょう。 amxmlc src/IketeruGourmet.mxml -output src/IketeruGourmet.swf コマンドプロンプトを起動後、 C:¥IketeruGourmetに移動して コマンドを実行してください。 設定ファイル quot;D:¥develop¥Adobe¥flex_sdk_3¥frameworks¥air- config.xmlquot; をロードしています C:¥IketeruGourmet¥src¥IketeruGourmet.swf (486726 bytes) このメッセージが表示されたら、 コンパイルOK。 14
  • 15.  C:¥IketeruGourmet¥src直下 にIketeruGourmet.swf が作成されます。 コンパイル実行前 コンパイル実行後 15
  • 16. コマンドプロンプトで →のコマンドを実行 adl application.xml すると・・・ ↓の画面が表示されます。 16
  • 17.  プロジェクトを作成する。  検索結果位置情報画面を表示する。  検索結果一覧画面を表示する。  各イベントのアクションを実装する。 ①検索ボタンをクリック ②地図上のマーカーをクリック  AIRパッケージを作成する。 17
  • 18.  検索結果位置情報画面を表示する。 Google Maps API for Flashを使って、地図を 表示する画面を作りましょう。 こんな画面を表示 しましょう。 18
  • 19. その1  src/rbc/view/GoogleMaps.mxml <?xml version=quot;1.0quot; encoding=quot;utf-8quot;?> <PodContentBase 赤色の部分を追加 してください。 xmlns=quot;rbc.view.*quot; xmlns:maps=quot;com.google.maps.*quot; xmlns:mx=quot;http://www.adobe.com/2006/mxmlquot; width=quot;100%quot; height=quot;100%quot;> <maps:Map id=quot;mapquot; width=quot;100%quot; height=quot;100%quot; url=quot;http://localhost/quot; key=quot;ABQIAAAA3hk8tSWJBtrv7SdGaRNVahT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSwJelIuU1E96KfDhGIXqqayaU9HAquot; mapevent_mapready=quot;displayMap(event)quot; /> </PodContentBase> 19
  • 20. その2  src/rbc/view/GoogleMaps.mxml <mx:Script> 前ページの<PodContentBase>タグと<maps> <![CDATA[ タグの間に全て追加してください。 import com.google.maps.*; import com.google.maps.controls.*; private function displayMap(event:MapEvent):void { map.setCenter( new LatLng(35.690137,139.692836), 16, MapType.NORMAL_MAP_TYPE); map.addControl(new ZoomControl()); map.addControl(new PositionControl()); map.addControl(new MapTypeControl()); } ]]> </mx:Script> 20
  • 21.  コンパイルしましょう。 amxmlc src/IketeruGourmet.mxml -output src/IketeruGourmet.swf - library-path+=libs/map_flex_1_9.swc コマンドプロンプトを起動後、 C:¥IketeruGourmetに移動して コマンドを実行してください。 設定ファイル quot;D:¥develop¥Adobe¥flex_sdk_3¥frameworks¥air- config.xmlquot; をロードしています C:¥IketeruGourmet¥src¥IketeruGourmet.swf (486726 bytes) このメッセージが表示されたら、 コンパイルOK。 21
  • 22. コマンドプロンプトで →のコマンドを実行 adl application.xml すると・・・ ↓の画面が表示されます。 22
  • 23.  プロジェクトを作成する。  検索結果位置情報画面を表示する。  検索結果一覧画面を表示する。  各イベントのアクションを実装する。 ①検索ボタンをクリック ②地図上のマーカーをクリック  AIRパッケージを作成する。 23
  • 25.  src/rbc/view/SearchResult.mxml <?xml version=quot;1.0quot; encoding=quot;utf-8quot;?> <PodContentBase 赤色の部分を追加 xmlns=quot;rbc.view.*quot; してください。 xmlns:mx=quot;http://www.adobe.com/2006/mxmlquot; width=quot;100%quot; height=quot;100%quot;> <mx:DataGrid id=quot;dataGridquot; width=quot;100%quot; height=quot;100%quot;> <mx:columns> <mx:DataGridColumn headerText=quot;名称quot; dataField=quot;restaurant_namequot; visible=quot;truequot; width=quot;180quot;/> <mx:DataGridColumn headerText=quot;URLquot; dataField=quot;tabelog_urlquot; visible=quot;falsequot;/> <mx:DataGridColumn headerText=quot;総合評価quot; dataField=quot;total_scorequot; visible=quot;truequot; width=quot;45quot;/> <mx:DataGridColumn headerText=quot;料理・味quot; dataField=quot;taste_scorequot; visible=quot;truequot; width=quot;45quot;/> <mx:DataGridColumn headerText=quot;サービスquot; dataField=quot;service_scorequot; visible=quot;truequot; width=quot;45quot;/> <mx:DataGridColumn headerText=quot;雰囲気quot; dataField=quot;mood_scorequot; visible=quot;truequot; width=quot;45quot;/> <mx:DataGridColumn headerText=quot;シチュエーションquot; dataField=quot;situationquot; visible=quot;falsequot;/> <mx:DataGridColumn headerText=quot;価格(夜)quot; dataField=quot;dinner_pricequot; visible=quot;truequot; width=quot;90quot;/> <mx:DataGridColumn headerText=quot;価格(昼)quot; dataField=quot;lunch_pricequot; visible=quot;truequot; width=quot;90quot;/> <mx:DataGridColumn headerText=quot;カテゴリquot; dataField=quot;categoryquot; visible=quot;falsequot;/> <mx:DataGridColumn headerText=quot;最寄り駅quot; dataField=quot;stationquot; visible=quot;falsequot;/> <mx:DataGridColumn headerText=quot;住所quot; dataField=quot;addressquot; visible=quot;falsequot;/> <mx:DataGridColumn headerText=quot;電話番号quot; dataField=quot;telquot; visible=quot;falsequot;/> <mx:DataGridColumn headerText=quot;営業時間quot; dataField=quot;business_hoursquot; visible=quot;falsequot;/> <mx:DataGridColumn headerText=quot;休日quot; dataField=quot;holidayquot; visible=quot;falsequot;/> <mx:DataGridColumn headerText=quot;緯度quot; dataField=quot;latitudequot; visible=quot;falsequot;/> <mx:DataGridColumn headerText=quot;経度quot; dataField=quot;longitudequot; visible=quot;falsequot;/> <mx:DataGridColumn headerText=quot;メモquot; dataField=quot;memoquot; visible=quot;falsequot;/> <mx:DataGridColumn headerText=quot;画像quot; dataField=quot;image_urlquot; visible=quot;falsequot;/> </mx:columns> </mx:DataGrid> </PodContentBase> 25
  • 26.  コンパイルしましょう。 amxmlc src/IketeruGourmet.mxml -output src/IketeruGourmet.swf - library-path+=libs/map_flex_1_9.swc コマンドプロンプトを起動後、 C:¥IketeruGourmetに移動して コマンドを実行してください。 設定ファイル quot;D:¥develop¥Adobe¥flex_sdk_3¥frameworks¥air- config.xmlquot; をロードしています C:¥IketeruGourmet¥src¥IketeruGourmet.swf (486726 bytes) このメッセージが表示されたら、 コンパイルOK。 26
  • 27. コマンドプロンプトで →のコマンドを実行 adl application.xml すると・・・ ↓の画面が表示されます。 27
  • 28.  プロジェクトを作成する。  検索結果位置情報画面を表示する。  検索結果一覧画面を表示する。  各イベントのアクションを実装する。 ①検索ボタンをクリック ②地図上のマーカーをクリック  AIRパッケージを作成する。 28
  • 29.  各イベントのアクションを実装する。 ①検索ボタンをクリック Action Scriptを使って、検索ボタンをクリック した時に動作するプログラムを書きましょう。 ※検索ボタンをクリックすると、以下のことができるように します。 ・検索条件をRailsに渡して、検索してもらう。 ・検索結果の店舗の場所を地図上に表示する。 ・検索結果を一覧表示する。 29
  • 30. その1  src/rbc/view/SearchCondition.mxml <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; 赤色の部分を追加 してください。 import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.rpc.http.HTTPService; import mx.utils.ObjectProxy; import data.SearchConditionData; import rbc.managers.SharedVariable; 30
  • 31. その2  src/rbc/view/SearchCondition.mxml private function onClickBtnSearch(e:MouseEvent):void { var httpService:HTTPService = new HTTPService(); httpService.url = quot;http://localhost:3000/restaurants.xmlquot;; httpService.resultFormat = HTTPService.RESULT_FORMAT_E4X; httpService.addEventListener(ResultEvent.RESULT, resultHandler); httpService.addEventListener(FaultEvent.FAULT, faultHandler); var parameters:Object = new Object(); parameters.Prefecture = cboPrefecture.selectedItem.data; parameters.SortOrder = cboSortOrder.selectedItem.data; parameters.PageNum = cboPage.selectedItem.data; parameters.ResultSet = quot;largequot;; httpService.send(parameters); } 赤色の部分を追加 してください。 31
  • 32. その3  src/rbc/view/SearchCondition.mxml 前ページのonClickBtnSearchの後に 全て追加してください。 private function resultHandler(e:ResultEvent):void { var itemList:XMLList = e.result.items.item; sharedVariable.searchResult = this.xmlListToArrayCollection(itemList); } private function faultHandler(e:FaultEvent):void { Alert.show(quot;通信エラーが発生しました!¥nquot; + e.toString()); } 32
  • 33. その1  src/rbc/view/GoogleMaps.mxml <mx:Script> <![CDATA[ 赤色の部分を追加 import com.google.maps.*; してください。 import com.google.maps.controls.*; import com.google.maps.overlays.Marker; import com.google.maps.overlays.MarkerOptions; import mx.collections.ArrayCollection; import mx.events.PropertyChangeEvent; import mx.utils.ObjectProxy; 33
  • 34. その2  src/rbc/view/GoogleMaps.mxml override protected function onChangeSharedVariable(e:PropertyChangeEvent):void { map.clearOverlays(); var result:ArrayCollection = sharedVariable.searchResult; for(var i:Number=0; i<result.length; i++) { if(i==0) { map.setCenter( new LatLng(result[i].latitude, result[i].longitude), 16, MapType.NORMAL_MAP_TYPE); } displayMapの後に全て this.addMarker(result[i], i); 追加してください。 } } private function addMarker(result:ObjectProxy, index:Number):void { var marker:Marker = new Marker( new LatLng(result.latitude, result.longitude), new MarkerOptions({draggable:true, hasShadow:true})); map.addOverlay(marker); } 34
  • 35.  src/rbc/view/SearchResult.mxml <mx:DataGrid>タグの前に 全て追加してください。 <mx:Script> <![CDATA[ import mx.events.PropertyChangeEvent; override protected function onChangeSharedVariable(e:PropertyChangeEvent):void { dataGrid.dataProvider = sharedVariable.searchResult; } ]]> </mx:Script> 35
  • 36.  コンパイルしましょう。 amxmlc src/IketeruGourmet.mxml -output src/IketeruGourmet.swf - library-path+=libs/map_flex_1_9.swc コマンドプロンプトを起動後、 C:¥IketeruGourmetに移動して コマンドを実行してください。 設定ファイル quot;D:¥develop¥Adobe¥flex_sdk_3¥frameworks¥air- config.xmlquot; をロードしています C:¥IketeruGourmet¥src¥IketeruGourmet.swf (486726 bytes) このメッセージが表示されたら、 コンパイルOK。 36
  • 37. adl application.xml コマンドプロンプトで 検索ボタンをクリックすると・・・ ↑のコマンドを実行 して画面を表示 検索結果が表示されます。 37
  • 38.  プロジェクトを作成する。  検索結果位置情報画面を表示する。  検索結果一覧画面を表示する。  各イベントのアクションを実装する。 ①検索ボタンをクリック ②地図上のマーカーをクリック  AIRパッケージを作成する。 38
  • 39.  各イベントのアクションを実装する。 ②地図上のマーカーをクリック 地図上に表示されたマーカーをクリックすると、 該当の店舗情報が吹き出しに表示されるように しましょう。 ※吹き出しに表示するのは、 ・食べログの情報:店名、住所、電話番号、URL ・第1部にて自分で登録した情報:メモ、画像 の6項目です。 39
  • 40.  src/rbc/view/GoogleMaps.mxml private function addMarker(result:ObjectProxy, index:Number):void { var marker:Marker = new Marker( 赤色の部分を追加 new LatLng(result.Latitude, result.Longitude), してください。 new MarkerOptions({draggable:true, hasShadow:true})); marker.addEventListener(MapMouseEvent.CLICK, function(event:MapMouseEvent):void { var infoWindowOptions:InfoWindowOptions = new InfoWindowOptions(); infoWindowOptions.contentHTML = quot;店名:quot;+ result.restaurant_name + quot;<br/>quot; + quot;住所:quot;+ result.address + quot;<br/>quot; + quot;TEL:quot;+ result.tel + quot;<br/>quot; + quot;URL:quot;+ quot;<a href='quot; + result.tabelog_url + quot;'><b>ココをクリック!</b></a>quot; + quot;<br/>quot;; if(result.memo != null && result.memo != quot;quot;) { infoWindowOptions.contentHTML = infoWindowOptions.contentHTML + quot;メモ:quot; + result.memo + quot;<br/>quot;; } if(result.image_url != null && result.image_url != quot;quot;) { infoWindowOptions.contentHTML = infoWindowOptions.contentHTML + quot;画像:quot; + quot;<a href='quot; + result.image_url + quot;'><b>ココをクリック!</b></a>quot;; } infoWindowOptions.width = 350; marker.openInfoWindow(infoWindowOptions); map.setCenter(new LatLng(result.latitude, result.longitude), 16, MapType.NORMAL_MAP_TYPE); } ); map.addOverlay(marker); } 40
  • 41.  コンパイルしましょう。 amxmlc src/IketeruGourmet.mxml -output src/IketeruGourmet.swf - library-path+=libs/map_flex_1_9.swc コマンドプロンプトを起動後、 C:¥IketeruGourmetに移動して コマンドを実行してください。 設定ファイル quot;D:¥develop¥Adobe¥flex_sdk_3¥frameworks¥air- config.xmlquot; をロードしています C:¥IketeruGourmet¥src¥IketeruGourmet.swf (486726 bytes) このメッセージが表示されたら、 コンパイルOK。 41
  • 42. adl application.xml コマンドプロンプトで ↑のコマンドを実行 して画面を表示 マーカーをクリックすると・・・ 該当マーカーが地図の中央に移動して、 吹き出しが表示されます。 42
  • 43.  プロジェクトを作成する。  検索結果位置情報画面を表示する。  検索結果一覧画面を表示する。  各イベントのアクションを実装する。 ①検索ボタンをクリック ②地図上のマーカーをクリック  AIRパッケージを作成する。 43
  • 45.  AIRパッケージを作成しましょう。 adt -package -storetype pkcs12 -keystore IketeruGourmet.p12 - storepass iketeru IketeruGourmet.air application.xml icons libs src コマンドプロンプトを起動後、 C:¥IketeruGourmetに移動して コマンドを実行してください。 C:¥IketeruGourmet> 次のプロンプトが表示 されたら、OK。 45
  • 46.  C:¥IketeruGourmet直下に IketeruGourmet.airが 作成されます。 コマンド実行前 コマンド実行後 46
  • 47. ②インストーラが起動するので、 「インストール」をクリック ① IketeruGourmet.air をダブルクリック ③「続行」をクリック ④インストールが 完了すると・・・ 47