搜尋部落格文章

2012年5月23日 星期三

TweenMax用法統整


TweenMax.to(this, 0.5, { yoyo:true, repeat: -1, 
glowFilter: { color:0xFFFFFF, alpha:0.9, blurX:15, blurY:15, inner:true, strength:1.5 }} );
//yoyo: 溜溜球模式,1-2-3-3-2-1
//repeat: 重複次數,-1代表無限
//glowFilter: 套用光暈濾鏡

... 未完待續

2012年5月16日 星期三

URLVariables 送Array資料類型給後端

終於找到解決方法可以將陣列資料送給後端
 this._urlLdr = new URLLoader();
 this._urlVar = new URLVariables();
 this._urlVar.action = "test";
 this._urlVar.id = 123456;
 this._urlVar["arr[]"] = [3,4];// 這個就是陣列啦!
 this._urlReq.data = this._urlVar;
 this._urlReq.method = URLRequestMethod.POST;

2012.06.29 更新
假設傳送二維陣列給後端,後端接收到的資料格式會有些怪
this._urlVar["arr[][]"] = [[3,4],[2,5]]; //這邊是flash送二維陣列給後端的方式

但 ~後端接收到的格式會變成 [["3,4"],["2,5"]]
可以發現在陣列中的值,被轉成字串格式了
 後端可用"逗號"切割成陣列去抓值
目前還在研究AS3的解決方法,若有網友發現可以讓接收後端正確二維陣列的方法
請分享讓大家知道吧!!

2012年5月11日 星期五

替換滑鼠游標,游標會不停閃爍

很久以前就碰到過這樣子的問題,
 首先,
我要自訂一個圖案在MOSUE_OVER某物件時,去取代原生的滑鼠指標並跟隨移動,
但若自訂圖案擋住了原本滑鼠的位置時,圖案則會不停的切換。
Mouse.hide();
↓
Mouse.show();
↓
Mouse.hide();
↓
Mouse.show();
↓
xN次
這根本就是陷入了無窮盡的迴圈啊~~~

為了確保父輩實體能夠當作滑鼠事件的目標物件來運作,
可以將父輩實體的 mouseChildren 屬性設為 false,
因為子系物件會也會觸發滑鼠事件而去影響到父輩實體。

// Ignores all sub movie clips and treats them as the parent
//      — otherwise events will be triggered on the child
//      movieclips and not our main clip
自訂圖案.mouseChildren   = false;
滑入物件.mouseChildren = false;
若自訂圖案重疊壓在要滑入的物件上方,會不斷觸發MOSUE_OUT事件,
接著我們要忽略自訂圖案的所有滑鼠事件,避免這個問題。
// Ignore all the mouse events for the cursor
//      — otherwise MOUSE_OUT will trigger since mouse is
//      now on target_mc instead of boundary_mc
自訂圖案.mouseEnabled = false;