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

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

Fix the Equation - Multiply (2 to 6).swf

This is the info page for
Flash #239036

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


ActionScript [AS3]
Section 1
//Games (General.Games) package General { public class Games { private var gameName:String;// = "" private var gameOptions:Array; private var members:Array; private var gameCount:int;// = 0 private var options:Array; public function Games(_arg1:Array){ options = new Array(); gameOptions = new Array(); super(); this.members = _arg1; } public function add(_arg1:String, _arg2:Array):void{ if (this.gameName.length == 0){ this.gameName = _arg1; }; this.options[_arg1] = new Object(); var _local3:int; while (_local3 < _arg2.length) { this.options[_arg1][members[_local3]] = _arg2[_local3]; _local3++; }; this.options[_arg1]["gameNo"] = gameCount++; } public function getGameTitles(_arg1:String, _arg2:int):Array{ var _local4:String; var _local5:Array; var _local6:int; var _local3:Array = new Array(); for (_local4 in options) { _local3.push({gameNo:options[_local4]["gameNo"], title:options[_local4][_arg1][_arg2]}); }; _local3.sortOn("gameNo", Array.NUMERIC); _local5 = new Array(); _local6 = 0; while (_local6 < _local3.length) { _local5.push(_local3[_local6]["title"]); _local6++; }; return (_local5); } public function getGameList(_arg1:String):String{ var _local4:String; var _local2 = ""; var _local3:int; for (_local4 in options) { _local2 = (_local2 + (_arg1 + ",")); _local2 = (_local2 + (_local3 + ",")); _local2 = (_local2 + (_local4 + ",")); _local2 = (_local2 + ((_arg1 + " - ") + options[_local4]["title"][0])); _local2 = (_local2 + "\n"); _local3++; }; return (_local2); } public function getGame():String{ return (this.gameName); } public function game(_arg1:String, _arg2:String){ return (options[_arg1][_arg2]); } public function setGameByTitle(_arg1:String, _arg2:String, _arg3:int):void{ var _local4:String; for (_local4 in options) { if (_arg1 == options[_local4][_arg2][_arg3]){ this.gameName = _local4; }; }; } public function setGame(_arg1:String):void{ if (options[_arg1] == undefined){ } else { this.gameName = _arg1; }; } public function option(_arg1:String){ return (options[gameName][_arg1]); } } }//package General
Section 2
//HighScores (General.HighScores) package General { import flash.net.*; public class HighScores { private var sttTime:Date; private var score:Number; public var gameMode:String; private var gameName:String; public function HighScores(_arg1:String, _arg2:String){ sttTime = new Date(); super(); this.gameName = _arg1; this.gameMode = _arg2; trace(("HighScores gameMode=" + _arg2)); } private function rotStr(_arg1:String, _arg2:String):String{ var _local3 = ""; var _local4:int; while (_local4 < 4) { _local3 = (_local3 + rotChr(_arg1.substr(_local4, 1), _arg2.substr(_local4, 1))); _local4++; }; return (_local3); } private function encodeBase64(_arg1:String):String{ var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local2 = ""; var _local3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_:"; var _local4:int; while (_local4 < _arg1.length) { var _temp1 = _local4; _local4 = (_local4 + 1); _local5 = _arg1.charCodeAt(_temp1); var _temp2 = _local4; _local4 = (_local4 + 1); _local6 = _arg1.charCodeAt(_temp2); var _temp3 = _local4; _local4 = (_local4 + 1); _local7 = _arg1.charCodeAt(_temp3); _local8 = (_local5 >> 2); _local9 = (((_local5 & 3) << 4) | (_local6 >> 4)); _local10 = (((_local6 & 15) << 2) | (_local7 >> 6)); _local11 = (_local7 & 63); if (isNaN(_local6)){ _local11 = 64; _local10 = _local11; } else { if (isNaN(_local7)){ _local11 = 64; }; }; _local2 = ((((_local2 + _local3.charAt(_local8)) + _local3.charAt(_local9)) + _local3.charAt(_local10)) + _local3.charAt(_local11)); }; return (_local2); } private function cleanURL(_arg1:String):String{ _arg1 = _arg1.replace(" ", "%20"); return (_arg1); } private function keyShuffle(_arg1:String, _arg2:String):String{ var _local8:int; var _local9:int; var _local10:String; var _local3:int = _arg1.length; var _local4:Array = new Array(); var _local5:int; while (_local5 < 4) { _local4[_local5] = _arg1.substr(_local5, 1); _local5++; }; var _local6:int = _arg2.length; _local5 = 0; while (_local5 < 4) { _local8 = ordOffset(_arg2.substr(_local5, 1)); _local9 = ((_local5 + _local8) % 4); if (_local9 != _local5){ _local10 = _local4[_local5]; _local4[_local5] = _local4[_local9]; _local4[_local9] = _local10; }; _local5++; }; var _local7 = ""; _local5 = 0; while (_local5 < 4) { _local7 = (_local7 + _local4[_local5]); _local5++; }; return (_local7); } private function pad0(_arg1:Number):String{ if (_arg1 < 10){ return (("0" + _arg1.toString())); }; return (_arg1.toString()); } private function makeScoreStr(_arg1:Date, _arg2:Number, _arg3:String, _arg4:String, _arg5:Number, _arg6:int, _arg7:int):String{ var _local8 = "00"; var _local9 = "~"; var _local10 = ""; _local10 = (_local10 + fmtTime(_arg1)); _local10 = (_local10 + _local9); _local10 = (_local10 + int((_arg1.getTimezoneOffset() / 60))); _local10 = (_local10 + _local9); _local10 = (_local10 + (_arg2 / 1000)); _local10 = (_local10 + _local9); _local10 = (_local10 + _arg3); _local10 = (_local10 + _local9); _local10 = (_local10 + _arg4); _local10 = (_local10 + _local9); _local10 = (_local10 + _arg5.toString()); _local10 = (_local10 + _local9); _local10 = (_local10 + _arg6); _local10 = (_local10 + _local9); _local10 = (_local10 + _arg7); _local10 = (_local10 + _local9); _local10 = (_local10 + keyMake(_arg4, _arg5.toString())); _local10 = encodeBase64(_local10); _local10 = (_local8 + _local10); return (_local10); } public function setStt():void{ sttTime = new Date(); } private function keyMake(_arg1:String, _arg2:String):String{ var _local3:String = (_arg1 + _arg2); var _local4:String = _local3.substr(0, 4); var _local5 = 1; while (_local5 <= int((_local3.length / 4))) { _local4 = rotStr(_local4, _local3.substr((_local5 * 4), 4)); _local5++; }; _local4 = keyShuffle(_local4, _arg2); _local4 = rotStr(_local4, _arg2); return (_local4); } private function rotChr(_arg1:String, _arg2:String):String{ var _local3:int = ordOffset(_arg1); var _local4:int = ordOffset(_arg2); var _local5:int = (_local3 + _local4); if (_local5 >= 26){ _local5 = (_local5 - 26); }; return (String.fromCharCode((_local5 + "a".charCodeAt(0)))); } public function addMe(_arg1:Number, _arg2:int, _arg3:int):void{ score = fmt2(_arg1); trace(score); var _local4:Date = new Date(); var _local5:Number = (_local4.valueOf() - sttTime.valueOf()); trace(_local5); var _local6:String = makeScoreStr(sttTime, _local5, gameName, gameMode, score, _arg2, _arg3); var _local7:LocalConnection = new LocalConnection(); _local7.client = this; _local7.send("mathopolis", "methodToExecute", _local6); } private function ordOffset(_arg1:String):int{ if (_arg1.length == 0){ return (0); }; var _local2:int = _arg1.toLowerCase().charCodeAt(0); if ((((_local2 >= 48)) && ((_local2 <= 57)))){ _local2 = (_local2 - 48); }; if ((((_local2 >= 97)) && ((_local2 <= 122)))){ _local2 = (_local2 - 97); }; if (_local2 > 26){ _local2 = 0; }; return (_local2); } private function fmtTime(_arg1:Date):String{ var _local2 = ""; _local2 = (_local2 + _arg1.getFullYear().toString().substr(2, 2)); _local2 = (_local2 + pad0((_arg1.getMonth() + 1))); _local2 = (_local2 + pad0(_arg1.getDate())); _local2 = (_local2 + pad0(_arg1.getHours())); _local2 = (_local2 + pad0(_arg1.getMinutes())); _local2 = (_local2 + pad0(_arg1.getSeconds())); return (_local2); } private function fmt2(_arg1:Number):Number{ var _local2:Number = (Math.round((_arg1 * 100)) / 100); return (_local2); } } }//package General
Section 3
//Cell (GUI.Cell) package GUI { import flash.events.*; import flash.display.*; public class Cell extends Sprite { public var itemText:String;// = "" public var clickClr:uint;// = 0xFFFF00 private var bg:Sprite; public var loClr:uint;// = 16768511 public var hiClr:uint;// = 14548991 public var bgHeight:int;// = 18 public var bgWidth:int;// = 180 public var textBox:TextBox; public function Cell(_arg1:String){ bg = new Sprite(); super(); itemText = _arg1; this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut); this.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); drawMe(0xCCCCCC, loClr); addChild(bg); textBox = new TextBox("Arial", 15, bgWidth, 1, _arg1, 5, -2); addChild(textBox); } private function drawMe(_arg1:uint, _arg2:uint):void{ var edgeClr = _arg1; var bgClr = _arg2; var _local4 = bg.graphics; with (_local4) { clear(); beginFill(bgClr, 1); drawRoundRect(0, 0, bgWidth, bgHeight, bgHeight, bgHeight); endFill(); }; } public function onMouseOut(_arg1:MouseEvent):void{ drawMe(0xCCCCCC, loClr); } public function onMouseOver(_arg1:MouseEvent):void{ drawMe(0xCCCCCC, hiClr); } public function onMouseDown(_arg1:MouseEvent):void{ loClr = clickClr; drawMe(0xCCCCCC, loClr); dispatchEvent(new Event("CellClick")); } } }//package GUI
Section 4
//CircleButton (GUI.CircleButton) package GUI { import flash.events.*; import flash.display.*; import flash.geom.*; public class CircleButton extends HiSprite { private var symbolHi:Sprite; private var radius:int; private var innerCircle:Shape; private var downCircle2:Shape; private var outerCircle:Shape; private var tb:TextBox; private var downCircle:Shape; private var symbolLo:Sprite; public function CircleButton(_arg1:int=23):void{ symbolLo = new Sprite(); symbolHi = new Sprite(); super(); this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut); this.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); this.addEventListener(MouseEvent.MOUSE_UP, onMouseUp); this.buttonMode = true; this.useHandCursor = true; this.radius = _arg1; outerCircle = createGradient(_arg1, (-(Math.PI) / 6)); this.addChild(outerCircle); innerCircle = createGradient((_arg1 * 0.85), ((-(Math.PI) / 6) - Math.PI)); this.addChild(innerCircle); downCircle = createGradient(_arg1, ((-(Math.PI) / 6) - Math.PI)); downCircle.visible = false; this.addChild(downCircle); downCircle2 = createGradient((_arg1 * 0.85), (-(Math.PI) / 6)); downCircle2.visible = false; this.addChild(downCircle2); this.addChild(symbolLo); this.addChild(symbolHi); symbolLo.visible = true; symbolHi.visible = false; tb = new TextBox("Arial", (_arg1 / 2), (_arg1 * 2), 1, "OK", -(_arg1), (-(_arg1) / 3)); tb.setFontClr(0xFFFFFF); tb.setAlign("center"); tb.mouseEnabled = false; this.addChild(tb); } private function createGradient(_arg1:Number, _arg2:Number):Shape{ var _local3:Shape = new Shape(); var _local4:Matrix = new Matrix(); _local4.createGradientBox((_arg1 * 2), (_arg1 * 2), _arg2, -(_arg1), -(_arg1)); _local3.graphics.beginGradientFill("linear", [153, 0xFFFFFF], [100, 100], [0, 0xFF], _local4, "pad", "RGB", 0); _local3.graphics.moveTo(0, 0); _local3.graphics.drawCircle(0, 0, _arg1); _local3.graphics.endFill(); return (_local3); } private function onMouseOut(_arg1:MouseEvent):void{ outerCircle.alpha = 1; innerCircle.alpha = 1; downCircle.visible = false; downCircle2.visible = false; symbolLo.visible = true; symbolHi.visible = false; } private function onMouseOver(_arg1:MouseEvent):void{ outerCircle.alpha = 0.4; symbolLo.visible = false; symbolHi.visible = true; } private function onMouseUp(_arg1:MouseEvent):void{ downCircle.visible = false; downCircle2.visible = false; symbolLo.visible = true; symbolHi.visible = false; } public function setStyle(_arg1:String):void{ this.tb.visible = false; symbolLo.graphics.clear(); symbolHi.graphics.clear(); switch (_arg1){ case "play": symbolLo.graphics.lineStyle(3, 0xFFFFFF, 1); symbolLo.graphics.moveTo((-(radius) * 0.4), (-(radius) * 0.5)); symbolLo.graphics.lineTo((-(radius) * 0.4), (radius * 0.5)); symbolLo.graphics.lineTo((radius * 0.5), 0); symbolLo.graphics.lineTo((-(radius) * 0.4), (-(radius) * 0.5)); symbolHi.graphics.beginFill(0xFF00FF); symbolHi.graphics.lineStyle(3, 0xFFFFFF, 1); symbolHi.graphics.moveTo((-(radius) * 0.4), (-(radius) * 0.5)); symbolHi.graphics.lineTo((-(radius) * 0.4), (radius * 0.5)); symbolHi.graphics.lineTo((radius * 0.5), 0); symbolHi.graphics.lineTo((-(radius) * 0.4), (-(radius) * 0.5)); symbolHi.graphics.endFill(); break; }; } private function onMouseDown(_arg1:MouseEvent):void{ downCircle.alpha = 0.3; downCircle.visible = true; downCircle2.visible = true; symbolLo.visible = false; symbolHi.visible = true; } public function setText(_arg1:String):void{ tb.text = _arg1; } } }//package GUI
Section 5
//CircleTimer (GUI.CircleTimer) package GUI { import flash.events.*; import flash.display.*; import flash.utils.*; public class CircleTimer extends Sprite { private var timeShape:Shape; private var timeStt:int; public var timingQ:Boolean;// = false private var Seconds:int;// = 0 public function CircleTimer(){ timeShape = new Shape(); super(); var _local1:Shape = new Shape(); _local1.graphics.lineStyle(5, 14540287, 1); _local1.graphics.beginFill(15658751); _local1.graphics.moveTo(0, 0); _local1.graphics.drawCircle(0, 0, 35); _local1.graphics.endFill(); addChild(_local1); addChild(timeShape); } private function timeLoop(_arg1:Event):void{ var _local3:Number; var _local4:Number; timeShape.graphics.clear(); var _local2:Number = ((getTimer() - timeStt) / 1000); if (_local2 < Seconds){ _local3 = (_local2 / Seconds); _local4 = Math.min(360, (360 * _local3)); HiGraphics.drawSector(timeShape.graphics, 0, 0, 30, (0 - 90), (_local4 - 90), 0, 1, 0xFF, true); } else { trace("time ends"); timeShape.graphics.beginFill(0x880088); timeShape.graphics.drawCircle(0, 0, 30); timeShape.graphics.endFill(); removeEventListener(Event.ENTER_FRAME, timeLoop); dispatchEvent(new Event("TimesUp")); }; } public function start(_arg1:int, _arg2:uint):void{ Seconds = _arg1; var _local3:uint = _arg2; timingQ = true; timeStt = getTimer(); addEventListener(Event.ENTER_FRAME, timeLoop); } } }//package GUI
Section 6
//Copyright (GUI.Copyright) package GUI { import flash.events.*; import flash.display.*; import flash.net.*; public class Copyright extends Sprite { public var linkText:TextBox; public var versText:TextBox; public function Copyright(_arg1:String){ this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut); this.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); linkText = new TextBox("Arial", 11, 150, 1, "© MathsIsFun.com", 0, 0); linkText.setFontClr(0xFF); linkText.alpha = 0.5; this.addChild(linkText); versText = new TextBox("Arial", 11, 100, 1, ("v" + _arg1), 110, 0); versText.setFontClr(0x888888); this.addChild(versText); } private function onMouseOut(_arg1:MouseEvent):void{ linkText.alpha = 0.5; } private function onMouseOver(_arg1:MouseEvent):void{ linkText.alpha = 1; } private function onMouseDown(_arg1:MouseEvent):void{ var ev = _arg1; linkText.alpha = 0.5; var request:URLRequest = new URLRequest("http://www.mathsisfun.com"); try { navigateToURL(request, "_blank"); } catch(e:Error) { trace("Error occurred!"); }; } } }//package GUI
Section 7
//HiSprite (GUI.HiSprite) package GUI { import flash.events.*; import flash.display.*; public class HiSprite extends Sprite { private var shakeStep:Number;// = 0 private var alphaStep:Number;// = 0 private var shakes:Array; public function HiSprite(){ shakes = new Array(); super(); } private function fadeLoop(_arg1:Event):void{ if (alphaStep < 0){ if (this.alpha > 0){ this.alpha = (this.alpha + alphaStep); } else { this.alpha = 0; this.visible = false; removeEventListener(Event.ENTER_FRAME, fadeLoop); }; } else { if (this.alpha < 1){ this.alpha = (this.alpha + alphaStep); } else { this.alpha = 1; removeEventListener(Event.ENTER_FRAME, fadeLoop); }; }; } public function shake():void{ var _local1:Number = (3 * Maths.randomRange(1, 2)); this.shakes.push(_local1); this.shakes.push((_local1 * 2)); var _local2:int; while (_local2 < (_local1 * 2)) { this.shakes.push(((_local1 * 2) - _local2)); _local2 = (_local2 + 2); }; shakeStep = 0; addEventListener(Event.ENTER_FRAME, shakeLoop); } private function shakeLoop(_arg1:Event):void{ if (shakeStep < shakes.length){ if ((shakeStep % 2) == 0){ this.x = (this.x - this.shakes[shakeStep]); } else { this.x = (this.x + this.shakes[shakeStep]); }; shakeStep++; } else { removeEventListener(Event.ENTER_FRAME, shakeLoop); }; } public function fade(_arg1:Number):void{ this.alphaStep = _arg1; this.visible = true; if (_arg1 < 0){ this.alpha = 1; } else { this.alpha = 0; }; addEventListener(Event.ENTER_FRAME, fadeLoop); } } }//package GUI
Section 8
//InfoBox (GUI.InfoBox) package GUI { import flash.display.*; public class InfoBox extends Sprite { private var scoreLbl:TextBox; private var scoreBox:Sprite; private var scoreText:TextBox; public function InfoBox(_arg1:String){ scoreBox = new Sprite(); scoreLbl = new TextBox("Arial", 16, 80, 1, "Score", 0, 0); scoreText = new TextBox("Arial", 20, 80, 1, "0", 0, 22); super(); scoreLbl.setAlign("center"); scoreLbl.setText(_arg1); scoreBox.addChild(scoreLbl); scoreBox.graphics.beginFill(16777164, 1); scoreBox.graphics.lineStyle(1, 0x888888, 1); scoreBox.graphics.drawRect(0, 20, 80, 30); scoreBox.graphics.endFill(); scoreText.setAlign("center"); scoreBox.addChild(scoreText); addChild(scoreBox); } public function setText(_arg1:String):void{ scoreText.setText(_arg1); } } }//package GUI
Section 9
//Popup (GUI.Popup) package GUI { import flash.events.*; import flash.display.*; import flash.geom.*; public class Popup extends Sprite { public var OKBtn:CircleButton; private var currX:Number;// = 0 private var currY:Number;// = 0 private var appearType:String;// = "pop" private var newX:Number;// = 0 private var newY:Number;// = 0 private var round:Number;// = 50 public function Popup(_arg1:int, _arg2:int){ trace("new Popup"); var _local3:Shape = createGradient(_arg1, _arg2, (-(Math.PI) * 0.6)); addChild(_local3); var _local4:Shape = new Shape(); _local4.graphics.beginFill(8947967, 1); _local4.graphics.drawRoundRect(0, 0, _arg1, _arg2, round); _local4.graphics.endFill(); addChild(_local4); OKBtn = new CircleButton(25); OKBtn.x = (_arg1 - 30); OKBtn.y = (_arg2 - 30); addChild(OKBtn); OKBtn.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); } public function slideTo(_arg1:Number, _arg2:Number):void{ trace("slideTo"); currX = this.x; currY = this.y; newX = _arg1; newY = _arg2; addEventListener(Event.ENTER_FRAME, doSlide); } private function onMouseDown(_arg1:MouseEvent):void{ trace("onMouseDown"); this.close(); } public function open():void{ switch (appearType){ case "pop": parent.addChild(this); break; case "slide": break; }; } private function doSlide(_arg1:Event=null):void{ var _local2:int; var _local3:Number = Point.distance(new Point(currX, currY), new Point(newX, newY)); if (_local3 > 0.1){ if (_local3 > 1){ currX = ((currX * 0.85) + (newX * 0.15)); currY = ((currY * 0.85) + (newY * 0.15)); _local2++; } else { currX = newX; currY = newY; _local2++; }; }; if (_local2 > 0){ this.x = currX; this.y = currY; } else { removeEventListener(Event.ENTER_FRAME, doSlide); }; } public function setAppearType(_arg1:String):void{ this.appearType = _arg1; trace(("appearType=" + _arg1)); } private function createGradient(_arg1:int, _arg2:int, _arg3:Number):Shape{ var _local4:Shape = new Shape(); var _local5:Matrix = new Matrix(); _local5.createGradientBox((_arg1 * 1.5), (_arg2 * 1.5), _arg3, 0, 0); _local4.graphics.beginGradientFill("linear", [0xFF, 13421823], [100, 100], [0, 0xFF], _local5, "pad", "RGB", 0); var _local6 = 10; _local4.graphics.moveTo(0, 0); _local4.graphics.drawRoundRect(-(_local6), -(_local6), (_arg1 + (_local6 * 2)), (_arg2 + (_local6 * 2)), (round + _local6)); _local4.graphics.endFill(); return (_local4); } public function close():void{ trace("close"); trace(("appearType=" + appearType)); switch (appearType){ case "pop": parent.removeChild(this); break; case "slide": this.slideTo(-600, this.y); break; }; } } }//package GUI
Section 10
//Radio (GUI.Radio) package GUI { import flash.events.*; import flash.display.*; public class Radio extends Sprite { public var currItem:String;// = "" private var currX:Number;// = 0 private var boxWd:int;// = 200 private var boxNo:int;// = 0 private var currY:Number;// = 0 private var boxHt:int;// = 20 private var boxes:Array; private var maxHt:int;// = 250 public function Radio(){ boxes = new Array(); super(); } public function getItem():String{ return (boxes[boxNo].label); } public function clearMe():void{ var _local1:int; while (_local1 < boxes.length) { _local1++; }; boxes = []; } public function checkMe(_arg1:int):void{ var _local2:int; while (_local2 < boxes.length) { if (boxes[_local2] == _arg1){ setItemNo(_local2); }; _local2++; }; } public function getItemNo():int{ return (boxNo); } private function onCellClick(_arg1:Event):void{ this.currItem = _arg1.currentTarget.itemText; trace(("onCellClick=" + this.currItem)); dispatchEvent(new Event("RadioClick")); } public function setItemNo(_arg1:int):void{ var _local2:int; while (_local2 < boxes.length) { boxes[_local2].checked = false; _local2++; }; boxes[_arg1].checked = true; boxNo = _arg1; } public function setItems(_arg1:Array):void{ var _local3:Cell; clearMe(); currX = 20; currY = 20; var _local2:int; while (_local2 < _arg1.length) { _local3 = new Cell(_arg1[_local2]); _local3.x = currX; _local3.y = currY; _local3.addEventListener("CellClick", onCellClick); addChild(_local3); this.boxes.push(_local3); currY = (currY + boxHt); if (currY > maxHt){ currY = 20; currX = (currX + boxWd); }; _local2++; }; } } }//package GUI
Section 11
//RoundedButton (GUI.RoundedButton) package GUI { import flash.events.*; import flash.display.*; import flash.geom.*; public class RoundedButton extends HiSprite { private var midClr:Number;// = 13421823 public var wd:Number;// = 90 private var onQ:Boolean;// = false private var btn:Sprite; private var btnShape:Shape; private var brdrClr:Number;// = 13421823 private var tb:TextBox; private var toggleQ:Boolean;// = false public function RoundedButton(_arg1:Number=30):void{ btnShape = new Shape(); super(); this.wd = _arg1; this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut); this.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); this.buttonMode = true; this.useHandCursor = true; this.mouseChildren = false; btn = new Sprite(); btnShape = createGradient(30, (Math.PI / 2), brdrClr, midClr); btn.addChild(btnShape); this.addChild(btn); tb = new TextBox("Arial", 12, wd, 1, "OK", 0, 5); tb.setAlign("center"); this.addChild(tb); } private function onMouseDown(_arg1:MouseEvent):void{ if (toggleQ){ onQ = !(onQ); if (onQ){ chgMiddle(10092390); } else { chgMiddle(0x888888); }; } else { chgMiddle(10092390); this.addEventListener(MouseEvent.MOUSE_UP, onMouseUp); }; } private function createGradient(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Shape{ var _local5:Shape = new Shape(); var _local6:Matrix = new Matrix(); _local6.createGradientBox(_arg1, _arg1, _arg2, 0, 0); _local5.graphics.beginGradientFill("linear", [0xFFFFFF, _arg4, 0xFFFFFF], [100, 100, 100], [0, 136, 0xFF], _local6, "pad", "RGB", 0); _local5.graphics.lineStyle(2, _arg3, 1); _local5.graphics.moveTo(0, 0); _local5.graphics.drawRoundRect(0, 0, wd, 30, 30, 30); _local5.graphics.endFill(); return (_local5); } private function onMouseUp(_arg1:MouseEvent):void{ chgMiddle(13421823); this.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp); } private function chgMiddle(_arg1:Number):void{ midClr = _arg1; btn.removeChild(btnShape); btnShape = createGradient(30, (Math.PI / 2), brdrClr, midClr); btn.addChild(btnShape); } public function setToggle(_arg1:Boolean):void{ toggleQ = _arg1; if (toggleQ){ if (_arg1){ chgMiddle(10092390); } else { chgMiddle(0x888888); }; } else { chgMiddle(13421823); }; } public function setOn(_arg1:Boolean):void{ this.onQ = _arg1; if (toggleQ){ if (_arg1){ chgMiddle(10092390); } else { chgMiddle(0x888888); }; } else { chgMiddle(13421823); }; } private function onMouseOut(_arg1:MouseEvent):void{ chgBorder(13421823); } public function isOn():Boolean{ return (onQ); } public function setText(_arg1:String):void{ tb.text = _arg1; } private function chgBorder(_arg1:Number):void{ brdrClr = _arg1; btn.removeChild(btnShape); btnShape = createGradient(30, (Math.PI / 2), brdrClr, midClr); btn.addChild(btnShape); } private function onMouseOver(_arg1:MouseEvent):void{ chgBorder(10092390); } } }//package GUI
Section 12
//ScoreBoard (GUI.ScoreBoard) package GUI { import flash.display.*; import flash.geom.*; public class ScoreBoard extends Sprite { private var midClr:Number;// = 13421823 private var noImg:Bitmap; private var bg:Sprite; private var noCount:int;// = 0 private var noBox:InfoBox; private var score:int;// = 0 private var wide:int;// = 600 private var scoreBox:InfoBox; private var yesImg:Bitmap; private var NoImg:Class; private var bgShape:Shape; private var yesBox:InfoBox; private var yesCount:int;// = 0 private var high:int;// = 90 private var brdrClr:Number;// = 13421823 private var YesImg:Class; public function ScoreBoard(){ YesImg = ScoreBoard_YesImg; yesImg = new YesImg(); NoImg = ScoreBoard_NoImg; noImg = new NoImg(); bg = new Sprite(); bgShape = new Shape(); yesBox = new InfoBox("Yes"); noBox = new InfoBox("No"); scoreBox = new InfoBox("Score"); super(); bgShape = createGradient((high * 1.2), (Math.PI / 2), brdrClr, midClr); bg.addChild(bgShape); addChild(bg); yesBox.x = 150; yesBox.y = 15; addChild(yesBox); yesImg.scaleX = 0.7; yesImg.scaleY = 0.7; yesImg.x = 220; yesImg.y = 30; addChild(yesImg); noBox.x = 260; noBox.y = 15; addChild(noBox); noImg.scaleX = 0.7; noImg.scaleY = 0.7; noImg.x = 330; noImg.y = 30; addChild(noImg); scoreBox.x = 410; scoreBox.y = 15; addChild(scoreBox); } public function addScore(_arg1:int):void{ score = (score + _arg1); if (score < 0){ score = 0; }; scoreBox.setText(score.toString()); } public function addYes():void{ yesCount++; yesBox.setText(yesCount.toString()); } private function createGradient(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Shape{ var _local5:Shape = new Shape(); var _local6:Matrix = new Matrix(); _local6.createGradientBox(_arg1, _arg1, _arg2, 0, 0); _local5.graphics.beginGradientFill("linear", [0xFFFFFF, _arg4, 0xFFFFFF], [100, 100, 100], [0, 136, 0xFF], _local6, "pad", "RGB", 0); _local5.graphics.lineStyle(2, _arg3, 1); _local5.graphics.moveTo(0, 0); _local5.graphics.drawRoundRect(0, 0, wide, high, high, high); _local5.graphics.endFill(); return (_local5); } public function setScore(_arg1:int):void{ score = _arg1; scoreBox.setText(score.toString()); } public function addNo():void{ noCount++; noBox.setText(noCount.toString()); } public function getScore():int{ return (score); } } }//package GUI
Section 13
//ScoreBoard_NoImg (GUI.ScoreBoard_NoImg) package GUI { import mx.core.*; public class ScoreBoard_NoImg extends BitmapAsset { } }//package GUI
Section 14
//ScoreBoard_YesImg (GUI.ScoreBoard_YesImg) package GUI { import mx.core.*; public class ScoreBoard_YesImg extends BitmapAsset { } }//package GUI
Section 15
//TextBox (GUI.TextBox) package GUI { import flash.display.*; import flash.text.*; public class TextBox extends TextField { private var tf:TextFormat; public function TextBox(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number=1, _arg5:String="", _arg6:int=0, _arg7:int=0):void{ tf = new TextFormat(); super(); this.x = 0; this.y = 0; this.width = _arg3; this.height = (((_arg4 * _arg2) * 1.1) + 6); this.border = false; this.multiline = true; this.wordWrap = true; this.selectable = false; this.mouseEnabled = false; this.blendMode = BlendMode.LAYER; this.text = _arg5; this.x = _arg6; this.y = _arg7; tf.size = _arg2; tf.color = 0; tf.font = _arg1; tf.bold = true; this.setTextFormat(tf); this.defaultTextFormat = tf; } public function setFontClr(_arg1:Number):void{ tf.color = _arg1; this.defaultTextFormat = tf; this.setTextFormat(tf); } public function setAlign(_arg1:String):void{ tf.align = _arg1; this.defaultTextFormat = tf; this.setTextFormat(tf); } public function cleanup():void{ parent.removeChild(this); } public function setText(_arg1:String):void{ this.text = _arg1; } } }//package GUI
Section 16
//Ticks (GUI.Ticks) package GUI { import flash.display.*; public class Ticks extends Sprite { private var maxTicks:int;// = 5 private var ticks:Array; private var TickImg:Class; public function Ticks(){ var _local2:Bitmap; TickImg = Ticks_TickImg; ticks = new Array(); super(); var _local1:int; while (_local1 < maxTicks) { _local2 = new TickImg(); _local2.x = (_local1 * 38); _local2.y = 0; ticks[_local1] = _local2; trace(("x=" + _local2.x)); _local1++; }; _local1 = (maxTicks - 1); while (_local1 >= 0) { addChild(ticks[_local1]); _local1--; }; } public function showTicks(_arg1:int):void{ var _local2:int; while (_local2 < maxTicks) { if (_local2 < _arg1){ ticks[_local2].alpha = 1; } else { ticks[_local2].alpha = 0.1; }; _local2++; }; } public function hideTicks():void{ var _local1:int; while (_local1 < maxTicks) { ticks[_local1].alpha = 0; _local1++; }; } } }//package GUI
Section 17
//Ticks_TickImg (GUI.Ticks_TickImg) package GUI { import mx.core.*; public class Ticks_TickImg extends BitmapAsset { } }//package GUI
Section 18
//BitmapAsset (mx.core.BitmapAsset) package mx.core { import flash.display.*; public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject { mx_internal static const VERSION:String = "3.3.0.4852"; public function BitmapAsset(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){ super(_arg1, _arg2, _arg3); } public function get measuredWidth():Number{ if (bitmapData){ return (bitmapData.width); }; return (0); } public function get measuredHeight():Number{ if (bitmapData){ return (bitmapData.height); }; return (0); } public function setActualSize(_arg1:Number, _arg2:Number):void{ width = _arg1; height = _arg2; } public function move(_arg1:Number, _arg2:Number):void{ this.x = _arg1; this.y = _arg2; } } }//package mx.core
Section 19
//FlexBitmap (mx.core.FlexBitmap) package mx.core { import flash.display.*; import mx.utils.*; public class FlexBitmap extends Bitmap { mx_internal static const VERSION:String = "3.3.0.4852"; public function FlexBitmap(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){ var bitmapData = _arg1; var pixelSnapping = _arg2; var smoothing = _arg3; super(bitmapData, pixelSnapping, smoothing); try { name = NameUtil.createUniqueName(this); } catch(e:Error) { }; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 20
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 21
//IFlexDisplayObject (mx.core.IFlexDisplayObject) package mx.core { import flash.events.*; import flash.display.*; import flash.geom.*; import flash.accessibility.*; public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher { function get visible():Boolean; function get rotation():Number; function localToGlobal(_arg1:Point):Point; function get name():String; function set width(_arg1:Number):void; function get measuredHeight():Number; function get blendMode():String; function get scale9Grid():Rectangle; function set name(_arg1:String):void; function set scaleX(_arg1:Number):void; function set scaleY(_arg1:Number):void; function get measuredWidth():Number; function get accessibilityProperties():AccessibilityProperties; function set scrollRect(_arg1:Rectangle):void; function get cacheAsBitmap():Boolean; function globalToLocal(_arg1:Point):Point; function get height():Number; function set blendMode(_arg1:String):void; function get parent():DisplayObjectContainer; function getBounds(_arg1:DisplayObject):Rectangle; function get opaqueBackground():Object; function set scale9Grid(_arg1:Rectangle):void; function setActualSize(_arg1:Number, _arg2:Number):void; function set alpha(_arg1:Number):void; function set accessibilityProperties(_arg1:AccessibilityProperties):void; function get width():Number; function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean; function set cacheAsBitmap(_arg1:Boolean):void; function get scaleX():Number; function get scaleY():Number; function get scrollRect():Rectangle; function get mouseX():Number; function get mouseY():Number; function set height(_arg1:Number):void; function set mask(_arg1:DisplayObject):void; function getRect(_arg1:DisplayObject):Rectangle; function get alpha():Number; function set transform(_arg1:Transform):void; function move(_arg1:Number, _arg2:Number):void; function get loaderInfo():LoaderInfo; function get root():DisplayObject; function hitTestObject(_arg1:DisplayObject):Boolean; function set opaqueBackground(_arg1:Object):void; function set visible(_arg1:Boolean):void; function get mask():DisplayObject; function set x(_arg1:Number):void; function set y(_arg1:Number):void; function get transform():Transform; function set filters(_arg1:Array):void; function get x():Number; function get y():Number; function get filters():Array; function set rotation(_arg1:Number):void; function get stage():Stage; } }//package mx.core
Section 22
//IRepeaterClient (mx.core.IRepeaterClient) package mx.core { public interface IRepeaterClient { function get instanceIndices():Array; function set instanceIndices(_arg1:Array):void; function get isDocument():Boolean; function set repeaters(_arg1:Array):void; function initializeRepeaterArrays(_arg1:IRepeaterClient):void; function get repeaters():Array; function set repeaterIndices(_arg1:Array):void; function get repeaterIndices():Array; } }//package mx.core
Section 23
//mx_internal (mx.core.mx_internal) package mx.core { public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal"; }//package mx.core
Section 24
//NameUtil (mx.utils.NameUtil) package mx.utils { import flash.display.*; import mx.core.*; import flash.utils.*; public class NameUtil { mx_internal static const VERSION:String = "3.3.0.4852"; private static var counter:int = 0; public static function displayObjectToString(_arg1:DisplayObject):String{ var result:String; var o:DisplayObject; var s:String; var indices:Array; var displayObject = _arg1; try { o = displayObject; while (o != null) { if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){ break; }; s = o.name; if ((o is IRepeaterClient)){ indices = IRepeaterClient(o).instanceIndices; if (indices){ s = (s + (("[" + indices.join("][")) + "]")); }; }; result = ((result == null)) ? s : ((s + ".") + result); o = o.parent; }; } catch(e:SecurityError) { }; return (result); } public static function createUniqueName(_arg1:Object):String{ if (!_arg1){ return (null); }; var _local2:String = getQualifiedClassName(_arg1); var _local3:int = _local2.indexOf("::"); if (_local3 != -1){ _local2 = _local2.substr((_local3 + 2)); }; var _local4:int = _local2.charCodeAt((_local2.length - 1)); if ((((_local4 >= 48)) && ((_local4 <= 57)))){ _local2 = (_local2 + "_"); }; return ((_local2 + counter++)); } } }//package mx.utils
Section 25
//Equation (Equation) package { import flash.events.*; import flash.display.*; import flash.geom.*; import GUI.*; public class Equation extends Sprite { private var qStr:String;// = "" private var noImg:Bitmap; private var answer:Number;// = 0 private var fixedOperator:Boolean;// = false private var operators:String;// = "+-*/" private var box:Sprite; private var negativeNumbers:Boolean;// = false private var yesImg:Bitmap; private var maxVal:Number;// = 9 private var NoImg:Class; private var currX:Number;// = 0 private var currY:Number;// = 0 private var aText:TextBox; private var minVal:Number;// = 1 private var theOperator:String;// = "+" private var newX:Number;// = 0 private var newY:Number;// = 0 private var YesImg:Class; private var qText:TextBox; public function Equation(_arg1:String, _arg2:Number, _arg3:Number){ YesImg = Equation_YesImg; yesImg = new YesImg(); NoImg = Equation_NoImg; noImg = new NoImg(); qText = new TextBox("Arial", 29, 540, 1, "1 + 1 = 2", 0, 0); aText = new TextBox("Arial", 29, 400, 1, "", 0, 0); box = new Sprite(); super(); this.operators = _arg1; this.minVal = _arg2; this.maxVal = _arg3; addChild(yesImg); addChild(noImg); qText.setAlign("center"); addChild(qText); box.graphics.lineStyle(2, 0, 1); box.graphics.beginFill(0xFFFFFF, 1); box.graphics.drawRect(0, 0, 30, 36); box.graphics.endFill(); addChild(box); aText.setAlign("center"); aText.setFontClr(0xFF00FF); addChild(aText); newEqun(_arg2, _arg3); } private function doSlide(_arg1:Event=null):void{ var _local2:int; var _local3:Number = Point.distance(new Point(currX, currY), new Point(newX, newY)); if (_local3 > 0.1){ if (_local3 > 1){ currX = ((currX * 0.85) + (newX * 0.15)); currY = ((currY * 0.85) + (newY * 0.15)); _local2++; } else { currX = newX; currY = newY; _local2++; }; }; if (_local2 > 0){ this.x = currX; this.y = currY; } else { removeEventListener(Event.ENTER_FRAME, doSlide); }; } public function setOperators(_arg1:String):void{ operators = _arg1; } public function slideTo(_arg1:Number, _arg2:Number):void{ currX = this.x; currY = this.y; newX = _arg1; newY = _arg2; addEventListener(Event.ENTER_FRAME, doSlide); } public function newEqun(_arg1:Number, _arg2:Number):void{ var _local3 = "FSR"; yesImg.visible = false; noImg.visible = false; var _local4:String = operators.charAt(int(Maths.randomRange(0, operators.length))); if (_local4 == "c"){ _local3 = "FS"; }; var _local5:String = _local3.charAt(int(Maths.randomRange(0, _local3.length))); var _local6:Number = 0; var _local7:Number = 0; do { _local6 = int(Maths.randomRange(_arg1, (_arg2 + 1))); _local7 = int(Maths.randomRange(_arg1, (_arg2 + 1))); if (negativeNumbers){ if (Math.random() < 0.5){ _local6 = -(_local6); }; if (Math.random() < 0.5){ _local7 = -(_local7); }; }; if (_local4 == "/"){ _local6 = calculate(_local6, _local7, "*"); }; if (_local4 == "c"){ _local7 = (_arg2 - _local6); }; } while (calculate(_local6, _local7, _local4) == -32768); var _local8:Number = calculate(_local6, _local7, _local4); switch (_local5){ case "F": qStr = (((((("MM" + " ") + _local4) + " ") + _local7) + " = ") + _local8); answer = _local6; break; case "S": qStr = ((((((_local6 + " ") + _local4) + " ") + "MM") + " = ") + _local8); answer = _local7; break; case "R": qStr = ((((((_local6 + " ") + _local4) + " ") + _local7) + " = ") + "MM"); answer = _local8; break; }; qStr = qStr.replace("*", "×"); qStr = qStr.replace("c", "+"); qText.setText(qStr); var _local9:int = qStr.indexOf("MM"); var _local10:Rectangle = qText.getCharBoundaries(_local9); box.x = int(_local10.x); box.width = int((_local10.width * 2)); aText.x = (_local10.x - 12); aText.width = ((_local10.width * 2) + 20); } public function setRight(_arg1:Boolean):void{ yesImg.visible = false; yesImg.y = -5; noImg.visible = false; noImg.y = -5; var _local2:Number = (qText.getCharBoundaries((qText.length - 1)).x + 40); if (_arg1){ yesImg.visible = true; yesImg.x = _local2; noImg.visible = false; } else { yesImg.visible = false; noImg.visible = true; noImg.x = _local2; }; } private function calculate(_arg1:Number, _arg2:Number, _arg3:String):Number{ var _local4:Number; var _local5:String; switch (_arg3){ case "+": return ((_arg1 + _arg2)); case "-": if (negativeNumbers){ return ((_arg1 - _arg2)); }; if ((_arg1 - _arg2) < 0){ return (-32768); }; return ((_arg1 - _arg2)); case "*": if ((((_arg1 == 0)) || ((_arg2 == 0)))){ return (-32768); }; return ((_arg1 * _arg2)); case "/": if (_arg2 == 0){ return (-32768); }; _local4 = (_arg1 / _arg2); _local5 = _local4.toString(); if (_local5.indexOf(".") > -1){ return (-32768); }; if (negativeNumbers){ return ((_arg1 / _arg2)); }; if (_local4 < 0){ return (-32768); }; return ((_arg1 / _arg2)); case "c": case "d": return ((_arg1 + _arg2)); }; return (0); } public function setAnswer(_arg1:String):void{ aText.setText(_arg1); } public function getAnswer():String{ return (answer.toString()); } public function getQ():String{ return (qStr); } } }//package
Section 26
//Equation_NoImg (Equation_NoImg) package { import mx.core.*; public class Equation_NoImg extends BitmapAsset { } }//package
Section 27
//Equation_YesImg (Equation_YesImg) package { import mx.core.*; public class Equation_YesImg extends BitmapAsset { } }//package
Section 28
//HiGraphics (HiGraphics) package { import flash.display.*; import flash.geom.*; public class HiGraphics { public static function drawPseudo3D(_arg1:Graphics, _arg2:String, _arg3:Boolean, _arg4:Boolean, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number):Point{ var xStart:*; var yStart:*; var factor:*; var backX:*; var backY:*; var i:*; var j:*; var temp:*; var destGraphics = _arg1; var type = _arg2; var filled = _arg3; var liteClrQ = _arg4; var blockHeight = _arg5; var blockWidth = _arg6; var edgeA = _arg7; var edgeB = _arg8; var height = _arg9; var fillHeight = _arg10; var topDownPt:Point = new Point(); var lineThick:Number = 2; var lineClr:uint; var mainClr:uint = 6711039; var topClr:uint = 2280703; if (liteClrQ){ mainClr = 12303359; topClr = 16768511; }; var _local12 = destGraphics; with (_local12) { xStart = 0; yStart = 0; factor = 4; switch (type){ case "rect": backX = ((blockHeight * edgeB) / factor); backY = (-((edgeB * blockHeight)) / factor); xStart = backX; yStart = backY; lineStyle(lineThick, 0, 0.6); moveTo(backX, backY); lineTo((backX + (edgeA * blockWidth)), backY); lineTo((backX + (edgeA * blockWidth)), (backY + (height * blockHeight))); lineTo(backX, (backY + (height * blockHeight))); lineTo(backX, backY); moveTo(0, (height * blockHeight)); lineTo(backX, (backY + (height * blockHeight))); if (filled){ xStart = 0; yStart = (blockHeight * height); moveTo(xStart, yStart); lineStyle(lineThick, 0xFF, 0); beginFill(mainClr, 1); lineTo((xStart + (edgeA * blockWidth)), yStart); lineTo(((backX + xStart) + (edgeA * blockWidth)), (backY + yStart)); lineTo(((backX + xStart) + (edgeA * blockWidth)), ((backY + yStart) - (fillHeight * blockHeight))); lineTo((xStart + (edgeA * blockWidth)), (yStart - (fillHeight * blockHeight))); lineTo(xStart, (yStart - (fillHeight * blockHeight))); lineTo(xStart, yStart); endFill(); xStart = 0; yStart = ((height - fillHeight) * blockHeight); moveTo(xStart, yStart); lineStyle(lineThick, 0xFFFF, 0.1); beginFill(topClr, 1); lineTo((xStart + (edgeA * blockWidth)), yStart); lineTo(((backX + xStart) + (edgeA * blockWidth)), (backY + yStart)); lineTo((backX + xStart), (backY + yStart)); lineTo(xStart, yStart); endFill(); lineStyle(lineThick, 0, 0.6); moveTo((backX + (edgeA * blockWidth)), backY); lineTo((backX + (edgeA * blockWidth)), (backY + (height * blockHeight))); }; xStart = 0; yStart = 0; lineStyle(lineThick, 0, 1); moveTo(xStart, yStart); lineTo((xStart + (edgeA * blockWidth)), yStart); lineTo((xStart + (edgeA * blockWidth)), (yStart + (height * blockHeight))); lineTo(xStart, (yStart + (height * blockHeight))); lineTo(xStart, yStart); moveTo(0, 0); lineTo(backX, backY); moveTo((edgeA * blockWidth), 0); lineTo((backX + (edgeA * blockWidth)), backY); moveTo((edgeA * blockWidth), (height * blockHeight)); lineTo((backX + (edgeA * blockWidth)), (backY + (height * blockHeight))); i = 1; while (i < height) { yStart = (i * blockHeight); moveTo(xStart, yStart); lineTo((xStart + 10), yStart); i++; }; yStart = (0 + (height * blockHeight)); i = 0; while (i < edgeB) { xStart = 0; yStart = (yStart + blockHeight); j = 0; while (j < edgeA) { moveTo(xStart, yStart); lineTo((xStart + blockWidth), yStart); lineTo((xStart + blockWidth), (yStart + blockHeight)); lineTo(xStart, (yStart + blockHeight)); lineTo(xStart, yStart); xStart = (xStart + blockWidth); j++; }; i++; }; break; case "cylinder": if (filled){ xStart = (0 + (edgeA * blockWidth)); yStart = (0 + (height * blockHeight)); beginFill(mainClr, 1); drawEllipseRadius(destGraphics, xStart, yStart, (edgeA * blockWidth), ((edgeA * blockWidth) / factor)); endFill(); moveTo(0, yStart); beginFill(mainClr, 1); lineTo((0 + ((edgeA * 2) * blockWidth)), yStart); lineTo((0 + ((edgeA * 2) * blockWidth)), (yStart - (fillHeight * blockHeight))); lineTo(0, (yStart - (fillHeight * blockHeight))); lineTo(0, yStart); endFill(); xStart = (0 + (edgeA * blockWidth)); yStart = (0 + ((height - fillHeight) * blockHeight)); beginFill(topClr, 1); drawEllipseRadius(destGraphics, xStart, yStart, (edgeA * blockWidth), ((edgeA * blockWidth) / factor)); endFill(); }; xStart = 0; yStart = 0; lineStyle(lineThick, 0, 0.6); moveTo(xStart, yStart); lineTo(xStart, (yStart + (height * blockHeight))); moveTo((xStart + ((edgeA * 2) * blockWidth)), yStart); lineTo((xStart + ((edgeA * 2) * blockWidth)), (yStart + (height * blockHeight))); drawEllipseRadius(destGraphics, (xStart + (edgeA * blockWidth)), yStart, (edgeA * blockWidth), ((edgeA * blockWidth) / factor)); drawEllipseRadius(destGraphics, (xStart + (edgeA * blockWidth)), (yStart + (height * blockHeight)), (edgeA * blockWidth), ((edgeA * blockWidth) / factor)); i = 1; while (i < height) { yStart = (i * blockHeight); moveTo(xStart, yStart); lineTo((xStart + 5), (yStart + 5)); i++; }; break; case "cone": if (filled){ temp = ((edgeA * (fillHeight / height)) * blockWidth); xStart = (0 + (edgeA * blockWidth)); yStart = (0 + ((height - fillHeight) * blockHeight)); beginFill(mainClr, 1); moveTo((xStart - temp), yStart); lineTo((0 + (edgeA * blockWidth)), (0 + (height * blockHeight))); lineTo((xStart + temp), yStart); endFill(); beginFill(topClr, 1); drawEllipseRadius(destGraphics, xStart, yStart, temp, (temp / factor)); endFill(); }; xStart = 0; yStart = 0; lineStyle(lineThick, 0, 0.6); moveTo(xStart, yStart); lineTo((xStart + (edgeA * blockWidth)), (yStart + (height * blockHeight))); moveTo((xStart + ((edgeA * 2) * blockWidth)), yStart); lineTo((xStart + (edgeA * blockWidth)), (yStart + (height * blockHeight))); drawEllipseRadius(destGraphics, (xStart + (edgeA * blockWidth)), yStart, (edgeA * blockWidth), ((edgeA * blockWidth) / factor)); beginFill(0xFF, 0.1); drawEllipseRadius(destGraphics, (xStart + (edgeA * blockWidth)), (yStart + (height * blockHeight)), 20, (20 / factor)); endFill(); i = 1; while (i < height) { xStart = ((edgeA * (i / height)) * blockWidth); yStart = (i * blockHeight); moveTo(xStart, yStart); lineTo((xStart + 5), (yStart + 5)); i++; }; break; }; if ((((type == "cone")) || ((type == "cylinder")))){ xStart = (edgeA * blockWidth); yStart = ((((height * blockWidth) + (edgeA * blockWidth)) + ((edgeA * blockWidth) / factor)) + 5); drawCircle(xStart, yStart, (edgeA * blockWidth)); moveTo(xStart, yStart); lineTo((xStart + (((edgeA * 2) * blockWidth) / 2)), yStart); topDownPt.x = xStart; topDownPt.y = yStart; if (type == "cone"){ lineStyle(0, 0, 0); beginFill(mainClr, 0.1); drawCircle(xStart, yStart, ((edgeA * (fillHeight / height)) * blockWidth)); endFill(); }; }; }; return (topDownPt); } public static function drawCircle(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{ drawEllipseRadius(_arg1, _arg2, _arg3, _arg4, _arg4, _arg5); } public static function drawArrow(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:uint):void{ var destGraphics = _arg1; var x0 = _arg2; var y0 = _arg3; var totLen = _arg4; var shaftHt = _arg5; var headLen = _arg6; var headHt = _arg7; var clr = _arg8; var _local10 = destGraphics; with (_local10) { beginFill(clr, 1); moveTo(x0, y0); lineTo((x0 - headLen), (y0 + (headHt / 2))); lineTo((x0 - headLen), (y0 + (shaftHt / 2))); lineTo((x0 - totLen), (y0 + (shaftHt / 2))); lineTo((x0 - totLen), (y0 - (shaftHt / 2))); lineTo((x0 - headLen), (y0 - (shaftHt / 2))); lineTo((x0 - headLen), (y0 - (headHt / 2))); lineTo(x0, y0); endFill(); }; } public static function drawPipeCorner(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:String, _arg5:String, _arg6:uint):void{ var j:*; var dist:*; var destGraphics = _arg1; var x0 = _arg2; var y0 = _arg3; var fromUDLR = _arg4; var toUDLR = _arg5; var clr = _arg6; var alpha:Array = [1, 0.8, 0.6, 0.4, 0.4, 0.2, 0.4, 0.6, 1]; var size:int = alpha.length; var radius:int = ((size / 2) - (1 / 2)); var i:int; while (i < size) { var _local8 = destGraphics; with (_local8) { j = 0; while (j < 2) { if (j == 0){ lineStyle(1, 0xFFFFFF, 1); } else { lineStyle(1, clr, alpha[i]); }; dist = (((size / 2) - (1 / 2)) - i); switch (((fromUDLR + ",") + toUDLR)){ case "3,1": case "0,2": moveTo((x0 - radius), ((y0 - radius) + i)); lineTo((((x0 + radius) - i) + 1), ((y0 - radius) + i)); moveTo(((x0 + radius) - i), ((y0 - radius) + i)); lineTo(((x0 + radius) - i), ((y0 + radius) + 1)); break; case "3,0": case "1,2": moveTo((x0 - radius), ((y0 - radius) + i)); lineTo((((x0 - radius) + i) + 1), ((y0 - radius) + i)); moveTo(((x0 + radius) - i), (y0 - radius)); lineTo(((x0 + radius) - i), ((y0 + radius) - i)); break; case "2,1": case "0,3": moveTo((x0 + radius), ((y0 - radius) + i)); lineTo(((x0 - radius) + i), ((y0 - radius) + i)); moveTo(((x0 + radius) - i), ((y0 + radius) - i)); lineTo(((x0 + radius) - i), (y0 + radius)); break; case "2,0": case "1,3": moveTo((x0 + radius), ((y0 - radius) + i)); lineTo(((x0 + radius) - i), ((y0 - radius) + i)); moveTo(((x0 + radius) - i), (y0 - radius)); lineTo(((x0 + radius) - i), ((y0 - radius) + i)); break; }; j++; }; }; i = (i + 1); }; } public static function drawPipe(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:uint):void{ var j:*; var dist:*; var destGraphics = _arg1; var x0 = _arg2; var y0 = _arg3; var x1 = _arg4; var y1 = _arg5; var clr = _arg6; var alpha:Array = [1, 0.8, 0.6, 0.4, 0.4, 0.2, 0.4, 0.6, 1]; var size:int = alpha.length; var i:int; while (i < size) { var _local8 = destGraphics; with (_local8) { j = 0; while (j < 2) { if (j == 0){ lineStyle(1, 0xFFFFFF, 1); } else { lineStyle(1, clr, alpha[i]); }; dist = (((size / 2) - (1 / 2)) - i); if (y0 == y1){ moveTo(x0, (y0 - dist)); lineTo(x1, (y1 - dist)); }; if (x0 == x1){ moveTo((x0 + dist), y0); lineTo((x1 + dist), y1); }; j++; }; }; i = (i + 1); }; } public static function drawSector(_arg1:Graphics, _arg2:int, _arg3:int, _arg4:int, _arg5:Number, _arg6:Number, _arg7:uint, _arg8:Number=1, _arg9:uint=0, _arg10:Boolean=false):void{ var steps:*; var i:*; var radians:*; var thisX:*; var thisY:*; var destGraphics = _arg1; var midX = _arg2; var midY = _arg3; var size = _arg4; var FromDeg = _arg5; var ToDeg = _arg6; var lineCol = _arg7; var lineAlpha = _arg8; var fillCol = _arg9; var fillQ = _arg10; var _local12 = destGraphics; with (_local12) { if (fillQ){ beginFill(fillCol, 1); }; lineStyle(1, lineCol, lineAlpha); steps = Math.max(1, int(((ToDeg - FromDeg) / 5))); moveTo(midX, midY); i = 0; while (i <= steps) { radians = ((FromDeg + ((ToDeg - FromDeg) * (i / steps))) / 57.296); thisX = (midX + (Math.cos(radians) * size)); thisY = (midY + (Math.sin(radians) * size)); lineTo(thisX, thisY); i++; }; lineTo(midX, midY); if (fillQ){ endFill(); }; }; } public static function drawEllipseRadius(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number=8):void{ var periode:*; var sgmAngle:*; var cRangle:*; var cRx:*; var cRy:*; var angle:*; var cX:*; var cY:*; var pX:*; var pY:*; var destGraphics = _arg1; var x = _arg2; var y = _arg3; var rx = _arg4; var ry = _arg5; var sgm = _arg6; var _local8 = destGraphics; with (_local8) { periode = (2 * Math.PI); sgmAngle = (periode / sgm); cRangle = (sgmAngle / 2); cRx = (rx / Math.cos(cRangle)); cRy = (ry / Math.cos(cRangle)); moveTo((x + rx), y); angle = sgmAngle; while (angle <= periode) { cX = (x + (Math.cos((angle - cRangle)) * cRx)); cY = (y + (Math.sin((angle - cRangle)) * cRy)); pX = (x + (Math.cos(angle) * rx)); pY = (y + (Math.sin(angle) * ry)); curveTo(cX, cY, pX, pY); angle = (angle + sgmAngle); }; }; } } }//package
Section 29
//Main (Main) package { import flash.events.*; import flash.display.*; import GUI.*; import General.*; public class Main extends Sprite { private var instructText:TextBox; private var playBtn:CircleButton; private var isGamePaused:Boolean;// = false private var modeRadio:Radio; private var gameName:String;// = "Fix the Equation" private var userAns:String;// = "" private var optionBtn:RoundedButton; private var isGameOver:Boolean;// = true private var currEqunNo:int;// = 0 private var equnSpacing:int;// = 55 private var games:Games; private var timer:CircleTimer; private var copyright:Copyright; private var equnHistCount:int;// = 2 private var equnCount:int;// = 4 private var startY:int;// = 130 private var prevQStr:String;// = "" private var equns:Array; private var currFrame:HiSprite; private var highScores:HighScores; private var gamesPopup:Popup; private var summaryText:TextBox; private var scoreBoard:ScoreBoard; private var ticks:Ticks; private var optionsQ:Boolean;// = false public function Main():void{ ticks = new Ticks(); playBtn = new CircleButton(40); optionBtn = new RoundedButton(90); summaryText = new TextBox("Arial", 36, 560, 1, "", 40, 220); instructText = new TextBox("Arial", 16, 100, 10, "", 30, 30); timer = new CircleTimer(); scoreBoard = new ScoreBoard(); gamesPopup = new Popup(420, 300); modeRadio = new Radio(); copyright = new Copyright("0.81"); equns = new Array(); currFrame = new HiSprite(); super(); if (stage){ init(); } else { addEventListener(Event.ADDED_TO_STAGE, init); }; } private function onRadioClick(_arg1:Event):void{ games.setGameByTitle(_arg1.currentTarget.currItem, "title", 0); gamesPopup.close(); newGame(null); } private function check():void{ trace("check"); if (isGameOver){ return; }; if (isGamePaused){ return; }; var _local1:String = equns[currEqunNo].getAnswer(); trace(((("userAns=" + userAns) + ", correctAns=") + _local1)); if (userAns.length < _local1.length){ return; }; if (userAns == _local1){ trace("correct answer"); equns[currEqunNo].setRight(true); scoreBoard.addScore(1); scoreBoard.addYes(); } else { equns[currEqunNo].setRight(false); scoreBoard.addScore(-1); scoreBoard.addNo(); }; newQ(); } private function init(_arg1:Event=null):void{ removeEventListener(Event.ADDED_TO_STAGE, init); games = new Games(["title", "operators", "minVal", "maxVal", "negatives"]); games.add("mult-2-6", [["Multiply (2 to 6)", ""], ["*"], 2, 6, false]); games.add("mult-6-8", [["Multiply (6 to 8)", ""], ["*"], 6, 8, false]); games.add("mult-2-9", [["Multiply (2 to 9)", ""], ["*"], 2, 9, false]); games.add("mult-2-12", [["Multiply (2 to 12)", ""], ["*"], 2, 12, false]); games.add("add", [["Addition", ""], ["+"], 2, 9, false]); games.add("sub", [["Subtraction", ""], ["-"], 2, 9, false]); games.add("div", [["Division", ""], ["/"], 2, 9, false]); games.add("add-hard", [["Add (Harder)", ""], ["+"], 6, 25, false]); games.add("sub-hard", [["Subtract (Harder)", ""], ["-"], 6, 25, false]); games.add("div-hard", [["Divide (Harder)", ""], ["/"], 3, 12, false]); games.add("add-sub", [["Add and Subtract", ""], ["+-"], 2, 10, false]); games.add("mult-div", [["Multiply and Divide", ""], ["*/"], 2, 10, false]); games.add("mix", [["Mixed", ""], ["+-*/"], 2, 9, false]); games.add("mix-hard", [["Mixed (Harder)", ""], ["+-*/"], 3, 15, false]); games.add("make9", [["What Makes 9", ""], ["c"], 1, 9, false]); games.add("make10", [["What Makes 10", ""], ["c"], 1, 10, false]); games.add("make100", [["What Makes 100", ""], ["c"], 1, 100, false]); games.setGame("mix"); games.setGame(this.root.loaderInfo.parameters["m"]); trace(("games=" + games.getGameList(gameName))); highScores = new HighScores(gameName, games.getGame()); currFrame.graphics.lineStyle(2, 15658683, 1); currFrame.graphics.beginFill(16777164, 0.2); currFrame.graphics.drawRoundRect(0, 0, 540, 54, 54, 54); currFrame.graphics.endFill(); currFrame.x = 50; currFrame.y = (startY - 9); currFrame.visible = false; addChild(currFrame); playBtn.x = (stage.stageWidth / 2); playBtn.y = 160; playBtn.setStyle("play"); playBtn.addEventListener(MouseEvent.MOUSE_DOWN, newGame); addChild(playBtn); instructText.setFontClr(0xFF); instructText.visible = false; addChild(instructText); summaryText.setAlign("center"); addChild(summaryText); scoreBoard.x = 20; scoreBoard.y = (stage.stageHeight - 100); addChild(scoreBoard); timer.x = 70; timer.y = (stage.stageHeight - 55); addChild(timer); ticks.x = 150; ticks.y = (stage.stageHeight - 85); ticks.visible = false; addChild(ticks); copyright.x = 400; copyright.y = (stage.stageHeight - 25); addChild(copyright); if (optionsQ){ optionBtn.setText("Options"); optionBtn.x = 273; optionBtn.y = 80; optionBtn.addEventListener(MouseEvent.MOUSE_DOWN, showGamesPopup); addChild(optionBtn); gamesPopup.setAppearType("slide"); gamesPopup.visible = true; gamesPopup.x = -600; gamesPopup.y = 20; gamesPopup.slideTo(110, 20); modeRadio.setItems(games.getGameTitles("title", 0)); modeRadio.addEventListener("RadioClick", onRadioClick); gamesPopup.addChild(modeRadio); addChild(gamesPopup); }; stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); clearAll(); } private function clearAll():void{ summaryText.setText(""); summaryText.visible = false; ticks.visible = false; var _local1:int; while (_local1 < equns.length) { removeChild(equns[_local1]); _local1++; }; equns = []; } private function newQ():void{ var _local2:*; var _local3:*; userAns = ""; while ((equns.length - currEqunNo) < equnCount) { do { _local2 = new Equation(games.option("operators"), games.option("minVal"), games.option("maxVal")); _local3 = _local2.getQ(); } while (_local3 == prevQStr); prevQStr = _local3; _local2.x = ((Math.random() - 0.5) * stage.stageWidth); _local2.y = (startY + (Math.random() * (stage.stageHeight - startY))); addChild(_local2); equns.push(_local2); }; currEqunNo++; var _local1:int; while (_local1 < equns.length) { equns[_local1].slideTo(50, (startY + ((_local1 - currEqunNo) * equnSpacing))); _local1++; }; pruneEquns(); } private function newGame(_arg1:MouseEvent):void{ highScores.setStt(); clearAll(); isGameOver = false; playBtn.fade(-0.1); currFrame.fade(0.1); optionBtn.visible = false; scoreBoard.setScore(0); timer.start(120, 0xFF); timer.addEventListener("TimesUp", gameOver); instructText.visible = true; currEqunNo = -1; newRound(); } private function onKeyDown(_arg1:KeyboardEvent):void{ var _local2:uint; if (!isGameOver){ _local2 = _arg1.keyCode; trace(("keyCode: " + _local2)); if ((((_local2 >= 96)) && ((_local2 <= 105)))){ userAns = (userAns + (_local2 - 96).toString()); equns[currEqunNo].setAnswer(userAns); }; if ((((_local2 >= 48)) && ((_local2 <= 57)))){ userAns = (userAns + (_local2 - 48).toString()); equns[currEqunNo].setAnswer(userAns); }; if ((((_local2 == 8)) || ((_local2 == 46)))){ if (userAns.length > 0){ userAns = userAns.substr(0, (userAns.length - 1)); equns[currEqunNo].setAnswer(userAns); }; }; trace(("userAns" + userAns)); check(); }; } private function pruneEquns():void{ while (currEqunNo > equnHistCount) { removeChild(equns[0]); equns.splice(0, 1); currEqunNo--; }; } private function showGamesPopup(_arg1:Event):void{ gamesPopup.slideTo(100, 20); } private function newRound():void{ if (!isGameOver){ isGamePaused = false; clearAll(); newQ(); }; } private function gameOver(_arg1:Event):void{ trace("game over"); isGameOver = true; playBtn.fade(0.1); currFrame.fade(-0.1); optionBtn.visible = true; clearAll(); summaryText.setText(("Total Score: " + scoreBoard.getScore().toString())); summaryText.visible = true; highScores.addMe(scoreBoard.getScore(), 0, 0); } } }//package
Section 30
//Maths (Maths) package { public class Maths { public function sign(_arg1:Number):int{ var _local2:int = ((_arg1 < 0)) ? -1 : 1; return (_local2); } public static function fmt2(_arg1:Number):String{ var _local2:String = (Math.round((_arg1 * 100)) / 100).toString(); return (_local2); } public static function dist(_arg1:Number, _arg2:Number):Number{ return (Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)))); } public static function volCylinder(_arg1:Number, _arg2:Number):Number{ return (((Math.PI * Math.pow(_arg1, 2)) * _arg2)); } public static function randomRange(_arg1:int, _arg2:int):int{ return ((Math.floor((Math.random() * (_arg2 - _arg1))) + _arg1)); } public static function fmt(_arg1:Number, _arg2:int):String{ if (_arg2 <= 0){ return (Math.round(_arg1).toString()); }; var _local3:Number = Math.pow(10, _arg2); var _local4:String = String((Math.round((_arg1 * _local3)) / _local3)); if (_local4.indexOf(".") == -1){ _local4 = (_local4 + ".0"); }; var _local5:Array = _local4.split("."); var _local6:int = (_arg2 - _local5[1].length); var _local7 = 1; while (_local7 <= _local6) { _local4 = (_local4 + "0"); _local7++; }; return (_local4); } public static function volCone(_arg1:Number, _arg2:Number):Number{ return ((((Math.PI / 3) * Math.pow(_arg1, 2)) * _arg2)); } } }//package

Library Items

Symbol 1 Bitmap {Equation_NoImg}
Symbol 2 Bitmap {Equation_YesImg}
Symbol 3 Bitmap {GUI.Ticks_TickImg}

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata present, AS3.
SWFMetaData (77)Timeline Frame 1457 bytes "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'><rdf:Description rdf:about='' xmlns ..."
ScriptLimits (65)Timeline Frame 1MaxRecursionDepth: 1000, ScriptTimeout: 60 seconds
SerialNumber (41)Timeline Frame 1

Labels

"Main"Frame 1




http://swfchan.com/48/239036/info.shtml
Created: 8/1 -2021 18:55:40 Last modified: 8/1 -2021 18:55:40 Server time: 30/04 -2024 15:53:40