2009年11月6日星期五

Firefox 3.5 惱人的 Bug   [+/-]

Ticore's Blog

Firefox 3, 3.5 直到最新的 3.5.5 一直都有一個討厭的 Bug
就是書籤側邊攔會自己不停的往下捲動
以下是 Bug 重覆步驟的示意圖

有時候在桌面上拖曳檔案,不小心掠過 Firefox 也會觸發這 Bug
真的很討厭!

Read more...

2009年11月1日星期日

Flash Innovation Timeline   [+/-]

Ticore's Blog

Adobe MAX 2009 Keynote Day 1 中看到 Flash Innovation Timeline
覺得蠻有紀念價值,網路上找不到這份文件
所以從影片中擷取出來貼到 Blog 上留作紀念

Read more...

2009年10月23日星期五

Adobe Flash Platform Language Reference BETA   [+/-]

Ticore's Blog

隨著 Flash Player 衍生產品越來越多
ActionScript 文件也不斷分支出來
但是各版文件中又經常有重覆的部分
這樣使用起來很沒效率
前陣子 Adobe 終於把 AS3 文件統一了
Adobe Flash Platform Language Reference BETA

文件包含了 Adobe Flash CS4 Professional, Adobe AIR, LiveCycle Data Services, Adobe ColdFusion, Adobe Flex 與 Adobe Flash Player
一份文件抵六份,最方便的地方是可以用 Filter 濾掉不想看的部分

這麼好的東西一定要分享一下啦!
http://rapidshare.com/files/296859473/Flash_Platform_AS_3.0_Reference_BETA_20091015.rar

Read more...

2009年9月9日星期三

Flex DataGrid Sorting Issue   [+/-]

Ticore's Blog

Flex DataGrid 的 selectedIndex 有一個問題
當 User 按下 Column 排序之後,雖然 selectedItem 沒變
但是 selectedIndex 卻有可能發生變化
此時 DatdGrid 居然不會發出 Change Event
使得 selectedIndex 相關的資料綁定更新失敗

