打地鼠遊戲用到的一些代碼

.影片剪輯
MovieClip: alpha  scaleX scaleY parent  visible

.加載資源
var MCLoader:Loader=new Loader();
var adurl:URLRequest=new URLRequest("圖片路徑.jpg");
MCLoader.load(adurl);
MCLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,comleteHandle);
MCLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,loadingProgress);


function loadingProgress(e:ProgressEvent):void
{
trace(int((e.bytesLoaded/e.bytesTotal)*100)+"%");
}
function comleteHandle(e:Event)
{
   addChild(e.target.content.loader);
}


.加載外部文本
var TxtLoader=new URLLoader();
var adurl:URLRequest=new URLRequest("文本文件路徑.xml");
TxtLoader.load(adurl);
TxtLoader.addEventListener(Event.COMPLETE,comleteHandle);


.監聽鼠標事件
btn.addEventListener(MouseEvent.ROLL_OUT,btout);
btn.addEventListener(MouseEvent.ROLL_OVER,btover);


function btover(event:Event)
{

}


.拋出事件
dispatchEvent(new Event("事件名稱",true));//true設置冒泡


.彈出瀏覽器窗口
var request1:URLRequest = new URLRequest("http://www.baidu.com/");
navigateToURL(request1);




.動畫引擎
import com.greensock.*;
import com.greensock.easing.*;


TweenLite.to(mc, 0.5, {x:294, y:356, ease:Cubic.easeInOut,onComplete:wancheng});
function wancheng()
{


}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章