import mx.containers.TitleWindow; import wafer_map.*; import flash.geom.Point; import mx.effects.*; private function showWindow():void { // New 一個新效果 var mShowEffect:Blur=new Blur(); var wafer:wafer1=wafer1(PopUpManager.createPopUp( this, wafer1 , true)); PopUpManager.centerPopUp(wafer); mShowEffect.blurXFrom=255; //從x坐標255開始模糊 mShowEffect.blurYFrom=255; //從y坐標255開始模糊 mShowEffect.blurXTo=0; //應該不用了吧~ mShowEffect.blurYTo=0; mShowEffect.target=wafer; //目標是PopUpManager create出來的 login 物件 mShowEffect.duration=1000; //動畫持續一秒 mShowEffect.play(); //播放動畫 } ]]> |
2009年6月29日 星期一
Flex Blur 與 PopUpManager 一起使用
2009年3月2日 星期一
Flex 調用Web Service 之使用Flex Builder 產生的proxy Code之ActionScript呼叫~~
Service proxy已經產生完畢,
本篇使用ActionScripts來呼叫Service,
以下是範例程式碼~
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()"> <mx:Script> <![CDATA[ import generated.webservices.*; import mx.rpc.events.FaultEvent; import mx.controls.Alert; public var ws:Service1; //宣告ws //application initial時會呼叫的程式 public function initApp():void { ws=new Service1(); //建立 Service1的 instance } //當User按下按鈕,呼叫的Function public function callHelloWorld(echo:String):void{ // 建立呼叫helloWorldEvent的Listener, // 有回應則呼叫handleEchoResult ws.addhelloWorldEventListener(handleEchoResult); //呼叫operation ws.helloWorld(echo); } //當呼叫operation後,有任何 Response時,Listener會呼叫本function public function handleEchoResult(event:HelloWorldResultEvent):void{ this.txt_result.text=event.result; //將結果傳給input_text } ]]> </mx:Script> <mx:TextInput x="82" y="55" id="txt_result"/> <mx:Button x="82" y="85" label="呼叫Service" id="btn_callService" click="{callHelloWorld('island123');}" /> </mx:Application> |
2009年2月27日 星期五
Flex 調用.NET Web Service 之使用Flex Builder 產生的proxy Code
因Flex使用Web Service有很多種方法,打算全部整理起來~~
第一步 要知道Web Service在哪? wsdl在哪?
以下是使用VS建立一個簡單的Web Service
namespace WebServices { [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] public class Service1 : System.Web.Services.WebService { [WebMethod] public string HelloWorld(String echo) { return echo; } } } |
該Service Name為 Service1
有一個operation 叫做 HelloWorld 參數是字串 echo
該service的wsdl假設在http://localhost:3722/Service1.asmx?wsdl
到此已經有充足的資訊,以下顯示如何使用Flex Builder 3 產生Service proxy!
![]() |
![]() |
![]() |
![]() |
![]() |
以下簡介一下,所產生的元件的意義,暫時沒空翻譯,大家先看看吧!
Generated file | Description |
---|---|
BaseServiceName.as | A base implementation of the web service. This class contains the internal code that maps the operations from the WSDL file to Flex WSDLOperation instances and sets the corresponding parameters. |
IServicename.as | The service interface that defines all of the methods that users can access. |
Servicename.as | The concrete web service implementation. |
BaseServicenameSchema.as | A file containing the XSD schema of the web service as an ActionScript custom type. |
OperationnameResultEvent.as | For each web service operation, Flex Builder generates a strongly typed event type class. You can use these classes to benefit from strongly typed results. |
Operationname_request.as | For each web service operation that passes parameters to the server operation, Flex Builder generates a request wrapper class with the parameters as members. The request object is intended for use with the MXML tag syntax. |
Type.as | For each complex type defined in the WSDL file, Flex Builder generates a class with the same name as the complex type or with the same name as the enclosing element. |
以下的範例是單純使用Flex Tag來呼叫~~
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:myws="generated.webservices.*"> <myws:Service1 id="myservices"> <myws:helloWorld_request_var> <myws:HelloWorld_request> <myws:echo> Hubert </myws:echo> </myws:HelloWorld_request> </myws:helloWorld_request_var> </myws:Service1> <mx:Button x="127" y="271" label="Get Data" id="btn_GetData" click="{myservices.helloWorld_send();}"/> <mx:TextArea x="127" y="85" width="274" height="149" id="lb_data" text="{myservices.helloWorld_lastResult}"/> </mx:Application> |
下一篇我們將使用ActionScript來使用~~
2009年1月21日 星期三
What is Google App Engine?
換句話說,用Google App Engine開發網路應用程式,不需要煩惱買Server,維護Server,網路頻寬等等的問題,只需要將程式Upload到Google即可讓你的User使用。
Google還提供一個免費的Domain Name (appspot.com),當然也可以使用自己的Domain,程式還選擇式開放給全世界或只限制給組織內的某些成員。
App Engine 不需要任何成本。只要Sing Up一個免費的帳號,然後即可開發並publish你的系統,這中間沒有人和的費用以及應盡的義務或限制。
一個免費的帳號提供以下的服務
- 使用500MB的實體儲存空間
- 一定足夠的CPU
- 流量為5百萬次瀏覽/每月
聽起來很不錯,不過,Google也透露將來應該會收費才對!
The Application Environment
Google App Engine的執行環境有以下的特性
- 實體資料儲存體(類似DB)提供查詢、排序和transactions
- 自動作load balancing
- 權限控管以及email的API使用Google的帳戶
- 開發環境可以完全模擬Google App Engine
Google App Engine applications 開發與執行皆使用Python語言(使用standard library)。
目前Google App Engine applications 只支援 Python,未來應該會支援更多
語言。
The Sandbox
沙箱概念在此不敘述(請見http://en.wikipedia.org/wiki/Sandbox_(computer_security)),總之以此APP環境下的程式有以下的先天性限制:
- 應用程式只能操作其他Server提供出來的URL或API或Emai等Services,不能操作其他電腦內的資料。其他電腦也只能透過特殊的Port及Http(or Https)協定與應用程式連結。
- 應用程式不能寫檔到Local System。應用程式可以讀檔,但只能讀已經上傳的檔案。
- 程式必須使用App Engine datastore來儲存所有類型的資料。
- 程式碼的執行時機只會出現在Web 提出Request後,並在Response前,不會有response後才執行的程式(感覺有點廢話~@@)