blog.Ring.idv.tw

ActionScript 3.0

ActionScript 3.0 Cookbook 嚴重的錯誤~

Recipe 16.10. Pausing and Resuming Video

If you pass the method a true value, the video pauses if it's currently playing, and nothing occurs if the video is already paused:

videoStream.pause(true);

Likewise, if you call the method with a false value, it resumes if the video is paused, and nothing occurs if the video is already playing:

videoStream.pause(false);

上述的內容完全不正確,根據ActionScript 3.0 Language and Components Reference的文件內容,pause()是沒有任何參數的傳遞~ 雖然「暫停」仍然要呼叫pause(),但是「恢復」其實是要呼叫resume()才行,不可不慎。

ActionScript 3.0 Cookbook Errata已經有其它讀者也發現這個錯誤~

2007-05-04 23:50:00 | Add Comment

嶄新的Event Handling

在ActionScript 3.0以前,我們要實作一個Button或MovieClip的互動,可以透過on() or onClipEvent() Event Handlers來處理~

但是在ActionScript 3.0,我們必須仰賴的是全新的Event Model~

也代表著以往只要將程式一寫在Button上就可以做出的效果,現在統一要改寫成程式二的方式。

程式一

on(release)
{
	trace("Hello!");
}

程式二

btn.addEventListener(MouseEvent.CLICK,clickHandler);
function clickHandler(event:MouseEvent)
{
	trace("Hello!");
}

其實MouseEvent.CLICK就相等同於on(release)~

然而這樣的改變,個人是覺得相當贊成的~ 至少統一都將程式碼鎖在於Frame,不會再看到出現在Button或MovieClip的ActionScript,不過對於設計者來說可能會覺得相當麻煩~

2007-05-04 10:25:14 | Add Comment

Controlling the Playback Frame Rate

以往在Flash要動態控制Frame Rate只有呼叫loadMovieNum()來「協助」達成,但基本上在Flash CS3之前,其實我們是無法動態控制Frame Rate,只能透過下列轉個彎的方式來達成:

loadMovieNum("xx.swf",0);

這是因為以往Flash Player的播放速度是取決於_level0的SWF Frame Rate,然而這並不是一個完美的解決方式,還需要依賴種種的額外處理~

但是在Flash CS3之後,一切都將徹底改觀~進而取而代之的是stage.frameRate,你可以在動畫的播放之間加入下列的程式:

stage.frameRate = 100;

你會發現居然可以動態控制Frame Rate了~

2007-05-03 22:52:49 | Add Comment

Next Posts
Copyright (C) Ching-Shen Chen. All rights reserved.

::: 搜尋 :::

::: 分類 :::

::: Ads :::

::: 最新文章 :::

::: 最新回應 :::

::: 訂閱 :::

Atom feed
Atom Comment