DataGrid Sorting Issue Demo:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    fontSize="12" backgroundColor="#FFFFFF" layout="vertical"
    paddingBottom="5" paddingTop="5" paddingLeft="5" paddingRight="5">
 <mx:Panel title="DataGrid Sorting Issue" height="100%" width="100%"
     backgroundAlpha="0" layout="vertical">
  <mx:DataGrid id="dg" dataProvider="{employees}"
    width="100%" height="100%" backgroundAlpha="0">
   <mx:columns>
    <mx:DataGridColumn dataField="name" headerText="Name" />
    <mx:DataGridColumn dataField="phone" headerText="Phone"/>
    <mx:DataGridColumn dataField="email" headerText="Email" />
   </mx:columns>
  </mx:DataGrid>
  <mx:ControlBar paddingTop="5" paddingBottom="5" horizontalAlign="center">
   <mx:Text text="{chk.selected, 'selectedIndex : '}{dg.selectedIndex}" />
   <mx:VRule height="10" />
   <mx:Text text="{chk.selected, 'dataProvider.length : '}{dg.dataProvider.length}" />
   <mx:VRule height="10" />
   <mx:Button id="chk" label="Force Update" />
  </mx:ControlBar>
 </mx:Panel>
 <mx:Text width="100%" textAlign="right"><mx:htmlText>
  <![CDATA[ <u><a href="http://ticore.blogspot.com">Ticore's Blog -]]>
  <![CDATA[ http://ticore.blogspot.com/</a></u> ]]>
 </mx:htmlText></mx:Text>
 
 <mx:XMLList id="employees">
  <employee>
   <name>Christina Coenraets</name>
   <phone>000-000-0000</phone>
   <email>ccoenraets@fictitious.com</email>
  </employee>
  <employee>
   <name>Christina Coenraets</name>
   <phone>000-111-0000</phone>
   <email>ccoenraets@fictitious.com</email>
  </employee>
  <employee>
   <name>Joanne Wall</name>
   <phone>000-222-0000</phone>
   <email>jwall@fictitious.com</email>
  </employee>
  <employee>
   <name>Maurice Smith</name>
   <phone>000-333-0000</phone>
   <email>maurice@fictitious.com</email>
  </employee>
  <employee>
   <name>Mary Jones</name>
   <phone>000-444-0000</phone>
   <email>mjones@fictitious.com</email>
  </employee>
 </mx:XMLList>
</mx:Application>

以上的 Bug Demo 中,點選任一 Item
然後點擊 Column 排序,就會發現 selectedIndex 不會發生改變
除非按下 "Force Update" 按鈕

解決的方式,覆寫 DateGrid 的 collectionChangeHandler
自行判定 selectedIndex 是否發生改變
然後決定是否要送出 ListEvent.CHANGE 事件

package {
 import flash.events.Event;
 import mx.controls.DataGrid;
 import mx.events.ListEvent;

 public class MyDataGrid extends DataGrid {
  public function MyDataGrid() {
   super();
  }

  // Fix selectedIndex not update issue after sorting.
  override protected function collectionChangeHandler(event:Event):void {
   var oldSelectedIndex:int = selectedIndex;
   super.collectionChangeHandler(event);
   if (oldSelectedIndex != selectedIndex) {
    var evt:ListEvent = new ListEvent(ListEvent.CHANGE);
    dispatchEvent(evt);
   }
  }
 }
}
// Ticore's Blog - http://ticore.blogspot.com/

以上的 Bug 至少會在以下版本 Flex SDK 發生
Flex SDK 2.01、3.1、3.2、3.3、3.4

Read more...

2009年9月5日星期六

Clutter set_depth() Bug   [+/-]

Ticore's Blog

測試 Clutter Actor 的深度管理功能時,發現一個奇怪的 Bug
當企圖設定深度為浮點數值時,無法成功改變 Actor 前後順序

以下利用 PyClutter 建立兩個 Rectangle
red rectangle 深度設為 0,blue rectangle 深度設為 -0.9

Clutter set_depth() Bug Demo:

#! /usr/bin/env python
# encoding=UTF-8

'''
clutter 1.0.0
pyclutter 0.9.2
'''

import clutter

def main():
 stage = clutter.Stage()
 stage.set_title("Clutter set_depth Bug")
 stage.connect("destroy", clutter.main_quit)
 stage.set_size(250, 250)

 rectRed = clutter.Rectangle(clutter.Color(255, 0, 0, 192))
 rectRed.set_border_color(clutter.Color(192, 192, 192, 192))
 rectRed.set_border_width(6)
 rectRed.set_size(100, 100)
 rectRed.set_position(50, 50)
 rectRed.set_depth(0)

 rectBlue = clutter.Rectangle(clutter.Color(0, 0, 255, 192))
 rectBlue.set_border_color(clutter.Color(192, 192, 192, 192))
 rectBlue.set_border_width(6)
 rectBlue.set_size(100, 100)
 rectBlue.set_position(100, 100)
 rectBlue.set_depth(-0.9)

 stage.add(rectRed)
 stage.add(rectBlue)
 # stage.sort_depth_order()
 stage.show()

 clutter.main()

if __name__ == "__main__":
 main()

實際執行結果如下

深度為 -0.9 的 blue rectangle 居然壓在 red rectangle 上面
除非設為 -1 或以下才能成功改變先後排列順序
照這樣情況看起來,Clutter 的先後排列的精度似乎只有到 int

或許會這樣想,那為什麼不就用 int 管理深度就好呢?
答案是根本不行,Clutter Stage 預設就是一個 3D 的空間
假如有 100 個相同的 Actor,那深度差距至少有 100 單位
3D 透視結果會讓每個 Actor 大小位置產生偏移~

企圖找尋其它控制深度與順序的 API
只有 clutter_actor_raise、clutter_actor_lower、clutter_actor_raise_top、clutter_actor_lower_bottom
這些雖然正常,但都不是很好用,無法完全取代 set_depth 的功能
除此之外 Clutter 還欠缺一個最重要的 function - swap_depth

當初 Clutter 設計時,是有參考到 Flash、Director 等等的模型
但是看這樣子,似乎還有待加強吧!

Read more...

2009年8月25日星期二

Linux Flash Player Render Event Bug   [+/-]

Ticore's Blog

接續上次的 Flex UIComponent 更新尺寸的問題
整個 Flex Framework 都是以 AS3 寫成,應該是與平台無關
假如有問題只發生在 Linux 上,那肯定是 Flash Player 或其它地方的問題

再繼續搜尋問題的根源,發現 validateNow 與 invalidateSize、invalidateDisplayList
最主要的差別是在呼叫 updateDisplayList 執行的時間
validateNow 會立刻執行,而 invalidateSize、invalidateDisplayList 會呼叫 callLater 等一下才執行

再看 UIComponent.callLater 實作,發現它是等到下一次 Render or EnterFrame 事件執行
原因很明顯了,稍微再作測試就會發現 Linux 版的 Flash Player
以 opaque wmode 運行時,根本不會發出 Render Event!
所以當調整 UIComponent (UIMovieClip) 尺寸之後
因為收不到 Render Event,在錯誤的座標上被 Render 一次
隨後 EnterFrame 觸發,更新座標後又被 Render 一次
才會看起來像鋸齒狀的縮放
而 Flash Player 9 Linux 版尚未支援 wmode,難怪都是正常的

以上的 Bug 至少會在以下版本的 Flash Player 發生:
Flash Player 10.0.0.525 LNX
Flash Player 10.0.12.10 LNX
Flash Player 10.0.15.3 LNX
Flash Player 10.0.22.87 LNX
Flash Player 10.0.32.18 LNX

相關連結:
Flex UIComponent 更新尺寸的問題

Read more...