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

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

Actionscript Made Easy #1.swf

This is the info page for
Flash #68328

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


Text
Next step

Previous step

Reset simulation

ActionScript [AS3]

Section 1
//Instructions_1 (AME_fla.Instructions_1) package AME_fla { import fl.controls.*; import flash.display.*; import flash.events.*; import flash.text.*; import flash.utils.*; import flash.ui.*; import flash.system.*; import flash.accessibility.*; import flash.errors.*; import flash.filters.*; import flash.geom.*; import flash.media.*; import flash.net.*; public dynamic class Instructions_1 extends MovieClip { public var CodeBackground:MovieClip; public var NextStep:TextField; public var PreviousStep:TextField; public var CodeScrollbar:UIScrollBar; public var ResetSimulation:TextField; public var Instructions:TextField; public var CodeField:TextField; public function Instructions_1(){ __setProp_CodeScrollbar_Instructions_Layer1_1(); } function __setProp_CodeScrollbar_Instructions_Layer1_1(){ try { CodeScrollbar["componentInspectorSetting"] = true; } catch(e:Error) { }; CodeScrollbar.direction = "vertical"; CodeScrollbar.scrollTargetName = "CodeField"; CodeScrollbar.visible = true; try { CodeScrollbar["componentInspectorSetting"] = false; } catch(e:Error) { }; } } }//package AME_fla
Section 2
//MainTimeline (AME_fla.MainTimeline) package AME_fla { import flash.display.*; import flash.events.*; import flash.text.*; import flash.utils.*; import flash.ui.*; import flash.system.*; import flash.accessibility.*; import flash.errors.*; import flash.filters.*; import flash.geom.*; import flash.media.*; import flash.net.*; public dynamic class MainTimeline extends MovieClip { public var unitArray:Array; public var timer:Timer; public var i; public var CurrentSimulation; public var CurrentPage; public var Instructions:MovieClip; public var PageArray; public function MainTimeline(){ addFrameScript(0, frame1); } public function UpdatePage(){ Instructions.Instructions.text = PageArray[CurrentPage].Instructions; if (PageArray[CurrentPage].Code.length > 0){ Instructions.CodeField.visible = true; Instructions.CodeScrollbar.visible = true; Instructions.CodeBackground.visible = true; Instructions.CodeField.text = PageArray[CurrentPage].Code; } else { Instructions.CodeField.visible = false; Instructions.CodeScrollbar.visible = false; Instructions.CodeBackground.visible = false; }; if (PageArray[CurrentPage].ShowPrevious == true){ Instructions.PreviousStep.visible = true; } else { Instructions.PreviousStep.visible = false; }; if (PageArray[CurrentPage].ShowNext == true){ Instructions.NextStep.visible = true; } else { Instructions.NextStep.visible = false; }; } public function NextStepClick(_arg1:MouseEvent):void{ CurrentPage = (CurrentPage + 1); if (PageArray[CurrentPage].Simulation > -1){ CurrentSimulation = PageArray[CurrentPage].Simulation; }; if (CurrentSimulation > 0){ ResetSimulation(); }; UpdatePage(); } function frame1(){ Instructions.PreviousStep.addEventListener(MouseEvent.MOUSE_DOWN, PreviousStepClick); Instructions.NextStep.addEventListener(MouseEvent.MOUSE_DOWN, NextStepClick); Instructions.ResetSimulation.addEventListener(MouseEvent.MOUSE_DOWN, ResetSimulationClick); PageArray = new Array(); CurrentPage = 0; CurrentSimulation = 0; i = 0; while (i < 50) { PageArray[i] = new Object(); if (i > 0){ PageArray[i].ShowPrevious = true; } else { PageArray[i].ShowPrevious = false; }; if (i < 34){ PageArray[i].ShowNext = true; } else { PageArray[i].ShowNext = false; }; PageArray[i].Instructions = ""; PageArray[i].Code = ""; PageArray[i].Simulation = -1; i++; }; PageArray[0].Instructions = "Hello and welcome to Actionscript Made Easy: Collisions"; PageArray[1].Instructions = "I will explain how a simple collision detection system can work, and we'll also cover some basic actionscript functionality, like arrays, objects, handling movieClips and using timers and loops. Before we start, please note that this tutorial is written for actionscript 3 so if you try to run the code in actionscript 2 it will not work, but the principles in both the languages are basically the same. \n\nWell let's get started shall we."; PageArray[2].Instructions = "Step 1: Introduction"; PageArray[3].Instructions = "Start by creating a new project. Then open the actions tab for frame 1. This is where we will write all the code in this tutorial. If your project have more then 1 frame you will need to add the stop(); function in the code to keep the movie from going past the first frame."; PageArray[3].Code = "Stop();"; PageArray[4].Instructions = "Step 2: Create the unit holder array"; PageArray[5].Instructions = "To proceed we will need to introduce two new concepts. The array and the object. An array is a variable that can hold more then one piece of information at a time. "; PageArray[5].Code = "//Array of strings\nmyArray:Array = new Array();\nmyArray[0] = \"Uno\";\nmyArray[1] = \"Dos\";\nmyArray[2] = \"Tres\";"; PageArray[6].Instructions = "The array myArray now contains three different string variables that each hold a piece of information. In this tutorial we will however not use string variables, but instead use objects. An object can be used as a container that can hold several variables. The same could be done by making the array a two-dimensional array."; PageArray[6].Code = "//Two-dimensional array\nmyArray:Array = new Array();\nmyArray[0] = new Array(2);\nmyArray[0][0] = 123;\nmyArray[0][1] = \"Hello I'm a string\";\n\n//Array using objects\nmyArray:Array = new Array();\nmyArray[0] = new Object();\nmyArray[0].numberVariable = 123;\nmyArray[0].stringVariable = \"Hello I'm a string\";\n"; PageArray[7].Instructions = "We will just go right ahead and create the unit array so you can see where this is going."; PageArray[7].Code = "var unitArray:Array = new Array();"; PageArray[8].Instructions = "Step 3: Create a unit"; PageArray[9].Instructions = "Now on to creating a unit. We are going to need a movie clip to draw on the screen. There are a few alternatives on how to create it. You could for example draw your own unit, add it to the library by converting it to a symbol and giving it a unique classname in the linkage window. Or, in this example we will dynamically create a empty movie clip when the unit is created and draw a circle on it."; PageArray[9].Code = "movieClip = this.addChild(new MovieClip());\nmovieClip.graphics.lineStyle(3, 0xFFFFFF);\nmovieClip.graphics.drawCircle(0,0,20);\n"; PageArray[10].Instructions = "The first line creates an empty movie clip, and the other two draws a circle with the radius 20 pixels on it. Let's implement this by creating a temporary unit object, and then adding it to the unit array."; PageArray[10].Code = "movieClip = this.addChild(new MovieClip());\nmovieClip.graphics.lineStyle(3, 0xFFFFFF);\nmovieClip.graphics.drawCircle(0,0,20);\n"; PageArray[11].Instructions = "First we create the object, which we will declare two variables in, an empty movieClip and a velocity variable. As explained earlier we will draw a circle on a movieClip, then we position it in the center of the screen and give the unit a randomized velocity ranging from -5, if the random() function returns 0 (-5 + 0 * 10 = -5), to +5 if it returns 1 (-5 + 1 * 10 = +5). The point is a class that holds a x and a y variable that in this tutorial will be the unit's speed on the x and y axle."; PageArray[11].Code = "var tempUnit:Object = new Object();\ntempUnit.movieClip = this.addChild(new MovieClip());\ntempUnit.movieClip.graphics.lineStyle(3, 0xFFFFFF);\ntempUnit.movieClip.graphics.drawCircle(0,0,20);\ntempUnit.movieClip.x = stage.stageWidth * 0.5;\ntempUnit.movieClip.y = stage.stageHeight * 0.5;\ntempUnit.velocity = new Point(-5 + Math.random() * 10, -5 + Math.random() * 10);\nunitArray.push(tempUnit);\n"; PageArray[11].Simulation = 1; PageArray[12].Instructions = "Step 4: The timer class"; PageArray[13].Instructions = "Now that we got our unit, we need some way of making it move. This is where the timer class comes into play. When we create the timer class we get to set it's interval in milliseconds, so if we were to set the interval to say, 20, the timer would update 50 times per second (1000/20=50)."; PageArray[13].Code = "var timer:Timer = new Timer(20);"; PageArray[14].Instructions = "This timer is useless to us unless we add an event listener that fires each time the timer reaches zero. We will add an event listener that calls the function onTimer(evt:TimerEvent). And to make sure the event actually works we add a trace(); function to onTimer."; PageArray[14].Code = "timer.addEventListener(TimerEvent.TIMER, onTimer);\ntimer.start();\nfunction onTimer(evt:TimerEvent) {\n trace(\"Updated!\")\n}"; PageArray[15].Instructions = "Step 5: Create a for loop"; PageArray[16].Instructions = "Now that we have seen that the function works we can proceed. If we were only going to work with a single unit we could use unitArray[0] for all the actions we're going to create, but that's not what we want. Instead, we're going to add a for loop that will go through each unit in the unitArray."; PageArray[16].Code = "//Our for loop will look like this\nfor (var i = 0; i < unitArray.length; i++) {\n //Statements\n}"; PageArray[17].Instructions = "The for loops contains three parts. var i = 0: We initialize a new variable i with the value 0. i < unitArray.length: This is the condition for while the loop shall continue. Our array starts with 0, which means that while the variable i is under the length of the array the for loop will have to continue."; PageArray[17].Code = "//Our for loop will look like this\nfor (var i = 0; i < unitArray.length; i++) {\n //Statements\n}"; PageArray[18].Instructions = "i++: The last parts tells us what we're going to do with the variable i every time the loops reaches it's end. i++ simply means i + 1, and this increment could just as well have been put as the last statement in the loop."; PageArray[18].Code = "//Our for loop will look like this\nfor (var i = 0; i < unitArray.length; i++) {\n //Statements\n}"; PageArray[19].Instructions = "Step 6: Move the units"; PageArray[20].Instructions = "Now when our loop is finished we can access each unit in the unitArray seperatly by using unitArray[i] inside the for loop. So let's try it out."; PageArray[20].Code = "unitArray[i].movieClip.x += unitArray[i].velocity.x;\nunitArray[i].movieClip.y += unitArray[i].velocity.y;"; PageArray[20].Simulation = 2; PageArray[21].Instructions = "These statements are fairly easy to understand. The unit's movieClip position is moved by the unit's velocity. To make it a bit more interresting we will add yet another statement. This line will accelerate the unit downward simulating gravity."; PageArray[21].Code = "unitArray[i].movieClip.x += unitArray[i].velocity.x;\nunitArray[i].movieClip.y += unitArray[i].velocity.y;\n\nunitArray[i].velocity.y += 0.1;"; PageArray[21].Simulation = 3; PageArray[22].Instructions = "Step 7: Collide units with the border"; PageArray[23].Instructions = "As you see the unit will always fly out of and exit the screen, so to keep it from doing that we will add a couple of if statement that will bounce it from the bottom, left and right edge of the screen."; PageArray[23].Code = "if (unitArray[i].movieClip.y > stage.stageHeight - 20 && unitArray[i].velocity.y > 0) {\n unitArray[i].velocity.y *= -1;\n}\nif (unitArray[i].movieClip.x > stage.stageWidth - 20 && unitArray[i].velocity.x > 0 ||\n unitArray[i].movieClip.x < 20 && unitArray[i].velocity.x < 0) {\n unitArray[i].velocity.x *= -1;\n}"; PageArray[23].Simulation = 4; PageArray[24].Instructions = "Simply put, the first if statement checks if the circle's lower edge is under the edge of the screen, and if the unit is accelerating downwards, then we will take it's velocity.y times -1 which will make the unit travel in the exact opposite direction on the y axle. The same is done for x axle for the walls."; PageArray[24].Code = "if (unitArray[i].movieClip.y > stage.stageHeight - 20 && unitArray[i].velocity.y > 0) {\n unitArray[i].velocity.y *= -1;\n}\nif (unitArray[i].movieClip.x > stage.stageWidth - 20 && unitArray[i].velocity.x > 0 ||\n unitArray[i].movieClip.x < 20 && unitArray[i].velocity.x < 0) {\n unitArray[i].velocity.x *= -1;\n}"; PageArray[25].Instructions = "Step 8: Collision detection"; PageArray[26].Instructions = "Finally, we'll start on the collision detection. When dealing with collisions between circles the easiest method of collision detection is the pythagorean theorem. According to this formula if you want to know the closest distance between two points you can take the square root of the distance between the objects on the x axle with the power of two plus the distance on the y axle with the power of two, or in actionscript:"; PageArray[26].Code = "Math.sqrt(Math.pow(point1.x - point2.x, 2) + Math.pow(point1.y - point2.y, 2))"; PageArray[27].Instructions = "We assume that the radius of both the unit's circles are 20 pixels, that means that if the distance between the units is under 40 pixels they are overlapping eachother. Let us write the whole if statement."; PageArray[27].Code = "if (Math.sqrt(Math.pow(unitArray[i].movieClip.x - unitArray[n].movieClip.x, 2) +\n Math.pow(unitArray[i].movieClip.y - unitArray[n].movieClip.y, 2)) < 40) {\n //Collision\n}"; PageArray[28].Instructions = "This statement checks if the two units, unitArray[i] and unitArray[n], collide with eachother, but we still need a secondary loop, as each unit need to check if it collides with all the other units."; PageArray[28].Code = "if (Math.sqrt(Math.pow(unitArray[i].movieClip.x - unitArray[n].movieClip.x, 2) +\n Math.pow(unitArray[i].movieClip.y - unitArray[n].movieClip.y, 2)) < 40) {\n //Collision\n}"; PageArray[29].Instructions = "Note that instead of initializing the variable n at 0, like i, we now start it off from the i + 1. This is because if we were to start it from 0 there would be more then one collision check for each pair of units. Also note that we put a trace(); function in the if statement so we know the collision detection works."; PageArray[29].Code = "for (var n = i + 1; n < unitArray.length; n++) {\n if (Math.sqrt(Math.pow(unitArray[i].movieClip.x - unitArray[n].movieClip.x, 2)+\n Math.pow(unitArray[i].movieClip.y - unitArray[n].movieClip.y, 2)) < 40) {\n trace(\"Collision!\");\n }\n}"; PageArray[30].Instructions = "This is all fairly boring with just a single unit in the game, so we will spawn a few more. Modify the code that creates the first unit by putting it in a for loop. We only need to put the var keyword infront of the i variable once, so if you want the compiler not to remind you, you need to remove var infront of i in the units for loop."; PageArray[30].Code = "for (var i = 0; i < 10; i++) {\n var tempUnit = new Object();\n tempUnit.movieClip = this.addChild(new MovieClip);\n tempUnit.movieClip.graphics.lineStyle(3, 0xFFFFFF);\n tempUnit.movieClip.graphics.drawCircle(0,0,20);\n tempUnit.movieClip.x = stage.stageWidth * 0.5;\n tempUnit.movieClip.y = stage.stageHeight * 0.5;\n tempUnit.velocity = new Point(-5 + Math.random() * 10, -5 + Math.random() * 10);\n unitArray.push(tempUnit);\n}"; PageArray[30].Simulation = 5; PageArray[31].Instructions = "Step 9: Bounce units"; PageArray[32].Instructions = "That's a bit more interresting. Let's add a finilizing touch by making the circles bounce off eachother. We insert this code in the collision if statement."; PageArray[32].Code = "var m1 = 1, m2 = 1;\nvar x1 = unitArray[i].movieClip.x, x2 = unitArray[n].movieClip.x;\nvar y1 = unitArray[i].movieClip.y, y2 = unitArray[n].movieClip.y;\nvar vx1 = unitArray[i].velocity.x, vx2 = unitArray[n].velocity.x;\nvar vy1 = unitArray[i].velocity.y, vy2 = unitArray[n].velocity.y;\nvar m21,dvx2,a,x21,y21,vx21,vy21;\nm21=m2/m1; x21=x2-x1; y21=y2-y1; vx21=vx2-vx1; vy21=vy2-vy1;\nif (!(vx21*x21 + vy21*y21 >= 0)) {\n a=y21/x21; dvx2= -2*(vx21 +a*vy21)/((1+a*a)*(1+m21));\n vx2=vx2+dvx2; vy2=vy2+a*dvx2; vx1=vx1-m21*dvx2; vy1=vy1-a*m21*dvx2;\n}\nunitArray[i].velocity.x = vx1, unitArray[n].velocity.x = vx2;\nunitArray[i].velocity.y = vy1, unitArray[n].velocity.y = vy2;"; PageArray[32].Simulation = 6; PageArray[33].Instructions = "This snippet is a way of calculating the velocity after two round objects collide in two dimensions. If you want to learn how this code works I suggest that you visit http://www.plasmaphysics.org.uk/programs/coll2d_cpp.htm"; PageArray[33].Code = "var m1 = 1, m2 = 1;\nvar x1 = unitArray[i].movieClip.x, x2 = unitArray[n].movieClip.x;\nvar y1 = unitArray[i].movieClip.y, y2 = unitArray[n].movieClip.y;\nvar vx1 = unitArray[i].velocity.x, vx2 = unitArray[n].velocity.x;\nvar vy1 = unitArray[i].velocity.y, vy2 = unitArray[n].velocity.y;\nvar m21,dvx2,a,x21,y21,vx21,vy21;\nm21=m2/m1; x21=x2-x1; y21=y2-y1; vx21=vx2-vx1; vy21=vy2-vy1;\nif (!(vx21*x21 + vy21*y21 >= 0)) {\n a=y21/x21; dvx2= -2*(vx21 +a*vy21)/((1+a*a)*(1+m21));\n vx2=vx2+dvx2; vy2=vy2+a*dvx2; vx1=vx1-m21*dvx2; vy1=vy1-a*m21*dvx2;\n}\nunitArray[i].velocity.x = vx1, unitArray[n].velocity.x = vx2;\nunitArray[i].velocity.y = vy1, unitArray[n].velocity.y = vy2;"; PageArray[34].Instructions = "Finished: Woooh, look at them go. This concludes the tutorial, I hope you learned something new. If there is something else you'd like me to make a tutorial about or if you have any feedback about this one. Please leave a comment."; PageArray[34].Code = "var unitArray:Array = new Array();\nfor (var i = 0; i < 10; i++) {\n var tempUnit:Object = new Object();\n tempUnit.movieClip = this.addChild(new MovieClip);\n tempUnit.movieClip.graphics.lineStyle(3, 0xFFFFFF);\n tempUnit.movieClip.graphics.drawCircle(0,0,20);\n tempUnit.movieClip.x = stage.stageWidth * 0.5;\n tempUnit.movieClip.y = stage.stageHeight * 0.5;\n tempUnit.velocity = new Point(-5 + Math.random() * 10, -5 + Math.random() * 10);\n unitArray.push(tempUnit);\n}\n\nvar timer:Timer = new Timer(20);\ntimer.addEventListener(TimerEvent.TIMER, onTimer);\ntimer.start();\nfunction onTimer(evt:TimerEvent) {\n for (i = 0; i < unitArray.length; i++) {\n unitArray[i].movieClip.x += unitArray[i].velocity.x;\n unitArray[i].movieClip.y += unitArray[i].velocity.y;\n\n unitArray[i].velocity.y += 0.1;\n\n if (unitArray[i].movieClip.y > stage.stageHeight - 20 && unitArray[i].velocity.y > 0) {\n unitArray[i].velocity.y *= -1;\n }\n if (unitArray[i].movieClip.x > stage.stageWidth - 20 && unitArray[i].velocity.x > 0 || \n unitArray[i].movieClip.x < 20 && unitArray[i].velocity.x < 0) {\n unitArray[i].velocity.x *= -1;\n }\n\n for (var n = i + 1; n < unitArray.length; n++) {\n if (Math.sqrt(Math.pow(unitArray[i].movieClip.x - unitArray[n].movieClip.x, 2) +\n Math.pow(unitArray[i].movieClip.y - unitArray[n].movieClip.y, 2)) < 40) {\n var m1 = 1, m2 = 1;\n var x1 = unitArray[i].movieClip.x, x2 = unitArray[n].movieClip.x;\n var y1 = unitArray[i].movieClip.y, y2 = unitArray[n].movieClip.y;\n var vx1 = unitArray[i].velocity.x, vx2 = unitArray[n].velocity.x;\n var vy1 = unitArray[i].velocity.y, vy2 = unitArray[n].velocity.y;\n var m21,dvx2,a,x21,y21,vx21,vy21;\n m21=m2/m1; x21=x2-x1; y21=y2-y1; vx21=vx2-vx1; vy21=vy2-vy1;\n if (!(vx21*x21 + vy21*y21 >= 0)) {\n a=y21/x21; dvx2= -2*(vx21 +a*vy21)/((1+a*a)*(1+m21));\n vx2=vx2+dvx2; vy2=vy2+a*dvx2; vx1=vx1-m21*dvx2; vy1=vy1-a*m21*dvx2;\n }\n unitArray[i].velocity.x = vx1, unitArray[n].velocity.x = vx2;\n unitArray[i].velocity.y = vy1, unitArray[n].velocity.y = vy2;\n }\n }\n }\n}"; unitArray = new Array(); UpdatePage(); timer = new Timer(20); timer.addEventListener(TimerEvent.TIMER, onTimer); timer.start(); } public function ResetSimulationClick(_arg1:MouseEvent):void{ ResetSimulation(); } public function ResetSimulation(){ var _local1:*; var _local2:*; var _local3:Object; _local1 = 0; while (_local1 < unitArray.length) { Instructions.removeChild(unitArray[_local1].movieClip); unitArray.splice(_local1, 1); _local1--; _local1++; }; _local2 = 0; if (CurrentSimulation > 4){ _local2 = 10; } else { if (CurrentSimulation > 0){ _local2 = 1; }; }; _local1 = 0; while (_local1 < _local2) { _local3 = new Object(); _local3.movieClip = Instructions.addChild(new MovieClip()); Instructions.setChildIndex(_local3.movieClip, 2); _local3.movieClip.graphics.lineStyle(3, 0xFFFFFF); _local3.movieClip.graphics.drawCircle(0, 0, 20); _local3.movieClip.x = (stage.stageWidth * 0.5); _local3.movieClip.y = (stage.stageHeight * 0.5); _local3.velocity = new Point((-5 + (Math.random() * 10)), (-5 + (Math.random() * 10))); unitArray.push(_local3); _local1++; }; } public function onTimer(_arg1:TimerEvent){ var _local2:*; var _local3:*; var _local4:*; var _local5:*; var _local6:*; var _local7:*; var _local8:*; var _local9:*; var _local10:*; var _local11:*; var _local12:*; var _local13:*; var _local14:*; var _local15:*; var _local16:*; var _local17:*; var _local18:*; var _local19:*; var _local20:*; _local2 = 0; while (_local2 < unitArray.length) { if (CurrentSimulation > 1){ unitArray[_local2].movieClip.x = (unitArray[_local2].movieClip.x + unitArray[_local2].velocity.x); unitArray[_local2].movieClip.y = (unitArray[_local2].movieClip.y + unitArray[_local2].velocity.y); }; if (CurrentSimulation > 2){ unitArray[_local2].velocity.y = (unitArray[_local2].velocity.y + 0.1); }; if (CurrentSimulation > 3){ if ((((unitArray[_local2].movieClip.y > (stage.stageHeight - 20))) && ((unitArray[_local2].velocity.y > 0)))){ unitArray[_local2].velocity.y = (unitArray[_local2].velocity.y * -1); }; if ((((((unitArray[_local2].movieClip.x > (stage.stageWidth - 20))) && ((unitArray[_local2].velocity.x > 0)))) || ((((unitArray[_local2].movieClip.x < 20)) && ((unitArray[_local2].velocity.x < 0)))))){ unitArray[_local2].velocity.x = (unitArray[_local2].velocity.x * -1); }; }; if (CurrentSimulation > 5){ _local3 = (_local2 + 1); while (_local3 < unitArray.length) { if (Math.sqrt((Math.pow((unitArray[_local2].movieClip.x - unitArray[_local3].movieClip.x), 2) + Math.pow((unitArray[_local2].movieClip.y - unitArray[_local3].movieClip.y), 2))) < 40){ _local4 = 1; _local5 = 1; _local6 = unitArray[_local2].movieClip.x; _local7 = unitArray[_local3].movieClip.x; _local8 = unitArray[_local2].movieClip.y; _local9 = unitArray[_local3].movieClip.y; _local10 = unitArray[_local2].velocity.x; _local11 = unitArray[_local3].velocity.x; _local12 = unitArray[_local2].velocity.y; _local13 = unitArray[_local3].velocity.y; _local14 = (_local5 / _local4); _local17 = (_local7 - _local6); _local18 = (_local9 - _local8); _local19 = (_local11 - _local10); _local20 = (_local13 - _local12); if (!(((_local19 * _local17) + (_local20 * _local18)) >= 0)){ _local16 = (_local18 / _local17); _local15 = ((-2 * (_local19 + (_local16 * _local20))) / ((1 + (_local16 * _local16)) * (1 + _local14))); _local11 = (_local11 + _local15); _local13 = (_local13 + (_local16 * _local15)); _local10 = (_local10 - (_local14 * _local15)); _local12 = (_local12 - ((_local16 * _local14) * _local15)); }; unitArray[_local2].velocity.x = _local10; unitArray[_local3].velocity.x = _local11; unitArray[_local2].velocity.y = _local12; unitArray[_local3].velocity.y = _local13; }; _local3++; }; }; _local2++; }; } public function PreviousStepClick(_arg1:MouseEvent):void{ CurrentPage = (CurrentPage - 1); if (PageArray[CurrentPage].Simulation > -1){ CurrentSimulation = PageArray[CurrentPage].Simulation; }; if (CurrentSimulation > 0){ ResetSimulation(); }; UpdatePage(); } } }//package AME_fla
Section 3
//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 4
//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 5
//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 6
//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 7
//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 8
//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 9
//UIScrollBar (fl.controls.UIScrollBar) package fl.controls { import fl.core.*; import flash.events.*; import fl.events.*; import flash.text.*; public class UIScrollBar extends ScrollBar { protected var inScroll:Boolean;// = false protected var _scrollTarget:TextField; protected var inEdit:Boolean;// = false private static var defaultStyles:Object = {}; public function UIScrollBar(){ inEdit = false; inScroll = false; super(); } protected function handleTargetScroll(_arg1:Event):void{ if (inDrag){ return; }; if (!enabled){ return; }; inEdit = true; updateScrollTargetProperties(); scrollPosition = ((direction)==ScrollBarDirection.HORIZONTAL) ? _scrollTarget.scrollH : _scrollTarget.scrollV; inEdit = false; } override public function set minScrollPosition(_arg1:Number):void{ super.minScrollPosition = ((_arg1)<0) ? 0 : _arg1; } override public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{ super.setScrollPosition(_arg1, _arg2); if (!_scrollTarget){ inScroll = false; return; }; updateTargetScroll(); } override public function setScrollProperties(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{ var _local5:Number; var _local6:Number; _local5 = _arg3; _local6 = ((_arg2)<0) ? 0 : _arg2; if (_scrollTarget != null){ if (direction == ScrollBarDirection.HORIZONTAL){ _local5 = ((_arg3)>_scrollTarget.maxScrollH) ? _scrollTarget.maxScrollH : _local5; } else { _local5 = ((_arg3)>_scrollTarget.maxScrollV) ? _scrollTarget.maxScrollV : _local5; }; }; super.setScrollProperties(_arg1, _local6, _local5, _arg4); } public function get scrollTargetName():String{ return (_scrollTarget.name); } public function get scrollTarget():TextField{ return (_scrollTarget); } protected function updateScrollTargetProperties():void{ var _local1:Boolean; var _local2:Number; if (_scrollTarget == null){ setScrollProperties(pageSize, minScrollPosition, maxScrollPosition, pageScrollSize); scrollPosition = 0; } else { _local1 = (direction == ScrollBarDirection.HORIZONTAL); _local2 = (_local1) ? _scrollTarget.width : 10; setScrollProperties(_local2, (_local1) ? 0 : 1, (_local1) ? _scrollTarget.maxScrollH : _scrollTarget.maxScrollV, pageScrollSize); scrollPosition = (_local1) ? _scrollTarget.scrollH : _scrollTarget.scrollV; }; } public function update():void{ inEdit = true; updateScrollTargetProperties(); inEdit = false; } public function set scrollTargetName(_arg1:String):void{ var target = _arg1; try { scrollTarget = (parent.getChildByName(target) as TextField); } catch(error:Error) { throw (new Error("ScrollTarget not found, or is not a TextField")); }; } override public function set direction(_arg1:String):void{ if (isLivePreview){ return; }; super.direction = _arg1; updateScrollTargetProperties(); } protected function handleTargetChange(_arg1:Event):void{ inEdit = true; setScrollPosition(((direction)==ScrollBarDirection.HORIZONTAL) ? _scrollTarget.scrollH : _scrollTarget.scrollV, true); updateScrollTargetProperties(); inEdit = false; } override public function set maxScrollPosition(_arg1:Number):void{ var _local2:Number; _local2 = _arg1; if (_scrollTarget != null){ if (direction == ScrollBarDirection.HORIZONTAL){ _local2 = ((_local2)>_scrollTarget.maxScrollH) ? _scrollTarget.maxScrollH : _local2; } else { _local2 = ((_local2)>_scrollTarget.maxScrollV) ? _scrollTarget.maxScrollV : _local2; }; }; super.maxScrollPosition = _local2; } protected function updateTargetScroll(_arg1:ScrollEvent=null):void{ if (inEdit){ return; }; if (direction == ScrollBarDirection.HORIZONTAL){ _scrollTarget.scrollH = scrollPosition; } else { _scrollTarget.scrollV = scrollPosition; }; } override protected function draw():void{ if (isInvalid(InvalidationType.DATA)){ updateScrollTargetProperties(); }; super.draw(); } public function set scrollTarget(_arg1:TextField):void{ if (_scrollTarget != null){ _scrollTarget.removeEventListener(Event.CHANGE, handleTargetChange, false); _scrollTarget.removeEventListener(TextEvent.TEXT_INPUT, handleTargetChange, false); _scrollTarget.removeEventListener(Event.SCROLL, handleTargetScroll, false); removeEventListener(ScrollEvent.SCROLL, updateTargetScroll, false); }; _scrollTarget = _arg1; if (_scrollTarget != null){ _scrollTarget.addEventListener(Event.CHANGE, handleTargetChange, false, 0, true); _scrollTarget.addEventListener(TextEvent.TEXT_INPUT, handleTargetChange, false, 0, true); _scrollTarget.addEventListener(Event.SCROLL, handleTargetScroll, false, 0, true); addEventListener(ScrollEvent.SCROLL, updateTargetScroll, false, 0, true); }; invalidate(InvalidationType.DATA); } override public function get direction():String{ return (super.direction); } public static function getStyleDefinition():Object{ return (UIComponent.mergeStyles(defaultStyles, ScrollBar.getStyleDefinition())); } } }//package fl.controls
Section 10
//ComponentShim (fl.core.ComponentShim) package fl.core { import flash.display.*; public dynamic class ComponentShim extends MovieClip { } }//package fl.core
Section 11
//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 12
//UIComponent (fl.core.UIComponent) package fl.core { import flash.display.*; import flash.events.*; import fl.managers.*; import fl.events.*; import flash.text.*; import flash.utils.*; import flash.system.*; 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 13
//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 14
//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 15
//FocusManager (fl.managers.FocusManager) package fl.managers { import fl.controls.*; import flash.display.*; import fl.core.*; import flash.events.*; import flash.text.*; import flash.utils.*; 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 16
//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 17
//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 18
//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 19
//StyleManager (fl.managers.StyleManager) package fl.managers { import fl.core.*; import flash.text.*; import flash.utils.*; 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 20
//focusRectSkin (focusRectSkin) package { import flash.display.*; public dynamic class focusRectSkin extends MovieClip { } }//package
Section 21
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin) package { import flash.display.*; public dynamic class ScrollArrowDown_disabledSkin extends MovieClip { } }//package
Section 22
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin) package { import flash.display.*; public dynamic class ScrollArrowDown_downSkin extends MovieClip { } }//package
Section 23
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin) package { import flash.display.*; public dynamic class ScrollArrowDown_overSkin extends MovieClip { } }//package
Section 24
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin) package { import flash.display.*; public dynamic class ScrollArrowDown_upSkin extends MovieClip { } }//package
Section 25
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin) package { import flash.display.*; public dynamic class ScrollArrowUp_disabledSkin extends MovieClip { } }//package
Section 26
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin) package { import flash.display.*; public dynamic class ScrollArrowUp_downSkin extends MovieClip { } }//package
Section 27
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin) package { import flash.display.*; public dynamic class ScrollArrowUp_overSkin extends MovieClip { } }//package
Section 28
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin) package { import flash.display.*; public dynamic class ScrollArrowUp_upSkin extends MovieClip { } }//package
Section 29
//ScrollBar_thumbIcon (ScrollBar_thumbIcon) package { import flash.display.*; public dynamic class ScrollBar_thumbIcon extends MovieClip { } }//package
Section 30
//ScrollThumb_downSkin (ScrollThumb_downSkin) package { import flash.display.*; public dynamic class ScrollThumb_downSkin extends MovieClip { } }//package
Section 31
//ScrollThumb_overSkin (ScrollThumb_overSkin) package { import flash.display.*; public dynamic class ScrollThumb_overSkin extends MovieClip { } }//package
Section 32
//ScrollThumb_upSkin (ScrollThumb_upSkin) package { import flash.display.*; public dynamic class ScrollThumb_upSkin extends MovieClip { } }//package
Section 33
//ScrollTrack_skin (ScrollTrack_skin) package { import flash.display.*; public dynamic class ScrollTrack_skin extends MovieClip { } }//package

