Section 1
//SpectrumPlayer (com.rox.spectrum.SpectrumPlayer)
package com.rox.spectrum {
import flash.display.*;
import flash.events.*;
import flash.media.*;
public class SpectrumPlayer {
public static var m_pSoundByteArray:Array;
private static var m_kHost:MovieClip;
private static var m_kTrackChannel:SoundChannel;
private static var m_kClapChannel:SoundChannel;
private static var m_nPoopVol:Number = 0.5;
private static var m_kWaveChannel:SoundChannel;
public static var m_bClapping:Boolean;
public static function stopTrack():void{
m_kHost = undefined;
m_kTrackChannel.stop();
}
public static function update(_arg1:Event){
if (m_kHost == null){
return;
};
}
public static function startClap(_arg1:Number):void{
var _local2:Sound;
var _local3:Sound;
if (m_bClapping != true){
_local2 = new sndWave();
m_kWaveChannel = _local2.play(0, 0);
m_kWaveChannel.soundTransform = new SoundTransform(0.01);
_local3 = new sndClap();
m_kClapChannel = _local3.play(0, 9999);
m_bClapping = true;
};
if (m_kClapChannel != null){
if (_arg1 > 40){
_arg1 = 40;
};
m_nPoopVol = (0.1 + (_arg1 / 40));
m_kClapChannel.soundTransform = new SoundTransform(_arg1);
};
}
public static function playPoop():void{
var _local1:Sound;
_local1 = new sndPoop();
_local1.play();
}
public static function stopClap():void{
if (m_bClapping){
m_bClapping = false;
m_kClapChannel.stop();
};
}
public static function playTrack(_arg1:MovieClip, _arg2):void{
var _local3:*;
var _local4:Sound;
_local3 = sndTestTrack;
_local4 = new (_local3);
m_kTrackChannel = _local4.play(0, 99999);
m_kTrackChannel.soundTransform = new SoundTransform(0.5);
_arg1.addEventListener(Event.ENTER_FRAME, update, false, 0, true);
m_kHost = _arg1;
}
public static function getSoundByteArray():Array{
return (m_pSoundByteArray);
}
}
}//package com.rox.spectrum
Section 2
//Blob (com.rox.wormsynth.Game.Blob)
package com.rox.wormsynth.Game {
import flash.display.*;
import com.rox.spectrum.*;
import flash.geom.*;
public class Blob {
protected var m_kHost:MovieClip;
protected var m_nWidth:Number;// = 0
protected var m_nSpeed:Number;
protected var m_nScale:Number;// = 2
protected var m_nPathYScale:Number;// = 1
protected var m_bDead:Boolean;
protected var m_nRadiusXScale:Number;// = 1
protected var m_nPathLength:Number;
protected var m_nChainNumber:Number;// = 1
protected var m_nXs:Number;
protected var m_nX:Number;
protected var m_nPathRadius2:Number;// = 100
protected var m_nY:Number;
protected var m_nSpectrumIndex:Number;
protected var m_nDistanceToNextWaypoint:Number;// = 0
protected var m_nPiPath2Mult:Number;// = 10
protected var m_nPathRadius:Number;// = 200
protected var m_nYs:Number;
protected var m_nRadiusYScale:Number;// = 1
protected var m_nByteLimit:Number;
protected var m_nDieTimer;// = 0
protected var m_kDisplay:MovieClip;
protected var m_pPath:Array;
protected var m_nPoopVol:Number;// = 0.4
protected var m_nPathXScale:Number;// = 1
protected var m_nPathWaypointIndex:Number;// = 0
protected var m_nPiPath2:Number;// = 0
protected var m_nPiPath3:Number;// = 0
protected var m_nPiPath:Number;// = 0
protected var m_kRGB:Object;
public function Blob(_arg1:MovieClip, _arg2, _arg3:Object, _arg4:Number, _arg5, _arg6){
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:Number;
m_nChainNumber = 1;
m_nPathXScale = 1;
m_nPathYScale = 1;
m_nRadiusXScale = 1;
m_nRadiusYScale = 1;
m_nDieTimer = 0;
m_nPiPath2Mult = 10;
m_nPathRadius2 = 100;
m_nPathRadius = 200;
m_nPathWaypointIndex = 0;
m_nDistanceToNextWaypoint = 0;
m_nPiPath = 0;
m_nPiPath2 = 0;
m_nPiPath3 = 0;
m_nScale = 2;
m_nWidth = 0;
m_nPoopVol = 0.4;
super();
m_pPath = extractPath("204 81|204 81|202 81|200 81|196 83|192 85|184 88|177 92|170 97|162 103|156 108|151 111|145 118|143 124|141 129|139 140|137 150|135 160|135 168|135 176|136 185|139 195|142 203|146 211|150 218|153 221|158 226|163 231|173 239|182 244|191 250|200 254|208 258|224 265|234 269|244 272|261 280|270 284|276 285|286 287|297 287|312 288|321 287|327 283|334 279|341 274|348 269|357 260|361 254|365 248|372 240|375 234|379 229|382 224|383 220|386 211|389 205|391 197|393 188|393 179|393 170|393 159|391 152|387 144|384 136|381 130|377 121|374 116|370 110|365 104|361 99|356 94|350 89|343 84|334 78|328 74|322 70|317 66|309 63|304 60|293 56|285 55|277 53|263 52|256 52|250 52|246 54|241 56|235 59|231 60|228 62|225 63|221 65|217 66|213 68|211 69|210 71|208 72|207 73|206 73|205 74|205 74|205 74|205 74|205 74|64 139|64 133|61 110|58 84|57 66|57 55|57 41|57 32|57 24|58 17|60 14|73 7|94 2|119 1|155 1|184 1|219 1|257 1|305 4|348 4|375 0|412 4|435 5|441 1|448 0|460 0|471 6|483 17|490 29|494 47|494 69|496 88|496 110|497 133|497 158|497 183|498 209|500 230|501 252|500 271|493 285|479 298|463 307|450 310|417 313|368 314|315 314|277 314|247 308|222 303|198 298|176 293|154 292|130 290|108 288|91 288|80 287|76 283|71 276|69 263|63 242|60 227|57 208|56 183|57 162|60 147|61 139|61 139|61 139|115 327|115 326");
setStartingPositionOnPath(_arg2);
m_nByteLimit = _arg5;
m_nSpectrumIndex = _arg4;
m_kHost = _arg1;
m_kDisplay = new mcBlob();
m_kHost.addChild(m_kDisplay);
m_kRGB = _arg3;
m_kDisplay.transform.colorTransform = new ColorTransform((m_kRGB.red / 0xFF), (m_kRGB.green / 0xFF), (m_kRGB.blue / 0xFF), 0.1, 1, 1, 1, 1);
_local7 = (150 + (Math.random() * 250));
_local8 = (100 + (Math.random() * 250));
_local9 = Math.atan2((_local8 - m_nY), (_local7 - m_nX));
_local10 = (Math.random() * 1);
m_nSpeed = 0.01;
m_nScale = 2;
m_nXs = (Math.cos(_local9) * m_nSpeed);
m_nYs = (Math.sin(_local9) * m_nSpeed);
checkPathWaypoint();
m_nPiPath = ((_arg2 * Math.PI) * 2);
}
public function setSpeed(_arg1:Number):void{
m_nSpeed = _arg1;
}
public function setRadiusScale(_arg1:Number, _arg2:Number):void{
m_nRadiusXScale = _arg1;
m_nRadiusYScale = _arg2;
}
public function getRGB():Object{
return (m_kRGB);
}
public function setPathRadius(_arg1:Number):void{
m_nPathRadius = _arg1;
}
public function setStartingPositionOnPath(_arg1:Number):void{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local2 = (m_nPathLength * _arg1);
_local3 = 0;
_local4 = 0;
_local5 = 0;
while (_local5 < m_pPath.length) {
_local3 = (_local3 + m_pPath[_local5].length);
if (_local3 > _local2){
_local4 = _local5;
break;
};
_local5++;
};
m_nPathWaypointIndex = _local4;
m_nX = m_pPath[_local4].x;
m_nY = m_pPath[_local4].y;
}
public function setPath2Mult(_arg1:Number):void{
m_nPiPath2Mult = _arg1;
}
public function popSelf(){
var _local1:*;
var _local2:Number;
var _local3:*;
var _local4:MovieClip;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:Matrix;
var _local10:*;
_local1 = m_nChainNumber;
SpectrumPlayer.playPoop();
Game.getApp().processRestoreCounter(1);
_local2 = 10;
m_kDisplay.scaleX = 3;
m_kDisplay.scaleY = 3;
_local3 = 0;
while (_local3 < _local2) {
_local5 = (((Math.PI / 2) / _local2) * _local3);
_local6 = (Math.random() * 50);
_local7 = (Math.cos(_local5) * _local6);
_local8 = (Math.sin(_local5) * _local6);
_local9 = new Matrix();
_local10 = new ColorTransform((m_kRGB.red / 0xFF), (m_kRGB.green / 0xFF), (m_kRGB.blue / 0xFF), 1, 1, 1, 1, 1);
_local9.tx = ((m_kDisplay.x / 4) + _local7);
_local9.ty = ((m_kDisplay.y / 4) + _local8);
_local3++;
};
Game.getApp().addBullet(m_kDisplay.x, m_kDisplay.y, 5, 5, m_kRGB).setChain(_local1);
Game.getApp().addBullet(m_kDisplay.x, m_kDisplay.y, 5, -5, m_kRGB).setChain(_local1);
Game.getApp().addBullet(m_kDisplay.x, m_kDisplay.y, -5, 5, m_kRGB).setChain(_local1);
Game.getApp().addBullet(m_kDisplay.x, m_kDisplay.y, -5, -5, m_kRGB).setChain(_local1);
Game.getApp().addBullet(m_kDisplay.x, m_kDisplay.y, 0, 5, m_kRGB).setChain(_local1);
Game.getApp().addBullet(m_kDisplay.x, m_kDisplay.y, 0, -5, m_kRGB).setChain(_local1);
Game.getApp().addBullet(m_kDisplay.x, m_kDisplay.y, 5, 0, m_kRGB).setChain(_local1);
Game.getApp().addBullet(m_kDisplay.x, m_kDisplay.y, -5, 0, m_kRGB).setChain(_local1);
_local4 = new mcTextDisplay();
_local4.m_kText.m_dtText.text = (Game.getApp().getChainNum() * 100);
_local4.x = m_kDisplay.x;
_local4.y = m_kDisplay.y;
_local9.tx = (m_kDisplay.x / 4);
_local9.ty = (m_kDisplay.y / 4);
if (m_kDisplay.parent != undefined){
m_kDisplay.parent.addChild(_local4);
};
Game.getApp().m_kBitmapData.draw(_local4, _local9, _local10);
removeSelf();
}
public function getX():Number{
return (m_nX);
}
public function getY():Number{
return (m_nY);
}
public function extractPath(_arg1):Array{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:Array;
var _local6:Point;
_local2 = new Array();
_local3 = _arg1.split("|");
m_nPathLength = 0;
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = _local3[_local4].split(" ");
_local6 = new Point(_local5[0], _local5[1]);
_local2.push(_local6);
m_nPathLength = (m_nPathLength + _local6.length);
_local4++;
};
return (_local2);
}
public function update():void{
var _local1:*;
var _local2:Matrix;
var _local3:Number;
var _local4:*;
if (SpectrumPlayer.getSoundByteArray == null){
_local3 = 0;
} else {
if (SpectrumPlayer.getSoundByteArray() != null){
_local3 = (SpectrumPlayer.getSoundByteArray()[m_nSpectrumIndex] * m_nByteLimit);
};
};
if (Math.random() > 0.95){
_local3 = 0.6;
} else {
_local3 = 0;
};
if ((((_local3 > 0.3)) && ((m_kDisplay.m_kBlink.currentFrame == 1)))){
m_kDisplay.m_kBlink.scaleX = (1 + _local3);
m_kDisplay.m_kBlink.scaleY = m_kDisplay.m_kBlink.scaleX;
m_kDisplay.m_kBlink.play();
};
m_nPiPath = (m_nPiPath + m_nSpeed);
_local1 = (Math.cos((m_nPiPath * m_nPiPath2Mult)) * m_nPathRadius2);
if (m_bDead != true){
m_nX = (250 + ((Math.cos((m_nPiPath * m_nPathXScale)) * (m_nPathRadius + _local1)) * m_nRadiusXScale));
m_nY = (259 + ((Math.sin((m_nPiPath * m_nPathYScale)) * (m_nPathRadius + _local1)) * m_nRadiusYScale));
} else {
m_nX = (m_nX + m_nXs);
m_nY = (m_nY + m_nYs);
m_nXs = (m_nXs * 0.95);
m_nYs = (m_nYs * 0.95);
m_nDieTimer--;
if (m_nDieTimer < 0){
popSelf();
};
};
m_kDisplay.alpha = 1;
m_kDisplay.x = m_nX;
m_kDisplay.y = m_nY;
m_kDisplay.scaleX = m_nScale;
m_kDisplay.scaleY = m_nScale;
m_nX = (m_nX + m_nXs);
m_nY = (m_nY + m_nYs);
_local2 = new Matrix();
if (m_bDead != true){
_local4 = new ColorTransform((m_kRGB.red / 0xFF), (m_kRGB.green / 0xFF), (m_kRGB.blue / 0xFF), 0.05, 1, 1, 1, 1);
} else {
_local4 = new ColorTransform((m_kRGB.red / 0xFF), (m_kRGB.green / 0xFF), (m_kRGB.blue / 0xFF), 0.4, 1, 1, 1, 1);
};
_local2.tx = (m_kDisplay.x / 4);
_local2.ty = (m_kDisplay.y / 4);
Game.getApp().m_kBitmapData.draw(m_kDisplay, _local2, _local4, "add");
}
public function setPath2Radius(_arg1:Number):void{
m_nPathRadius2 = _arg1;
}
public function setPathScale(_arg1:Number, _arg2:Number):void{
m_nPathXScale = _arg1;
m_nPathYScale = _arg2;
}
public function destroySelf(_arg1, _arg2, _arg3, _arg4, _arg5):void{
var _local6:*;
var _local7:*;
var _local8:*;
_local6 = (_arg4 - m_nX);
_local7 = (_arg5 - m_nY);
_local8 = Math.atan2((_local7 * -1), (_local6 * -1));
m_nXs = (Math.cos(_local8) * 4);
m_nYs = (Math.sin(_local8) * 4);
m_nXs = (m_nXs / 2);
m_nYs = (m_nYs / 2);
m_nChainNumber = _arg1;
m_bDead = true;
}
protected function checkPathWaypoint():void{
if (m_nDistanceToNextWaypoint <= 0){
m_nPathWaypointIndex++;
if (m_nPathWaypointIndex > (m_pPath.length - 1)){
m_nPathWaypointIndex = 0;
};
};
m_nDistanceToNextWaypoint = new Point((m_nX - m_pPath[m_nPathWaypointIndex].x), (m_nY - m_pPath[m_nPathWaypointIndex].y)).length;
}
public function removeSelf(){
Game.getApp().removeBlob(this);
m_kHost.removeChild(m_kDisplay);
}
}
}//package com.rox.wormsynth.Game
Section 3
//ColorConversion (com.rox.wormsynth.Game.ColorConversion)
package com.rox.wormsynth.Game {
import com.rox.wormsynth.Game.*;
class ColorConversion {
public static function hex32toargb(_arg1:Number):Object{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local2 = ((_arg1 >> 24) & 0xFF);
_local3 = ((_arg1 >> 16) & 0xFF);
_local4 = ((_arg1 >> 8) & 0xFF);
_local5 = (_arg1 & 0xFF);
return ({alpha:_local2, red:_local3, green:_local4, blue:_local5});
}
public static function argbtohex32(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (((((_arg4 << 24) | (_arg1 << 16)) | (_arg2 << 8)) | _arg3));
}
public static function hex24torgb(_arg1:Number):Object{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = ((_arg1 >> 16) & 0xFF);
_local3 = ((_arg1 >> 8) & 0xFF);
_local4 = (_arg1 & 0xFF);
return ({red:_local2, green:_local3, blue:_local4});
}
public static function hex24tohsb(_arg1:Number):Object{
var _local2:*;
_local2 = ColorConversion.hex24torgb(_arg1);
return (ColorConversion.rgbtohsb(_local2.red, _local2.green, _local2.blue));
}
public static function toHexadecimalString(_arg1:Number):String{
return (("0x" + _arg1.toString(16).toUpperCase()));
}
public static function hsbtohex24(_arg1:Number, _arg2:Number, _arg3:Number):Number{
var _local4:*;
_local4 = ColorConversion.hsbtorgb(_arg1, _arg2, _arg3);
return (ColorConversion.rgbtohex24(_local4.red, _local4.green, _local4.blue));
}
public static function hsbtorgb(_arg1:Number, _arg2:Number, _arg3:Number):Object{
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
_arg1 = (_arg1 % 360);
if (_arg3 == 0){
return ({red:0, green:0, blue:0});
};
_arg2 = (_arg2 / 100);
_arg3 = (_arg3 / 100);
_arg1 = (_arg1 / 60);
_local7 = Math.floor(_arg1);
_local8 = (_arg1 - _local7);
_local9 = (_arg3 * (1 - _arg2));
_local10 = (_arg3 * (1 - (_arg2 * _local8)));
_local11 = (_arg3 * (1 - (_arg2 * (1 - _local8))));
switch (_local7){
case 0:
_local4 = _arg3;
_local5 = _local11;
_local6 = _local9;
break;
case 1:
_local4 = _local10;
_local5 = _arg3;
_local6 = _local9;
break;
case 2:
_local4 = _local9;
_local5 = _arg3;
_local6 = _local11;
break;
case 3:
_local4 = _local9;
_local5 = _local10;
_local6 = _arg3;
break;
case 4:
_local4 = _local11;
_local5 = _local9;
_local6 = _arg3;
break;
case 5:
_local4 = _arg3;
_local5 = _local9;
_local6 = _local10;
break;
};
_local4 = Math.round((_local4 * 0xFF));
_local5 = Math.round((_local5 * 0xFF));
_local6 = Math.round((_local6 * 0xFF));
return ({red:_local4, green:_local5, blue:_local6});
}
public static function rgbtohex24(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return ((((_arg1 << 16) | (_arg2 << 8)) | _arg3));
}
public static function rgbtohsb(_arg1:Number, _arg2:Number, _arg3:Number):Object{
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
_local4 = Math.min(Math.min(_arg1, _arg2), _arg3);
_local5 = Math.max(Math.max(_arg1, _arg2), _arg3);
_local6 = (_local5 - _local4);
_local7 = ((_local5)==0) ? 0 : (_local6 / _local5);
if (_local7 == 0){
_local8 = 0;
} else {
if (_arg1 == _local5){
_local8 = ((60 * (_arg2 - _arg3)) / _local6);
} else {
if (_arg2 == _local5){
_local8 = (120 + ((60 * (_arg3 - _arg1)) / _local6));
} else {
_local8 = (240 + ((60 * (_arg1 - _arg2)) / _local6));
};
};
if (_local8 < 0){
_local8 = (_local8 + 360);
};
};
_local7 = (_local7 * 100);
_local5 = ((_local5 / 0xFF) * 100);
return ({hue:_local8, saturation:_local7, brightness:_local5});
}
}
}//package com.rox.wormsynth.Game
Section 4
//Game (com.rox.wormsynth.Game.Game)
package com.rox.wormsynth.Game {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import com.rox.wormsynth.*;
import com.rox.spectrum.*;
import flash.text.*;
import flash.geom.*;
import flash.filters.*;
public class Game extends MovieClip {
protected var m_nGameOverInterval:Number;
public var m_dtScore:TextField;
public var m_kGlowBitmap:Bitmap;
public var m_dtHiScore:TextField;
public var m_nChainNum:Number;// = 0
public var m_dtShots:TextField;
public var m_dtHello:TextField;
public var m_kGlowBitmapData:BitmapData;
public var m_kTurret:Turret;
public var m_nBulletsOnScreen:Number;// = 0
public var m_kBitmapData:BitmapData;
public var m_nBlobIntervalId:Number;
public var m_kBonus:MovieClip;
public var m_nRestoreCounterMax:Number;// = 2
public var m_kBitmap:Bitmap;
public var m_pBullets:Array;
protected var m_nBlobs:Number;
public var m_nBlobCount:Number;// = 1
public var m_nBlobInterval:Number;// = 1000
public var m_nRestoreCounter:Number;// = 0
public var m_kWorm:Worm;
public var m_bBonusGiven:Boolean;
public var m_nShots:Number;// = 0
public var m_pBlobs:Array;
public static var m_kInstance:Game;
public function Game(){
m_nBulletsOnScreen = 0;
m_nBlobCount = 1;
m_nRestoreCounter = 0;
m_nRestoreCounterMax = 2;
m_nBlobInterval = 1000;
m_nShots = 0;
m_nChainNum = 0;
super();
m_kInstance = this;
init();
}
public function addBullet(_arg1, _arg2, _arg3, _arg4, _arg5):WormBullet{
var _local6:WormBullet;
m_nBulletsOnScreen++;
_local6 = new WormBullet(this, _arg1, _arg2, _arg3, _arg4, _arg5);
m_pBullets.push(_local6);
return (_local6);
}
public function init():void{
var _local1:Matrix;
var _local2:Matrix;
var _local3:*;
var _local4:Object;
wormsynth.m_nShotsLeft = 3;
m_nBlobs = 0;
if (wormsynth.m_nScore == undefined){
wormsynth.m_nScore = 0;
};
m_dtShots.text = String(wormsynth.m_nShotsLeft);
m_kBitmapData = new BitmapData(125, 125, false, 0);
m_kBitmap = new Bitmap(m_kBitmapData, "auto", false);
m_kGlowBitmapData = new BitmapData(125, 125, false, 0);
_local1 = new Matrix();
_local1.tx = Math.round((Math.random() * 330));
_local1.ty = Math.round((Math.random() * 330));
_local2 = new Matrix();
_local2.tx = 0;
_local2.ty = 0;
_local2.scale(0.25, 0.25);
m_kGlowBitmap = new Bitmap(m_kGlowBitmapData);
m_kBitmap.scaleX = (m_kBitmap.scaleX * 4);
m_kBitmap.scaleY = (m_kBitmap.scaleY * 4);
m_pBullets = new Array();
m_pBlobs = new Array();
m_nBlobInterval = 1500;
addEventListener(Event.ENTER_FRAME, update, false, 0, true);
_local3 = 0;
while (_local3 < Levels.getLevel(wormsynth.m_nLevel).length) {
_local4 = Levels.getLevel(wormsynth.m_nLevel)[_local3];
addBlobsToGame(_local4.nBlobsOnPath, _local4.nSpeed, _local4.nHue, _local4.nPathXScale, _local4.nPathYScale, _local4.nRadiusXScale, _local4.nRadiusYScale, _local4.nRadiusPath2Mult, _local4.nRadiusPath2);
_local3++;
};
m_kTurret = new Turret(this);
addChild(m_kBitmap);
m_kBitmap.blendMode = "add";
m_dtHiScore.text = String(wormsynth.m_kInstance.getLocalHighScore());
SpectrumPlayer.playTrack(this, Levels.getSettings(wormsynth.m_nLevel).track);
m_dtHello.text = ((("UID:" + root.loaderInfo.parameters.uid) + " Hello:") + root.loaderInfo.parameters.playername);
toScore(wormsynth.m_nScore);
}
public function drawGameBitmap():void{
var _local1:*;
var _local2:Matrix;
_local1 = new ColorTransform(1, 1, 1, 0.1, 1, 1, 1);
_local2 = new Matrix();
_local2.ty = 1;
_local1 = new ColorTransform(1, 1, 1, 0.01, 1, 1, 1);
m_kBitmapData.draw(m_kGlowBitmap, _local2, _local1, "normal");
}
public function gameOverFinal():void{
m_kTurret.deregesterHandlers();
wormsynth.m_nLevel++;
trace("GAMEEND");
clearInterval(m_nGameOverInterval);
removeEventListener(Event.ENTER_FRAME, update);
wormsynth.m_kInstance.setNextLevel();
}
public function gameLost():void{
removeEventListener(Event.ENTER_FRAME, update);
if (m_kTurret != null){
m_kTurret.deregesterHandlers();
};
wormsynth.m_kInstance.setGameEnd();
}
public function fire():void{
wormsynth.m_nShotsLeft--;
m_nChainNum = 1;
m_nShots++;
m_dtShots.text = String(wormsynth.m_nShotsLeft);
}
public function removeBlob(_arg1:Blob){
var _local2:*;
_local2 = m_pBlobs.indexOf(_arg1);
if (_local2 != -1){
m_nBlobs--;
wormsynth.m_nScore = (wormsynth.m_nScore + (100 * m_nChainNum));
toScore(wormsynth.m_nScore);
m_nChainNum++;
m_pBlobs.splice(_local2, 1);
};
}
public function getNumBullets():Number{
return (wormsynth.m_nShotsLeft);
}
public function getChainNum():Number{
return (m_nChainNum);
}
public function removeBullet(_arg1:WormBullet){
var _local2:*;
_local2 = m_pBullets.indexOf(_arg1);
if (_local2 != -1){
m_nBulletsOnScreen--;
m_pBullets.splice(_local2, 1);
};
}
public function addBlobsToGame(_arg1:Number, _arg2:Number=0.004, _arg3:Number=-1, _arg4:Number=1, _arg5:Number=1, _arg6:Number=1, _arg7:Number=1, _arg8:Number=0, _arg9:Number=0):void{
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:*;
var _local16:Number;
var _local17:Number;
var _local18:*;
var _local19:*;
var _local20:*;
var _local21:*;
var _local22:Number;
var _local23:*;
var _local24:*;
var _local25:Blob;
var _local26:*;
_local10 = _arg1;
_local11 = (1 / _local10);
_local12 = 0;
while (_local12 < _local10) {
_local13 = 2;
_local14 = 0.5;
_local15 = ((360 / _local13) * _local14);
_local16 = (_local13 / _local13);
_local17 = Math.round((Math.random() * _local13));
_local18 = 1;
_local19 = 0.4;
_local20 = (_local18 - _local19);
_local21 = (_local20 / _local13);
_local22 = (_local19 + (_local21 * _local17));
if (_arg3 == -1){
_local26 = ColorConversion.hsbtorgb((_local15 * _local17), 60, 100);
} else {
_local26 = ColorConversion.hsbtorgb(_arg3, 60, 100);
};
_local23 = Math.floor((Math.random() * 4));
_local24 = (_local11 * _local12);
_local25 = addBlob(_local24, _local26, _local17, _local22);
_local25.setPath2Radius(_arg9);
_local25.setPath2Mult(_arg8);
_local25.setPathScale(_arg4, _arg5);
_local25.setRadiusScale(_arg6, _arg7);
_local25.setSpeed(_arg2);
_local12++;
};
}
public function update(_arg1:Event):void{
var _local2:*;
var _local3:*;
drawGameBitmap();
m_kTurret.update();
_local2 = 0;
while (_local2 < m_pBullets.length) {
m_pBullets[_local2].update();
_local2++;
};
_local3 = 0;
while (_local3 < m_pBlobs.length) {
m_pBlobs[_local3].update();
_local3++;
};
m_kBitmapData.applyFilter(m_kBitmapData, new Rectangle(0, 0, 125, 125), new Point(0, 0), new BlurFilter(8, 8, 1));
if (m_nBulletsOnScreen > 0){
SpectrumPlayer.startClap((m_nBulletsOnScreen / 30));
} else {
SpectrumPlayer.stopClap();
};
if ((((m_nBlobs <= 0)) && (!((m_bBonusGiven == true))))){
m_bBonusGiven = true;
if (wormsynth.m_nShotsLeft > 0){
m_kBonus.play();
m_kBonus.m_kBonus.m_dtText.text = (wormsynth.m_nShotsLeft + " x 500");
wormsynth.m_nScore = (wormsynth.m_nScore + (wormsynth.m_nShotsLeft * 500));
toScore(wormsynth.m_nScore);
};
};
if ((((m_nBlobs <= 0)) && ((m_pBullets.length == 0)))){
wormsynth.m_bWonGame = true;
this.gameOver();
} else {
if ((((wormsynth.m_nShotsLeft < 1)) && ((m_pBullets.length == 0)))){
wormsynth.m_bWonGame = false;
gameLost();
};
};
}
public function getBulletsOnScreen():Number{
return (m_pBullets.length);
}
public function getBlobs():Array{
return (m_pBlobs);
}
public function toScore(_arg1:Number){
m_dtScore.text = String(_arg1);
}
public function processRestoreCounter(_arg1){
var _local2:*;
return;
}
public function addBlob(_arg1, _arg2, _arg3, _arg4):Blob{
var _local5:*;
m_nBlobs++;
_local5 = new Blob(this, _arg1, _arg2, _arg3, _arg4, 1);
m_pBlobs.push(_local5);
return (_local5);
}
public function gameOver():void{
SpectrumPlayer.stopTrack();
gameOverFinal();
}
public static function getApp():Game{
return (m_kInstance);
}
}
}//package com.rox.wormsynth.Game
Section 5
//HighscoreItem (com.rox.wormsynth.Game.HighscoreItem)
package com.rox.wormsynth.Game {
import flash.display.*;
import flash.text.*;
public class HighscoreItem extends MovieClip {
public var m_dtScore:TextField;
public var m_dtName:TextField;
public function populate(_arg1:Object):void{
m_dtName.text = _arg1.name;
m_dtScore.text = _arg1.score;
}
}
}//package com.rox.wormsynth.Game
Section 6
//Highscores (com.rox.wormsynth.Game.Highscores)
package com.rox.wormsynth.Game {
import flash.display.*;
public class Highscores extends MovieClip {
}
}//package com.rox.wormsynth.Game
Section 7
//LevelPanel (com.rox.wormsynth.Game.LevelPanel)
package com.rox.wormsynth.Game {
import flash.display.*;
import com.rox.wormsynth.*;
public class LevelPanel extends MovieClip {
public var m_kText:MovieClip;
public function LevelPanel(){
m_kText.m_dtLevelNumber.text = String((wormsynth.m_nLevel + 1));
}
}
}//package com.rox.wormsynth.Game
Section 8
//StartScreen (com.rox.wormsynth.Game.StartScreen)
package com.rox.wormsynth.Game {
import flash.display.*;
import flash.events.*;
public class StartScreen extends MovieClip {
public var m_kGlowBitmap:Bitmap;
public var m_kBlur:MovieClip;
public var m_kGlowBitmapData:BitmapData;
public function update(_arg1:Event):void{
}
}
}//package com.rox.wormsynth.Game
Section 9
//Turret (com.rox.wormsynth.Game.Turret)
package com.rox.wormsynth.Game {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class Turret {
protected var m_nSpectrumIndex:Number;
protected var m_nWidth:Number;// = 0
protected var m_nSpeed:Number;
protected var m_nScale:Number;// = 2
protected var m_nByteLimit:Number;
protected var m_nYs:Number;
protected var m_kHost:MovieClip;
protected var m_kDisplay:MovieClip;
protected var m_kRGB:Object;
protected var m_nXs:Number;
protected var m_nX:Number;
protected var m_nY:Number;
public function Turret(_arg1:MovieClip){
m_nScale = 2;
m_nWidth = 0;
super();
m_nX = 250;
m_nY = 250;
m_kRGB = new Object();
m_kRGB.red = 0xFF;
m_kRGB.green = 0xFF;
m_kRGB.blue = 0xFF;
m_kHost = _arg1;
m_kDisplay = new mcTurret();
m_kHost.addChild(m_kDisplay);
m_kDisplay.stage.addEventListener(MouseEvent.MOUSE_DOWN, this.fire, false, 0, true);
}
public function update():void{
var _local1:*;
var _local2:Matrix;
var _local3:ColorTransform;
_local1 = Math.atan2((m_kDisplay.parent.mouseY - m_nY), (m_kDisplay.parent.mouseX - m_nX));
m_kDisplay.x = m_nX;
m_kDisplay.y = m_nY;
m_kDisplay.m_kGun.rotation = (_local1 * 57.3);
_local2 = new Matrix();
_local2.translate(62, 62);
_local3 = new ColorTransform(0, 0, 0, 1);
Game.getApp().m_kBitmapData.draw(m_kDisplay, _local2, _local3, "normal");
}
public function destroySelf(_arg1):void{
removeSelf();
}
public function deregesterHandlers():void{
m_kDisplay.stage.removeEventListener(MouseEvent.MOUSE_DOWN, this.fire);
}
public function removeSelf(){
m_kHost.removeChild(m_kDisplay);
}
public function fire(_arg1){
var _local2:*;
var _local3:WormBullet;
if ((((Game.getApp().getNumBullets() < 1)) || ((Game.getApp().getBulletsOnScreen() > 0)))){
return;
};
Game.getApp().fire();
_local2 = Math.atan2((m_kDisplay.parent.mouseY - m_nY), (m_kDisplay.parent.mouseX - m_nX));
m_kDisplay.m_kBlink.play();
if (m_kDisplay.m_kBlink.currentFrame == 1){
_local3 = Game.getApp().addBullet(250, 250, (Math.cos(_local2) * 4), (Math.sin(_local2) * 4), m_kRGB);
_local3.setLife(3);
};
}
}
}//package com.rox.wormsynth.Game
Section 10
//Worm (com.rox.wormsynth.Game.Worm)
package com.rox.wormsynth.Game {
import flash.display.*;
import com.rox.spectrum.*;
import flash.geom.*;
public class Worm {
protected var m_nPhaseB:Number;// = 0
protected var m_pSegmentArray:Array;
protected var m_nSegSpacing:Number;// = 10
protected var m_nSpeed:Number;// = 5
protected var m_nY:Number;// = 0
protected var m_pPosArray:Array;
protected var m_kHost:MovieClip;
protected var m_nX:Number;// = 0
protected var m_nPhase:Number;// = 0
public function Worm(_arg1){
m_nPhase = 0;
m_nPhaseB = 0;
m_nSegSpacing = 10;
m_nSpeed = 5;
m_nX = 0;
m_nY = 0;
super();
m_kHost = _arg1;
init();
}
public function update(_arg1:Number):void{
var _local2:*;
var _local3:Number;
var _local4:Number;
var _local5:Point;
var _local6:*;
var _local7:*;
var _local8:Number;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:Number;
var _local15:*;
_local2 = Math.atan2((m_kHost.mouseY - m_nY), (m_kHost.mouseX - m_nX));
_local3 = (Math.cos(_local2) * m_nSpeed);
_local4 = (Math.sin(_local2) * m_nSpeed);
m_nPhase = (m_nPhase + 0.1);
m_nPhaseB = (m_nPhaseB + 0.02);
m_nX = (m_nX + (Math.cos(_local2) * 2));
m_nY = (m_nY + (Math.sin(_local2) * 2));
_local5 = new Point((m_kHost.mouseY - m_nY), (m_kHost.mouseX - m_nX));
m_nSpeed = (_local5.length / 10);
if (m_nSpeed < 1){
m_nSpeed = 1;
};
if (m_nSpeed > 10){
m_nSpeed = 10;
};
m_nSpeed = (m_nSpeed + _arg1);
if (_local5.length > m_nSpeed){
m_pPosArray.unshift(new Point(m_nX, m_nY));
m_pPosArray = m_pPosArray.slice(0, (m_pSegmentArray.length * m_nSegSpacing));
};
_local6 = 0.5;
_local7 = ((360 / m_pSegmentArray.length) * _local6);
_local8 = (32 / m_pSegmentArray.length);
_local9 = 1;
_local10 = 0.5;
_local11 = (_local9 - _local10);
_local12 = (_local11 / m_pSegmentArray.length);
_local13 = 0;
while (_local13 < m_pSegmentArray.length) {
_local14 = (SpectrumPlayer.getSoundByteArray()[Math.round((_local13 * _local8))] * (_local10 + (_local12 * _local13)));
_local15 = ColorConversion.hsbtorgb((_local7 * _local13), 100, 100);
m_pSegmentArray[_local13].update(m_pPosArray[(_local13 * m_nSegSpacing)].x, m_pPosArray[(_local13 * m_nSegSpacing)].y, _local14, _local3, _local4, _local15);
_local13++;
};
}
public function init(){
var _local1:Number;
var _local2:*;
var _local3:WormSegment;
_local1 = 10;
m_pSegmentArray = new Array();
m_pPosArray = new Array();
_local2 = 0;
while (_local2 < _local1) {
_local3 = new WormSegment(m_kHost);
m_pSegmentArray.push(_local3);
_local2++;
};
_local2 = 0;
while (_local2 <= (_local1 * m_nSegSpacing)) {
m_pPosArray.push(new Point(0, 0));
_local2++;
};
}
public function getSegments():Array{
return (m_pSegmentArray);
}
}
}//package com.rox.wormsynth.Game
Section 11
//WormBullet (com.rox.wormsynth.Game.WormBullet)
package com.rox.wormsynth.Game {
import flash.display.*;
import flash.geom.*;
public class WormBullet {
protected var m_nChain:Number;// = 0
protected var m_nWidth:Number;// = 0
protected var m_nYs:Number;
protected var m_kHost:MovieClip;
protected var m_kDisplay:MovieClip;
protected var m_nDamage:Number;
public var m_kRGB:Object;
protected var m_nXs:Number;
protected var m_nLife:Number;// = 0.5
public function WormBullet(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4, _arg5, _arg6:Object){
m_nChain = 0;
m_nWidth = 0;
m_nLife = 0.5;
super();
m_nXs = (_arg4 * 2);
m_nYs = (_arg5 * 2);
m_kHost = _arg1;
m_kDisplay = new mcBullet();
m_kHost.addChild(m_kDisplay);
m_kDisplay.x = _arg2;
m_kDisplay.y = _arg3;
m_kRGB = _arg6;
m_kDisplay.transform.colorTransform = new ColorTransform((_arg6.red / 0xFF), (_arg6.green / 0xFF), (_arg6.blue / 0xFF), 1, 1, 1, 1);
m_nDamage = (0.1 + (ColorConversion.rgbtohsb(_arg6.red, _arg6.green, _arg6.blue).hue / (360 * 6)));
}
public function update():void{
var _local1:Matrix;
var _local2:ColorTransform;
var _local3:Array;
var _local4:*;
var _local5:Point;
var _local6:*;
m_nLife = (m_nLife - 0.005);
m_kDisplay.x = (m_kDisplay.x + m_nXs);
m_kDisplay.y = (m_kDisplay.y + m_nYs);
if (m_nLife < 2){
m_kDisplay.scaleX = 1;
m_kDisplay.scaleY = 1;
} else {
m_kDisplay.scaleX = 1.5;
m_kDisplay.scaleY = 1.5;
};
if ((((((((((m_kDisplay.y > 500)) || ((m_kDisplay.y < 0)))) || ((m_kDisplay.x > 500)))) || ((m_kDisplay.x < 0)))) || ((m_nLife < 0)))){
Game.getApp().removeBullet(this);
removeSelf();
};
_local1 = new Matrix();
_local1.tx = (m_kDisplay.x / 4);
_local1.ty = (m_kDisplay.y / 4);
m_kDisplay.alpha = 1;
_local2 = m_kDisplay.transform.colorTransform;
_local2.alphaMultiplier = 0.3;
Game.getApp().m_kBitmapData.draw(m_kDisplay, _local1, _local2, "add");
_local1 = new Matrix();
_local1.scale(0.25, 0.25);
_local3 = Game.getApp().getBlobs();
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = new Point((_local3[_local4].getX() - m_kDisplay.x), (_local3[_local4].getY() - m_kDisplay.y));
if (_local5.length < 20){
_local6 = false;
if ((((((m_kRGB.red == _local3[_local4].getRGB().red)) && ((m_kRGB.green == _local3[_local4].getRGB().green)))) && ((m_kRGB.blue == _local3[_local4].getRGB().blue)))){
_local6 = true;
};
if (((_local6) || ((m_nChain == 0)))){
_local3[_local4].destroySelf((m_nChain + 1), m_nXs, m_nYs, m_kDisplay.x, m_kDisplay.y);
removeSelf();
break;
};
};
_local4++;
};
}
public function removeSelf(){
Game.getApp().removeBullet(this);
if (m_kDisplay.parent != null){
m_kHost.removeChild(m_kDisplay);
};
}
public function setLife(_arg1:Number):void{
m_nLife = _arg1;
}
public function setChain(_arg1):void{
m_nChain = _arg1;
}
}
}//package com.rox.wormsynth.Game
Section 12
//WormSegment (com.rox.wormsynth.Game.WormSegment)
package com.rox.wormsynth.Game {
import flash.display.*;
import flash.geom.*;
public class WormSegment {
protected var m_nWidth:Number;// = 10
protected var m_bActive:Boolean;// = true
protected var m_kDisplay:MovieClip;
protected var m_kHost:MovieClip;
protected var m_kRBG:Object;
public function WormSegment(_arg1:MovieClip){
m_nWidth = 10;
m_bActive = true;
super();
m_kHost = _arg1;
m_kDisplay = new mcWormSegment();
m_kHost.addChild(m_kDisplay);
m_kRBG = new Object();
m_kRBG.red = 6;
m_kRBG.green = 0;
m_kRBG.blue = 0;
}
public function setActive(_arg1:Boolean):void{
m_bActive = _arg1;
}
public function update(_arg1:Number, _arg2:Number, _arg3:Number, _arg4, _arg5, _arg6:Object):void{
var _local7:*;
var _local8:Matrix;
var _local9:*;
var _local10:Array;
var _local11:*;
var _local12:Point;
_arg3 = (_arg3 / 2);
m_kDisplay.x = _arg1;
m_kDisplay.y = _arg2;
if ((m_nWidth + (_arg3 * 40)) > m_kDisplay.width){
m_kDisplay.width = (m_nWidth + (_arg3 * 40));
m_kDisplay.height = (m_nWidth + (_arg3 * 40));
} else {
if (m_kDisplay.width > 10){
m_kDisplay.width--;
m_kDisplay.height--;
};
};
if (m_bActive){
m_kDisplay.transform.colorTransform = new ColorTransform((m_kRBG.red / 0xFF), (m_kRBG.green / 0xFF), (m_kRBG.blue / 0xFF), 1, 1, 1, 1, 1);
m_kDisplay.alpha = 1;
_local7 = new ColorTransform((m_kRBG.red / 0xFF), (m_kRBG.green / 0xFF), (m_kRBG.blue / 0xFF), 1, 1, 1, 1, 1);
_local8 = new Matrix();
_local8.tx = (m_kDisplay.x / 2);
_local8.ty = (m_kDisplay.y / 2);
_local8.scale(0.5, 0.5);
Game.getApp().m_kBitmapData.draw(m_kDisplay, _local8, _local7, "add");
_local9 = new ColorTransform((m_kRBG.red / 0xFF), (m_kRBG.green / 0xFF), (m_kRBG.blue / 0xFF), 1, 1, 1, 1, 1);
_local10 = Game.getApp().getBlobs();
_local11 = 0;
while (_local11 < _local10.length) {
_local12 = new Point((_local10[_local11].getX() - m_kDisplay.x), (_local10[_local11].getY() - m_kDisplay.y));
if (_local12.length < 20){
setRBG(Blob(_local10[_local11]).getRGB());
_local10[_local11].destroySelf(5);
break;
};
_local11++;
};
} else {
_local7 = new ColorTransform((m_kRBG.red / 0xFF), (m_kRBG.green / 0xFF), (m_kRBG.blue / 0xFF), (0.5 + _arg3), 1, 1, 1, 1);
_local9 = new ColorTransform((m_kRBG.red / 0xFF), (m_kRBG.green / 0xFF), (m_kRBG.blue / 0xFF), 0.1, 1, 1, 1, 1);
m_kDisplay.transform.colorTransform = _local7;
_local8 = new Matrix();
_local8.tx = m_kDisplay.x;
_local8.ty = m_kDisplay.y;
_local8.scale(0.25, 0.25);
Game.getApp().m_kBitmapData.draw(m_kDisplay, _local8, _local7);
Game.getApp().m_kGlowBitmapData.draw(m_kDisplay, _local8, _local9);
};
}
public function isActive():Boolean{
return (m_bActive);
}
public function setRBG(_arg1:Object):void{
m_bActive = false;
m_kRBG = _arg1;
}
public function removeSelf(){
m_bActive = false;
}
}
}//package com.rox.wormsynth.Game
Section 13
//PathEdit (com.rox.wormsynth.PathEditor.PathEdit)
package com.rox.wormsynth.PathEditor {
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class PathEdit extends MovieClip {
protected var m_kOldMouse:Point;
protected var m_nMouseDown:Boolean;
protected var m_pPath:Array;
public var m_btArray:Button;
protected var m_kNowMouse:Point;
public var m_btSimplify:Button;
public function PathEdit(){
m_btArray.addEventListener(MouseEvent.MOUSE_DOWN, toArray);
m_btSimplify.addEventListener(MouseEvent.MOUSE_DOWN, toSimplify);
stage.addEventListener(Event.ENTER_FRAME, update);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
}
public function mouseUp(_arg1:Event):void{
m_nMouseDown = false;
}
public function drawPath(_arg1):void{
var _local2:*;
graphics.lineStyle(1, _arg1, 1);
_local2 = 0;
while (_local2 < (m_pPath.length - 1)) {
graphics.moveTo(m_pPath[_local2].x, m_pPath[_local2].y);
graphics.lineTo(m_pPath[(_local2 + 1)].x, m_pPath[(_local2 + 1)].y);
_local2++;
};
}
public function toArray(_arg1):void{
var _local2:String;
var _local3:*;
_local2 = new String();
_local3 = 0;
while (_local3 < m_pPath.length) {
_local2 = (_local2 + (((m_pPath[_local3].x + " ") + m_pPath[_local3].y) + "|"));
_local3++;
};
trace(_local2);
}
public function toSimplify(_arg1:Event):void{
var _local2:Array;
var _local3:*;
_local2 = new Array();
_local3 = 0;
while (_local3 < m_pPath.length) {
_local2.push(m_pPath[_local3]);
_local3 = (_local3 + 4);
};
m_pPath = _local2;
drawPath(0xFF0000);
toArray(1);
}
public function update(_arg1:Event):void{
if (m_kOldMouse == null){
m_kOldMouse = new Point(mouseX, mouseY);
} else {
m_kOldMouse = m_kNowMouse;
};
m_kNowMouse = new Point(mouseX, mouseY);
if (m_nMouseDown){
graphics.moveTo(m_kOldMouse.x, m_kOldMouse.y);
graphics.lineTo(m_kNowMouse.x, m_kNowMouse.y);
m_pPath.push(m_kNowMouse);
};
}
public function mouseDown(_arg1:Event):void{
if (mouseY < 350){
m_pPath = new Array();
graphics.clear();
graphics.lineStyle(1, 0, 1);
m_nMouseDown = true;
};
}
}
}//package com.rox.wormsynth.PathEditor
Section 14
//GameEnd (com.rox.wormsynth.GameEnd)
package com.rox.wormsynth {
import flash.display.*;
import flash.events.*;
public class GameEnd extends MovieClip {
public var m_kGameOver:MovieClip;
public var m_kOk:SimpleButton;
public var m_kText:MovieClip;
public function GameEnd(){
m_kOk.visible = false;
if ((((Levels.getLevel((wormsynth.m_nLevel + 1)) == null)) && (wormsynth.m_bWonGame))){
m_kGameOver.gotoAndStop(2);
} else {
m_kGameOver.gotoAndStop(1);
};
m_kText.m_dtLevelNumber.text = String(wormsynth.m_nScore);
setOk();
}
public function ok(_arg1:Event){
trace("#");
wormsynth.m_kInstance.setHighScore();
}
public function setOk():void{
m_kOk.addEventListener(MouseEvent.CLICK, ok);
m_kOk.visible = true;
}
}
}//package com.rox.wormsynth
Section 15
//HighScoreTable (com.rox.wormsynth.HighScoreTable)
package com.rox.wormsynth {
import flash.display.*;
import flash.events.*;
import flash.errors.*;
import com.rox.wormsynth.Game.*;
import flash.net.*;
import flash.system.*;
import fl.containers.*;
public class HighScoreTable extends MovieClip {
public var m_kHolder:MovieClip;
public var m_kScroll:ScrollPane;
public var InstanceName_0:MovieClip;
public var m_kBack:SimpleButton;
public var m_kLoader:URLLoader;
public var m_kMoreScores:SimpleButton;
public function HighScoreTable(){
m_kBack.addEventListener(MouseEvent.CLICK, back, false, 0, true);
m_kMoreScores.addEventListener(MouseEvent.CLICK, moreHighScores, false, 0, true);
recordScore();
}
function secerror(_arg1){
trace(_arg1);
}
public function moreHighScores(_arg1:Event){
}
function ioerror(_arg1:IOError){
trace(_arg1);
}
public function recordScore(){
var _local1:URLVariables;
var _local2:Number;
var _local3:*;
var _local4:URLLoader;
var _local5:URLRequest;
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local1 = new URLVariables();
_local2 = root.loaderInfo.parameters.uid;
if (_local2 > 0){
_local1.idfromflash = _local2;
} else {
_local1.idfromflash = 557907611;
};
_local3 = root.loaderInfo.parameters.playername;
if (_local3 == undefined){
_local1.name = ("test" + Math.round((Math.random() * 100)));
} else {
_local1.name = _local3;
};
_local1.score = wormsynth.m_nScore;
if (wormsynth.m_bPublic){
_local5 = new URLRequest("http://24.46.64.113:9955/FB/php/new_score_public.php");
} else {
_local5 = new URLRequest("http://24.46.64.113:9955/FB/php/new_score.php");
};
_local5.method = URLRequestMethod.POST;
_local5.data = _local1;
_local4 = new URLLoader();
_local4.dataFormat = URLLoaderDataFormat.VARIABLES;
_local4.addEventListener(Event.COMPLETE, completeHandler);
m_kLoader = _local4;
_local4.load(_local5);
}
function completeHandler(_arg1:Event){
var _local2:*;
_local2 = m_kLoader.data;
trace(("##" + _local2));
populate(_local2);
}
public function back(_arg1:Event){
wormsynth.m_kInstance.setStartScreenPost();
}
public function populate(_arg1):void{
var _local2:*;
var _local3:Array;
var _local4:*;
var _local5:*;
var _local6:HighscoreItem;
trace(_arg1);
_local2 = 0;
_local3 = new Array();
_local4 = 0;
while (_local4 < _arg1.name.length) {
_local5 = new Object();
_local5.name = _arg1.name[_local4];
_local5.score = Number(_arg1.score[_local4]);
_local3.push(_local5);
_local4++;
};
_local3.pop();
_local4 = 0;
while (_local4 < _local3.length) {
_local6 = new mcHighscoreItem();
m_kHolder.addChild(_local6);
_local6.y = (_local4 * 20);
_local6.populate(_local3[_local4]);
_local4++;
};
ScrollPane(m_kScroll).source = m_kHolder;
}
}
}//package com.rox.wormsynth
Section 16
//Levels (com.rox.wormsynth.Levels)
package com.rox.wormsynth {
public class Levels {
public static var m_pLevelSettings:Array;
public static var m_pLevels:Array;
public static function getSettings(_arg1:Number):Object{
return (m_pLevelSettings[_arg1]);
}
public static function addBlobsToGame(_arg1:Number, _arg2:Number=0.004, _arg3:Number=-1, _arg4:Number=1, _arg5:Number=1, _arg6:Number=1, _arg7:Number=1, _arg8:Number=0, _arg9:Number=0):Object{
var _local10:Object;
_local10 = new Object();
_local10.nBlobsOnPath = _arg1;
_local10.nSpeed = _arg2;
_local10.nHue = _arg3;
_local10.nPathXScale = _arg4;
_local10.nPathYScale = _arg5;
_local10.nRadiusXScale = _arg6;
_local10.nRadiusYScale = _arg7;
_local10.nRadiusPath2Mult = _arg8;
_local10.nRadiusPath2 = _arg9;
return (_local10);
}
public static function setupLevels():void{
var _local1:*;
m_pLevelSettings = new Array();
m_pLevels = new Array();
_local1 = 0;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(4, 0, 266, 1, 1, 0.5, 0.5));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
_local1 = 1;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(3, 0.005, 166, 1, 1, 0.4, 0.4));
m_pLevels[_local1].push(addBlobsToGame(3, 0, 166, 1, 1, 0.7, 0.7));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
_local1 = 2;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(2, -0.01, 66, 1, 1, 0.8, 0.8));
m_pLevels[_local1].push(addBlobsToGame(4, 0, 166, 1, 1, 0.5, 0.5, 2, 50));
m_pLevels[_local1].push(addBlobsToGame(2, 0.01, 166, 1, 1, 0.8, 0.8, 2, 50));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
_local1 = 3;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(4, -0.005, 46, 1, 1, 0.6, 0.6));
m_pLevels[_local1].push(addBlobsToGame(4, 0.005, 206, 1, 1, 0.8, 0.8, 2, 50));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
_local1 = 4;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(6, -0.005, 146, 1, 1, 1, 0.5, 8, 100));
m_pLevels[_local1].push(addBlobsToGame(6, 0.005, 56, 1, 1, 1, 0.5, 8, 100));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
_local1 = 5;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(7, 0.002, 246, 1, 1, 0.5, 0.5, 10, 30));
m_pLevels[_local1].push(addBlobsToGame(7, -0.002, 316, 1, 1, 0.8, 0.8, 10, 30));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
_local1 = 6;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(3, 0.01, 146, 2.5, 1, 0.5, 0.5, 10, 30));
m_pLevels[_local1].push(addBlobsToGame(3, -0.01, 46, 1.5, 1, 1, 1, 10, 30));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
_local1 = 7;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(2, 0.01, 246, 2.5, 1, 0.5, 0.5, 10, 10));
m_pLevels[_local1].push(addBlobsToGame(2, -0.01, 306, 2.5, 1, 0.5, 0.5, 10, 10));
m_pLevels[_local1].push(addBlobsToGame(4, 0.02, 246, 1, 1, 0.7, 0.7, 20, 10));
m_pLevels[_local1].push(addBlobsToGame(4, -0.02, 306, 1, 1, 0.7, 0.7, 20, 10));
m_pLevels[_local1].push(addBlobsToGame(4, 0, 86, 1, 1, 1, 1, 20, 0));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
_local1 = 8;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(8, 0.03, 246, 1, 1, 0.5, 0.5, 10, 10));
m_pLevels[_local1].push(addBlobsToGame(10, -0.03, 306, 1, 1, 0.7, 0.7, 10, 10));
m_pLevels[_local1].push(addBlobsToGame(12, 0.03, 106, 1, 1, 1, 1, 10, 10));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
_local1 = 9;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(8, 0.007, 126, 1, 1, 0.5, 0.5, 10, 100));
m_pLevels[_local1].push(addBlobsToGame(8, -0.007, 26, 1, 1, 0.7, 0.7, 5, 100));
m_pLevels[_local1].push(addBlobsToGame(8, -0.007, 199, 1, 1, 0.7, 0.7, 0, 0));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
_local1 = 10;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(8, -0.007, 26, 1, 1, 0.7, 0.7, 10, 100));
m_pLevels[_local1].push(addBlobsToGame(8, 0.007, 226, 1, 1, 0.7, 0.7, 10, 100));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
_local1 = 11;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(4, 0.009, 175, 1, 1, 1, 1, 10, 40));
m_pLevels[_local1].push(addBlobsToGame(4, -0.009, 175, 1, 1, 0.8, 0.8, 10, 30));
m_pLevels[_local1].push(addBlobsToGame(4, 0.009, 275, 1, 1, 0.6, 0.6, 10, 20));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
_local1 = 12;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(4, 0.007, 95, 1, 1, 1.15, 1.15, 10, 40));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
_local1 = 13;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(4, -0.007, 175, 1, 1, 0.8, 0.8, 10, 40));
m_pLevels[_local1].push(addBlobsToGame(4, 0.007, 275, 1, 1, 1.15, 1.15, 10, 50));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
_local1 = 14;
m_pLevels[_local1] = new Array();
m_pLevels[_local1].push(addBlobsToGame(8, 0.007, 25, 1, 1, 0.5, 0.5, 5, 20));
m_pLevels[_local1].push(addBlobsToGame(12, -0.007, 95, 1, 1, 0.7, 0.7, 5, 20));
m_pLevels[_local1].push(addBlobsToGame(4, 0.007, 0, 1, 1, 1.15, 1.15, 5, 20));
m_pLevelSettings[_local1] = new Object();
m_pLevelSettings[_local1].track = "sndTestTrack";
}
public static function getLevel(_arg1:Number):Array{
if (m_pLevels == null){
setupLevels();
};
return (m_pLevels[_arg1]);
}
}
}//package com.rox.wormsynth
Section 17
//Loader (com.rox.wormsynth.Loader)
package com.rox.wormsynth {
import flash.display.*;
import flash.events.*;
public class Loader extends MovieClip {
public var m_kBar:MovieClip;
public function Loader(){
this.addEventListener(Event.ENTER_FRAME, update, false, 0, true);
}
public function update(_arg1:Event){
var _local2:*;
_local2 = (stage.loaderInfo.bytesLoaded / stage.loaderInfo.bytesTotal);
m_kBar.width = (_local2 * 152);
if (_local2 == 1){
wormsynth.m_kInstance.setStartScreen();
alpha = (alpha - 0.1);
if (alpha < 0.1){
wormsynth.m_kInstance.setStartScreenPost();
removeEventListener(Event.ENTER_FRAME, update);
};
};
}
}
}//package com.rox.wormsynth
Section 18
//StartScreen (com.rox.wormsynth.StartScreen)
package com.rox.wormsynth {
import flash.display.*;
import flash.events.*;
public class StartScreen extends MovieClip {
public var m_kStart:SimpleButton;
public function StartScreen(){
var _local1:*;
super();
m_kStart.addEventListener(MouseEvent.CLICK, start, false, 0, true);
_local1 = getChildByName("m_kScores");
if (_local1 != null){
_local1.addEventListener(MouseEvent.CLICK, highScores, false, 0, true);
};
}
public function highScores(_arg1:Event){
wormsynth.m_kInstance.setHighScore();
}
public function start(_arg1:Event){
wormsynth.m_kInstance.startNewGame();
}
}
}//package com.rox.wormsynth
Section 19
//wormsynth (com.rox.wormsynth.wormsynth)
package com.rox.wormsynth {
import flash.display.*;
import flash.net.*;
import flash.system.*;
import flash.media.*;
public class wormsynth extends MovieClip {
public var t2;
public var t;
public static var m_bMochi:Boolean = true;
public static var m_kHighscoreVars:URLVariables;
public static var m_nShotsLeft:Number;
public static var m_nLevel:Number = 0;
public static var m_kInstance:wormsynth;
public static var m_nScore:Number = 0;
public static var m_bWonGame:Boolean;
public static var m_bPublic:Boolean = true;
public static var m_nAdCount:Number = 0;
public function wormsynth(){
addFrameScript(0, frame1, 1, frame2, 10, frame11, 11, frame12, 17, frame18, 24, frame25, 39, frame40);
Security.allowDomain("*");
wormsynth.m_kInstance = this;
}
public function onStartScreen():void{
}
public function setNextLevel():void{
if (Levels.getLevel(m_nLevel) == null){
setGameEnd();
} else {
gotoAndStop("nextLevel");
};
}
public function onNextLevel():void{
writeLocalHighScore(m_nScore);
onNextGame(1);
}
public function continueGame(){
t2.parent.removeChild(t2);
setStartScreenPost();
}
function frame18(){
stop();
}
function frame12(){
stop();
}
function frame1(){
t = new MovieClip();
addChild(t);
MochiAd.showPreGameAd({clip:t, id:"e0c6ff6f7a6e2c4c", res:"500x500", ad_finished:startGame});
stop();
}
function frame25(){
onNextLevel();
}
public function startGame(){
t.parent.removeChild(t);
setStartScreen();
}
public function onNextGame(_arg1):void{
m_nShotsLeft = 3;
gotoAndStop("gameplay");
}
public function setMochi(){
gotoAndStop("mochiAds");
}
public function setStartScreenPost():void{
SoundMixer.stopAll();
gotoAndStop("startScreenPostLoader");
}
function frame11(){
onStartScreen();
}
function frame40(){
t2 = new MovieClip();
addChild(t2);
MochiAd.showInterLevelAd({clip:t2, id:"e0c6ff6f7a6e2c4c", res:"500x500", ad_finished:continueGame, ad_failed:continueGame});
}
public function setStartScreen():void{
gotoAndStop("startScreen");
}
public function writeLocalHighScore(_arg1){
var _local2:SharedObject;
_local2 = SharedObject.getLocal("highscore");
if (_arg1 > _local2.data.hiscore){
_local2.data.hiscore = _arg1;
_local2.flush();
};
}
function frame2(){
setStartScreen();
}
public function setHighScore():void{
writeLocalHighScore(m_nScore);
if (m_bMochi){
m_nAdCount++;
if (m_nAdCount == 7){
setMochi();
} else {
setStartScreenPost();
};
} else {
gotoAndStop("highScore");
};
}
public function setGameEnd():void{
gotoAndStop("gameEnd");
}
public function getLocalHighScore(){
var _local1:SharedObject;
_local1 = SharedObject.getLocal("highscore");
if (_local1.data.hiscore == null){
_local1.data.hiscore = 0;
_local1.flush();
};
return (_local1.data.hiscore);
}
public function startNewGame():void{
m_nLevel = 0;
m_nScore = 0;
m_nShotsLeft = 3;
onNextLevel();
}
}
}//package com.rox.wormsynth
Section 20
//BaseScrollPane (fl.containers.BaseScrollPane)
package fl.containers {
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.events.*;
import flash.geom.*;
public class BaseScrollPane extends UIComponent {
protected var defaultLineScrollSize:Number;// = 4
protected var _maxHorizontalScrollPosition:Number;// = 0
protected var vScrollBar:Boolean;
protected var disabledOverlay:Shape;
protected var hScrollBar:Boolean;
protected var availableWidth:Number;
protected var _verticalPageScrollSize:Number;// = 0
protected var vOffset:Number;// = 0
protected var _verticalScrollBar:ScrollBar;
protected var useFixedHorizontalScrolling:Boolean;// = false
protected var contentWidth:Number;// = 0
protected var contentHeight:Number;// = 0
protected var _horizontalPageScrollSize:Number;// = 0
protected var background:DisplayObject;
protected var _useBitmpScrolling:Boolean;// = false
protected var contentPadding:Number;// = 0
protected var availableHeight:Number;
protected var _horizontalScrollBar:ScrollBar;
protected var contentScrollRect:Rectangle;
protected var _horizontalScrollPolicy:String;
protected var _verticalScrollPolicy:String;
protected static const SCROLL_BAR_STYLES:Object = {upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {repeatDelay:500, repeatInterval:35, skin:"ScrollPane_upSkin", contentPadding:0, disabledAlpha:0.5};
public function BaseScrollPane(){
contentWidth = 0;
contentHeight = 0;
contentPadding = 0;
vOffset = 0;
_maxHorizontalScrollPosition = 0;
_horizontalPageScrollSize = 0;
_verticalPageScrollSize = 0;
defaultLineScrollSize = 4;
useFixedHorizontalScrolling = false;
_useBitmpScrolling = false;
super();
}
protected function handleWheel(_arg1:MouseEvent):void{
if (((((!(enabled)) || (!(_verticalScrollBar.visible)))) || ((contentHeight <= availableHeight)))){
return;
};
_verticalScrollBar.scrollPosition = (_verticalScrollBar.scrollPosition - (_arg1.delta * verticalLineScrollSize));
setVerticalScrollPosition(_verticalScrollBar.scrollPosition);
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _arg1.delta, horizontalScrollPosition));
}
public function get verticalScrollPosition():Number{
return (_verticalScrollBar.scrollPosition);
}
protected function drawDisabledOverlay():void{
if (enabled){
if (contains(disabledOverlay)){
removeChild(disabledOverlay);
};
} else {
disabledOverlay.x = (disabledOverlay.y = contentPadding);
disabledOverlay.width = availableWidth;
disabledOverlay.height = availableHeight;
disabledOverlay.alpha = (getStyleValue("disabledAlpha") as Number);
addChild(disabledOverlay);
};
}
public function set verticalScrollPosition(_arg1:Number):void{
drawNow();
_verticalScrollBar.scrollPosition = _arg1;
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
}
protected function setContentSize(_arg1:Number, _arg2:Number):void{
if ((((((contentWidth == _arg1)) || (useFixedHorizontalScrolling))) && ((contentHeight == _arg2)))){
return;
};
contentWidth = _arg1;
contentHeight = _arg2;
invalidate(InvalidationType.SIZE);
}
public function get horizontalScrollPosition():Number{
return (_horizontalScrollBar.scrollPosition);
}
public function get horizontalScrollBar():ScrollBar{
return (_horizontalScrollBar);
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
_verticalScrollBar.enabled = _arg1;
_horizontalScrollBar.enabled = _arg1;
super.enabled = _arg1;
}
public function get verticalLineScrollSize():Number{
return (_verticalScrollBar.lineScrollSize);
}
public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
protected function calculateAvailableSize():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = ScrollBar.WIDTH;
_local2 = (contentPadding = Number(getStyleValue("contentPadding")));
_local3 = ((height - (2 * _local2)) - vOffset);
vScrollBar = (((_verticalScrollPolicy == ScrollPolicy.ON)) || ((((_verticalScrollPolicy == ScrollPolicy.AUTO)) && ((contentHeight > _local3)))));
_local4 = ((width - (vScrollBar) ? _local1 : 0) - (2 * _local2));
_local5 = (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - _local4);
hScrollBar = (((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_local5 > 0)))));
if (hScrollBar){
_local3 = (_local3 - _local1);
};
if (((((((hScrollBar) && (!(vScrollBar)))) && ((_verticalScrollPolicy == ScrollPolicy.AUTO)))) && ((contentHeight > _local3)))){
vScrollBar = true;
_local4 = (_local4 - _local1);
};
availableHeight = (_local3 + vOffset);
availableWidth = _local4;
}
public function get maxVerticalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentHeight - availableHeight)));
}
public function set horizontalScrollPosition(_arg1:Number):void{
drawNow();
_horizontalScrollBar.scrollPosition = _arg1;
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
}
public function get horizontalLineScrollSize():Number{
return (_horizontalScrollBar.lineScrollSize);
}
public function set verticalPageScrollSize(_arg1:Number):void{
_verticalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get verticalScrollPolicy():String{
return (_verticalScrollPolicy);
}
protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function get useBitmapScrolling():Boolean{
return (_useBitmpScrolling);
}
protected function handleScroll(_arg1:ScrollEvent):void{
if (_arg1.target == _verticalScrollBar){
setVerticalScrollPosition(_arg1.position);
} else {
setHorizontalScrollPosition(_arg1.position);
};
}
public function set verticalLineScrollSize(_arg1:Number):void{
_verticalScrollBar.lineScrollSize = _arg1;
}
public function get verticalScrollBar():ScrollBar{
return (_verticalScrollBar);
}
protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function set horizontalPageScrollSize(_arg1:Number):void{
_horizontalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STATE)){
drawLayout();
};
updateChildren();
super.draw();
}
public function set horizontalScrollPolicy(_arg1:String):void{
_horizontalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function configUI():void{
var _local1:Graphics;
super.configUI();
contentScrollRect = new Rectangle(0, 0, 85, 85);
_verticalScrollBar = new ScrollBar();
_verticalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_verticalScrollBar.visible = false;
_verticalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_verticalScrollBar);
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
_horizontalScrollBar = new ScrollBar();
_horizontalScrollBar.direction = ScrollBarDirection.HORIZONTAL;
_horizontalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_horizontalScrollBar.visible = false;
_horizontalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_horizontalScrollBar);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
disabledOverlay = new Shape();
_local1 = disabledOverlay.graphics;
_local1.beginFill(0xFFFFFF);
_local1.drawRect(0, 0, width, height);
_local1.endFill();
addEventListener(MouseEvent.MOUSE_WHEEL, handleWheel, false, 0, true);
}
protected function calculateContentWidth():void{
}
public function get verticalPageScrollSize():Number{
if (isNaN(availableHeight)){
drawNow();
};
return (((((_verticalPageScrollSize == 0)) && (!(isNaN(availableHeight))))) ? availableHeight : _verticalPageScrollSize);
}
protected function drawLayout():void{
calculateAvailableSize();
calculateContentWidth();
background.width = width;
background.height = height;
if (vScrollBar){
_verticalScrollBar.visible = true;
_verticalScrollBar.x = ((width - ScrollBar.WIDTH) - contentPadding);
_verticalScrollBar.y = contentPadding;
_verticalScrollBar.height = availableHeight;
} else {
_verticalScrollBar.visible = false;
};
_verticalScrollBar.setScrollProperties(availableHeight, 0, (contentHeight - availableHeight), verticalPageScrollSize);
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
if (hScrollBar){
_horizontalScrollBar.visible = true;
_horizontalScrollBar.x = contentPadding;
_horizontalScrollBar.y = ((height - ScrollBar.WIDTH) - contentPadding);
_horizontalScrollBar.width = availableWidth;
} else {
_horizontalScrollBar.visible = false;
};
_horizontalScrollBar.setScrollProperties(availableWidth, 0, (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - availableWidth), horizontalPageScrollSize);
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
drawDisabledOverlay();
}
protected function drawBackground():void{
var _local1:DisplayObject;
_local1 = background;
background = getDisplayObjectInstance(getStyleValue("skin"));
background.width = width;
background.height = height;
addChildAt(background, 0);
if (((!((_local1 == null))) && (!((_local1 == background))))){
removeChild(_local1);
};
}
public function set horizontalLineScrollSize(_arg1:Number):void{
_horizontalScrollBar.lineScrollSize = _arg1;
}
public function get horizontalPageScrollSize():Number{
if (isNaN(availableWidth)){
drawNow();
};
return (((((_horizontalPageScrollSize == 0)) && (!(isNaN(availableWidth))))) ? availableWidth : _horizontalPageScrollSize);
}
public function get maxHorizontalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentWidth - availableWidth)));
}
protected function setStyles():void{
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
}
protected function updateChildren():void{
_verticalScrollBar.enabled = (_horizontalScrollBar.enabled = enabled);
_verticalScrollBar.drawNow();
_horizontalScrollBar.drawNow();
}
public function set verticalScrollPolicy(_arg1:String):void{
_verticalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set useBitmapScrolling(_arg1:Boolean):void{
_useBitmpScrolling = _arg1;
invalidate(InvalidationType.STATE);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.containers
Section 21
//ScrollPane (fl.containers.ScrollPane)
package fl.containers {
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
public class ScrollPane extends BaseScrollPane implements IFocusManagerComponent {
protected var scrollDragHPos:Number;
protected var loader:Loader;
protected var yOffset:Number;
protected var currentContent:Object;
protected var xOffset:Number;
protected var _source:Object;// = ""
protected var scrollDragVPos:Number;
protected var _scrollDrag:Boolean;// = false
protected var contentClip:Sprite;
private static var defaultStyles:Object = {upSkin:"ScrollPane_upSkin", disabledSkin:"ScrollPane_disabledSkin", focusRectSkin:null, focusRectPadding:null, contentPadding:0};
public function ScrollPane(){
_source = "";
_scrollDrag = false;
super();
}
public function get source():Object{
return (_source);
}
public function set source(_arg1:Object):void{
var _local2:*;
clearContent();
if (isLivePreview){
return;
};
_source = _arg1;
if ((((_source == "")) || ((_source == null)))){
return;
};
currentContent = getDisplayObjectInstance(_arg1);
if (currentContent != null){
_local2 = contentClip.addChild((currentContent as DisplayObject));
dispatchEvent(new Event(Event.INIT));
update();
} else {
load(new URLRequest(_source.toString()));
};
}
public function get bytesLoaded():Number{
return (((((loader == null)) || ((loader.contentLoaderInfo == null)))) ? 0 : loader.contentLoaderInfo.bytesLoaded);
}
protected function doDrag(_arg1:MouseEvent):void{
var _local2:*;
var _local3:*;
_local2 = (scrollDragVPos - (mouseY - yOffset));
_verticalScrollBar.setScrollPosition(_local2);
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, true);
_local3 = (scrollDragHPos - (mouseX - xOffset));
_horizontalScrollBar.setScrollPosition(_local3);
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, true);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = calculateAvailableHeight();
switch (_arg1.keyCode){
case Keyboard.DOWN:
verticalScrollPosition++;
break;
case Keyboard.UP:
verticalScrollPosition--;
break;
case Keyboard.RIGHT:
horizontalScrollPosition++;
break;
case Keyboard.LEFT:
horizontalScrollPosition--;
break;
case Keyboard.END:
verticalScrollPosition = maxVerticalScrollPosition;
break;
case Keyboard.HOME:
verticalScrollPosition = 0;
break;
case Keyboard.PAGE_UP:
verticalScrollPosition = (verticalScrollPosition - _local2);
break;
case Keyboard.PAGE_DOWN:
verticalScrollPosition = (verticalScrollPosition + _local2);
break;
};
}
protected function doStartDrag(_arg1:MouseEvent):void{
if (!enabled){
return;
};
xOffset = mouseX;
yOffset = mouseY;
scrollDragHPos = horizontalScrollPosition;
scrollDragVPos = verticalScrollPosition;
stage.addEventListener(MouseEvent.MOUSE_MOVE, doDrag, false, 0, true);
}
public function get content():DisplayObject{
var _local1:Object;
_local1 = currentContent;
if ((_local1 is URLRequest)){
_local1 = loader.content;
};
return ((_local1 as DisplayObject));
}
public function get percentLoaded():Number{
if (loader != null){
return (Math.round(((bytesLoaded / bytesTotal) * 100)));
};
return (0);
}
protected function endDrag(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
}
public function update():void{
var _local1:DisplayObject;
_local1 = contentClip.getChildAt(0);
setContentSize(_local1.width, _local1.height);
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:*;
_local3 = contentClip.scrollRect;
_local3.x = _arg1;
contentClip.scrollRect = _local3;
}
public function refreshPane():void{
if ((_source is URLRequest)){
_source = _source.url;
};
source = _source;
}
protected function passEvent(_arg1:Event):void{
dispatchEvent(_arg1);
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
_local1 = Number(getStyleValue("contentPadding"));
return (((height - (_local1 * 2)) - ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0));
}
public function load(_arg1:URLRequest, _arg2:LoaderContext=null):void{
if (_arg2 == null){
_arg2 = new LoaderContext(false, ApplicationDomain.currentDomain);
};
clearContent();
initLoader();
currentContent = (_source = _arg1);
loader.load(_arg1, _arg2);
}
override protected function handleScroll(_arg1:ScrollEvent):void{
passEvent(_arg1);
super.handleScroll(_arg1);
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:*;
_local3 = contentClip.scrollRect;
_local3.y = _arg1;
contentClip.scrollRect = _local3;
}
protected function initLoader():void{
loader = new Loader();
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, passEvent, false, 0, true);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onContentLoad, false, 0, true);
loader.contentLoaderInfo.addEventListener(Event.INIT, passEvent, false, 0, true);
contentClip.addChild(loader);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
drawBackground();
};
if (isInvalid(InvalidationType.STATE)){
setScrollDrag();
};
super.draw();
}
override protected function configUI():void{
super.configUI();
contentClip = new Sprite();
addChild(contentClip);
contentClip.scrollRect = contentScrollRect;
_horizontalScrollPolicy = ScrollPolicy.AUTO;
_verticalScrollPolicy = ScrollPolicy.AUTO;
}
public function set scrollDrag(_arg1:Boolean):void{
_scrollDrag = _arg1;
invalidate(InvalidationType.STATE);
}
protected function clearContent():void{
if (contentClip.numChildren == 0){
return;
};
contentClip.removeChildAt(0);
currentContent = null;
if (loader != null){
try {
loader.close();
} catch(e) {
};
try {
loader.unload();
} catch(e) {
};
loader = null;
};
}
override protected function drawLayout():void{
super.drawLayout();
contentScrollRect = contentClip.scrollRect;
contentScrollRect.width = availableWidth;
contentScrollRect.height = availableHeight;
contentClip.cacheAsBitmap = useBitmapScrolling;
contentClip.scrollRect = contentScrollRect;
contentClip.x = (contentClip.y = contentPadding);
}
override protected function drawBackground():void{
var _local1:DisplayObject;
_local1 = background;
background = getDisplayObjectInstance(getStyleValue((enabled) ? "upSkin" : "disabledSkin"));
background.width = width;
background.height = height;
addChildAt(background, 0);
if (((!((_local1 == null))) && (!((_local1 == background))))){
removeChild(_local1);
};
}
public function get bytesTotal():Number{
return (((((loader == null)) || ((loader.contentLoaderInfo == null)))) ? 0 : loader.contentLoaderInfo.bytesTotal);
}
protected function onContentLoad(_arg1:Event):void{
var _local2:*;
update();
_local2 = calculateAvailableHeight();
calculateAvailableSize();
horizontalScrollBar.setScrollProperties(availableWidth, 0, (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - availableWidth), availableWidth);
verticalScrollBar.setScrollProperties(_local2, 0, (contentHeight - _local2), _local2);
passEvent(_arg1);
}
public function get scrollDrag():Boolean{
return (_scrollDrag);
}
protected function setScrollDrag():void{
if (_scrollDrag){
contentClip.addEventListener(MouseEvent.MOUSE_DOWN, doStartDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, endDrag, false, 0, true);
} else {
contentClip.removeEventListener(MouseEvent.MOUSE_DOWN, doStartDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, endDrag);
removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
};
contentClip.buttonMode = _scrollDrag;
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseScrollPane.getStyleDefinition()));
}
}
}//package fl.containers
Section 22
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.events.*;
import flash.utils.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 23
//Button (fl.controls.Button)
package fl.controls {
import flash.display.*;
import fl.core.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 24
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 25
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 26
//ScrollBar (fl.controls.ScrollBar)
package fl.controls {
import fl.core.*;
import flash.events.*;
import fl.events.*;
public class ScrollBar extends UIComponent {
private var _direction:String;// = "vertical"
protected var inDrag:Boolean;// = false
protected var upArrow:BaseButton;
private var _pageScrollSize:Number;// = 0
protected var downArrow:BaseButton;
private var _pageSize:Number;// = 10
private var thumbScrollOffset:Number;
private var _maxScrollPosition:Number;// = 0
private var _scrollPosition:Number;// = 0
protected var track:BaseButton;
private var _minScrollPosition:Number;// = 0
private var _lineScrollSize:Number;// = 1
protected var thumb:LabelButton;
protected static const THUMB_STYLES:Object = {disabledSkin:"thumbDisabledSkin", downSkin:"thumbDownSkin", overSkin:"thumbOverSkin", upSkin:"thumbUpSkin", icon:"thumbIcon", textPadding:0};
public static const WIDTH:Number = 15;
protected static const DOWN_ARROW_STYLES:Object = {disabledSkin:"downArrowDisabledSkin", downSkin:"downArrowDownSkin", overSkin:"downArrowOverSkin", upSkin:"downArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const UP_ARROW_STYLES:Object = {disabledSkin:"upArrowDisabledSkin", downSkin:"upArrowDownSkin", overSkin:"upArrowOverSkin", upSkin:"upArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const TRACK_STYLES:Object = {disabledSkin:"trackDisabledSkin", downSkin:"trackDownSkin", overSkin:"trackOverSkin", upSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {downArrowDisabledSkin:"ScrollArrowDown_disabledSkin", downArrowDownSkin:"ScrollArrowDown_downSkin", downArrowOverSkin:"ScrollArrowDown_overSkin", downArrowUpSkin:"ScrollArrowDown_upSkin", thumbDisabledSkin:"ScrollThumb_upSkin", thumbDownSkin:"ScrollThumb_downSkin", thumbOverSkin:"ScrollThumb_overSkin", thumbUpSkin:"ScrollThumb_upSkin", trackDisabledSkin:"ScrollTrack_skin", trackDownSkin:"ScrollTrack_skin", trackOverSkin:"ScrollTrack_skin", trackUpSkin:"ScrollTrack_skin", upArrowDisabledSkin:"ScrollArrowUp_disabledSkin", upArrowDownSkin:"ScrollArrowUp_downSkin", upArrowOverSkin:"ScrollArrowUp_overSkin", upArrowUpSkin:"ScrollArrowUp_upSkin", thumbIcon:"ScrollBar_thumbIcon", repeatDelay:500, repeatInterval:35};
public function ScrollBar(){
_pageSize = 10;
_pageScrollSize = 0;
_lineScrollSize = 1;
_minScrollPosition = 0;
_maxScrollPosition = 0;
_scrollPosition = 0;
_direction = ScrollBarDirection.VERTICAL;
inDrag = false;
super();
setStyles();
focusEnabled = false;
}
public function get minScrollPosition():Number{
return (_minScrollPosition);
}
public function set minScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _arg1, _maxScrollPosition);
}
public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{
var _local3:Number;
_local3 = scrollPosition;
_scrollPosition = Math.max(_minScrollPosition, Math.min(_maxScrollPosition, _arg1));
if (_local3 == _scrollPosition){
return;
};
if (_arg2){
dispatchEvent(new ScrollEvent(_direction, (scrollPosition - _local3), scrollPosition));
};
updateThumb();
}
public function set scrollPosition(_arg1:Number):void{
setScrollPosition(_arg1, true);
}
public function get pageScrollSize():Number{
return (((_pageScrollSize)==0) ? _pageSize : _pageScrollSize);
}
public function set pageSize(_arg1:Number):void{
if (_arg1 > 0){
_pageSize = _arg1;
};
}
public function setScrollProperties(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{
this.pageSize = _arg1;
_minScrollPosition = _arg2;
_maxScrollPosition = _arg3;
if (_arg4 >= 0){
_pageScrollSize = _arg4;
};
enabled = (_maxScrollPosition > _minScrollPosition);
setScrollPosition(_scrollPosition, false);
updateThumb();
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
downArrow.enabled = (track.enabled = (thumb.enabled = (upArrow.enabled = ((enabled) && ((_maxScrollPosition > _minScrollPosition))))));
updateThumb();
}
protected function updateThumb():void{
var _local1:Number;
_local1 = ((_maxScrollPosition - _minScrollPosition) + _pageSize);
if ((((((track.height <= 12)) || ((_maxScrollPosition <= _minScrollPosition)))) || ((((_local1 == 0)) || (isNaN(_local1)))))){
thumb.height = 12;
thumb.visible = false;
} else {
thumb.height = Math.max(13, ((_pageSize / _local1) * track.height));
thumb.y = (track.y + ((track.height - thumb.height) * ((_scrollPosition - _minScrollPosition) / (_maxScrollPosition - _minScrollPosition))));
thumb.visible = enabled;
};
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
inDrag = true;
thumbScrollOffset = (mouseY - thumb.y);
thumb.mouseStateLocked = true;
mouseChildren = false;
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
inDrag = false;
mouseChildren = true;
thumb.mouseStateLocked = false;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
}
public function set pageScrollSize(_arg1:Number):void{
if (_arg1 >= 0){
_pageScrollSize = _arg1;
};
}
protected function handleThumbDrag(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = Math.max(0, Math.min((track.height - thumb.height), ((mouseY - track.y) - thumbScrollOffset)));
setScrollPosition((((_local2 / (track.height - thumb.height)) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition));
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
if (_direction == _arg1){
return;
};
_direction = _arg1;
if (isLivePreview){
return;
};
setScaleY(1);
_local2 = (_direction == ScrollBarDirection.HORIZONTAL);
if (((_local2) && (componentInspectorSetting))){
if (rotation == 90){
return;
};
setScaleX(-1);
rotation = -90;
};
if (!componentInspectorSetting){
if (((_local2) && ((rotation == 0)))){
rotation = -90;
setScaleX(-1);
} else {
if (((!(_local2)) && ((rotation == -90)))){
rotation = 0;
setScaleX(1);
};
};
};
invalidate(InvalidationType.SIZE);
}
public function set lineScrollSize(_arg1:Number):void{
if (_arg1 > 0){
_lineScrollSize = _arg1;
};
}
override public function get height():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.width : super.height);
}
protected function scrollPressHandler(_arg1:ComponentEvent):void{
var _local2:Number;
var _local3:Number;
_arg1.stopImmediatePropagation();
if (_arg1.currentTarget == upArrow){
setScrollPosition((_scrollPosition - _lineScrollSize));
} else {
if (_arg1.currentTarget == downArrow){
setScrollPosition((_scrollPosition + _lineScrollSize));
} else {
_local2 = (((track.mouseY / track.height) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition);
_local3 = ((pageScrollSize)==0) ? pageSize : pageScrollSize;
if (_scrollPosition < _local2){
setScrollPosition(Math.min(_local2, (_scrollPosition + _local3)));
} else {
if (_scrollPosition > _local2){
setScrollPosition(Math.max(_local2, (_scrollPosition - _local3)));
};
};
};
};
}
public function get pageSize():Number{
return (_pageSize);
}
public function set maxScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _minScrollPosition, _arg1);
}
public function get scrollPosition():Number{
return (_scrollPosition);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
var _local1:Number;
if (isInvalid(InvalidationType.SIZE)){
_local1 = super.height;
downArrow.move(0, Math.max(upArrow.height, (_local1 - downArrow.height)));
track.setSize(WIDTH, Math.max(0, (_local1 - (downArrow.height + upArrow.height))));
updateThumb();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
setStyles();
};
downArrow.drawNow();
upArrow.drawNow();
track.drawNow();
thumb.drawNow();
validate();
}
override protected function configUI():void{
super.configUI();
track = new BaseButton();
track.move(0, 14);
track.useHandCursor = false;
track.autoRepeat = true;
track.focusEnabled = false;
addChild(track);
thumb = new LabelButton();
thumb.label = "";
thumb.setSize(WIDTH, 15);
thumb.move(0, 15);
thumb.focusEnabled = false;
addChild(thumb);
downArrow = new BaseButton();
downArrow.setSize(WIDTH, 14);
downArrow.autoRepeat = true;
downArrow.focusEnabled = false;
addChild(downArrow);
upArrow = new BaseButton();
upArrow.setSize(WIDTH, 14);
upArrow.move(0, 0);
upArrow.autoRepeat = true;
upArrow.focusEnabled = false;
addChild(upArrow);
upArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
downArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
track.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
enabled = false;
}
public function get direction():String{
return (_direction);
}
public function get lineScrollSize():Number{
return (_lineScrollSize);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if (_direction == ScrollBarDirection.HORIZONTAL){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
}
public function get maxScrollPosition():Number{
return (_maxScrollPosition);
}
override public function get width():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.height : super.width);
}
protected function setStyles():void{
copyStylesToChild(downArrow, DOWN_ARROW_STYLES);
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
copyStylesToChild(upArrow, UP_ARROW_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 27
//ScrollBarDirection (fl.controls.ScrollBarDirection)
package fl.controls {
public class ScrollBarDirection {
public static const HORIZONTAL:String = "horizontal";
public static const VERTICAL:String = "vertical";
}
}//package fl.controls
Section 28
//ScrollPolicy (fl.controls.ScrollPolicy)
package fl.controls {
public class ScrollPolicy {
public static const OFF:String = "off";
public static const ON:String = "on";
public static const AUTO:String = "auto";
}
}//package fl.controls
Section 29
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 30
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const SIZE:String = "size";
public static const ALL:String = "all";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const STATE:String = "state";
public static const STYLES:String = "styles";
public static const SELECTED:String = "selected";
public static const RENDERER_STYLES:String = "rendererStyles";
}
}//package fl.core
Section 31
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.system.*;
import flash.utils.*;
import flash.text.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 32
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 33
//ScrollEvent (fl.events.ScrollEvent)
package fl.events {
import flash.events.*;
public class ScrollEvent extends Event {
private var _position:Number;
private var _direction:String;
private var _delta:Number;
public static const SCROLL:String = "scroll";
public function ScrollEvent(_arg1:String, _arg2:Number, _arg3:Number){
super(ScrollEvent.SCROLL, false, false);
_direction = _arg1;
_delta = _arg2;
_position = _arg3;
}
override public function clone():Event{
return (new ScrollEvent(_direction, _delta, _position));
}
public function get position():Number{
return (_position);
}
override public function toString():String{
return (formatToString("ScrollEvent", "type", "bubbles", "cancelable", "direction", "delta", "position"));
}
public function get delta():Number{
return (_delta);
}
public function get direction():String{
return (_direction);
}
}
}//package fl.events
Section 34
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 35
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 36
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 37
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 38
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.utils.*;
import flash.text.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 39
//Game_Background_Random_24 (wormsynth_mochi_fla.Game_Background_Random_24)
package wormsynth_mochi_fla {
import flash.display.*;
public dynamic class Game_Background_Random_24 extends MovieClip {
public function Game_Background_Random_24(){
addFrameScript(0, frame1);
}
function frame1(){
gotoAndStop((Math.round((Math.random() * this.totalFrames)) + 1));
}
}
}//package wormsynth_mochi_fla
Section 40
//GameEndDisplay_32 (wormsynth_mochi_fla.GameEndDisplay_32)
package wormsynth_mochi_fla {
import flash.display.*;
import flash.text.*;
public dynamic class GameEndDisplay_32 extends MovieClip {
public var m_dtLevelNumber:TextField;
}
}//package wormsynth_mochi_fla
Section 41
//mcBonus_27 (wormsynth_mochi_fla.mcBonus_27)
package wormsynth_mochi_fla {
import flash.display.*;
import flash.text.*;
public dynamic class mcBonus_27 extends MovieClip {
public var m_dtText:TextField;
}
}//package wormsynth_mochi_fla
Section 42
//mcBonusDisplay_26 (wormsynth_mochi_fla.mcBonusDisplay_26)
package wormsynth_mochi_fla {
import flash.display.*;
public dynamic class mcBonusDisplay_26 extends MovieClip {
public var m_kBonus:MovieClip;
public function mcBonusDisplay_26(){
addFrameScript(0, frame1, 19, frame20);
}
function frame1(){
stop();
}
function frame20(){
stop();
}
}
}//package wormsynth_mochi_fla
Section 43
//mcText_64 (wormsynth_mochi_fla.mcText_64)
package wormsynth_mochi_fla {
import flash.display.*;
import flash.text.*;
public dynamic class mcText_64 extends MovieClip {
public var m_dtText:TextField;
}
}//package wormsynth_mochi_fla
Section 44
//mcTextContainer_30 (wormsynth_mochi_fla.mcTextContainer_30)
package wormsynth_mochi_fla {
import flash.display.*;
import flash.text.*;
public dynamic class mcTextContainer_30 extends MovieClip {
public var m_dtLevelNumber:TextField;
}
}//package wormsynth_mochi_fla
Section 45
//mcWormBlinkClip_66 (wormsynth_mochi_fla.mcWormBlinkClip_66)
package wormsynth_mochi_fla {
import flash.display.*;
public dynamic class mcWormBlinkClip_66 extends MovieClip {
public function mcWormBlinkClip_66(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package wormsynth_mochi_fla
Section 46
//Button_disabledSkin (Button_disabledSkin)
package {
import flash.display.*;
public dynamic class Button_disabledSkin extends MovieClip {
}
}//package
Section 47
//Button_downSkin (Button_downSkin)
package {
import flash.display.*;
public dynamic class Button_downSkin extends MovieClip {
}
}//package
Section 48
//Button_emphasizedSkin (Button_emphasizedSkin)
package {
import flash.display.*;
public dynamic class Button_emphasizedSkin extends MovieClip {
}
}//package
Section 49
//Button_overSkin (Button_overSkin)
package {
import flash.display.*;
public dynamic class Button_overSkin extends MovieClip {
}
}//package
Section 50
//Button_selectedDisabledSkin (Button_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class Button_selectedDisabledSkin extends MovieClip {
}
}//package
Section 51
//Button_selectedDownSkin (Button_selectedDownSkin)
package {
import flash.display.*;
public dynamic class Button_selectedDownSkin extends MovieClip {
}
}//package
Section 52
//Button_selectedOverSkin (Button_selectedOverSkin)
package {
import flash.display.*;
public dynamic class Button_selectedOverSkin extends MovieClip {
}
}//package
Section 53
//Button_selectedUpSkin (Button_selectedUpSkin)
package {
import flash.display.*;
public dynamic class Button_selectedUpSkin extends MovieClip {
}
}//package
Section 54
//Button_upSkin (Button_upSkin)
package {
import flash.display.*;
public dynamic class Button_upSkin extends MovieClip {
}
}//package
Section 55
//class_Game (class_Game)
package {
import com.rox.wormsynth.Game.*;
public dynamic class class_Game extends Game {
}
}//package
Section 56
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 57
//HighScores_Class (HighScores_Class)
package {
import com.rox.wormsynth.*;
public dynamic class HighScores_Class extends HighScoreTable {
public function HighScores_Class(){
__setProp_m_kScroll_HighScores_Class_Layer5_1();
}
function __setProp_m_kScroll_HighScores_Class_Layer5_1(){
try {
m_kScroll["componentInspectorSetting"] = true;
} catch(e:Error) {
};
m_kScroll.enabled = true;
m_kScroll.horizontalLineScrollSize = 4;
m_kScroll.horizontalPageScrollSize = 0;
m_kScroll.horizontalScrollPolicy = "auto";
m_kScroll.scrollDrag = false;
m_kScroll.source = "m_kHolder";
m_kScroll.verticalLineScrollSize = 4;
m_kScroll.verticalPageScrollSize = 0;
m_kScroll.verticalScrollPolicy = "auto";
m_kScroll.visible = true;
try {
m_kScroll["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 58
//Loader_Loader (Loader_Loader)
package {
import com.rox.wormsynth.*;
public dynamic class Loader_Loader extends Loader {
}
}//package
Section 59
//mcBlob (mcBlob)
package {
import flash.display.*;
public dynamic class mcBlob extends MovieClip {
public var m_kBlink:MovieClip;
}
}//package
Section 60
//mcBullet (mcBullet)
package {
import flash.display.*;
public dynamic class mcBullet extends MovieClip {
}
}//package
Section 61
//mcGameEnd (mcGameEnd)
package {
import com.rox.wormsynth.*;
public dynamic class mcGameEnd extends GameEnd {
public function mcGameEnd(){
addFrameScript(74, frame75);
}
function frame75(){
stop();
}
}
}//package
Section 62
//mcGameLost (mcGameLost)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcGameLost extends MovieClip {
public var m_dtScore:TextField;
}
}//package
Section 63
//mcHighscore (mcHighscore)
package {
import com.rox.wormsynth.Game.*;
public dynamic class mcHighscore extends Highscores {
}
}//package
Section 64
//mcHighscoreItem (mcHighscoreItem)
package {
import com.rox.wormsynth.Game.*;
public dynamic class mcHighscoreItem extends HighscoreItem {
}
}//package
Section 65
//mcLevelPanel (mcLevelPanel)
package {
import com.rox.wormsynth.Game.*;
public dynamic class mcLevelPanel extends LevelPanel {
public function mcLevelPanel(){
addFrameScript(50, frame51);
}
function frame51(){
stop();
}
}
}//package
Section 66
//mcPathEdit (mcPathEdit)
package {
import com.rox.wormsynth.PathEditor.*;
public dynamic class mcPathEdit extends PathEdit {
public function mcPathEdit(){
__setProp_m_btSimplify_mcPathEdit_Layer1_1();
__setProp_m_btArray_mcPathEdit_Layer1_1();
}
function __setProp_m_btSimplify_mcPathEdit_Layer1_1(){
try {
m_btSimplify["componentInspectorSetting"] = true;
} catch(e:Error) {
};
m_btSimplify.emphasized = false;
m_btSimplify.enabled = true;
m_btSimplify.label = "Simplify";
m_btSimplify.labelPlacement = "right";
m_btSimplify.selected = false;
m_btSimplify.toggle = false;
m_btSimplify.visible = true;
try {
m_btSimplify["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_m_btArray_mcPathEdit_Layer1_1(){
try {
m_btArray["componentInspectorSetting"] = true;
} catch(e:Error) {
};
m_btArray.emphasized = false;
m_btArray.enabled = true;
m_btArray.label = "Array";
m_btArray.labelPlacement = "right";
m_btArray.selected = false;
m_btArray.toggle = false;
m_btArray.visible = true;
try {
m_btArray["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 67
//mcStartScreen (mcStartScreen)
package {
import com.rox.wormsynth.Game.*;
public dynamic class mcStartScreen extends StartScreen {
}
}//package
Section 68
//mcTextDisplay (mcTextDisplay)
package {
import flash.display.*;
public dynamic class mcTextDisplay extends MovieClip {
public var m_kText:MovieClip;
public function mcTextDisplay(){
addFrameScript(15, frame16);
}
function frame16(){
if (this.parent != null){
this.parent.removeChild(this);
};
}
}
}//package
Section 69
//mcTurret (mcTurret)
package {
import flash.display.*;
public dynamic class mcTurret extends MovieClip {
public var m_kGun:MovieClip;
public var m_kBlink:MovieClip;
}
}//package
Section 70
//mcWormSegment (mcWormSegment)
package {
import flash.display.*;
public dynamic class mcWormSegment extends MovieClip {
public var m_kBlink:MovieClip;
}
}//package
Section 71
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
import flash.utils.*;
public class MochiAd {
public static function getVersion():String{
return ("2.6");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 72
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_disabledSkin extends MovieClip {
}
}//package
Section 73
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_downSkin extends MovieClip {
}
}//package
Section 74
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_overSkin extends MovieClip {
}
}//package
Section 75
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_upSkin extends MovieClip {
}
}//package
Section 76
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_disabledSkin extends MovieClip {
}
}//package
Section 77
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_downSkin extends MovieClip {
}
}//package
Section 78
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_overSkin extends MovieClip {
}
}//package
Section 79
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_upSkin extends MovieClip {
}
}//package
Section 80
//ScrollBar_thumbIcon (ScrollBar_thumbIcon)
package {
import flash.display.*;
public dynamic class ScrollBar_thumbIcon extends MovieClip {
}
}//package
Section 81
//ScrollPane_disabledSkin (ScrollPane_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollPane_disabledSkin extends MovieClip {
}
}//package
Section 82
//ScrollPane_upSkin (ScrollPane_upSkin)
package {
import flash.display.*;
public dynamic class ScrollPane_upSkin extends MovieClip {
}
}//package
Section 83
//ScrollThumb_downSkin (ScrollThumb_downSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_downSkin extends MovieClip {
}
}//package
Section 84
//ScrollThumb_overSkin (ScrollThumb_overSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_overSkin extends MovieClip {
}
}//package
Section 85
//ScrollThumb_upSkin (ScrollThumb_upSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_upSkin extends MovieClip {
}
}//package
Section 86
//ScrollTrack_skin (ScrollTrack_skin)
package {
import flash.display.*;
public dynamic class ScrollTrack_skin extends MovieClip {
}
}//package
Section 87
//sndClap (sndClap)
package {
import flash.media.*;
public dynamic class sndClap extends Sound {
}
}//package
Section 88
//sndPoop (sndPoop)
package {
import flash.media.*;
public dynamic class sndPoop extends Sound {
}
}//package
Section 89
//sndTestTrack (sndTestTrack)
package {
import flash.media.*;
public dynamic class sndTestTrack extends Sound {
}
}//package
Section 90
//sndTestTrack2 (sndTestTrack2)
package {
import flash.media.*;
public dynamic class sndTestTrack2 extends Sound {
}
}//package
Section 91
//sndWave (sndWave)
package {
import flash.media.*;
public dynamic class sndWave extends Sound {
}
}//package
Section 92
//StartScreen_Class (StartScreen_Class)
package {
import com.rox.wormsynth.*;
public dynamic class StartScreen_Class extends StartScreen {
}
}//package