這一節主要是針對上一節的補充,關於地圖的優化策略上一節中已經涉及了一些,這一節具體說下。網絡
public function set thumbnail(bmd:BitmapData) : void { if (thumbnailData == bmd) return; thumbnailData = bmd; g.clear(); g.beginBitmapFill(thumbnailData, scaleMatrix); g.drawRect(0, 0, viewPort.maxRect.width, viewPort.maxRect.height); }
還有兩個問題:優化
private function gcByException():void { try { new LocalConnection().connect("foo"); new LocalConnection().connect("foo"); } catch (e:Error) { } return; }
2.震屏的實現(TweenMax實現):spa
public static function shake(target:DisplayObject, distance:int = 10, delay:Number = 0.5): void { var targetX:* = target.x; var targetY:* = target.y; var shakeDis:* = distance; TweenMax.killTweensOf(target); TweenMax.to(target, delay, {bezierThrough:[{x:targetX, y:targetY + distance}, {x:targetX, y:targetY - distance}, {x:targetX, y:targetY + distance/4}, {x:targetX, y:targetY - distance/4},{x:targetX, y:targetY}]}); return; }