STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
228046
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2560 · P5120

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/23610183?noj=FRM23610183-23DC" width="1" height="1"></div>

kungfu-panda.swf

This is the info page for
Flash #117107

(Click the ID number above for more basic data on this flash file.)


ActionScript [AS3]
Section 1
//Def (def.Def) package def { import flash.display.*; import GamesList.as3.*; import myUtils.keyboardManage.*; import gameSound.*; import flash.net.*; public class Def { public static const DIE:String = "die"; public static const OK:String = "OK"; public static var isSound:Boolean = true; public static var agScore:int = 10; public static var bao:Number = 1.5; public static var goldScore:int = 50; public static var keZhuoAr:Array = [["Boat"], ["地面1", "地面2"], ["天宫墙"], ["皇城墙"], ["Boss墙"]]; public static var kong:String = ""; public static var soundAr:Array = ["关卡1", "关卡2", "关卡3", "关卡4", "boss关卡"]; public static var keDaoAr:Array = ["Wood", "竹子", "天宫塔", "皇城塔", "Boss塔"]; public static var isFirst:Boolean = true; public static var totalScore:int = 0; public static var lifeMc:MovieClip; public static var kongAr:Array = ["Point2", "陷井竹子", "Point2", "Point2", "Point2"]; public static var curobj; public static var gameSound:GameSound = new GameSound(); public static var keZhuo:Array = []; public static var vy:Number = -45; public static var currentSence:Array = ["关卡1-桂林", "关卡2-山林", "关卡3-天宫", "关卡4-皇城", "关卡5-BOSS"]; public static var vx:Number = 17; public static var bossXv:Number = 17.2; public static var myEvent:EventListener; public static var stageHeight:Number = 480; public static var keDao:String = ""; public static var g:Number = 4; public static var dieDis:Number = 160; public static var stageWidth:Number = 640; public static var currentId:int = 0; public static var lifes:int = 5; public function Def(){ super(); } public static function toWeb():void{ navigateToURL(new URLRequest("http://www.gameslist.com/freegames")); } public static function submitScore(bn):void{ if (curobj != bn){ curobj = bn; GamesListAPIAS3.GenerateScoreID(); GamesListAPIAS3.submitScore(totalScore); }; } public static function moreGame():void{ navigateToURL(new URLRequest("http://www.gameslist.com/")); } } }//package def
Section 2
//GamesListAPIAS3 (GamesList.as3.GamesListAPIAS3) package GamesList.as3 { import flash.net.*; public class GamesListAPIAS3 { private static var HighScore_Pass:String; private static var HighScore_GameName:String; private static var HighScore_ScoreID:String; private static var HighScore_RequestURL:URLRequest; public function GamesListAPIAS3(){ super(); } public static function submitScore(score:Number):void{ trace("submitscore"); var pass:* = GamesListMD5AS3.calculate(((HighScore_Pass + HighScore_ScoreID) + score)); HighScore_RequestURL.url = ((((((("http://www.gameslist.com/submitscore.php?game=" + HighScore_GameName) + "&scoreid=") + HighScore_ScoreID) + "&score=") + score) + "&key=") + pass); navigateToURL(HighScore_RequestURL, "_blank"); } public static function config(gamename:String, pass:String):void{ HighScore_GameName = gamename; HighScore_Pass = pass; HighScore_RequestURL = new URLRequest(); } public static function GenerateScoreID():void{ var currentDate:Date = new Date(); HighScore_ScoreID = (currentDate.getTime() + String((Math.floor((Math.random() * 9000)) + 1000))); } } }//package GamesList.as3
Section 3
//GamesListMD5AS3 (GamesList.as3.GamesListMD5AS3) package GamesList.as3 { public class GamesListMD5AS3 { private static var hexChars:String = "0123456789abcdef"; public function GamesListMD5AS3(){ super(); } private static function ff(a:int, b:int, c:int, d:int, x:int, s:int, t:int):int{ return (transform(f, a, b, c, d, x, s, t)); } private static function createBlocks(s:String):Array{ var blocks:Array = new Array(); var len:int = (s.length * 8); var mask = 0xFF; var i:int; while (i < len) { blocks[(i >> 5)] = (blocks[(i >> 5)] | ((s.charCodeAt((i / 8)) & mask) << (i % 32))); i = (i + 8); }; blocks[(len >> 5)] = (blocks[(len >> 5)] | (128 << (len % 32))); blocks[((((len + 64) >>> 9) << 4) + 14)] = len; return (blocks); } private static function f(x:int, y:int, z:int):int{ return (((x & y) | (~(x) & z))); } private static function ii(a:int, b:int, c:int, d:int, x:int, s:int, t:int):int{ return (transform(i, a, b, c, d, x, s, t)); } private static function h(x:int, y:int, z:int):int{ return (((x ^ y) ^ z)); } private static function transform(func:Function, a:int, b:int, c:int, d:int, x:int, s:int, t:int):int{ var tmp:int = (((a + int(func(b, c, d))) + x) + t); return ((rol(tmp, s) + b)); } public static function calculate(s:String):String{ var aa:int; var bb:int; var cc:int; var dd:int; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; var x:Array = createBlocks(s); var len:int = x.length; var i:int; while (i < len) { aa = a; bb = b; cc = c; dd = d; a = ff(a, b, c, d, x[(i + 0)], 7, -680876936); d = ff(d, a, b, c, x[(i + 1)], 12, -389564586); c = ff(c, d, a, b, x[(i + 2)], 17, 606105819); b = ff(b, c, d, a, x[(i + 3)], 22, -1044525330); a = ff(a, b, c, d, x[(i + 4)], 7, -176418897); d = ff(d, a, b, c, x[(i + 5)], 12, 1200080426); c = ff(c, d, a, b, x[(i + 6)], 17, -1473231341); b = ff(b, c, d, a, x[(i + 7)], 22, -45705983); a = ff(a, b, c, d, x[(i + 8)], 7, 1770035416); d = ff(d, a, b, c, x[(i + 9)], 12, -1958414417); c = ff(c, d, a, b, x[(i + 10)], 17, -42063); b = ff(b, c, d, a, x[(i + 11)], 22, -1990404162); a = ff(a, b, c, d, x[(i + 12)], 7, 1804603682); d = ff(d, a, b, c, x[(i + 13)], 12, -40341101); c = ff(c, d, a, b, x[(i + 14)], 17, -1502002290); b = ff(b, c, d, a, x[(i + 15)], 22, 1236535329); a = gg(a, b, c, d, x[(i + 1)], 5, -165796510); d = gg(d, a, b, c, x[(i + 6)], 9, -1069501632); c = gg(c, d, a, b, x[(i + 11)], 14, 643717713); b = gg(b, c, d, a, x[(i + 0)], 20, -373897302); a = gg(a, b, c, d, x[(i + 5)], 5, -701558691); d = gg(d, a, b, c, x[(i + 10)], 9, 38016083); c = gg(c, d, a, b, x[(i + 15)], 14, -660478335); b = gg(b, c, d, a, x[(i + 4)], 20, -405537848); a = gg(a, b, c, d, x[(i + 9)], 5, 568446438); d = gg(d, a, b, c, x[(i + 14)], 9, -1019803690); c = gg(c, d, a, b, x[(i + 3)], 14, -187363961); b = gg(b, c, d, a, x[(i + 8)], 20, 1163531501); a = gg(a, b, c, d, x[(i + 13)], 5, -1444681467); d = gg(d, a, b, c, x[(i + 2)], 9, -51403784); c = gg(c, d, a, b, x[(i + 7)], 14, 1735328473); b = gg(b, c, d, a, x[(i + 12)], 20, -1926607734); a = hh(a, b, c, d, x[(i + 5)], 4, -378558); d = hh(d, a, b, c, x[(i + 8)], 11, -2022574463); c = hh(c, d, a, b, x[(i + 11)], 16, 1839030562); b = hh(b, c, d, a, x[(i + 14)], 23, -35309556); a = hh(a, b, c, d, x[(i + 1)], 4, -1530992060); d = hh(d, a, b, c, x[(i + 4)], 11, 1272893353); c = hh(c, d, a, b, x[(i + 7)], 16, -155497632); b = hh(b, c, d, a, x[(i + 10)], 23, -1094730640); a = hh(a, b, c, d, x[(i + 13)], 4, 681279174); d = hh(d, a, b, c, x[(i + 0)], 11, -358537222); c = hh(c, d, a, b, x[(i + 3)], 16, -722521979); b = hh(b, c, d, a, x[(i + 6)], 23, 76029189); a = hh(a, b, c, d, x[(i + 9)], 4, -640364487); d = hh(d, a, b, c, x[(i + 12)], 11, -421815835); c = hh(c, d, a, b, x[(i + 15)], 16, 530742520); b = hh(b, c, d, a, x[(i + 2)], 23, -995338651); a = ii(a, b, c, d, x[(i + 0)], 6, -198630844); d = ii(d, a, b, c, x[(i + 7)], 10, 1126891415); c = ii(c, d, a, b, x[(i + 14)], 15, -1416354905); b = ii(b, c, d, a, x[(i + 5)], 21, -57434055); a = ii(a, b, c, d, x[(i + 12)], 6, 1700485571); d = ii(d, a, b, c, x[(i + 3)], 10, -1894986606); c = ii(c, d, a, b, x[(i + 10)], 15, -1051523); b = ii(b, c, d, a, x[(i + 1)], 21, -2054922799); a = ii(a, b, c, d, x[(i + 8)], 6, 1873313359); d = ii(d, a, b, c, x[(i + 15)], 10, -30611744); c = ii(c, d, a, b, x[(i + 6)], 15, -1560198380); b = ii(b, c, d, a, x[(i + 13)], 21, 1309151649); a = ii(a, b, c, d, x[(i + 4)], 6, -145523070); d = ii(d, a, b, c, x[(i + 11)], 10, -1120210379); c = ii(c, d, a, b, x[(i + 2)], 15, 718787259); b = ii(b, c, d, a, x[(i + 9)], 21, -343485551); a = (a + aa); b = (b + bb); c = (c + cc); d = (d + dd); i = (i + 16); }; return ((((toHex(a) + toHex(b)) + toHex(c)) + toHex(d))); } private static function g(x:int, y:int, z:int):int{ return (((x & z) | (y & ~(z)))); } private static function hh(a:int, b:int, c:int, d:int, x:int, s:int, t:int):int{ return (transform(h, a, b, c, d, x, s, t)); } private static function i(x:int, y:int, z:int):int{ return ((y ^ (x | ~(z)))); } private static function ror(x:int, n:int):uint{ var nn:int = (32 - n); return (((x << nn) | (x >>> (32 - nn)))); } private static function rol(x:int, n:int):int{ return (((x << n) | (x >>> (32 - n)))); } private static function gg(a:int, b:int, c:int, d:int, x:int, s:int, t:int):int{ return (transform(g, a, b, c, d, x, s, t)); } private static function toHex(n:int, bigEndian:Boolean=false):String{ var i:int; var x:int; var s:String = ""; if (bigEndian){ i = 0; while (i < 4) { s = (s + (hexChars.charAt(((n >> (((3 - i) * 8) + 4)) & 15)) + hexChars.charAt(((n >> ((3 - i) * 8)) & 15)))); i++; }; } else { x = 0; while (x < 4) { s = (s + (hexChars.charAt(((n >> ((x * 8) + 4)) & 15)) + hexChars.charAt(((n >> (x * 8)) & 15)))); x++; }; }; return (s); } } }//package GamesList.as3
Section 4
//GameSound (gameSound.GameSound) package gameSound { import def.*; import flash.media.*; public class GameSound { private var soundAr:Object; private var channel:SoundChannel; public var currentBgSound:String; public function GameSound(){ soundAr = new Object(); super(); soundAr["boss关卡"] = new (Panda.instance.getClass("boss关卡")); soundAr["按钮声"] = new (Panda.instance.getClass("按钮声")); soundAr["吃金币"] = new (Panda.instance.getClass("吃金币")); soundAr["吃银币"] = new (Panda.instance.getClass("吃银币")); soundAr["关卡1"] = new (Panda.instance.getClass("关卡1")); soundAr["关卡2"] = new (Panda.instance.getClass("关卡2")); soundAr["关卡3"] = new (Panda.instance.getClass("关卡3")); soundAr["关卡4"] = new (Panda.instance.getClass("关卡4")); soundAr["开始关卡前熊猫的吼叫"] = new (Panda.instance.getClass("开始关卡前熊猫的吼叫")); soundAr["甩刀"] = new (Panda.instance.getClass("甩刀")); soundAr["惊讶"] = new (Panda.instance.getClass("惊讶")); soundAr["落下"] = new (Panda.instance.getClass("落下")); soundAr["死亡"] = new (Panda.instance.getClass("死亡")); } public function lost():void{ if (Def.isSound){ soundAr["落下"].play(); }; } public function stopBgSound():void{ if (this.channel){ this.channel.stop(); this.channel = null; }; } public function furbishBgSound():void{ if (Def.isSound){ if (channel == null){ channel = soundAr[this.currentBgSound].play(0, 99999); }; } else { stopBgSound(); }; } public function jingYa():void{ if (Def.isSound){ soundAr["惊讶"].play(); }; } public function dao():void{ if (Def.isSound){ soundAr["甩刀"].play(); }; } public function clickBn():void{ if (Def.isSound){ soundAr["按钮声"].play(); }; } public function die():void{ if (Def.isSound){ soundAr["死亡"].play(); }; } public function beginGate():void{ if (Def.isSound){ soundAr["开始关卡前熊猫的吼叫"].play(); }; } public function eatAg():void{ if (Def.isSound){ soundAr["吃银币"].play(); }; } public function eatGold():void{ if (Def.isSound){ soundAr["吃金币"].play(); }; } } }//package gameSound
Section 5
//ByteArrayAsset (mx.core.ByteArrayAsset) package mx.core { import flash.utils.*; public class ByteArrayAsset extends ByteArray implements IFlexAsset { mx_internal static const VERSION:String = "3.2.0.3958"; public function ByteArrayAsset(){ super(); } } }//package mx.core
Section 6
//EdgeMetrics (mx.core.EdgeMetrics) package mx.core { public class EdgeMetrics { public var top:Number; public var left:Number; public var bottom:Number; public var right:Number; mx_internal static const VERSION:String = "3.2.0.3958"; public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0); ; public function EdgeMetrics(left:Number=0, top:Number=0, right:Number=0, bottom:Number=0){ super(); this.left = left; this.top = top; this.right = right; this.bottom = bottom; } public function clone():EdgeMetrics{ return (new EdgeMetrics(left, top, right, bottom)); } } }//package mx.core
Section 7
//FlexMovieClip (mx.core.FlexMovieClip) package mx.core { import flash.display.*; import mx.utils.*; public class FlexMovieClip extends MovieClip { mx_internal static const VERSION:String = "3.2.0.3958"; public function FlexMovieClip(){ super(); name = NameUtil.createUniqueName(this); //unresolved jump var _slot1 = e; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 8
//IBorder (mx.core.IBorder) package mx.core { public interface IBorder { function get borderMetrics():EdgeMetrics; } }//package mx.core
Section 9
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 10
//IFlexDisplayObject (mx.core.IFlexDisplayObject) package mx.core { import flash.events.*; import flash.display.*; import flash.geom.*; import flash.accessibility.*; public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher { function get visible():Boolean; function get rotation():Number; function localToGlobal(void:Point):Point; function get name():String; function set width(flash.display:Number):void; function get measuredHeight():Number; function get blendMode():String; function get scale9Grid():Rectangle; function set name(flash.display:String):void; function set scaleX(flash.display:Number):void; function set scaleY(flash.display:Number):void; function get measuredWidth():Number; function get accessibilityProperties():AccessibilityProperties; function set scrollRect(flash.display:Rectangle):void; function get cacheAsBitmap():Boolean; function globalToLocal(void:Point):Point; function get height():Number; function set blendMode(flash.display:String):void; function get parent():DisplayObjectContainer; function getBounds(String:DisplayObject):Rectangle; function get opaqueBackground():Object; function set scale9Grid(flash.display:Rectangle):void; function setActualSize(_arg1:Number, _arg2:Number):void; function set alpha(flash.display:Number):void; function set accessibilityProperties(flash.display:AccessibilityProperties):void; function get width():Number; function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean; function set cacheAsBitmap(flash.display:Boolean):void; function get scaleX():Number; function get scaleY():Number; function get scrollRect():Rectangle; function get mouseX():Number; function get mouseY():Number; function set height(flash.display:Number):void; function set mask(flash.display:DisplayObject):void; function getRect(String:DisplayObject):Rectangle; function get alpha():Number; function set transform(flash.display:Transform):void; function move(_arg1:Number, _arg2:Number):void; function get loaderInfo():LoaderInfo; function get root():DisplayObject; function hitTestObject(mx.core:IFlexDisplayObject/mx.core:IFlexDisplayObject:stage/get:DisplayObject):Boolean; function set opaqueBackground(flash.display:Object):void; function set visible(flash.display:Boolean):void; function get mask():DisplayObject; function set x(flash.display:Number):void; function set y(flash.display:Number):void; function get transform():Transform; function set filters(flash.display:Array):void; function get x():Number; function get y():Number; function get filters():Array; function set rotation(flash.display:Number):void; function get stage():Stage; } }//package mx.core
Section 11
//IRepeaterClient (mx.core.IRepeaterClient) package mx.core { public interface IRepeaterClient { function get instanceIndices():Array; function set instanceIndices(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void; function get isDocument():Boolean; function set repeaters(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void; function initializeRepeaterArrays(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:IRepeaterClient):void; function get repeaters():Array; function set repeaterIndices(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void; function get repeaterIndices():Array; } }//package mx.core
Section 12
//MovieClipAsset (mx.core.MovieClipAsset) package mx.core { public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject, IBorder { private var _measuredHeight:Number; private var _measuredWidth:Number; mx_internal static const VERSION:String = "3.2.0.3958"; public function MovieClipAsset(){ super(); _measuredWidth = width; _measuredHeight = height; } public function get measuredWidth():Number{ return (_measuredWidth); } public function get measuredHeight():Number{ return (_measuredHeight); } public function setActualSize(newWidth:Number, newHeight:Number):void{ width = newWidth; height = newHeight; } public function move(x:Number, y:Number):void{ this.x = x; this.y = y; } public function get borderMetrics():EdgeMetrics{ if (scale9Grid == null){ return (EdgeMetrics.EMPTY); }; return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom)))); } } }//package mx.core
Section 13
//MovieClipLoaderAsset (mx.core.MovieClipLoaderAsset) package mx.core { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.system.*; public class MovieClipLoaderAsset extends MovieClipAsset implements IFlexAsset, IFlexDisplayObject { protected var initialHeight:Number;// = 0 private var loader:Loader;// = null private var initialized:Boolean;// = false protected var initialWidth:Number;// = 0 private var requestedHeight:Number; private var requestedWidth:Number; mx_internal static const VERSION:String = "3.2.0.3958"; public function MovieClipLoaderAsset(){ super(); var loaderContext:LoaderContext = new LoaderContext(); loaderContext.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain); if (("allowLoadBytesCodeExecution" in loaderContext)){ loaderContext["allowLoadBytesCodeExecution"] = true; }; loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler); loader.loadBytes(movieClipData, loaderContext); addChild(loader); } override public function get width():Number{ if (!initialized){ return (initialWidth); }; return (super.width); } override public function set width(value:Number):void{ if (!initialized){ requestedWidth = value; } else { loader.width = value; }; } override public function get measuredHeight():Number{ return (initialHeight); } private function completeHandler(event:Event):void{ initialized = true; initialWidth = loader.width; initialHeight = loader.height; if (!isNaN(requestedWidth)){ loader.width = requestedWidth; }; if (!isNaN(requestedHeight)){ loader.height = requestedHeight; }; dispatchEvent(event); } override public function set height(value:Number):void{ if (!initialized){ requestedHeight = value; } else { loader.height = value; }; } override public function get measuredWidth():Number{ return (initialWidth); } override public function get height():Number{ if (!initialized){ return (initialHeight); }; return (super.height); } public function get movieClipData():ByteArray{ return (null); } } }//package mx.core
Section 14
//mx_internal (mx.core.mx_internal) package mx.core { public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal"; }//package mx.core
Section 15
//NameUtil (mx.utils.NameUtil) package mx.utils { import flash.display.*; import mx.core.*; import flash.utils.*; public class NameUtil { mx_internal static const VERSION:String = "3.2.0.3958"; private static var counter:int = 0; public function NameUtil(){ super(); } public static function displayObjectToString(displayObject:DisplayObject):String{ var result:String; var o:DisplayObject; var s:String; var indices:Array; var displayObject = displayObject; o = displayObject; while (o != null) { if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){ break; }; s = o.name; if ((o is IRepeaterClient)){ indices = IRepeaterClient(o).instanceIndices; if (indices){ s = (s + (("[" + indices.join("][")) + "]")); }; }; result = ((result == null)) ? s : ((s + ".") + result); o = o.parent; }; //unresolved jump var _slot1 = e; return (result); } public static function createUniqueName(object:Object):String{ if (!object){ return (null); }; var name:String = getQualifiedClassName(object); var index:int = name.indexOf("::"); if (index != -1){ name = name.substr((index + 2)); }; var charCode:int = name.charCodeAt((name.length - 1)); if ((((charCode >= 48)) && ((charCode <= 57)))){ name = (name + "_"); }; return ((name + counter++)); } } }//package mx.utils
Section 16
//CartonMc (myUtils.cartonMc.CartonMc) package myUtils.cartonMc { import flash.events.*; import flash.display.*; import flash.utils.*; import def.*; public class CartonMc { private var vy:Number; private var timer:Timer; private var g:Number; private var mask:Sprite; private var mc:MovieClip; private var upVy:Number; private var fun:Function; private static var _instance:CartonMc; private static var n:int = 0; public function CartonMc(){ super(); } public function toUp(mc:MovieClip, _fun:Function=null):void{ if (timer.hasEventListener(TimerEvent.TIMER)){ if (fun != null){ fun(); fun = null; }; timer.stop(); timer.removeEventListener(TimerEvent.TIMER, onTimer); }; fun = _fun; timer.start(); timer.addEventListener(TimerEvent.TIMER, onTimer2); } private function onTimer(e:TimerEvent):void{ mc.y = (mc.y + vy); vy = (vy + g); if ((((n == 0)) && ((mc.y >= (Def.stageHeight * 0.5))))){ n++; vy = (-(vy) * 0.5); } else { if ((((n == 1)) && ((mc.y >= (Def.stageHeight * 0.5))))){ if (fun != null){ fun(); fun = null; }; timer.stop(); timer.removeEventListener(TimerEvent.TIMER, onTimer); mc.y = (Def.stageHeight * 0.5); }; }; } private function onTimer2(e:TimerEvent):void{ mc.y = (mc.y - upVy); if (mc.y <= -(mc.height)){ if (fun != null){ trace("aa"); fun(); fun = null; }; if (mask.parent){ mask.parent.removeChild(mask); }; timer.stop(); timer.removeEventListener(TimerEvent.TIMER, onTimer2); mc.y = -(mc.height); }; } public function toDown(_mc:MovieClip, time:int, _fun:Function=null):void{ fun = _fun; this.mc = _mc; if (mc.stage){ if (mask == null){ mask = new Sprite(); mask.graphics.beginFill(0, 0.7); mask.graphics.drawRect(0, 0, Def.stageWidth, Def.stageHeight); mask.graphics.endFill(); }; mc.parent.addChildAt(mask, mc.parent.getChildIndex(mc)); mc.y = (-(mc.height) * 0.5); mc.x = (Def.stageWidth * 0.5); }; this.upVy = 40; timer = new Timer(20); vy = 0; g = (3 / time); timer.addEventListener(TimerEvent.TIMER, onTimer); timer.start(); } public static function get instance():CartonMc{ if (_instance == null){ _instance = new (CartonMc); }; n = 0; return (_instance); } } }//package myUtils.cartonMc
Section 17
//EventListener (myUtils.keyboardManage.EventListener) package myUtils.keyboardManage { import flash.events.*; import flash.display.*; public class EventListener { private var frameEnterFrame:Array; public var stage:Stage; private var frameKeyDownFun:Array; private var keyDownFun:Array; public var key:Object; public function EventListener(_stage:Stage){ key = new Object(); keyDownFun = []; frameKeyDownFun = []; frameEnterFrame = []; super(); stage = _stage; } public function onKey_Down(e:KeyboardEvent):void{ var arr:Array; key[e.keyCode] = true; for each (arr in keyDownFun) { arr[0].apply(null, arr[1]); }; } public function onEnter_Frame(e:Event):void{ var arr:Array; for each (arr in frameKeyDownFun) { arr[0].apply(null, arr[1]); }; for each (arr in frameEnterFrame) { arr[0].apply(null, arr[1]); }; } public function addFunToframeEnterFrame(fun:Function, ... _args):void{ var arr:Array = [fun, _args]; frameEnterFrame.push(arr); } public function removeFunToframeEnterFrame(fun:Function):void{ var i:int; while (i < frameEnterFrame.length) { if (frameEnterFrame[i][0] == fun){ frameEnterFrame.splice(i, 1); break; }; i++; }; } public function addFunToFrameKeyDownFun(fun:Function, ... _args):void{ var arr:Array = [fun, _args]; frameKeyDownFun.push(arr); } public function removeFunToKeyDownFun(fun:Function):void{ var i:int; while (i < keyDownFun.length) { if (keyDownFun[i][0] == fun){ keyDownFun.splice(i, 1); break; }; i++; }; } public function removeFunToFrameKeyDownFun(fun:Function):void{ var i:int; while (i < frameKeyDownFun.length) { if (frameKeyDownFun[i][0] == fun){ frameKeyDownFun.splice(i, 1); break; }; i++; }; } public function addFunToKeyDownFun(fun:Function, ... _args):void{ var arr:Array = [fun, _args]; keyDownFun.push(arr); } public function addEvent():void{ if (!stage.hasEventListener(KeyboardEvent.KEY_DOWN)){ stage.addEventListener(KeyboardEvent.KEY_DOWN, onKey_Down); }; if (!stage.hasEventListener(KeyboardEvent.KEY_UP)){ stage.addEventListener(KeyboardEvent.KEY_UP, onKey_Up); }; if (!stage.hasEventListener(Event.ENTER_FRAME)){ stage.addEventListener(Event.ENTER_FRAME, onEnter_Frame); }; } public function onKey_Up(e:KeyboardEvent):void{ key[e.keyCode] = false; } public function removeEvent():void{ stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKey_Down); stage.removeEventListener(KeyboardEvent.KEY_UP, onKey_Up); stage.removeEventListener(Event.ENTER_FRAME, onEnter_Frame); } } }//package myUtils.keyboardManage
Section 18
//Keyboad2 (myUtils.keyboardManage.Keyboad2) package myUtils.keyboardManage { public class Keyboad2 { public static const left:uint = 37; public static const right:uint = 39; public static const A:uint = 65; public static const B:uint = 66; public static const C:uint = 67; public static const E:uint = 69; public static const F:uint = 70; public static const G:uint = 71; public static const H:uint = 72; public static const I:uint = 73; public static const J:uint = 74; public static const Page_Up:uint = 33; public static const L:uint = 76; public static const M:uint = 77; public static const N:uint = 78; public static const O:uint = 79; public static const P:uint = 80; public static const Q:uint = 81; public static const Page_Down:uint = 34; public static const D:uint = 68; public static const T:uint = 84; public static const U:uint = 85; public static const V:uint = 86; public static const W:uint = 87; public static const X:uint = 88; public static const R:uint = 82; public static const S:uint = 83; public static const ESC:uint = 27; public static const Backspace:uint = 8; public static const Y:uint = 89; public static const Z:uint = 90; public static const K:uint = 75; public static const Shift:uint = 16; public static const Spacebar:uint = 32; public static const TAB:uint = 9; public static const Ctrl:uint = 17; public static const up:uint = 38; public static const down:uint = 40; public static const F3:uint = 114; public static const F5:uint = 116; public static const _0:uint = 48; public static const _2:uint = 50; public static const _3:uint = 51; public static const _4:uint = 52; public static const _5:uint = 53; public static const _6:uint = 54; public static const _7:uint = 55; public static const _1:uint = 49; public static const _9:uint = 57; public static const End:uint = 35; public static const F4:uint = 115; public static const Enter:uint = 13; public static const _8:uint = 56; public static const Delete:uint = 46; public static const F1:uint = 112; public static const F6:uint = 117; public static const F8:uint = 119; public static const Insert:uint = 45; public static const Numpad_0:uint = 96; public static const Numpad_1:uint = 97; public static const Numpad_2:uint = 98; public static const Numpad_3:uint = 99; public static const Numpad_4:uint = 100; public static const Numpad_5:uint = 101; public static const Numpad_6:uint = 102; public static const Numpad_7:uint = 103; public static const Numpad_8:uint = 104; public static const Numpad_9:uint = 105; public static const F2:uint = 113; public static const F7:uint = 118; public static const Home:uint = 36; public function Keyboad2(){ super(); } } }//package myUtils.keyboardManage
Section 19
//Masked (myUtils.masked.Masked) package myUtils.masked { import flash.events.*; import flash.display.*; import flash.utils.*; public class Masked extends Sprite { private var timer:Timer; private var repeat:int; private var fun:Function; public function Masked(sec:Number, _width:Number=733, _height:Number=550){ super(); this.graphics.beginFill(0); this.graphics.drawRect(0, 0, _width, _height); this.graphics.endFill(); repeat = int(((sec * 1000) / 50)); timer = new Timer(50, repeat); } public function toDrak(_fun:Function=null):void{ timer.addEventListener(TimerEvent.TIMER, onTimer1); timer.start(); this.alpha = 0; this.fun = _fun; } public function toLight(_fun:Function=null):void{ timer.addEventListener(TimerEvent.TIMER, onTimer2); timer.start(); this.alpha = 1; this.fun = _fun; } private function onTimer2(e:Event):void{ this.alpha = ((repeat - timer.currentCount) / repeat); if (timer.currentCount == repeat){ timer.stop(); timer.removeEventListener(TimerEvent.TIMER, onTimer2); timer = null; if (fun != null){ fun(); fun = null; }; if (this.parent){ this.parent.removeChild(this); }; }; } private function onTimer1(e:Event):void{ this.alpha = (timer.currentCount / repeat); if (timer.currentCount == repeat){ timer.stop(); timer.removeEventListener(TimerEvent.TIMER, onTimer1); timer = null; if (fun != null){ fun(); fun = null; }; if (this.parent){ this.parent.removeChild(this); }; }; } } }//package myUtils.masked
Section 20
//ChangeReferenceSystem (myUtils.ChangeReferenceSystem) package myUtils { import flash.geom.*; public class ChangeReferenceSystem { public function ChangeReferenceSystem(){ super(); } public static function ChangeReference(sourceMC, targetMC):Point{ var point:Point; if ((((sourceMC == null)) || ((targetMC == null)))){ return (null); }; if (sourceMC.parent != null){ point = new Point(sourceMC.x, sourceMC.y); point = sourceMC.parent.localToGlobal(point); point = targetMC.globalToLocal(point); return (point); }; return (null); } } }//package myUtils
Section 21
//CheckTouch (myUtils.CheckTouch) package myUtils { import flash.display.*; import flash.geom.*; public class CheckTouch { public function CheckTouch(){ super(); } protected static function getDrawMatrix(target:DisplayObject, hitRectangle:Rectangle, accurracy:Number):Matrix{ var localToGlobal:Point; var matrix:Matrix; var rootConcatenatedMatrix:Matrix = target.root.transform.concatenatedMatrix; var point:Point = target.localToGlobal(new Point(0, 0)); localToGlobal = target.root.globalToLocal(point); matrix = target.transform.concatenatedMatrix; matrix.tx = (localToGlobal.x - hitRectangle.x); matrix.ty = (localToGlobal.y - hitRectangle.y); matrix.a = (matrix.a / rootConcatenatedMatrix.a); if (accurracy != 1){ matrix.scale(accurracy, accurracy); }; return (matrix); } public static function complexHitTestObject(target1:DisplayObject, target2:DisplayObject, accurracy:Number=1):Boolean{ return (!((complexIntersectionRectangle(target1, target2, accurracy).width == 0))); } public static function complexIntersectionRectangle(target1:DisplayObject, target2:DisplayObject, accurracy:Number=1):Rectangle{ if (accurracy <= 0){ throw (new Error("ArgumentError: Error #5001: Invalid value for accurracy", 5001)); }; if (!target1.hitTestObject(target2)){ return (new Rectangle()); }; var hitRectangle:Rectangle = intersectionRectangle(target1, target2); if (((((hitRectangle.width * accurracy) < 1)) || (((hitRectangle.height * accurracy) < 1)))){ return (new Rectangle()); }; var bitmapData:BitmapData = new BitmapData((hitRectangle.width * accurracy), (hitRectangle.height * accurracy), false, 0); bitmapData.draw(target1, CheckTouch.getDrawMatrix(target1, hitRectangle, accurracy), new ColorTransform(1, 1, 1, 1, 0xFF, -255, -255, 0xFF)); bitmapData.draw(target2, CheckTouch.getDrawMatrix(target2, hitRectangle, accurracy), new ColorTransform(1, 1, 1, 1, 0xFF, 0xFF, 0xFF, 0xFF), BlendMode.DIFFERENCE); var intersection:Rectangle = bitmapData.getColorBoundsRect(4294967295, 4278255615); bitmapData.dispose(); if (accurracy != 1){ intersection.x = (intersection.x / accurracy); intersection.y = (intersection.y / accurracy); intersection.width = (intersection.width / accurracy); intersection.height = (intersection.height / accurracy); }; intersection.x = (intersection.x + hitRectangle.x); intersection.y = (intersection.y + hitRectangle.y); return (intersection); } public static function intersectionRectangle(target1:DisplayObject, target2:DisplayObject):Rectangle{ if (((((!(target1.root)) || (!(target2.root)))) || (!(target1.hitTestObject(target2))))){ return (new Rectangle()); }; var bounds1:Rectangle = target1.getBounds(target1.root); var bounds2:Rectangle = target2.getBounds(target2.root); var intersection:Rectangle = new Rectangle(); intersection.x = Math.max(bounds1.x, bounds2.x); intersection.y = Math.max(bounds1.y, bounds2.y); intersection.width = Math.min(((bounds1.x + bounds1.width) - intersection.x), ((bounds2.x + bounds2.width) - intersection.x)); intersection.height = Math.min(((bounds1.y + bounds1.height) - intersection.y), ((bounds2.y + bounds2.height) - intersection.y)); return (intersection); } } }//package myUtils
Section 22
//iPointRegister (myUtils.iPointRegister) package myUtils { import flash.display.*; import flash.geom.*; import flash.utils.*; public class iPointRegister { private static var _target:Dictionary; public function iPointRegister(){ super(); } public static function register(target:DisplayObject, point:Point):void{ if (!_target){ _target = new Dictionary(); }; _target[target] = {}; var s:Object = _target[target]; s["x"] = point.x; s["y"] = point.y; s["r"] = Point.distance(new Point(target.x, target.y), new Point(s["x"], s["y"])); s["d"] = (Math.asin((Math.abs((s["y"] - target.y)) / s["r"])) / (Math.PI / 180)); if ((((s["x"] > target.x)) && ((s["y"] < target.y)))){ s["d"] = (180 - s["d"]); } else { if ((((s["x"] > target.x)) && ((s["y"] > target.y)))){ s["d"] = (s["d"] + 180); } else { if ((((s["x"] < target.x)) && ((s["y"] > target.y)))){ s["d"] = (360 - s["d"]); }; }; }; } public static function unregister(target:DisplayObject):void{ if (!_target){ return; }; if (!_target[target]){ return; }; _target[target] = null; } public static function rotate(target:DisplayObject, rotation:Number):void{ if (!_target){ return; }; if (!_target[target]){ return; }; var s:Object = _target[target]; var r:Number = (rotation - target.rotation); target.rotation = rotation; s["d"] = (s["d"] + r); target.x = (s["x"] + (s["r"] * Math.cos(((s["d"] * Math.PI) / 180)))); target.y = (s["y"] + (s["r"] * Math.sin(((s["d"] * Math.PI) / 180)))); } } }//package myUtils
Section 23
//Tween (myUtils.Tween) package myUtils { import flash.events.*; import flash.display.*; import flash.utils.*; public class Tween { public static var dic:Dictionary = new Dictionary(); public function Tween(){ super(); } public static function limeTo(mc:DisplayObject, x:Number, y:Number, scaleX:Number=1, scaleY:Number=1, time:Number=0.5, fun:Function=null):void{ var obj:Object; var mc = mc; var x = x; var y = y; var scaleX = scaleX; var scaleY = scaleY; var time = time; var fun = fun; if (mc){ var onTimer:Function = function (e:TimerEvent):void{ mc.x = (mc.x + obj.vx); mc.y = (mc.y + obj.vy); mc.scaleX = (mc.scaleX + obj.scaleVx); mc.scaleY = (mc.scaleY + obj.scaleVy); if (obj.timer.currentCount == obj.timer.repeatCount){ mc.x = obj.x; mc.y = obj.y; mc.scaleX = obj.scaleX; mc.scaleY = obj.scaleY; if (obj.fun != null){ obj.fun(); }; destroy(mc); }; }; if (dic[mc] == null){ dic[mc] = {}; dic[mc].timer = new Timer(20); }; obj = dic[mc]; obj.count = Math.ceil(((time * 1000) / 20)); obj.x = x; obj.y = y; obj.scaleX = scaleX; obj.scaleY = scaleY; obj.vx = ((obj.x - mc.x) / obj.count); obj.vy = ((obj.y - mc.y) / obj.count); obj.scaleVx = ((obj.scaleX - mc.scaleX) / obj.count); obj.scaleVy = ((obj.scaleY - mc.scaleY) / obj.count); obj.timer.repeatCount = obj.count; obj.timer.reset(); obj.fun = fun; if (!obj.timer.hasEventListener(TimerEvent.TIMER)){ obj.timer.addEventListener(TimerEvent.TIMER, onTimer); }; obj.timer.start(); obj.onTimer = onTimer; }; } public static function stop(mc:DisplayObject):void{ var obj:Object; if (mc){ obj = dic[mc]; if (obj){ if (Timer(obj.timer).hasEventListener(TimerEvent.TIMER)){ obj.timer.stop(); }; }; }; } public static function start(mc:DisplayObject):void{ var obj:Object; if (mc){ obj = dic[mc]; if (obj){ if (Timer(obj.timer).hasEventListener(TimerEvent.TIMER)){ obj.timer.start(); }; }; }; } public static function alphaTo(mc:DisplayObject, alpha:Number, time:Number=0.5, fun:Function=null):void{ var obj:Object; var mc = mc; var alpha = alpha; var time = time; var fun = fun; if (mc){ var onTimer:Function = function (e:TimerEvent):void{ mc.alpha = (mc.alpha + obj.alphaV); if (obj.timer.currentCount == obj.timer.repeatCount){ mc.alpha = obj.alpha; if (obj.fun != null){ obj.fun(); }; destroy(mc); }; }; if (dic[mc] == null){ dic[mc] = {}; dic[mc].timer = new Timer(20); }; obj = dic[mc]; obj.count = Math.ceil(((time * 1000) / 20)); obj.alpha = alpha; obj.alphaV = ((obj.alpha - mc.alpha) / obj.count); obj.timer.repeatCount = obj.count; obj.timer.reset(); obj.fun = fun; if (!obj.timer.hasEventListener(TimerEvent.TIMER)){ obj.timer.addEventListener(TimerEvent.TIMER, onTimer); }; obj.timer.start(); obj.onTimer = onTimer; }; } public static function destroy(mc:DisplayObject):void{ var obj:Object = dic[mc]; obj.timer.stop(); obj.timer.removeEventListener(TimerEvent.TIMER, obj.onTimer); obj.onTimer = null; obj.timer = null; delete dic[mc]; } } }//package myUtils
Section 24
//Player (player.Player) package player { import flash.events.*; import flash.display.*; import flash.geom.*; import flash.utils.*; import myUtils.cartonMc.*; import myUtils.keyboardManage.*; import scene.*; import def.*; import myUtils.*; import myUtils.masked.*; public class Player { private var biSp:Sprite; private var power:MovieClip; private var goldNum:int;// = 0 private var biCount:int;// = 5 private var count:int;// = 0 private var agRan:Number;// = 0.8 private var yy:Number;// = 400 private var totalGoldNum:int;// = 20 private var gameOverMc:MovieClip; private var isDao:Boolean;// = false private var pauseMc:MovieClip; private var isTouch:Boolean;// = false private var curScore:int; private var randomBiAr:Array; private var timer:Timer; private var map2:Sprite; private var map:Sprite; private var sp:Sprite; private var boss:MovieClip; private var dis:Number;// = 0 private var nextBi:String;// = null private var daoDis:Number; private var pan:MovieClip; private var panYY:Number;// = 380 private var disZhuang:Number;// = 0 private var disState:MovieClip; private var biYY:Number;// = 350 private var totalDis:Number;// = 25600 private var woodAr:Array; private var vx:Number; private var vy:Number; private var width:Number;// = 295 private var biDis:Number; private var scoreMc:MovieClip; private var currentWood:MovieClip; private var dieAr:Array; private var currentDieAr:Array; private var bossDis:MovieClip; private var isPause:Boolean;// = false private var hasG:Boolean;// = false public function Player(_panda:MovieClip){ dieAr = []; woodAr = []; randomBiAr = ["randomBi1", "randomBi2", "randomBi4", "randomBi5"]; timer = new Timer(500, 10); super(); vx = Def.vx; power = Panda.instance.getMovie("power"); disState = Panda.instance.getMovie("disState"); pan = _panda; panYY = pan.y; biYY = (pan.y - 30); yy = (pan.y + 20); sp = new Sprite(); Panda.instance.resource.parent.addChild(sp); map = new Sprite(); map2 = new Sprite(); biSp = new Sprite(); sp.addChild(map2); sp.addChild(map); sp.addChild(biSp); sp.addChild(pan); if ((((Def.currentId == 3)) || ((Def.currentId == 4)))){ sp.addChild(map); }; if (Def.currentId == 4){ sp.addChild(Panda.instance.getMovie("huo")); sp.addChild((boss = Panda.instance.getMovie("boss"))); }; sp.addChild(power); sp.addChild(disState); if (Def.currentId == 4){ sp.addChild((bossDis = Panda.instance.getMovie("bossDis"))); bossDis.gotoAndStop(1); }; sp.addChild((pauseMc = Panda.instance.getMovie("pauseMc"))); sp.addChild((gameOverMc = Panda.instance.getMovie("gameOver"))); sp.addChild(Def.lifeMc); sp.addChild((scoreMc = Panda.instance.getMovie("score"))); biDis = (width / biCount); init(); } public function destroy():void{ pan.removeEventListener(Def.OK, onDao); Def.gameSound.stopBgSound(); stop(); sp.stage.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); Def.myEvent.removeFunToframeEnterFrame(this.enterFrame); Panda.instance.resource.parent.removeChild(sp); clearMc(sp); clearMc(biSp); clearMc(map); clearMc(map2); scoreMc = null; sp = null; map = null; map2 = null; pan = null; currentWood = null; biSp = null; power = null; disState = null; timer = null; boss = null; bossDis = null; pauseMc = null; } public function stop():void{ removeEvent(); sp.stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); if (MovieClip(pan.getChildAt(0))){ MovieClip(pan.getChildAt(0)).stop(); }; if (timer.hasEventListener(TimerEvent.TIMER_COMPLETE)){ timer.stop(); }; } private function randomBi1():void{ var cla:Class; var bi:MovieClip; var ran:Number = Math.random(); if (ran <= agRan){ cla = Panda.instance.getClass("Ag"); } else { cla = Panda.instance.getClass("Gold"); }; var i:int; while (i < this.biCount) { bi = new (cla); biSp.addChild(bi); bi.y = this.biYY; bi.x = (dis + (i * this.biDis)); i++; }; } private function randomBi3():void{ var cla:Class; var bi:MovieClip; var k:int; var ran:Number = Math.random(); if (ran <= agRan){ cla = Panda.instance.getClass("Ag"); } else { cla = Panda.instance.getClass("Gold"); }; var i:int; while (i < this.biCount) { bi = new (cla); biSp.addChild(bi); k = (i - 1); if (k == -1){ k = 0; }; bi.y = ((this.biYY - (this.biDis * 3)) + (Math.abs(k) * this.biDis)); bi.x = (dis + (i * this.biDis)); i++; }; nextBi = null; } private function randomBi5():void{ var cla:Class; var bi:MovieClip; var k:int; var ran:Number = Math.random(); if (ran <= agRan){ cla = Panda.instance.getClass("Ag"); } else { cla = Panda.instance.getClass("Gold"); }; var i:int; while (i < this.biCount) { bi = new (cla); biSp.addChild(bi); k = (i - 4); bi.y = ((this.biYY - (this.biDis * 4)) + (Math.abs(k) * this.biDis)); bi.x = (dis + (i * this.biDis)); i++; }; this.nextBi = "randomBi6"; } private function randomBi7():void{ var cla:Class; var bi:MovieClip; var ran:Number = Math.random(); if (ran <= agRan){ cla = Panda.instance.getClass("Ag"); } else { cla = Panda.instance.getClass("Gold"); }; var i:int; while (i < (this.biCount * 1.5)) { bi = new (cla); biSp.addChild(bi); if (i < this.biCount){ bi.y = (this.biYY - (i * this.biDis)); } else { bi.y = ((this.biYY - (this.biDis * 5)) + ((i - 5) * this.biDis)); }; bi.y = (bi.y + 50); bi.x = (bi.x + ((dis + (this.width * 0.9)) + (i * this.biDis))); i++; }; } private function randomBi4():void{ var cla:Class; var bi:MovieClip; var ran:Number = Math.random(); if (ran <= agRan){ cla = Panda.instance.getClass("Ag"); } else { cla = Panda.instance.getClass("Gold"); }; var i:int; while (i < this.biCount) { bi = new (cla); biSp.addChild(bi); bi.y = (this.biYY - (this.biDis * 0.75)); bi.x = (dis + (i * this.biDis)); bi = new (cla); biSp.addChild(bi); bi.y = this.biYY; bi.x = (dis + (i * this.biDis)); i++; }; } private function randomBi6():void{ var cla:Class; var bi:MovieClip; var k:int; var ran:Number = Math.random(); if (ran <= agRan){ cla = Panda.instance.getClass("Ag"); } else { cla = Panda.instance.getClass("Gold"); }; var i:int; while (i < this.biCount) { bi = new (cla); biSp.addChild(bi); k = i; if (k == 4){ k = 3; }; bi.y = ((this.biYY - (this.biDis * 3)) + (Math.abs(k) * this.biDis)); bi.x = (dis + (i * this.biDis)); i++; }; this.nextBi = null; } private function onDie(e:Event):void{ pan.removeEventListener(Def.DIE, onDie); Def.lifes--; if (Def.lifes > 0){ destroy(); Panda.instance.resource.gotoAndStop(1, "首页"); new GameScene(true); } else { Def.lifeMc = null; CartonMc.instance.toDown(gameOverMc, 1); gameOverMc.score.score.text = (Def.totalScore + ""); Panda.instance.stage.addEventListener(MouseEvent.CLICK, onDieClick); }; } private function init():void{ scoreMc.score.text = (Def.totalScore + ""); var i:int; while (i < 5) { if (i < 2){ this.addEtem(0.6, false); } else { this.addEtem(0.6); }; i++; }; Def.myEvent.addFunToframeEnterFrame(enterFrame); } private function onMouseUp(e:MouseEvent):void{ if (((((isTouch) && (!(Def.myEvent.key[Keyboad2.Spacebar])))) && ((pan.currentLabel == "dao")))){ beginZhuang(); }; } private function onDao(e:Event):void{ var panChild:MovieClip; var dao:MovieClip; var point1:Point; var i:int; var e = e; pan.removeEventListener(Def.OK, onDao); panChild = MovieClip(pan.getChildAt(0)); var point:MovieClip = MovieClip(pan.getChildAt(0)).point; dao = MovieClip(pan.getChildAt(0)).dao; daoDis = 0; while (true) { if (this.currentWood == null){ dao.y = -900; break; }; dao.y = (dao.y - 5); if (CheckTouch.complexHitTestObject(dao, this.currentWood)){ dao.y = (dao.y - 40); daoDis = (((Math.abs(dao.y) * panChild.scaleX) * pan.scaleX) + 25); isTouch = true; break; } else { if (dao.y <= -900){ break; }; }; }; panChild.graphics.lineStyle(1, 7807522); panChild.graphics.moveTo(point.x, point.y); panChild.graphics.lineTo(dao.x, dao.y); if (isTouch){ Def.gameSound.jingYa(); point1 = ChangeReferenceSystem.ChangeReference(dao, pan); point1.y = (point1.y - 25); iPointRegister.register(panChild, point1); this.hasG = false; Def.myEvent.addFunToframeEnterFrame(rotation, panChild); } else { i = setTimeout(function ():void{ clearTimeout(i); panChild.graphics.clear(); if (dao.parent){ dao.parent.removeChild(dao); }; }, 50); }; } private function checkDie():void{ var point:Point; if ((((this.currentDieAr == null)) && ((this.dieAr.length >= 1)))){ currentDieAr = dieAr.shift(); }; if (currentDieAr){ point = ChangeReferenceSystem.ChangeReference(pan, map); if (((((((!(this.hasG)) && (!((pan.currentLabel == "dao"))))) && ((point.x >= currentDieAr[0])))) && ((point.x <= currentDieAr[1])))){ if (Panda.instance.getMovie("zhe")){ pan.mask = Panda.instance.getMovie("zhe"); Panda.instance.getMovie("zhe").parent.removeChild(Panda.instance.getMovie("zhe")); }; this.removeEvent(); changeState("diao"); MovieClip(Def.lifeMc.getChildByName(("l" + Def.lifes))).play(); Def.gameSound.lost(); pan.addEventListener(Def.DIE, onDie); } else { if (point.x > currentDieAr[1]){ currentDieAr = []; currentDieAr = null; }; }; }; } public function start():void{ addEvent(); MovieClip(pan.getChildAt(0)).play(); curScore = 0; if (timer.hasEventListener(TimerEvent.TIMER_COMPLETE)){ timer.start(); }; } private function checkDis():void{ var masked:Masked; var currentFrame:int = int((Math.abs((pan.x - this.map.x)) / (this.totalDis / this.disState.totalFrames))); this.disState.gotoAndStop(currentFrame); if (currentFrame == this.disState.totalFrames){ Def.currentId++; Def.totalScore = int(scoreMc.score.text); if (Def.currentId < 5){ this.stop(); masked = new Masked(1, 640, 480); Panda.instance.stage.addChild(masked); masked.toDrak(function ():void{ destroy(); new NextScene(); }); } else { this.stop(); masked = new Masked(1, 640, 480); Panda.instance.stage.addChild(masked); masked.toDrak(function ():void{ destroy(); new WinScene(); }); }; trace("胜利"); }; } private function randomBi2():void{ var cla:Class; var bi:MovieClip; var k:int; var ran:Number = Math.random(); if (ran <= agRan){ cla = Panda.instance.getClass("Ag"); } else { cla = Panda.instance.getClass("Gold"); }; var i:int; while (i < this.biCount) { bi = new (cla); biSp.addChild(bi); k = (i - 3); if (k >= 1){ k = 0; }; bi.y = ((this.biYY - (this.biDis * 3)) + (Math.abs(k) * this.biDis)); bi.x = (dis + (i * this.biDis)); i++; }; nextBi = "randomBi3"; } private function addScore(score:int):void{ scoreMc.score.text = ((int(scoreMc.score.text) + score) + ""); Def.totalScore = (Def.totalScore + score); curScore = (curScore + score); } private function enterFrame():void{ if (this.boss){ this.boss.x = (this.boss.x + (Def.bossXv - vx)); }; map.x = (map.x - vx); map2.x = (map2.x - vx); biSp.x = (biSp.x - vx); var rec:Rectangle = map.getBounds(this.sp); if (rec.x <= (-(this.width) * 2.8)){ map.removeChildAt(0); this.addEtem(); }; rec = map2.getBounds(this.sp); if (rec.x <= (-(this.width) * 2.8)){ map2.removeChildAt(0); this.addEtem(); }; rec = biSp.getBounds(this.sp); if (rec.x <= (-(this.width) * 2.8)){ biSp.removeChildAt(0); }; if (this.hasG){ vy = (vy + Def.g); pan.y = (pan.y + vy); if (pan.y >= panYY){ pan.y = panYY; this.hasG = false; if (vx == Def.vx){ this.changeState("pao"); } else { this.changeState("bao"); }; isDao = true; }; }; checkDie(); checkEatGold(); checkWood(); checkDis(); if (bossDis){ this.checkBossDis(); }; } private function removeEvent():void{ Def.myEvent.removeEvent(); sp.stage.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); sp.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp); } private function addEvent():void{ Def.myEvent.addEvent(); if (!sp.stage.hasEventListener(MouseEvent.MOUSE_DOWN)){ sp.stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); }; sp.stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp); } private function beginZhuang():void{ isTouch = false; Def.myEvent.removeFunToframeEnterFrame(rotation); pan.x = (pan.x + disZhuang); disZhuang = 0; this.changeState("zhuang"); this.vy = Def.vy; this.hasG = true; } private function rotation(panChild:MovieClip):void{ disZhuang = (disZhuang + vx); this.pan.x = (this.pan.x - vx); var angle:Number = ((panChild.rotation / 180) * Math.PI); var xdis:Number = (this.daoDis * Math.sin(angle)); xdis = (xdis - vx); angle = Math.asin((xdis / daoDis)); angle = ((angle / Math.PI) * 180); iPointRegister.rotate(panChild, angle); if (angle <= -50){ beginZhuang(); }; } private function onTimer(e:TimerEvent):void{ timer.stop(); timer.removeEventListener(TimerEvent.TIMER_COMPLETE, onTimer); power.gotoAndStop(1); vx = Def.vx; this.goldNum = 0; } private function checkEatGold():void{ var bi:MovieClip; var currentFrame:int; var i:int; while (i < biSp.numChildren) { bi = (biSp.getChildAt(i) as MovieClip); if (bi.currentFrame == 1){ if (CheckTouch.complexHitTestObject(pan, bi)){ if (bi.toString() == "[object Gold]"){ addScore(Def.goldScore); Def.gameSound.eatGold(); if (pan.currentLabel != "bao"){ this.goldNum++; currentFrame = int((goldNum / (this.totalGoldNum / this.power.totalFrames))); if (currentFrame <= this.power.totalFrames){ this.power.gotoAndStop(currentFrame); }; }; } else { addScore(Def.agScore); Def.gameSound.eatAg(); }; bi.play(); }; }; i++; }; if ((((this.power.currentFrame == this.power.totalFrames)) && ((pan.currentLabel == "pao")))){ vx = (Def.vx * Def.bao); if (!timer.hasEventListener(TimerEvent.TIMER_COMPLETE)){ timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimer); timer.reset(); timer.start(); }; this.changeState("bao"); } else { if ((((vx == Def.vx)) && ((this.pan.currentLabel == "bao")))){ this.changeState("pao"); }; }; } private function checkBossDis():void{ var currentFrame:int = int((Math.abs((this.boss.x - this.map.x)) / (this.totalDis / this.bossDis.totalFrames))); this.bossDis.gotoAndStop(currentFrame); if ((((Math.abs((bossDis.x - pan.x)) <= Def.dieDis)) && (!((pan.currentLabel == "dao"))))){ trace("被杀了"); this.removeEvent(); changeState("diao"); MovieClip(Def.lifeMc.getChildByName(("l" + Def.lifes))).play(); Def.gameSound.lost(); pan.addEventListener(Def.DIE, onDie); }; } private function changeState(lab:String):void{ pan.gotoAndStop(lab); } private function clearMc(mc):void{ while (mc.numChildren != 0) { mc.removeChildAt(0); }; } private function onMouseDown(e:MouseEvent):void{ switch (e.target.name){ case "backBn": this.destroy(); new BeginScene(); return; case "replayBn": destroy(); Panda.instance.resource.gotoAndStop(1, "首页"); Def.totalScore = (Def.totalScore - curScore); new GameScene(true); return; case "soundBn": Def.isSound = !(Def.isSound); Def.gameSound.furbishBgSound(); MovieClip(e.target.parent).play(); return; case "pauseBn": Panda.instance.getMovie("pause").play(); isPause = !(isPause); if (isPause){ this.stop(); CartonMc.instance.toDown(this.pauseMc, 1); } else { CartonMc.instance.toUp(this.pauseMc, start); }; return; case "mainMenuBn": this.destroy(); new BeginScene(); return; case "moreGameBn": Def.moreGame(); return; case "toWebBn": Def.toWeb(); return; }; if (this.isPause){ return; }; if (((!(this.hasG)) && (!((pan.currentLabel == "dao"))))){ this.changeState("tiao"); this.hasG = true; vy = Def.vy; } else { if (((((this.hasG) && (this.isDao))) && (!((pan.currentLabel == "dao"))))){ Def.gameSound.dao(); isDao = false; this.changeState("dao"); pan.addEventListener(Def.OK, onDao); }; }; } private function checkWood():void{ var point:Point; if ((((this.currentWood == null)) && ((this.woodAr.length >= 1)))){ currentWood = woodAr.shift(); }; if (currentWood){ point = ChangeReferenceSystem.ChangeReference(pan, map); if (point.x > (currentWood.x + this.width)){ currentWood = null; }; }; } private function onDieClick(e:MouseEvent):void{ var e = e; switch (e.target.name){ case "playAgainBn": Panda.instance.stage.removeEventListener(MouseEvent.CLICK, onDieClick); CartonMc.instance.toUp(gameOverMc, function ():void{ destroy(); Panda.instance.resource.gotoAndStop(1, "首页"); Def.currentId = 0; Def.totalScore = 0; Def.lifes = 5; Def.isFirst = true; new GameScene(); }); break; case "moreGameBn": Def.moreGame(); break; case "toWebBn": Def.toWeb(); break; case "backMenuBn": Panda.instance.stage.removeEventListener(MouseEvent.CLICK, onDieClick); CartonMc.instance.toUp(gameOverMc, function ():void{ Def.isFirst = true; destroy(); new BeginScene(); }); break; case "提交分数": Def.submitScore(e.target); break; }; } private function addEtem(_ran:Number=0, isBi:Boolean=true):void{ var mc:MovieClip; var wid:Number; var ranBi:String; var cla:String; if (isBi){ if (this.nextBi == null){ ranBi = this.randomBiAr[int((Math.random() * randomBiAr.length))]; } else { ranBi = nextBi; }; var _local8 = this; _local8[ranBi](); }; count++; var ran:Number = Math.random(); if (_ran != 0){ ran = _ran; }; _ran = 0; if ((((count <= 7)) || ((ran <= 0.5)))){ cla = Def.keZhuo[int((Math.random() * Def.keZhuo.length))]; mc = new (Panda.instance.getClass(cla)); wid = width; map.addChild(mc); } else { if (ran > 0.65){ mc = new (Panda.instance.getClass(Def.keDao)); mc.x = (width * 0.7); wid = (width * 2.4); this.randomBi7(); woodAr.push(mc); map2.addChild(mc); } else { mc = new (Panda.instance.getClass(Def.kong)); wid = (width * 0.8); map.addChild(mc); }; count = 0; this.dieAr.push([(dis + 25), ((dis + wid) - 25)]); }; if (mc){ mc.y = yy; mc.x = (mc.x + dis); }; dis = (dis + wid); } } }//package player
Section 25
//BeginScene (scene.BeginScene) package scene { import flash.events.*; import def.*; public class BeginScene { public function BeginScene(){ super(); Panda.instance.resource.gotoAndStop(1, "首页"); Panda.instance.addScriptToNextframe(init); } private function init():void{ Panda.instance.resource.addEventListener(MouseEvent.CLICK, onClick); Def.gameSound.currentBgSound = "关卡2"; Def.gameSound.furbishBgSound(); } private function onClick(e:MouseEvent):void{ switch (e.target.name){ case "playBn": e.currentTarget.removeEventListener(MouseEvent.CLICK, onClick); Def.currentId = 0; Def.totalScore = 0; Def.lifes = 5; Def.isFirst = true; Def.lifeMc = null; new GameScene(); break; case "moreGameBn": Def.moreGame(); break; case "toWebBn": Def.toWeb(); break; }; } } }//package scene
Section 26
//GameScene (scene.GameScene) package scene { import flash.events.*; import flash.display.*; import flash.utils.*; import def.*; import player.*; import myUtils.*; public class GameScene { private var isReplay:Boolean;// = false private var play:Player; private var mc:MovieClip; public function GameScene(isR:Boolean=false){ super(); this.isReplay = isR; Panda.instance.resource.gotoAndStop(1, Def.currentSence[Def.currentId]); Panda.instance.addScriptToNextframe(init); } private function init():void{ var help:MovieClip; if (Def.lifeMc == null){ Def.lifeMc = new (Panda.instance.getClass("Life")); Def.lifeMc.x = 100; Def.lifeMc.y = 60; }; Def.gameSound.stopBgSound(); if (Def.isFirst){ Def.isFirst = false; help = new (Panda.instance.getClass("Help")); Panda.instance.resource.parent.addChild(help); help.playBn.addEventListener(MouseEvent.CLICK, onClick); } else { begin(); }; } private function onClick(e:MouseEvent):void{ e.currentTarget.removeEventListener(e.type, onClick); var mc:MovieClip = (e.currentTarget.parent as MovieClip); if (mc.parent){ mc.parent.removeChild(mc); }; begin(); } private function begin():void{ var show:Function; show = function ():void{ var i:int; with ({}) { with ({}) { !ERROR!.show2 = function ():void{ clearTimeout(i); Tween.limeTo(mc, mc.x, -(mc.height), 1, 1, 0.3, begin2); }; }; i = setTimeout(function ():void{ clearTimeout(i); Tween.limeTo(mc, mc.x, -(mc.height), 1, 1, 0.3, begin2); }, 1500); }; if (Def.isSound){ Panda.instance.getMovie("sound").gotoAndStop(1); } else { Panda.instance.getMovie("sound").gotoAndStop(2); }; Def.keDao = Def.keDaoAr[Def.currentId]; Def.keZhuo = Def.keZhuoAr[Def.currentId]; Def.gameSound.currentBgSound = Def.soundAr[Def.currentId]; Def.kong = Def.kongAr[Def.currentId]; Panda.instance.getMovie("panda").getChildAt(0).stop(); trace("开始游戏"); play = new Player(Panda.instance.getMovie("panda")); if (isReplay){ begin2(); return; }; mc = Panda.instance.getMovie("gate"); Panda.instance.stage.addChild(mc); mc.x = (Def.stageWidth * 0.5); mc.y = -(mc.height); Tween.limeTo(mc, mc.x, (Def.stageHeight * 0.4), 1, 1, 0.3, show); } private function begin2():void{ if (((mc) && (mc.parent))){ mc.parent.removeChild(mc); }; mc = null; play.start(); Def.gameSound.beginGate(); Def.gameSound.furbishBgSound(); play = null; } } }//package scene
Section 27
//NextScene (scene.NextScene) package scene { import flash.events.*; import def.*; import myUtils.masked.*; public class NextScene { public function NextScene(){ super(); Panda.instance.resource.gotoAndStop(1, "下一关"); Panda.instance.addScriptToNextframe(init); var masked:Masked = new Masked(1, 640, 480); Panda.instance.stage.addChild(masked); masked.toLight(function ():void{ Panda.instance.resource.addEventListener(MouseEvent.CLICK, onClick); }); } private function init():void{ Panda.instance.getMovie("gate").gotoAndStop(Def.currentId); Panda.instance.getMovie("score").score.text = (Def.totalScore + ""); } private function onClick(e:MouseEvent):void{ switch (e.target.name){ case "nextLevelBn": e.currentTarget.removeEventListener(MouseEvent.CLICK, onClick); new GameScene(); break; case "toWebBn": Def.toWeb(); break; case "moreGameBn": Def.moreGame(); break; case "backBn": e.currentTarget.removeEventListener(MouseEvent.CLICK, onClick); new BeginScene(); break; case "提交分数": Def.submitScore(e.target); break; }; } } }//package scene
Section 28
//WinScene (scene.WinScene) package scene { import flash.events.*; import def.*; import myUtils.masked.*; public class WinScene { public function WinScene(){ super(); Panda.instance.resource.gotoAndStop(1, "胜利页"); Panda.instance.addScriptToNextframe(init); var masked:Masked = new Masked(1, 640, 480); Panda.instance.stage.addChild(masked); masked.toLight(); } private function init():void{ Panda.instance.resource.addEventListener(MouseEvent.CLICK, onClick); Panda.instance.getMovie("score").score.text = (Def.totalScore + ""); } private function onClick(e:MouseEvent):void{ switch (e.target.name){ case "playAgainBn": e.currentTarget.removeEventListener(MouseEvent.CLICK, onClick); Def.currentId = 0; Def.totalScore = 0; Def.lifes = 5; Def.isFirst = true; Def.lifeMc = null; new GameScene(); break; case "moreGameBn": Def.moreGame(); break; case "backBn": e.currentTarget.removeEventListener(MouseEvent.CLICK, onClick); new BeginScene(); break; case "toWebBn": Def.toWeb(); break; case "提交分数": Def.submitScore(e.target); break; }; } } }//package scene
Section 29
//Panda (Panda) package { import flash.events.*; import flash.display.*; import GamesList.as3.*; import myUtils.keyboardManage.*; import scene.*; import def.*; public class Panda extends MovieClip { public var loader:Loader; public var resource:MovieClip; private var Game:Class; public static var instance:Panda; public function Panda(){ Game = Panda_Game; super(); GamesListAPIAS3.config("Kungfu-Panda", "alsdfj2aslf123"); stage.quality = StageQuality.MEDIUM; instance = this; this.load(); var sp:Sprite = new Sprite(); sp.graphics.beginFill(0); sp.graphics.drawRect(0, 0, 640, 480); sp.graphics.endFill(); stage.addChild(sp); this.mask = sp; } public function traceAll(mc:MovieClip=null):void{ if (mc == null){ mc = resource; }; var i:int; while (i < mc.numChildren) { trace(mc.getChildAt(i).name); i++; }; } private function begin():void{ Def.myEvent = new EventListener(stage); new BeginScene(); } public function addScriptToNextframe(fun:Function):void{ var frameNum:int; var onEnter:Function; var fun = fun; onEnter = function (e:Event):void{ frameNum++; if (frameNum == 2){ fun(); removeEventListener(Event.ENTER_FRAME, onEnter); }; }; this.addEventListener(Event.ENTER_FRAME, onEnter); frameNum = 0; } public function load():void{ var _BoxGame:MovieClip = (new Game() as MovieClip); loader = (_BoxGame.getChildAt(0) as Loader); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); } public function getClass(className:String):Class{ if (loader != null){ return ((loader.contentLoaderInfo.applicationDomain.getDefinition(className) as Class)); }; return ((this.loaderInfo.applicationDomain.getDefinition(className) as Class)); } private function loadCs():void{ this.loaderInfo.addEventListener(Event.COMPLETE, onComplete); } private function onComplete(event:Event):void{ event.target.removeEventListener(Event.COMPLETE, onComplete); resource = (event.target.content as MovieClip); if (loader != null){ this.addChild(resource); }; begin(); } public function getMovie(movieName:String){ return (this.resource.getChildByName(movieName)); } } }//package
Section 30
//Panda_Game (Panda_Game) package { import mx.core.*; import flash.utils.*; public class Panda_Game extends MovieClipLoaderAsset { public var dataClass:Class; private static var bytes:ByteArray = null; public function Panda_Game(){ dataClass = Panda_Game_dataClass; super(); initialWidth = (0x3200 / 20); initialHeight = (9600 / 20); } override public function get movieClipData():ByteArray{ if (bytes == null){ bytes = ByteArray(new dataClass()); }; return (bytes); } } }//package
Section 31
//Panda_Game_dataClass (Panda_Game_dataClass) package { import mx.core.*; public class Panda_Game_dataClass extends ByteArrayAsset { } }//package

Library Items

Symbol 1 BinaryData {Panda_Game_dataClass} [Panda_Game_dataClass]
Symbol 2 MovieClip {Panda_Game}

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata present, AS3.
SWFMetaData (77)Timeline Frame 1457 bytes "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'><rdf:Description rdf:about='' xmlns ..."
ScriptLimits (65)Timeline Frame 1MaxRecursionDepth: 1000, ScriptTimeout: 60 seconds
ExportAssets (56)Timeline Frame 1Symbol 1 as "Panda_Game_dataClass"
EnableDebugger2 (64)Timeline Frame 131 bytes "u.$1$T1$kvuH7WR1yintqf.M90W081."
DebugMX1 (63)Timeline Frame 1
SerialNumber (41)Timeline Frame 1

Labels

"Panda"Frame 1




http://swfchan.com/24/117107/info.shtml
Created: 8/3 -2019 03:36:50 Last modified: 8/3 -2019 03:36:50 Server time: 23/04 -2024 19:30:15