My List

Showing posts with label actionscript. Show all posts
Showing posts with label actionscript. Show all posts

Monday, November 26, 2007

To Develop Web Applications

對現代人來說,網際網路幾乎是不可能從生活中抽離的,許多線上服務更是琳琅滿目、不斷推陳出新。我想試著從web設計者的角度重新思考這些網路應用程式(Web Applications)的服務,究竟為何而開發呢?而Yahoo! Search設計總監Bob Baxley是這樣解釋的:「The fundamental purpose of Web applications is to facilitate the completion of one or more tasks.」因此依據tasks的類型與複雜度,許多技術方案自然應不同服務與互動需求而被開發出來了,如Flash, Java applets, DHTML, Active X, Smart Clients, Java Web Start, SVG等。然而,對網站設計者而言,何種技術對自己的目標是較為合適的呢?各種技術又能夠支援什麼形式的互動與視覺會呈現呢?又各種技術的長處與限制?這些問題是網路應用程式設計者經常碰到的,因此,我想對這些主流的技術作一些優缺點的分析、比較、trade-offs的整理,以釐清一些實務上的迷思。

首先,到底什麼是Web Application呢?可以把它想成是web-accessible(透過瀏覽器呈現web)、web-connected(藉由HTTP connection來存取資訊)、以及task-oriented(不單只是瀏覽資訊而是有特定目的)的軟體。網路應用程式的本質種類繁多,Luke WroblewskiFrank Ramirez定義了從thin client到rich client的一套連續集(continuum)來區分不同網路應用程式的定位,以下我逐一介紹。

Thin Client

我們最常接觸到的網路應用程式種類,它仰賴client端瀏覽器來做事情,如安全性、狀態管理(state management)、以及腳本語言的執行(script execution, run-time),並且在遠端server處理並儲存資料,Server的request與response大多透過HTTL protocol。Thin Client有幾個主要的好處:(1) wide reach,任何人都能透過瀏覽器access web;(2) open development platform,它建立在廣為大家接受的公開標準上;(3) no footprint,具備快速下載的能力,除cookies外,並不會在本機端作任何手腳,不過造成一個問題是,每次關閉瀏覽器之後,都必須要執行重複的動作以便查閱資料;(4) deployment and manageability,分散式並且由一個點統一維護,其功能完全存在於伺服器端,客戶端完全不需要進行任何安裝與部署的工作。不過也具有一個致命的缺點,即資料往來相當消耗網路頻寬,資料傳輸量很大時,將嚴重導致程式的反應速度變慢。Thin Client主要使用的技術有以下幾種:

HTML, XHTML
HTML, JavaScript, and CSS (DHTML)
DHTML, with Remote Script via iFrame
DHTML, with XMLhttpRequest (AJAX)

Rich Internet Application (RIA)

RIA是目前最火紅的網路應用程式種類,它是一支在Web運行的應用程式,具有與桌面應用程式一樣的功能、反應、與體驗,AdobeFlash正是RIA的典型例子。或許有人會說Flash不是只是動畫製作工具嗎?RIA和Flash網站有什麼不同呢?其實他們最大差異在於RIA能夠操作資料並與之互動,而傳統的Flash網站僅止於視覺化的呈現,透過ActionScript控制Flash的行為正符合RIA的精神。

RIA使web內容的呈現更加豐富,藉由在local端與使用者互動,達到多媒體影音內容放送、動畫、即時驗證、以及遠端即時訊息傳送(Java Objects, Web Services, etc.)的功能。Sun的Java Plug-in (applets)與Adobe Flash就是最常見的Rich Internet Application run-times,然而RIAs的最大限制就是只能在具embedded plug-ins的瀏覽器上運作。

Thin Client應用程式所使用的HTTP傳輸層並不一定保證支援訊息傳遞及其完整性,且不支援由server端發起的資料傳輸。RIA所使用的傳輸層正彌補了這項缺點,提供了可靠的訊息傳遞機制,並促使server端主動提供資訊。

Thin Clients可將RIAs嵌於其中(透過瀏覽器plug-ins整合),在DHTML中加入Flash模組是一個代表的例子;而使用asynchronous JavaScript-driven的Thin Clients使用XML對server做requests與responses(就是AJAX)其實也可以視為一種JavaScript RIA。Rich Interest Application主要的技術有:

Flash 6 (and higher)
Java Applets
Active X
Flash with Flex or Laszlo Presentation Server
Microsoft SliverLight
Sun JavaFX

就使用者觀點來說,RIA將是未來Web技術的主流,不過對技術開發人員來講,懂Flash美工又精通ActionScript的人在台灣並不多,而熟悉Server端技術的人卻又不一定了解RIA與Flash,如何整合兼具創意、技術、符合使用者體驗的人,是RIA推廣的一大挑戰。另一方面,目前並沒有一個完全針對RIA開發的工具(架構在.NET Framework 3.0上的Windows Presentation Foundation是嗎?),因此技術門檻以及開發成本仍然相當高,或許將來RIA開發軟體問世後,才會更加普及?不過不管怎樣,RIA的潛力與商業價值是不容小覷的,拭目以待吧!:p

Rich Client (Smart client, desktop client)

簡單來說,也是一種web-connected的應用程式,只不過它並不是在瀏覽器上運作,並且可以離線執行,與本機端的硬體資源與軟體做整合(如同視窗應用程式,Windows Applications),因此其實可以把它想成桌上型軟體。就開發Rich Clients Application來說,程式與資料會被安裝到本機電腦中,而程式運作時會使用同步的方式與底層的資料進行溝通,若資料位於Internet的不同主機上,程式便會使用遠端物件通訊協定和資料進行溝通。Rich Client具有使用者介面豐富、高互動性、易於開發、反應時間短等優點。較著名的Rich Client技術有Windows Smart Clients與Java Web Start。

以下是Luke WroblewskiFrank Ramirez針對Thin Clients與RIA優缺點的比較,並以一張圖說明目前Web技術發展在Thin Clinets, RIA, Rich Clients的continum上的分佈。

The primary benefits of a thin client are reach (anyone with a Web browser can use it) and deployment (can be updated and distributed through a Web server). The primary disadvantages are limited interaction options and typically slower response times. Rich Internet Applications and Smart client technologies enable richer (desktop-like) interactions, more sophisticated messaging, and prevent server request/responses from having to rewrite entire pages. They also maintain some of the deployment and updating benefits of thin clients. The chart below overlays popular Web application technology solutions on a continuum from thin to rich client. Most solutions fall within a range on the continuum.



Sunday, March 18, 2007

[ActionScript] 動態文字遮罩

myMovieClip .setMask ( maskMovieClip )

myMovieClip : The instance name of a movie clip to be masked.
maskMovieClip : The instance name of a movie clip to be a mask.

The setMask method allows multiple-frame movie clips with complex, multilayered content to act as masks. You can shut masks on and off at runtime. However, you can't use the same mask for multiple maskees (which is possible by using mask layers). If you have device fonts in a masked movie clip, they are drawn but not masked. You can't set a movie clip to be its own mask, for example mc.setMask(mc) .

From: http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary566.html