情境
1.有一個ImgViewer Class用來載入外部圖片
2.ImgViewer內部使用了loader class來載圖
3.ImgViewer內設定好一個屬性data
3.當圖片載入完成後ImgViewer對外
dispatchEvent(new Event(Complete))
4.在主程式內使用ImgViewer來載入圖片
並監聽ImgViewer 所發出的Complete事件
5.當接收到Complete事件要取得imgViewer內的data值
該如何取得
做法
var viewer:ImgViewer();
viewer.addEventListener(ImgViewer.Complete,onComplete);
function onComplete(e:Event):void{
trace(e.target.parent.data)
}
注意:是要透過parent才能取到imgViewer物件來取得data值
2009年2月27日 星期五
複製Library裡的Mc到Stage上
想到重覆複製Library裡的movieClip到Stage上使用
但又不想特定為這個mc寫一個Class做法如下
FLA
1.開啟Library,找到物件,按滑鼠右鍵Linkage
2.勾選Export for ActionScript
3.設定Identifier名稱,這名稱即可當作如class名稱般使用
AS3使用
var myBtn:mmBtn=new mmBtn();
//mmBtn為Library內linkage的名稱
但又不想特定為這個mc寫一個Class做法如下
FLA
1.開啟Library,找到物件,按滑鼠右鍵Linkage
2.勾選Export for ActionScript
3.設定Identifier名稱,這名稱即可當作如class名稱般使用
AS3使用
var myBtn:mmBtn=new mmBtn();
//mmBtn為Library內linkage的名稱
2008年9月21日 星期日
Everybody Hurts
當你感到孤單 想要放棄
不想要再承受這樣的生活
堅持下去 你並不孤單
剛退伍的那一年,回到台北,買了這張
也是唯一的一張R.E.M.樂團的專輯,只因為這首歌
聽慣了重搖滾濃烈情感的音樂,對於較和緩的音樂總覺得不痛不癢
但這首歌卻可以陪伴我走過許多難過的時刻
曲目:Everybody Hurts
專輯:Automatic for the People
樂團:R.E.M.
年份:1992
Everybody Hurts
When the day is long and the night, the night is yours alone,
When you're sure you've had enough of this life, well hang on
Don't let yourself go, 'cause everybody cries and everybody hurts sometimes
Sometimes everything is wrong. Now it's time to sing along
When your day is night alone, (hold on, hold on)
If you feel like letting go, (hold on)
When you think you've had too much of this life, well hang on
'Cause everybody hurts. Take comfort in your friends
Everybody hurts. Don't throw your hand. Oh, no. Don't throw your hand
If you feel like you're alone, no, no, no, you are not alone
If you're on your own in this life, the days and nights are long,
When you think you've had too much of this life to hang on
Well, everybody hurts sometimes,
Everybody cries. And everybody hurts sometimes
And everybody hurts sometimes. So, hold on, hold on
Hold on, hold on, hold on, hold on, hold on, hold on
Everybody hurts. You are not alone
當你感到長日漫漫 夜晚是如此孤單
當你感到受夠了這樣的生活,堅持下去
不要讓你自己放棄
其實 每個人都會受傷 每個人都會哭泣
有時候 你感到自己怎麼做都不對
當你感到孤單 想要放棄
不想要再承受這樣的生活
堅持下去
因為 每個人都會受傷,也許可以在你的朋友找到一些安慰
因為 每個人都會受傷,不要放開你的手
如果你感到自己是如此孤單, 不,不,你並不孤單
每個人都有受傷與傷心的時候
要堅持下去
你不不孤單
2008年7月28日 星期一
訂閱:
文章 (Atom)