Library Items

Symbol 1 GraphicUsed by:2
Symbol 2 MovieClipUses:1Used by:34
Symbol 3 MovieClip {fl.core.ComponentShim}Used by:34
Symbol 4 GraphicUsed by:5
Symbol 5 MovieClip {focusRectSkin}Uses:4Used by:34
Symbol 6 GraphicUsed by:7
Symbol 7 MovieClip {ScrollTrack_skin}Uses:6Used by:34
Symbol 8 GraphicUsed by:11
Symbol 9 GraphicUsed by:10 13 17 27
Symbol 10 MovieClipUses:9Used by:11 21 23
Symbol 11 MovieClip {ScrollArrowUp_downSkin}Uses:8 10Used by:34
Symbol 12 GraphicUsed by:13
Symbol 13 MovieClip {ScrollArrowDown_downSkin}Uses:12 9Used by:34
Symbol 14 GraphicUsed by:15
Symbol 15 MovieClip {ScrollThumb_downSkin}Uses:14Used by:34
Symbol 16 GraphicUsed by:17
Symbol 17 MovieClip {ScrollArrowDown_overSkin}Uses:16 9Used by:34
Symbol 18 GraphicUsed by:19
Symbol 19 MovieClip {ScrollThumb_overSkin}Uses:18Used by:34
Symbol 20 GraphicUsed by:21
Symbol 21 MovieClip {ScrollArrowUp_overSkin}Uses:20 10Used by:34
Symbol 22 GraphicUsed by:23
Symbol 23 MovieClip {ScrollArrowUp_upSkin}Uses:22 10Used by:34
Symbol 24 GraphicUsed by:25
Symbol 25 MovieClip {ScrollThumb_upSkin}Uses:24Used by:34
Symbol 26 GraphicUsed by:27
Symbol 27 MovieClip {ScrollArrowDown_upSkin}Uses:26 9Used by:34
Symbol 28 GraphicUsed by:29
Symbol 29 MovieClip {ScrollArrowDown_disabledSkin}Uses:28Used by:34
Symbol 30 GraphicUsed by:31
Symbol 31 MovieClip {ScrollArrowUp_disabledSkin}Uses:30Used by:34
Symbol 32 GraphicUsed by:33
Symbol 33 MovieClip {ScrollBar_thumbIcon}Uses:32Used by:34
Symbol 34 MovieClip {fl.controls.UIScrollBar}Uses:2 3 5 7 11 13 15 17 19 21 23 25 27 29 31 33Used by:46
Symbol 35 BitmapUsed by:36
Symbol 36 GraphicUses:35Used by:Timeline
Symbol 37 FontUsed by:38 39 40 45
Symbol 38 EditableTextUses:37Used by:46
Symbol 39 EditableTextUses:37Used by:46
Symbol 40 EditableTextUses:37Used by:46
Symbol 41 GraphicUsed by:42
Symbol 42 MovieClipUses:41Used by:46
Symbol 43 FontUsed by:44
Symbol 44 EditableTextUses:43Used by:46
Symbol 45 EditableTextUses:37Used by:46
Symbol 46 MovieClip {AME_fla.Instructions_1}Uses:38 39 40 42 44 34 45Used by:Timeline

Instance Names

"Instructions"Frame 1Symbol 46 MovieClip {AME_fla.Instructions_1}
"Instructions"Symbol 46 MovieClip {AME_fla.Instructions_1} Frame 1Symbol 38 EditableText
"NextStep"Symbol 46 MovieClip {AME_fla.Instructions_1} Frame 1Symbol 39 EditableText
"PreviousStep"Symbol 46 MovieClip {AME_fla.Instructions_1} Frame 1Symbol 40 EditableText
"CodeBackground"Symbol 46 MovieClip {AME_fla.Instructions_1} Frame 1Symbol 42 MovieClip
"CodeField"Symbol 46 MovieClip {AME_fla.Instructions_1} Frame 1Symbol 44 EditableText
"CodeScrollbar"Symbol 46 MovieClip {AME_fla.Instructions_1} Frame 1Symbol 34 MovieClip {fl.controls.UIScrollBar}
"ResetSimulation"Symbol 46 MovieClip {AME_fla.Instructions_1} Frame 1Symbol 45 EditableText

Special Tags

FileAttributes (69)Timeline Frame 1Access local files only, Metadata not present, AS3.
ScriptLimits (65)Timeline Frame 1MaxRecursionDepth: 256, ScriptTimeout: 100 seconds




http://swfchan.com/14/68328/info.shtml
Created: 11/4 -2019 02:17:25 Last modified: 11/4 -2019 02:17:25 Server time: 29/04 -2024 09:08:54