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

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

doomdance.swf

This is the info page for
Flash #78790

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


ActionScript [AS3]
Section 1
//DebugDispatcher (com.blitzagency.xray.logger.events.DebugDispatcher) package com.blitzagency.xray.logger.events { import flash.events.*; public class DebugDispatcher extends EventDispatcher { public static var TRACE:String = "trace"; public function DebugDispatcher(){ super(); } public function sendEvent(eventName:String, obj:Object):void{ dispatchEvent(new DebugEvent(DebugDispatcher.TRACE, false, false, obj)); } } }//package com.blitzagency.xray.logger.events
Section 2
//DebugEvent (com.blitzagency.xray.logger.events.DebugEvent) package com.blitzagency.xray.logger.events { import flash.events.*; public class DebugEvent extends Event { public var obj:Object; public function DebugEvent(type:String, bubbles:Boolean, cancelable:Boolean, p_obj:Object):void{ obj = new Object(); super(type, bubbles, cancelable); obj = p_obj; } } }//package com.blitzagency.xray.logger.events
Section 3
//ObjectTools (com.blitzagency.xray.logger.util.ObjectTools) package com.blitzagency.xray.logger.util { import flash.utils.*; import com.blitzagency.xray.logger.*; public class ObjectTools { private static var log:XrayLog = new XrayLog(); public function ObjectTools(){ super(); } public function resolveBaseType(obj:Object):String{ return (""); } public static function getImmediateClassPath(obj:Object):String{ var className:String; var superClassName:String; className = getQualifiedClassName(obj); superClassName = getQualifiedSuperclassName(obj); className = ((className.indexOf("::") > -1)) ? className.split("::").join(".") : className; if (superClassName == null){ return (className); }; superClassName = ((superClassName.indexOf("::") > -1)) ? superClassName.split("::").join(".") : superClassName; return (((superClassName + ".") + className)); } public static function getFullClassPath(obj:Object):String{ var xmlDoc:XML; var ary:Array; var className:String; var item:XML; var extClass:String; xmlDoc = describeType(obj); ary = []; className = getQualifiedClassName(obj); className = ((className.indexOf("::") > -1)) ? className.split("::").join(".") : className; ary.push(className); for each (item in xmlDoc.extendsClass) { extClass = ((item.@type.toString().indexOf("::") > -1)) ? item.@type.toString().split("::")[1] : item.@type.toString(); ary.push(extClass); }; return (ary.join(".")); } } }//package com.blitzagency.xray.logger.util
Section 4
//PropertyTools (com.blitzagency.xray.logger.util.PropertyTools) package com.blitzagency.xray.logger.util { import flash.utils.*; public class PropertyTools { public function PropertyTools(){ super(); } private static function getVariables():void{ } public static function getProperties(obj:Object):Array{ var ary:Array; var xmlDoc:XML; var item:XML; var name:String; var type:String; var value:Object; var obj = obj; ary = []; xmlDoc = describeType(obj); for each (item in xmlDoc.variable) { name = item.@name.toString(); type = item.@type.toString(); value = ((obj[name])!=null) ? obj[name] : ""; ary.push({name:name, type:type, value:value}); }; //unresolved jump var _slot1 = e; return (ary); } private static function getMethods():void{ } } }//package com.blitzagency.xray.logger.util
Section 5
//Debug (com.blitzagency.xray.logger.Debug) package com.blitzagency.xray.logger { import flash.events.*; import flash.utils.*; import flash.net.*; import com.blitzagency.xray.logger.events.*; public class Debug { private static var connected:Boolean = false; private static var xrayLC:LocalConnection; private static var ed:DebugDispatcher = new DebugDispatcher(); public function Debug(){ super(); } public static function traceObject(o:Object, pRecurseDepth:Number=254, pIndent:Number=0, pPackage:String="", pLevel:Number=0):void{ var recurseDepth:Number; var indent:Number; var prop:String; var lead:String; var i:Number; var obj:String; var o = o; var pRecurseDepth = pRecurseDepth; var pIndent = pIndent; var pPackage = pPackage; var pLevel = pLevel; recurseDepth = pRecurseDepth; indent = pIndent; for (prop in o) { lead = ""; i = 0; while (i < indent) { lead = (lead + " "); i = (i + 1); }; obj = o[prop].toString(); if ((o[prop] is Array)){ obj = "[Array]"; }; if (obj == "[object Object]"){ obj = "[Object]"; }; Debug.trace((((lead + prop) + ": ") + obj), pPackage, pLevel); if (recurseDepth > 0){ Debug.traceObject(o[prop], (recurseDepth - 1), (indent + 1), pPackage, pLevel); }; }; //unresolved jump var _slot1 = e; } public static function trace(pMsg:Object, pPackage:String="", pLevel:Number=0):void{ var msg:String; var pMsg = pMsg; var pPackage = pPackage; var pLevel = pLevel; ed.sendEvent(DebugDispatcher.TRACE, {message:pMsg, classPackage:pPackage}); if (!connected){ makeConnection(); }; if (connected){ msg = ((String(pMsg).length >= 39995)) ? (String(pMsg).substr(0, 39995) + "...") : String(pMsg); xrayLC.send("_xray_view_conn", "setTrace", msg, pLevel, pPackage); //unresolved jump var _slot1 = e; LogError("No Xray Interface running"); }; } private static function makeConnection():void{ var err:LogError; xrayLC = new LocalConnection(); xrayLC.addEventListener("status", statusHandler); xrayLC.allowDomain("*"); try { xrayLC.connect(("_xray_standAlone_debug" + getTimer())); connected = true; //unresolved jump var _slot1 = e; err = new LogError("log"); setTimeout(makeConnection, 1000); } finally { }; } public static function addEventListener(type:String, listener:Function):void{ ed.addEventListener(type, listener); } private static function initialize():Boolean{ ed = new DebugDispatcher(); return (true); } private static function statusHandler(event:StatusEvent):void{ if ((((((event.code == null)) && ((event.level == "error")))) && (connected))){ connected = false; } else { if ((((event.level == "status")) && ((event.code == null)))){ connected = true; }; }; } } }//package com.blitzagency.xray.logger class LogError extends Error { private function LogError(message:String){ super(message); } }
Section 6
//Log (com.blitzagency.xray.logger.Log) package com.blitzagency.xray.logger { import com.blitzagency.xray.logger.util.*; public class Log { private var level:Number; private var caller:String;// = "" private var classPackage:String; private var dump:Object; private var message:String; public function Log(p_message:String, p_dump:Object, p_level:Number, ... _args){ var err:LogError; var nullArray:Array; var str:String; var p_message = p_message; var p_dump = p_dump; var p_level = p_level; var rest = _args; caller = ""; super(); try { nullArray.push("bogus"); //unresolved jump var _slot1 = e; err = new LogError("log"); } finally { if (err.hasOwnProperty("getStackTrace")){ str = err.getStackTrace(); setCaller(resolveCaller(str)); } else { setCaller(""); }; setMessage(p_message); setDump(p_dump); setLevel(p_level); setClassPackage(p_dump); }; } public function setLevel(p_level:Number):void{ level = p_level; } public function getCaller():String{ return (caller); } public function setMessage(p_message:String):void{ message = p_message; } public function getLevel():Number{ return (level); } public function getDump():Object{ return (dump); } public function setCaller(p_caller:String):void{ caller = p_caller; } public function setClassPackage(obj:Object):void{ classPackage = ObjectTools.getImmediateClassPath(obj); } public function getMessage():String{ return (message); } public function getClassPackage():String{ return (classPackage); } public function setDump(p_dump:Object):void{ dump = p_dump; } private function resolveCaller(str:String):String{ var ary:Array; var str = str; ary = []; try { str = str.split("\n").join(""); ary = str.split("\tat "); str = ary[3]; //unresolved jump var _slot1 = e; } finally { str = ""; }; return (str); } } }//package com.blitzagency.xray.logger class LogError extends Error { private function LogError(message:String){ super(message); } }
Section 7
//Logger (com.blitzagency.xray.logger.Logger) package com.blitzagency.xray.logger { public interface Logger { function setLevel(:Number=0):void; function debug(:Log):void; function fatal(:Log):void; function warn(:Log):void; function error(:Log):void; function log(_arg1:String, _arg2:String, _arg3:String, _arg4:Number, _arg5:Object=null):void; function info(:Log):void; } }//package com.blitzagency.xray.logger
Section 8
//XrayLog (com.blitzagency.xray.logger.XrayLog) package com.blitzagency.xray.logger { public class XrayLog { private var logger:XrayLogger; public function XrayLog(){ super(); logger = XrayLogger.getInstance(); } public function debug(message:String, ... _args):void{ var i:Number; if (_args.length == 0){ logger.debug(new Log(message, null, XrayLogger.DEBUG)); }; i = 0; while (i < _args.length) { if (i > 0){ message = ""; }; logger.debug(new Log(message, _args[i], XrayLogger.DEBUG)); i++; }; } public function fatal(message:String, ... _args):void{ var i:Number; if (_args.length == 0){ logger.fatal(new Log(message, null, XrayLogger.FATAL)); }; i = 0; while (i < _args.length) { if (i > 0){ message = ""; }; logger.fatal(new Log(message, _args[i], XrayLogger.FATAL)); i++; }; } public function info(message:String, ... _args):void{ var i:Number; if (_args.length == 0){ logger.info(new Log(message, null, XrayLogger.INFO)); }; i = 0; while (i < _args.length) { if (i > 0){ message = ""; }; logger.info(new Log(message, _args[i], XrayLogger.INFO)); i++; }; } public function warn(message:String, ... _args):void{ var i:Number; if (_args.length == 0){ logger.warn(new Log(message, null, XrayLogger.WARN)); }; i = 0; while (i < _args.length) { if (i > 0){ message = ""; }; logger.warn(new Log(message, _args[i], XrayLogger.WARN)); i++; }; } public function error(message:String, ... _args):void{ var i:Number; if (_args.length == 0){ logger.error(new Log(message, null, XrayLogger.ERROR)); }; i = 0; while (i < _args.length) { if (i > 0){ message = ""; }; logger.error(new Log(message, _args[i], XrayLogger.ERROR)); i++; }; } } }//package com.blitzagency.xray.logger
Section 9
//XrayLogger (com.blitzagency.xray.logger.XrayLogger) package com.blitzagency.xray.logger { import flash.events.*; import flash.utils.*; import com.blitzagency.xray.logger.util.*; public class XrayLogger extends EventDispatcher implements Logger { private var displayObjectRecursionDepth:Number;// = 3 private var level:Number;// = 0 private var indentation:Number;// = 0 private var objectRecursionDepth:Number;// = 254 private var filters:Array; public static var FATAL:Number = 4; public static var WARN:Number = 2; public static var ERROR:Number = 3; public static var INFO:Number = 1; public static var DEBUG:Number = 0; private static var _instance:XrayLogger = null; public static var NONE:Number = 5; public function XrayLogger(){ level = 0; displayObjectRecursionDepth = 3; objectRecursionDepth = 254; indentation = 0; filters = []; super(); } public function checkFilters():Boolean{ var i:uint; if (filters.length == 0){ return (true); }; i = 0; while (i < filters.length) { i++; }; return (true); } public function debug(obj:Log):void{ if (obj.getLevel() == level){ log(obj.getMessage(), obj.getCaller(), obj.getClassPackage(), 0, obj.getDump()); }; } public function setIndentation(p_indentation:Number=0):void{ indentation = p_indentation; } public function error(obj:Log):void{ if (obj.getLevel() >= level){ log(obj.getMessage(), obj.getCaller(), obj.getClassPackage(), 3, obj.getDump()); }; } public function setLevel(p_level:Number=0):void{ level = p_level; } public function fatal(obj:Log):void{ if (obj.getLevel() >= level){ log(obj.getMessage(), obj.getCaller(), obj.getClassPackage(), 4, obj.getDump()); }; } public function warn(obj:Log):void{ if (obj.getLevel() >= level){ log(obj.getMessage(), obj.getCaller(), obj.getClassPackage(), 2, obj.getDump()); }; } public function setObjectRecursionDepth(p_recursionDepth:Number):void{ objectRecursionDepth = p_recursionDepth; } public function setDisplayClipRecursionDepth(p_recursionDepth:Number):void{ displayObjectRecursionDepth = p_recursionDepth; } public function info(obj:Log):void{ if (obj.getLevel() >= level){ log(obj.getMessage(), obj.getCaller(), obj.getClassPackage(), 1, obj.getDump()); }; } public function log(message:String, caller:String, classPackage:String, level:Number, dump:Object=null):void{ var traceMessage:String; var type:String; var objType:String; var obj:Object; traceMessage = (("(" + getTimer()) + ") "); if (classPackage.length > 0){ traceMessage = (traceMessage + (caller + "\n")); }; traceMessage = (traceMessage + message); if (message.length > 0){ Debug.trace(traceMessage, classPackage, level); }; if (dump == null){ return; }; type = typeof(dump); if ((((((((((type == "string")) || ((type == "number")))) || ((type == "boolean")))) || ((type == "undefined")))) || ((type == "null")))){ Debug.trace(dump, classPackage, level); } else { if (type == "xml"){ Debug.trace(dump.toString(), classPackage, level); } else { objType = ObjectTools.getImmediateClassPath(dump); if ((((objType == "Object")) || ((objType == "Object.Array")))){ Debug.traceObject(dump, objectRecursionDepth, indentation, classPackage, level); } else { obj = PropertyTools.getProperties(dump); Debug.traceObject(obj, displayObjectRecursionDepth, indentation, classPackage, level); }; }; }; } public function setFilters(p_filters:Array):void{ filters = p_filters; } public static function getInstance():XrayLogger{ if (_instance == null){ _instance = new (XrayLogger); }; return (_instance); } public static function resolveLevelAsName(p_level:Number):String{ switch (p_level){ case 0: return ("debug"); case 1: return ("info"); case 2: return ("warn"); case 3: return ("error"); case 4: return ("fatal"); default: return ("debug"); }; } } }//package com.blitzagency.xray.logger
Section 10
//Frame (d3s.net.papervision3d.animation.Frame) package d3s.net.papervision3d.animation { public class Frame { public var vertices:Array; public var name:String; public function Frame(name:String, vertices:Array){ super(); this.name = name; this.vertices = vertices; } public function toString():String{ return ((((("[Frame][name:" + name) + "][vertices:") + vertices.length) + "]")); } } }//package d3s.net.papervision3d.animation
Section 11
//KeyframeMesh (d3s.net.papervision3d.objects.KeyframeMesh) package d3s.net.papervision3d.objects { import flash.utils.*; import org.papervision3d.objects.*; import org.papervision3d.core.proto.*; import org.papervision3d.core.geom.*; import d3s.net.papervision3d.animation.*; public class KeyframeMesh extends Mesh3D { private var interp:Number;// = 0 private var type:int; private var _currentFrame:int;// = 0 private var start:int; public var frames:Array; private var ctime:Number;// = 0 private var otime:Number;// = 0 private var end:int; public var fps:Number; public static const ANIM_STOP:int = 4; public static const ANIM_NORMAL:int = 1; public static const ANIM_LOOP:int = 2; public function KeyframeMesh(material:MaterialObject3D, fps:Number=6, scale:Number=1, initObject:Object=null){ frames = new Array(); _currentFrame = 0; interp = 0; ctime = 0; otime = 0; super(material, new Array(), new Array(), null, initObject); this.fps = fps; } public function stop():void{ type = ANIM_STOP; } override public function project(parent:DisplayObject3D, camera:CameraObject3D, sorted:Array=null):Number{ var dst:Vertex3D; var a:Vertex3D; var b:Vertex3D; var vertices:Array; var cframe:Frame; var nframe:Frame; var i:int; ctime = getTimer(); vertices = geometry.vertices; cframe = frames[_currentFrame]; nframe = frames[((_currentFrame + 1) % frames.length)]; i = 0; while (i < vertices.length) { dst = vertices[i]; a = cframe.vertices[i]; b = nframe.vertices[i]; dst.x = (a.x + (interp * (b.x - a.x))); dst.y = (a.y + (interp * (b.y - a.y))); dst.z = (a.z + (interp * (b.z - a.z))); i++; }; if (type != ANIM_STOP){ interp = (interp + ((fps * (ctime - otime)) / 1000)); if (interp >= 1){ keyframe = (keyframe + int(interp)); interp = (interp - int(interp)); }; }; otime = ctime; return (super.project(parent, camera, sorted)); } public function get keyframe():int{ return (_currentFrame); } public function gotoAndStop(frame:int):void{ keyframe = frame; type = ANIM_STOP; } public function loop(start:int, end:int):void{ this.start = (start % frames.length); keyframe = start; this.end = (end % frames.length); type = ANIM_LOOP; } public function gotoAndPlay(frame:int):void{ keyframe = frame; type = ANIM_NORMAL; } public function set keyframe(i:int):void{ var alen:int; if (type == ANIM_LOOP){ alen = (end - start); _currentFrame = ((i % alen) + start); } else { _currentFrame = (i % frames.length); }; } } }//package d3s.net.papervision3d.objects
Section 12
//Md2 (d3s.net.papervision3d.objects.Md2) package d3s.net.papervision3d.objects { import flash.events.*; import flash.utils.*; import org.papervision3d.core.proto.*; import org.papervision3d.core.*; import org.papervision3d.core.geom.*; import flash.net.*; import org.papervision3d.*; import d3s.net.papervision3d.animation.*; public class Md2 extends KeyframeMesh { private var loadScale:Number; private var offset_frames:int; private var offset_glcmds:int; private var loader:URLLoader; private var offset_end:int; private var num_tris:int; private var skinwidth:int; private var offset_tris:int; private var file:String; private var num_frames:int; private var num_vertices:int; private var offset_st:int; private var num_skins:int; private var num_glcmds:int; private var num_st:int; private var version:int; private var framesize:int; private var offset_skins:int; private var skinheight:int; private var ident:int; public function Md2(material:MaterialObject3D, asset, fps:int=6, scale:Number=1, initObject:Object=null){ super(material, fps, scale, initObject); loadScale = scale; visible = false; if ((asset is String)){ file = asset; load(asset); } else { if ((asset is ByteArray)){ parse(asset); }; }; } private function readFrames(data:ByteArray):void{ var sx:Number; var sy:Number; var sz:Number; var tx:Number; var ty:Number; var tz:Number; var verts:Array; var frame:Frame; var i:int; var j:int; var char:int; i = 0; while (i < num_frames) { verts = new Array(); frame = new Frame("", verts); sx = data.readFloat(); sy = data.readFloat(); sz = data.readFloat(); tx = data.readFloat(); ty = data.readFloat(); tz = data.readFloat(); j = 0; while (j < 16) { char = data.readUnsignedByte(); if (char != 0){ frame.name = (frame.name + String.fromCharCode(char)); }; j++; }; j = 0; while (j < num_vertices) { verts.push(new Vertex3D((((sx * data.readUnsignedByte()) + tx) * loadScale), (((sy * data.readUnsignedByte()) + ty) * loadScale), (((sz * data.readUnsignedByte()) + tz) * loadScale))); j++; data.position++; }; frames.push(frame); i++; }; } private function onFileProgress(event:Event):void{ dispatchEvent(event); } private function onFileLoad(event:Event):void{ parse(loader.data); loader.close(); } private function parse(data:ByteArray):void{ var a:int; var b:int; var c:int; var ta:int; var tb:int; var tc:int; var vertices:Array; var faces:Array; var i:int; var uvs:Array; var ev:Event; vertices = geometry.vertices; faces = geometry.faces; uvs = new Array(); data.endian = Endian.LITTLE_ENDIAN; readMd2Header(data); if (((!((ident == 844121161))) || (!((version == 8))))){ throw (new Error((("Error loading MD2 file (" + file) + "): Not a valid MD2 file/bad version"))); }; i = 0; while (i < num_vertices) { vertices.push(new Vertex3D()); i++; }; data.position = offset_st; i = 0; while (i < num_st) { uvs.push(new NumberUV((data.readShort() / skinwidth), (1 - (data.readShort() / skinheight)))); i++; }; data.position = offset_tris; i = 0; while (i < num_tris) { a = data.readUnsignedShort(); b = data.readUnsignedShort(); c = data.readUnsignedShort(); ta = data.readUnsignedShort(); tb = data.readUnsignedShort(); tc = data.readUnsignedShort(); faces.push(new Face3D([vertices[a], vertices[b], vertices[c]], null, [uvs[ta], uvs[tb], uvs[tc]])); i++; }; data.position = offset_frames; readFrames(data); visible = true; Papervision3D.log(((((((((("__________________________________" + "\n_______Parsed MD2_________________") + "\n|") + "\n|\tvertices:") + vertices.length) + "\n|\ttexture vertices:") + uvs.length) + "\n|\tfaces:") + faces.length) + "\n|_________________________________")); ev = new Event(Event.COMPLETE); dispatchEvent(ev); } private function load(filename:String):void{ loader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.BINARY; loader.addEventListener(Event.COMPLETE, onFileLoad); loader.addEventListener(ProgressEvent.PROGRESS, onFileProgress); loader.load(new URLRequest(filename)); } private function readMd2Header(data:ByteArray):void{ ident = data.readInt(); version = data.readInt(); skinwidth = data.readInt(); skinheight = data.readInt(); framesize = data.readInt(); num_skins = data.readInt(); num_vertices = data.readInt(); num_st = data.readInt(); num_tris = data.readInt(); num_glcmds = data.readInt(); num_frames = data.readInt(); offset_skins = data.readInt(); offset_st = data.readInt(); offset_tris = data.readInt(); offset_frames = data.readInt(); offset_glcmds = data.readInt(); offset_end = data.readInt(); } } }//package d3s.net.papervision3d.objects
Section 13
//IAutomationObject (mx.automation.IAutomationObject) package mx.automation { import flash.events.*; public interface IAutomationObject { function createAutomationIDPart(:IAutomationObject):Object; function get automationName():String; function get automationDelegate():Object; function set automationName(C:\dev\flex_201_ja\sdk\frameworks;mx\automation;IAutomationObject.as:String):void; function getAutomationChildAt(delegate:int):IAutomationObject; function get showInAutomationHierarchy():Boolean; function get automationTabularData():Object; function resolveAutomationIDPart(Object:Object):Array; function replayAutomatableEvent(void:Event):Boolean; function set automationDelegate(C:\dev\flex_201_ja\sdk\frameworks;mx\automation;IAutomationObject.as:Object):void; function get automationValue():Array; function get numAutomationChildren():int; function set showInAutomationHierarchy(C:\dev\flex_201_ja\sdk\frameworks;mx\automation;IAutomationObject.as:Boolean):void; } }//package mx.automation
Section 14
//Binding (mx.binding.Binding) package mx.binding { import mx.core.*; public class Binding { mx_internal var destFunc:Function; mx_internal var srcFunc:Function; mx_internal var destString:String; mx_internal var document:Object; private var hasHadValue:Boolean; mx_internal var isExecuting:Boolean; mx_internal var isHandlingEvent:Boolean; public var twoWayCounterpart:Binding; private var wrappedFunctionSuccessful:Boolean; public var uiComponentWatcher:int; private var lastValue:Object; mx_internal static const VERSION:String = "2.0.1.0"; public function Binding(document:Object, srcFunc:Function, destFunc:Function, destString:String){ super(); this.document = document; this.srcFunc = srcFunc; this.destFunc = destFunc; this.destString = destString; isExecuting = false; isHandlingEvent = false; hasHadValue = false; uiComponentWatcher = -1; BindingManager.addBinding(document, destString, this); } public function watcherFired(commitEvent:Boolean, cloneIndex:int):void{ var commitEvent = commitEvent; var cloneIndex = cloneIndex; if (isHandlingEvent){ return; }; try { try { isHandlingEvent = true; execute(cloneIndex); } finally { }; } finally { isHandlingEvent = false; }; } protected function wrapFunctionCall(thisArg:Object, wrappedFunction:Function, object:Object=null, ... _args):Object{ var result:Object; var thisArg = thisArg; var wrappedFunction = wrappedFunction; var object = object; var args = _args; wrappedFunctionSuccessful = false; result = wrappedFunction.apply(thisArg, args); wrappedFunctionSuccessful = true; return (result); //unresolved jump var _slot1 = itemPendingError; _slot1.addResponder(new EvalBindingResponder(this, object)); if (BindingManager.debugDestinationStrings[destString]){ trace(((("Binding: destString = " + destString) + ", error = ") + _slot1)); }; //unresolved jump var _slot1 = rangeError; if (BindingManager.debugDestinationStrings[destString]){ trace(((("Binding: destString = " + destString) + ", error = ") + _slot1)); }; //unresolved jump var _slot1 = error; if (((((((((!((_slot1.errorID == 1006))) && (!((_slot1.errorID == 1009))))) && (!((_slot1.errorID == 1010))))) && (!((_slot1.errorID == 1055))))) && (!((_slot1.errorID == 1069))))){ throw (_slot1); } else { if (BindingManager.debugDestinationStrings[destString]){ trace(((("Binding: destString = " + destString) + ", error = ") + _slot1)); }; }; return (null); } public function execute(o:Object=null):void{ var o = o; if (((isExecuting) || (((twoWayCounterpart) && (twoWayCounterpart.isExecuting))))){ hasHadValue = true; return; }; try { try { isExecuting = true; wrapFunctionCall(this, innerExecute, o); } finally { }; } finally { isExecuting = false; }; } private function nodeSeqEqual(x:XMLList, y:XMLList):Boolean{ var n:uint; var i:uint; n = x.length(); if (n == y.length()){ i = 0; while ((((i < n)) && ((x[i] === y[i])))) { i++; }; return ((i == n)); //unresolved jump }; return (false); } private function innerExecute():void{ var value:Object; value = wrapFunctionCall(document, srcFunc); if (BindingManager.debugDestinationStrings[destString]){ trace(((("Binding: destString = " + destString) + ", srcFunc result = ") + value)); }; if (((hasHadValue) || (wrappedFunctionSuccessful))){ if (((!((((((lastValue is XML)) && (lastValue.hasComplexContent()))) && ((lastValue === value))))) && (!((((((((lastValue is XMLList)) && (lastValue.hasComplexContent()))) && ((value is XMLList)))) && (nodeSeqEqual((lastValue as XMLList), (value as XMLList)))))))){ destFunc.call(document, value); lastValue = value; hasHadValue = true; }; }; } } }//package mx.binding
Section 15
//BindingManager (mx.binding.BindingManager) package mx.binding { import mx.core.*; public class BindingManager { mx_internal static const VERSION:String = "2.0.1.0"; static var debugDestinationStrings:Object = {}; public function BindingManager(){ super(); } public static function executeBindings(document:Object, destStr:String, destObj:Object):void{ var binding:String; if (((!(destStr)) || ((destStr == "")))){ return; }; if (((((((document) && (document._bindingsByDestination))) && (document._bindingsBeginWithWord))) && (document._bindingsBeginWithWord[getFirstWord(destStr)]))){ for (binding in document._bindingsByDestination) { if (binding.charAt(0) == destStr.charAt(0)){ if ((((((binding.indexOf((destStr + ".")) == 0)) || ((binding.indexOf((destStr + "[")) == 0)))) || ((binding == destStr)))){ document._bindingsByDestination[binding].execute(destObj); }; }; }; }; } public static function addBinding(document:Object, destStr:String, b:Binding):void{ if (!document._bindingsByDestination){ document._bindingsByDestination = {}; document._bindingsBeginWithWord = {}; }; document._bindingsByDestination[destStr] = b; document._bindingsBeginWithWord[getFirstWord(destStr)] = true; } public static function debugBinding(destinationString:String):void{ debugDestinationStrings[destinationString] = true; } private static function getFirstWord(destStr:String):String{ var indexPeriod:int; var indexBracket:int; var minIndex:int; indexPeriod = destStr.indexOf("."); indexBracket = destStr.indexOf("["); if (indexPeriod == indexBracket){ return (destStr); }; minIndex = Math.min(indexPeriod, indexBracket); if (minIndex == -1){ minIndex = Math.max(indexPeriod, indexBracket); }; return (destStr.substr(0, minIndex)); } public static function getUIComponentWatcherForDestination(document:Object, destStr:String):int{ var binding:String; if (document._bindingsByDestination){ for (binding in document._bindingsByDestination) { if ((((binding == destStr)) && (!((document._bindingsByDestination[binding].uiComponentWatcher == -1))))){ return (document._bindingsByDestination[binding].uiComponentWatcher); }; }; }; return (-1); } } }//package mx.binding
Section 16
//EvalBindingResponder (mx.binding.EvalBindingResponder) package mx.binding { import mx.core.*; import mx.rpc.*; public class EvalBindingResponder implements IResponder { private var binding:Binding; private var object:Object; mx_internal static const VERSION:String = "2.0.1.0"; public function EvalBindingResponder(binding:Binding, object:Object){ super(); this.binding = binding; this.object = object; } public function fault(data:Object):void{ } public function result(data:Object):void{ binding.execute(object); } } }//package mx.binding
Section 17
//ItemPendingError (mx.collections.errors.ItemPendingError) package mx.collections.errors { import mx.core.*; import mx.rpc.*; public class ItemPendingError extends Error { private var _responders:Array; mx_internal static const VERSION:String = "2.0.1.0"; public function ItemPendingError(message:String){ super(message); } public function addResponder(responder:IResponder):void{ if (!_responders){ _responders = []; }; _responders.push(responder); } public function get responders():Array{ return (_responders); } } }//package mx.collections.errors
Section 18
//ApplicationLayout (mx.containers.utilityClasses.ApplicationLayout) package mx.containers.utilityClasses { import mx.core.*; public class ApplicationLayout extends BoxLayout { mx_internal static const VERSION:String = "2.0.1.0"; public function ApplicationLayout(){ super(); } override public function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ var target:Container; var paddingLeft:Number; var paddingTop:Number; var oX:Number; var oY:Number; var n:int; var i:int; var child:IFlexDisplayObject; super.updateDisplayList(unscaledWidth, unscaledHeight); target = super.target; if (((((target.horizontalScrollBar) && ((getHorizontalAlignValue() > 0)))) || (((target.verticalScrollBar) && ((getVerticalAlignValue() > 0)))))){ paddingLeft = target.getStyle("paddingLeft"); paddingTop = target.getStyle("paddingTop"); oX = 0; oY = 0; n = target.numChildren; i = 0; while (i < n) { child = IFlexDisplayObject(target.getChildAt(i)); if (child.x < paddingLeft){ oX = Math.max(oX, (paddingLeft - child.x)); }; if (child.y < paddingTop){ oY = Math.max(oY, (paddingTop - child.y)); }; i++; }; if (((!((oX == 0))) || (!((oY == 0))))){ i = 0; while (i < n) { child = IFlexDisplayObject(target.getChildAt(i)); child.move((child.x + oX), (child.y + oY)); i++; }; }; }; } } }//package mx.containers.utilityClasses
Section 19
//BoxLayout (mx.containers.utilityClasses.BoxLayout) package mx.containers.utilityClasses { import mx.core.*; import mx.controls.scrollClasses.*; import mx.containers.*; public class BoxLayout extends Layout { public var direction:String;// = "vertical" mx_internal static const VERSION:String = "2.0.1.0"; public function BoxLayout(){ direction = BoxDirection.VERTICAL; super(); } private function isVertical():Boolean{ return (!((direction == BoxDirection.HORIZONTAL))); } override public function measure():void{ var target:Container; var isVertical:Boolean; var minWidth:Number; var minHeight:Number; var preferredWidth:Number; var preferredHeight:Number; var n:int; var numChildrenWithOwnSpace:int; var i:int; var wPadding:Number; var hPadding:Number; var child:IUIComponent; var wPref:Number; var hPref:Number; target = super.target; isVertical = isVertical(); minWidth = 0; minHeight = 0; preferredWidth = 0; preferredHeight = 0; n = target.numChildren; numChildrenWithOwnSpace = n; i = 0; while (i < n) { child = IUIComponent(target.getChildAt(i)); if (!child.includeInLayout){ numChildrenWithOwnSpace--; } else { wPref = child.getExplicitOrMeasuredWidth(); hPref = child.getExplicitOrMeasuredHeight(); if (isVertical){ minWidth = Math.max((isNaN(child.percentWidth)) ? wPref : child.minWidth, minWidth); preferredWidth = Math.max(wPref, preferredWidth); minHeight = (minHeight + (isNaN(child.percentHeight)) ? hPref : child.minHeight); preferredHeight = (preferredHeight + hPref); } else { minWidth = (minWidth + (isNaN(child.percentWidth)) ? wPref : child.minWidth); preferredWidth = (preferredWidth + wPref); minHeight = Math.max((isNaN(child.percentHeight)) ? hPref : child.minHeight, minHeight); preferredHeight = Math.max(hPref, preferredHeight); }; }; i++; }; wPadding = widthPadding(numChildrenWithOwnSpace); hPadding = heightPadding(numChildrenWithOwnSpace); target.measuredMinWidth = (minWidth + wPadding); target.measuredMinHeight = (minHeight + hPadding); target.measuredWidth = (preferredWidth + wPadding); target.measuredHeight = (preferredHeight + hPadding); } mx_internal function getHorizontalAlignValue():Number{ var horizontalAlign:String; horizontalAlign = target.getStyle("horizontalAlign"); if (horizontalAlign == "center"){ return (0.5); }; if (horizontalAlign == "right"){ return (1); }; return (0); } mx_internal function heightPadding(numChildren:Number):Number{ var vm:EdgeMetrics; var padding:Number; vm = target.viewMetricsAndPadding; padding = (vm.top + vm.bottom); if ((((numChildren > 1)) && (isVertical()))){ padding = (padding + (target.getStyle("verticalGap") * (numChildren - 1))); }; return (padding); } mx_internal function widthPadding(numChildren:Number):Number{ var vm:EdgeMetrics; var padding:Number; vm = target.viewMetricsAndPadding; padding = (vm.left + vm.right); if ((((numChildren > 1)) && ((isVertical() == false)))){ padding = (padding + (target.getStyle("horizontalGap") * (numChildren - 1))); }; return (padding); } override public function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ var target:Container; var n:int; var vm:EdgeMetrics; var paddingLeft:Number; var paddingTop:Number; var horizontalAlign:Number; var verticalAlign:Number; var mw:Number; var mh:Number; var w:Number; var h:Number; var horizontalScrollBar:ScrollBar; var verticalScrollBar:ScrollBar; var gap:Number; var numChildrenWithOwnSpace:int; var excessSpace:Number; var top:Number; var left:Number; var i:int; var obj:IUIComponent; var child:IUIComponent; var percentWidth:Number; var percentHeight:Number; var width:Number; var height:Number; target = super.target; n = target.numChildren; if (n == 0){ return; }; vm = target.viewMetricsAndPadding; paddingLeft = target.getStyle("paddingLeft"); paddingTop = target.getStyle("paddingTop"); horizontalAlign = getHorizontalAlignValue(); verticalAlign = getVerticalAlignValue(); mw = ((((target.scaleX > 0)) && (!((target.scaleX == 1))))) ? (target.minWidth / Math.abs(target.scaleX)) : target.minWidth; mh = ((((target.scaleY > 0)) && (!((target.scaleY == 1))))) ? (target.minHeight / Math.abs(target.scaleY)) : target.minHeight; w = ((Math.max(unscaledWidth, mw) - vm.right) - vm.left); h = ((Math.max(unscaledHeight, mh) - vm.bottom) - vm.top); horizontalScrollBar = target.horizontalScrollBar; verticalScrollBar = target.verticalScrollBar; if (n == 1){ child = IUIComponent(target.getChildAt(0)); percentWidth = child.percentWidth; percentHeight = child.percentHeight; if (percentWidth){ width = Math.max(child.minWidth, Math.min(child.maxWidth, ((percentWidth)>=100) ? w : ((w * percentWidth) / 100))); } else { width = child.getExplicitOrMeasuredWidth(); }; if (percentHeight){ height = Math.max(child.minHeight, Math.min(child.maxHeight, ((percentHeight)>=100) ? h : ((h * percentHeight) / 100))); } else { height = child.getExplicitOrMeasuredHeight(); }; if ((((child.scaleX == 1)) && ((child.scaleY == 1)))){ child.setActualSize(Math.floor(width), Math.floor(height)); } else { child.setActualSize(width, height); }; if (((!((verticalScrollBar == null))) && ((target.verticalScrollPolicy == ScrollPolicy.AUTO)))){ w = (w + verticalScrollBar.minWidth); }; if (((!((horizontalScrollBar == null))) && ((target.horizontalScrollPolicy == ScrollPolicy.AUTO)))){ h = (h + horizontalScrollBar.minHeight); }; left = (((w - child.width) * horizontalAlign) + paddingLeft); top = (((h - child.height) * verticalAlign) + paddingTop); child.move(Math.floor(left), Math.floor(top)); } else { if (isVertical()){ gap = target.getStyle("verticalGap"); numChildrenWithOwnSpace = n; i = 0; while (i < n) { if (!IUIComponent(target.getChildAt(i)).includeInLayout){ numChildrenWithOwnSpace--; }; i++; }; excessSpace = Flex.flexChildHeightsProportionally(target, (h - ((numChildrenWithOwnSpace - 1) * gap)), w); if (((!((horizontalScrollBar == null))) && ((target.horizontalScrollPolicy == ScrollPolicy.AUTO)))){ excessSpace = (excessSpace + horizontalScrollBar.minHeight); }; if (((!((verticalScrollBar == null))) && ((target.verticalScrollPolicy == ScrollPolicy.AUTO)))){ w = (w + verticalScrollBar.minWidth); }; top = (paddingTop + (excessSpace * verticalAlign)); i = 0; while (i < n) { obj = IUIComponent(target.getChildAt(i)); left = (((w - obj.width) * horizontalAlign) + paddingLeft); obj.move(Math.floor(left), Math.floor(top)); if (obj.includeInLayout){ top = (top + (obj.height + gap)); }; i++; }; } else { gap = target.getStyle("horizontalGap"); numChildrenWithOwnSpace = n; i = 0; while (i < n) { if (!IUIComponent(target.getChildAt(i)).includeInLayout){ numChildrenWithOwnSpace--; }; i++; }; excessSpace = Flex.flexChildWidthsProportionally(target, (w - ((numChildrenWithOwnSpace - 1) * gap)), h); if (((!((horizontalScrollBar == null))) && ((target.horizontalScrollPolicy == ScrollPolicy.AUTO)))){ h = (h + horizontalScrollBar.minHeight); }; if (((!((verticalScrollBar == null))) && ((target.verticalScrollPolicy == ScrollPolicy.AUTO)))){ excessSpace = (excessSpace + verticalScrollBar.minWidth); }; left = (paddingLeft + (excessSpace * horizontalAlign)); i = 0; while (i < n) { obj = IUIComponent(target.getChildAt(i)); top = (((h - obj.height) * verticalAlign) + paddingTop); obj.move(Math.floor(left), Math.floor(top)); if (obj.includeInLayout){ left = (left + (obj.width + gap)); }; i++; }; }; }; } mx_internal function getVerticalAlignValue():Number{ var verticalAlign:String; verticalAlign = target.getStyle("verticalAlign"); if (verticalAlign == "middle"){ return (0.5); }; if (verticalAlign == "bottom"){ return (1); }; return (0); } } }//package mx.containers.utilityClasses
Section 20
//CanvasLayout (mx.containers.utilityClasses.CanvasLayout) package mx.containers.utilityClasses { import mx.core.*; import flash.display.*; import flash.geom.*; import mx.styles.*; import mx.events.*; public class CanvasLayout extends Layout { private var _contentArea:Rectangle; mx_internal static const VERSION:String = "2.0.1.0"; private static var r:Rectangle = new Rectangle(); public function CanvasLayout(){ super(); } private function applyAnchorStylesDuringUpdateDisplayList(availableWidth:Number, availableHeight:Number, child:IUIComponent):void{ var styleableChild:IStyleClient; var left:Number; var right:Number; var horizontalCenter:Number; var top:Number; var bottom:Number; var verticalCenter:Number; var w:Number; var h:Number; var x:Number; var y:Number; var checkWidth:Boolean; var checkHeight:Boolean; styleableChild = (child as IStyleClient); if (!styleableChild){ return; }; left = styleableChild.getStyle("left"); right = styleableChild.getStyle("right"); horizontalCenter = styleableChild.getStyle("horizontalCenter"); top = styleableChild.getStyle("top"); bottom = styleableChild.getStyle("bottom"); verticalCenter = styleableChild.getStyle("verticalCenter"); checkWidth = false; checkHeight = false; if (((!(isNaN(left))) && (!(isNaN(right))))){ w = ((availableWidth - left) - right); if (w < child.minWidth){ w = child.minWidth; }; } else { if (!isNaN(child.percentWidth)){ w = ((child.percentWidth / 100) * availableWidth); w = bound(w, child.minWidth, child.maxWidth); checkWidth = true; } else { w = child.getExplicitOrMeasuredWidth(); }; }; if (((!(isNaN(top))) && (!(isNaN(bottom))))){ h = ((availableHeight - top) - bottom); if (h < child.minHeight){ h = child.minHeight; }; } else { if (!isNaN(child.percentHeight)){ h = ((child.percentHeight / 100) * availableHeight); h = bound(h, child.minHeight, child.maxHeight); checkHeight = true; } else { h = child.getExplicitOrMeasuredHeight(); }; }; if (!isNaN(horizontalCenter)){ x = Math.round((((availableWidth - w) / 2) + horizontalCenter)); } else { if (!isNaN(left)){ x = left; } else { if (!isNaN(right)){ x = ((availableWidth - right) - w); }; }; }; if (!isNaN(verticalCenter)){ y = Math.round((((availableHeight - h) / 2) + verticalCenter)); } else { if (!isNaN(top)){ y = top; } else { if (!isNaN(bottom)){ y = ((availableHeight - bottom) - h); }; }; }; x = (isNaN(x)) ? child.x : x; y = (isNaN(y)) ? child.y : y; child.move(x, y); if (checkWidth){ if ((x + w) > availableWidth){ w = Math.max((availableWidth - x), child.minWidth); }; }; if (checkHeight){ if ((y + h) > availableHeight){ h = Math.max((availableHeight - y), child.minHeight); }; }; if (((!(isNaN(w))) && (!(isNaN(h))))){ child.setActualSize(w, h); }; } override public function set target(value:Container):void{ var target:Container; var i:int; var n:int; target = super.target; if (value != target){ if (target){ target.removeEventListener(ChildExistenceChangedEvent.CHILD_ADD, target_childAddHandler); target.removeEventListener(ChildExistenceChangedEvent.CHILD_REMOVE, target_childRemoveHandler); n = target.numChildren; i = 0; while (i < n) { DisplayObject(target.getChildAt(i)).removeEventListener(MoveEvent.MOVE, child_moveHandler); i++; }; }; if (value){ value.addEventListener(ChildExistenceChangedEvent.CHILD_ADD, target_childAddHandler); value.addEventListener(ChildExistenceChangedEvent.CHILD_REMOVE, target_childRemoveHandler); n = value.numChildren; i = 0; while (i < n) { DisplayObject(value.getChildAt(i)).addEventListener(MoveEvent.MOVE, child_moveHandler); i++; }; }; super.target = value; }; } override public function measure():void{ var target:Container; var w:Number; var h:Number; var vm:EdgeMetrics; var contentArea:Rectangle; target = super.target; w = 0; h = 0; vm = target.viewMetrics; _contentArea = null; contentArea = measureContentArea(); target.measuredWidth = ((contentArea.width + vm.left) + vm.right); target.measuredHeight = ((contentArea.height + vm.top) + vm.bottom); } private function target_childAddHandler(event:ChildExistenceChangedEvent):void{ DisplayObject(event.relatedObject).addEventListener(MoveEvent.MOVE, child_moveHandler); } private function measureContentArea():Rectangle{ var n:int; var i:int; var child:IUIComponent; var styleableChild:IStyleClient; var cx:Number; var cy:Number; var pw:Number; var ph:Number; var rightEdge:Number; var bottomEdge:Number; if (_contentArea){ return (_contentArea); }; _contentArea = new Rectangle(); n = target.numChildren; i = 0; while (i < n) { child = (target.getChildAt(i) as IUIComponent); styleableChild = (child as IStyleClient); if (!child.includeInLayout){ } else { cx = child.x; cy = child.y; pw = child.getExplicitOrMeasuredWidth(); ph = child.getExplicitOrMeasuredHeight(); if (((!(isNaN(child.percentWidth))) || (((((styleableChild) && (!(isNaN(styleableChild.getStyle("left")))))) && (!(isNaN(styleableChild.getStyle("right")))))))){ pw = child.minWidth; }; if (((!(isNaN(child.percentHeight))) || (((((styleableChild) && (!(isNaN(styleableChild.getStyle("top")))))) && (!(isNaN(styleableChild.getStyle("bottom")))))))){ ph = child.minHeight; }; r.x = cx; r.y = cy; r.width = pw; r.height = ph; applyAnchorStylesDuringMeasure(child, r); cx = r.x; cy = r.y; pw = r.width; ph = r.height; if (isNaN(cx)){ cx = child.x; }; if (isNaN(cy)){ cy = child.y; }; rightEdge = cx; bottomEdge = cy; if (isNaN(pw)){ pw = child.width; }; if (isNaN(ph)){ ph = child.height; }; rightEdge = (rightEdge + pw); bottomEdge = (bottomEdge + ph); _contentArea.right = Math.max(_contentArea.right, rightEdge); _contentArea.bottom = Math.max(_contentArea.bottom, bottomEdge); }; i++; }; return (_contentArea); } private function child_moveHandler(event:MoveEvent):void{ var target:Container; if ((event.target is IUIComponent)){ if (!IUIComponent(event.target).includeInLayout){ return; }; }; target = super.target; if (target){ target.invalidateSize(); target.invalidateDisplayList(); _contentArea = null; }; } override public function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ var target:Container; var vm:EdgeMetrics; var viewableWidth:Number; var viewableHeight:Number; var n:int; var i:int; var child:IUIComponent; target = super.target; target.mx_internal::doingLayout = false; vm = target.viewMetrics; target.mx_internal::doingLayout = true; viewableWidth = ((unscaledWidth - vm.left) - vm.right); viewableHeight = ((unscaledHeight - vm.top) - vm.bottom); n = target.numChildren; i = 0; while (i < n) { child = (target.getChildAt(i) as IUIComponent); applyAnchorStylesDuringUpdateDisplayList(viewableWidth, viewableHeight, child); i++; }; } private function applyAnchorStylesDuringMeasure(child:IUIComponent, r:Rectangle):void{ var styleableChild:IStyleClient; var left:Number; var right:Number; var horizontalCenter:Number; var top:Number; var bottom:Number; var verticalCenter:Number; styleableChild = (child as IStyleClient); if (!styleableChild){ return; }; left = styleableChild.getStyle("left"); right = styleableChild.getStyle("right"); horizontalCenter = styleableChild.getStyle("horizontalCenter"); if (!isNaN(horizontalCenter)){ r.x = Math.round((((target.width - child.width) / 2) + horizontalCenter)); } else { if (((!(isNaN(left))) && (!(isNaN(right))))){ r.x = left; r.width = (r.width + right); } else { if (!isNaN(left)){ r.x = left; } else { if (!isNaN(right)){ r.x = 0; r.width = (r.width + right); }; }; }; }; top = styleableChild.getStyle("top"); bottom = styleableChild.getStyle("bottom"); verticalCenter = styleableChild.getStyle("verticalCenter"); if (!isNaN(verticalCenter)){ r.y = Math.round((((target.height - child.height) / 2) + verticalCenter)); } else { if (((!(isNaN(top))) && (!(isNaN(bottom))))){ r.y = top; r.height = (r.height + bottom); } else { if (!isNaN(top)){ r.y = top; } else { if (!isNaN(bottom)){ r.y = 0; r.height = (r.height + bottom); }; }; }; }; } private function bound(a:Number, min:Number, max:Number):Number{ if (a < min){ a = min; } else { if (a > max){ a = max; } else { a = Math.floor(a); }; }; return (a); } private function target_childRemoveHandler(event:ChildExistenceChangedEvent):void{ DisplayObject(event.relatedObject).removeEventListener(MoveEvent.MOVE, child_moveHandler); } } }//package mx.containers.utilityClasses
Section 21
//Flex (mx.containers.utilityClasses.Flex) package mx.containers.utilityClasses { import mx.core.*; public class Flex { mx_internal static const VERSION:String = "2.0.1.0"; public function Flex(){ super(); } public static function flexChildWidthsProportionally(parent:Container, spaceForChildren:Number, h:Number):Number{ var spaceToDistribute:Number; var totalPercentWidth:Number; var childInfoArray:Array; var childInfo:FlexChildInfo; var child:IUIComponent; var i:int; var n:int; var percentWidth:Number; var percentHeight:Number; var height:Number; var width:Number; spaceToDistribute = spaceForChildren; totalPercentWidth = 0; childInfoArray = []; n = parent.numChildren; i = 0; while (i < n) { child = IUIComponent(parent.getChildAt(i)); percentWidth = child.percentWidth; percentHeight = child.percentHeight; if (((!(isNaN(percentHeight))) && (child.includeInLayout))){ height = Math.max(child.minHeight, Math.min(child.maxHeight, ((percentHeight)>=100) ? h : ((h * percentHeight) / 100))); } else { height = child.getExplicitOrMeasuredHeight(); }; if (((!(isNaN(percentWidth))) && (child.includeInLayout))){ totalPercentWidth = (totalPercentWidth + percentWidth); childInfo = new FlexChildInfo(); childInfo.percent = percentWidth; childInfo.min = child.minWidth; childInfo.max = child.maxWidth; childInfo.height = height; childInfo.child = child; childInfoArray.push(childInfo); } else { width = child.getExplicitOrMeasuredWidth(); if ((((child.scaleX == 1)) && ((child.scaleY == 1)))){ child.setActualSize(Math.floor(width), Math.floor(height)); } else { child.setActualSize(width, height); }; if (child.includeInLayout){ spaceToDistribute = (spaceToDistribute - child.width); }; }; i++; }; if (totalPercentWidth){ spaceToDistribute = flexChildrenProportionally(spaceForChildren, spaceToDistribute, totalPercentWidth, childInfoArray); n = childInfoArray.length; i = 0; while (i < n) { childInfo = childInfoArray[i]; child = childInfo.child; if ((((child.scaleX == 1)) && ((child.scaleY == 1)))){ child.setActualSize(Math.floor(childInfo.size), Math.floor(childInfo.height)); } else { child.setActualSize(childInfo.size, childInfo.height); }; i++; }; }; return (spaceToDistribute); } public static function flexChildHeightsProportionally(parent:Container, spaceForChildren:Number, w:Number):Number{ var spaceToDistribute:Number; var totalPercentHeight:Number; var childInfoArray:Array; var childInfo:FlexChildInfo; var child:IUIComponent; var i:int; var n:int; var percentWidth:Number; var percentHeight:Number; var width:Number; var height:Number; spaceToDistribute = spaceForChildren; totalPercentHeight = 0; childInfoArray = []; n = parent.numChildren; i = 0; while (i < n) { child = IUIComponent(parent.getChildAt(i)); percentWidth = child.percentWidth; percentHeight = child.percentHeight; if (((!(isNaN(percentWidth))) && (child.includeInLayout))){ width = Math.max(child.minWidth, Math.min(child.maxWidth, ((percentWidth)>=100) ? w : ((w * percentWidth) / 100))); } else { width = child.getExplicitOrMeasuredWidth(); }; if (((!(isNaN(percentHeight))) && (child.includeInLayout))){ totalPercentHeight = (totalPercentHeight + percentHeight); childInfo = new FlexChildInfo(); childInfo.percent = percentHeight; childInfo.min = child.minHeight; childInfo.max = child.maxHeight; childInfo.width = width; childInfo.child = child; childInfoArray.push(childInfo); } else { height = child.getExplicitOrMeasuredHeight(); if ((((child.scaleX == 1)) && ((child.scaleY == 1)))){ child.setActualSize(Math.floor(width), Math.floor(height)); } else { child.setActualSize(width, height); }; if (child.includeInLayout){ spaceToDistribute = (spaceToDistribute - child.height); }; }; i++; }; if (totalPercentHeight){ spaceToDistribute = flexChildrenProportionally(spaceForChildren, spaceToDistribute, totalPercentHeight, childInfoArray); n = childInfoArray.length; i = 0; while (i < n) { childInfo = childInfoArray[i]; child = childInfo.child; if ((((child.scaleX == 1)) && ((child.scaleY == 1)))){ child.setActualSize(Math.floor(childInfo.width), Math.floor(childInfo.size)); } else { child.setActualSize(childInfo.width, childInfo.size); }; i++; }; }; return (spaceToDistribute); } public static function flexChildrenProportionally(spaceForChildren:Number, spaceToDistribute:Number, totalPercent:Number, childInfoArray:Array):Number{ var numChildren:int; var flexConsumed:Number; var done:Boolean; var unused:Number; var spacePerPercent:*; var i:*; var childInfo:*; var size:*; var min:*; var max:*; numChildren = childInfoArray.length; unused = (spaceToDistribute - ((spaceForChildren * totalPercent) / 100)); if (unused > 0){ spaceToDistribute = (spaceToDistribute - unused); }; do { flexConsumed = 0; done = true; spacePerPercent = (spaceToDistribute / totalPercent); i = 0; while (i < numChildren) { childInfo = childInfoArray[i]; size = (childInfo.percent * spacePerPercent); if (size < childInfo.min){ min = childInfo.min; childInfo.size = min; --numChildren; childInfoArray[i] = childInfoArray[numChildren]; childInfoArray[numChildren] = childInfo; totalPercent = (totalPercent - childInfo.percent); spaceToDistribute = (spaceToDistribute - min); done = false; break; } else { if (size > childInfo.max){ max = childInfo.max; childInfo.size = max; --numChildren; childInfoArray[i] = childInfoArray[numChildren]; childInfoArray[numChildren] = childInfo; totalPercent = (totalPercent - childInfo.percent); spaceToDistribute = (spaceToDistribute - max); done = false; break; } else { childInfo.size = size; flexConsumed = (flexConsumed + size); }; }; i++; }; } while (!(done)); return (Math.max(0, Math.floor((spaceToDistribute - flexConsumed)))); } } }//package mx.containers.utilityClasses
Section 22
//FlexChildInfo (mx.containers.utilityClasses.FlexChildInfo) package mx.containers.utilityClasses { import mx.core.*; public class FlexChildInfo { public var size:Number;// = 0 public var percent:Number; public var width:Number; public var max:Number; public var height:Number; public var preferred:Number;// = 0 public var min:Number; public var flex:Number;// = 0 public var child:IUIComponent; mx_internal static const VERSION:String = "2.0.1.0"; public function FlexChildInfo(){ size = 0; preferred = 0; flex = 0; super(); } } }//package mx.containers.utilityClasses
Section 23
//Layout (mx.containers.utilityClasses.Layout) package mx.containers.utilityClasses { import mx.core.*; public class Layout { private var _target:Container; mx_internal static const VERSION:String = "2.0.1.0"; public function Layout(){ super(); } public function set target(value:Container):void{ _target = value; } public function measure():void{ } public function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ } public function get target():Container{ return (_target); } } }//package mx.containers.utilityClasses
Section 24
//BoxDirection (mx.containers.BoxDirection) package mx.containers { import mx.core.*; public final class BoxDirection { public static const HORIZONTAL:String = "horizontal"; public static const VERTICAL:String = "vertical"; mx_internal static const VERSION:String = "2.0.1.0"; public function BoxDirection(){ super(); } } }//package mx.containers
Section 25
//DataGridListData (mx.controls.dataGridClasses.DataGridListData) package mx.controls.dataGridClasses { import mx.core.*; import mx.controls.listClasses.*; public class DataGridListData extends BaseListData { public var dataField:String; mx_internal static const VERSION:String = "2.0.1.0"; public function DataGridListData(text:String, dataField:String, columnIndex:int, uid:String, owner:IUIComponent, rowIndex:int=0){ super(text, uid, owner, rowIndex, columnIndex); this.dataField = dataField; } } }//package mx.controls.dataGridClasses
Section 26
//BaseListData (mx.controls.listClasses.BaseListData) package mx.controls.listClasses { import mx.core.*; public class BaseListData { private var _uid:String; public var label:String; public var rowIndex:int; public var owner:IUIComponent; public var columnIndex:int; mx_internal static const VERSION:String = "2.0.1.0"; public function BaseListData(label:String, uid:String, owner:IUIComponent, rowIndex:int=0, columnIndex:int=0){ super(); this.label = label; this.uid = uid; this.owner = owner; this.rowIndex = rowIndex; this.columnIndex = columnIndex; } public function set uid(value:String):void{ _uid = value; } public function get uid():String{ return (_uid); } } }//package mx.controls.listClasses
Section 27
//IDropInListItemRenderer (mx.controls.listClasses.IDropInListItemRenderer) package mx.controls.listClasses { public interface IDropInListItemRenderer { function set listData(C:\dev\flex_201_ja\sdk\frameworks;mx\controls\listClasses;IDropInListItemRenderer.as:BaseListData):void; function get listData():BaseListData; } }//package mx.controls.listClasses
Section 28
//IListItemRenderer (mx.controls.listClasses.IListItemRenderer) package mx.controls.listClasses { import flash.events.*; import mx.core.*; import mx.styles.*; import mx.managers.*; public interface IListItemRenderer extends IDataRenderer, IEventDispatcher, IFlexDisplayObject, ILayoutManagerClient, ISimpleStyleClient, IUIComponent { } }//package mx.controls.listClasses
Section 29
//ScrollBar (mx.controls.scrollClasses.ScrollBar) package mx.controls.scrollClasses { import flash.events.*; import mx.core.*; import flash.display.*; import flash.utils.*; import flash.geom.*; import mx.styles.*; import mx.events.*; import mx.controls.*; import flash.ui.*; public class ScrollBar extends UIComponent { mx_internal var isScrolling:Boolean; mx_internal var oldPosition:Number; mx_internal var downArrow:Button; private var _pageSize:Number;// = 0 mx_internal var _minHeight:Number;// = 32 private var trackScrolling:Boolean;// = false private var trackScrollRepeatDirection:int; private var _scrollPosition:Number;// = 0 private var _lineScrollSize:Number;// = 1 private var _direction:String;// = "vertical" mx_internal var upArrow:Button; private var trackScrollTimer:Timer; mx_internal var scrollTrack:DisplayObject; private var _pageScrollSize:Number;// = 0 private var _maxScrollPosition:Number;// = 0 mx_internal var scrollThumb:ScrollThumb; private var _minScrollPosition:Number;// = 0 private var trackPosition:Number; mx_internal var _minWidth:Number;// = 16 mx_internal static const VERSION:String = "2.0.1.0"; public static const THICKNESS:Number = 16; public function ScrollBar(){ _minWidth = 16; _minHeight = 32; trackScrolling = false; _direction = ScrollBarDirection.VERTICAL; _lineScrollSize = 1; _maxScrollPosition = 0; _minScrollPosition = 0; _pageSize = 0; _pageScrollSize = 0; _scrollPosition = 0; super(); } private function downArrow_buttonDownHandler(event:FlexEvent):void{ if (isNaN(oldPosition)){ oldPosition = scrollPosition; }; lineScroll(1); } public function set minScrollPosition(value:Number):void{ _minScrollPosition = value; } mx_internal function get virtualHeight():Number{ return (unscaledHeight); } mx_internal function get lineMinusDetail():String{ return (((direction == ScrollBarDirection.VERTICAL)) ? ScrollEventDetail.LINE_UP : ScrollEventDetail.LINE_LEFT); } public function setScrollProperties(pageSize:Number, minScrollPosition:Number, maxScrollPosition:Number, pageScrollSize:Number=0):void{ var thumbHeight:Number; this.pageSize = pageSize; _pageScrollSize = ((pageScrollSize)>0) ? pageScrollSize : pageSize; this.minScrollPosition = Math.max(minScrollPosition, 0); this.maxScrollPosition = Math.max(maxScrollPosition, 0); _scrollPosition = Math.max(this.minScrollPosition, _scrollPosition); _scrollPosition = Math.min(this.maxScrollPosition, _scrollPosition); if (((((this.maxScrollPosition - this.minScrollPosition) > 0)) && (enabled))){ upArrow.enabled = true; downArrow.enabled = true; addEventListener(MouseEvent.MOUSE_DOWN, scrollTrack_mouseDownHandler); addEventListener(MouseEvent.MOUSE_OVER, scrollTrack_mouseOverHandler); addEventListener(MouseEvent.MOUSE_OUT, scrollTrack_mouseOutHandler); if (!scrollThumb){ scrollThumb = new ScrollThumb(); scrollThumb.focusEnabled = false; addChildAt(scrollThumb, getChildIndex(downArrow)); scrollThumb.styleName = this; scrollThumb.upSkinName = "thumbUpSkin"; scrollThumb.overSkinName = "thumbOverSkin"; scrollThumb.downSkinName = "thumbDownSkin"; scrollThumb.iconName = "thumbIcon"; }; thumbHeight = ((trackHeight < 0)) ? 0 : Math.round(((pageSize / ((this.maxScrollPosition - this.minScrollPosition) + pageSize)) * trackHeight)); if (thumbHeight < scrollThumb.minHeight){ if (trackHeight < scrollThumb.minHeight){ scrollThumb.visible = false; } else { thumbHeight = scrollThumb.minHeight; scrollThumb.visible = true; scrollThumb.setActualSize(_minWidth, scrollThumb.minHeight); }; } else { scrollThumb.visible = true; scrollThumb.setActualSize(_minWidth, thumbHeight); }; scrollThumb.setRange((upArrow.getExplicitOrMeasuredHeight() + 0), ((virtualHeight - downArrow.getExplicitOrMeasuredHeight()) - scrollThumb.height), this.minScrollPosition, this.maxScrollPosition); scrollPosition = Math.max(Math.min(scrollPosition, this.maxScrollPosition), this.minScrollPosition); } else { upArrow.enabled = false; downArrow.enabled = false; if (scrollThumb){ scrollThumb.visible = false; }; }; } public function get pageScrollSize():Number{ return (_pageScrollSize); } private function get trackY():Number{ return (upArrow.getExplicitOrMeasuredHeight()); } public function set pageScrollSize(value:Number):void{ _pageScrollSize = value; } mx_internal function isScrollBarKey(key:uint):Boolean{ var oldPosition:Number; if (key == Keyboard.HOME){ if (scrollPosition != 0){ oldPosition = scrollPosition; scrollPosition = 0; dispatchScrollEvent(oldPosition, minDetail); }; return (true); } else { if (key == Keyboard.END){ if (scrollPosition < maxScrollPosition){ oldPosition = scrollPosition; scrollPosition = maxScrollPosition; dispatchScrollEvent(oldPosition, maxDetail); }; return (true); }; }; return (false); } private function trackScrollTimerHandler(event:Event):void{ if (trackScrollRepeatDirection == 1){ if ((scrollThumb.y + scrollThumb.height) > trackPosition){ return; }; }; if (trackScrollRepeatDirection == -1){ if (scrollThumb.y < trackPosition){ return; }; }; pageScroll(trackScrollRepeatDirection); if (((trackScrollTimer) && ((trackScrollTimer.repeatCount == 1)))){ trackScrollTimer.delay = getStyle("repeatInterval"); trackScrollTimer.repeatCount = 0; }; } private function scrollTrack_mouseUpHandler(event:MouseEvent):void{ scrollTrack_mouseLeaveHandler(event); } private function get minDetail():String{ return (((direction == ScrollBarDirection.VERTICAL)) ? ScrollEventDetail.AT_TOP : ScrollEventDetail.AT_LEFT); } override protected function measure():void{ super.measure(); upArrow.validateSize(); downArrow.validateSize(); _minWidth = upArrow.getExplicitOrMeasuredWidth(); _minHeight = (upArrow.getExplicitOrMeasuredHeight() + downArrow.getExplicitOrMeasuredHeight()); } public function get maxScrollPosition():Number{ return (_maxScrollPosition); } mx_internal function get linePlusDetail():String{ return (((direction == ScrollBarDirection.VERTICAL)) ? ScrollEventDetail.LINE_DOWN : ScrollEventDetail.LINE_RIGHT); } private function stage_scrollTrack_mouseMoveHandler(event:MouseEvent):void{ if (event.target != stage){ return; }; scrollTrack_mouseMoveHandler(event); } private function upArrow_buttonDownHandler(event:FlexEvent):void{ if (isNaN(oldPosition)){ oldPosition = scrollPosition; }; lineScroll(-1); } private function scrollTrack_mouseOverHandler(event:MouseEvent):void{ if (event.target != this){ return; }; if (trackScrolling){ trackScrollTimer.start(); }; } private function scrollTrack_mouseDownHandler(event:MouseEvent):void{ if (event.target != this){ return; }; trackScrolling = true; systemManager.addEventListener(MouseEvent.MOUSE_UP, scrollTrack_mouseUpHandler, true); systemManager.addEventListener(MouseEvent.MOUSE_MOVE, scrollTrack_mouseMoveHandler, true); systemManager.stage.addEventListener(MouseEvent.MOUSE_MOVE, stage_scrollTrack_mouseMoveHandler); systemManager.stage.addEventListener(Event.MOUSE_LEAVE, scrollTrack_mouseLeaveHandler); trackPosition = event.localY; if (isNaN(oldPosition)){ oldPosition = scrollPosition; }; trackScrollRepeatDirection = (((scrollThumb.y + scrollThumb.height) < event.localY)) ? 1 : ((scrollThumb.y > event.localY)) ? -1 : 0; pageScroll(trackScrollRepeatDirection); if (!trackScrollTimer){ trackScrollTimer = new Timer(getStyle("repeatDelay"), 1); trackScrollTimer.addEventListener(TimerEvent.TIMER, trackScrollTimerHandler); }; trackScrollTimer.start(); } public function get minScrollPosition():Number{ return (_minScrollPosition); } override public function set doubleClickEnabled(value:Boolean):void{ } public function set scrollPosition(value:Number):void{ var denom:Number; var y:Number; _scrollPosition = value; if (scrollThumb){ if (!cacheAsBitmap){ cacheHeuristic = (scrollThumb.cacheHeuristic = true); }; if (!isScrolling){ value = Math.min(value, maxScrollPosition); value = Math.max(value, minScrollPosition); denom = (maxScrollPosition - minScrollPosition); y = ((((denom == 0)) || (isNaN(denom)))) ? 0 : ((((value - minScrollPosition) * (trackHeight - scrollThumb.height)) / denom) + trackY); scrollThumb.move(0, Math.round(y)); }; }; } mx_internal function pageScroll(direction:int):void{ var delta:Number; var newPos:Number; var oldPosition:Number; var detail:String; delta = ((_pageScrollSize)!=0) ? _pageScrollSize : pageSize; newPos = (_scrollPosition + (direction * delta)); if (newPos > maxScrollPosition){ newPos = maxScrollPosition; } else { if (newPos < minScrollPosition){ newPos = minScrollPosition; }; }; if (newPos != scrollPosition){ oldPosition = scrollPosition; scrollPosition = newPos; detail = ((direction < 0)) ? pageMinusDetail : pagePlusDetail; dispatchScrollEvent(oldPosition, detail); }; } private function scrollTrack_mouseLeaveHandler(event:Event):void{ var detail:String; trackScrolling = false; systemManager.removeEventListener(MouseEvent.MOUSE_UP, scrollTrack_mouseUpHandler, true); systemManager.removeEventListener(MouseEvent.MOUSE_MOVE, scrollTrack_mouseMoveHandler, true); systemManager.stage.removeEventListener(MouseEvent.MOUSE_MOVE, stage_scrollTrack_mouseMoveHandler); systemManager.stage.removeEventListener(Event.MOUSE_LEAVE, scrollTrack_mouseLeaveHandler); if (trackScrollTimer){ trackScrollTimer.reset(); }; if (event.target != this){ return; }; detail = ((oldPosition > scrollPosition)) ? pageMinusDetail : pagePlusDetail; dispatchScrollEvent(oldPosition, detail); oldPosition = NaN; } private function get trackHeight():Number{ return ((virtualHeight - (upArrow.getExplicitOrMeasuredHeight() + downArrow.getExplicitOrMeasuredHeight()))); } public function set pageSize(value:Number):void{ _pageSize = value; } mx_internal function get pagePlusDetail():String{ return (((direction == ScrollBarDirection.VERTICAL)) ? ScrollEventDetail.PAGE_DOWN : ScrollEventDetail.PAGE_RIGHT); } override public function set enabled(value:Boolean):void{ super.enabled = value; invalidateDisplayList(); } mx_internal function get pageMinusDetail():String{ return (((direction == ScrollBarDirection.VERTICAL)) ? ScrollEventDetail.PAGE_UP : ScrollEventDetail.PAGE_LEFT); } private function get maxDetail():String{ return (((direction == ScrollBarDirection.VERTICAL)) ? ScrollEventDetail.AT_BOTTOM : ScrollEventDetail.AT_RIGHT); } private function scrollTrack_mouseOutHandler(event:MouseEvent):void{ if (trackScrolling){ trackScrollTimer.stop(); }; } mx_internal function dispatchScrollEvent(oldPosition:Number, detail:String):void{ var event:ScrollEvent; event = new ScrollEvent(ScrollEvent.SCROLL); event.detail = detail; event.position = scrollPosition; event.delta = (scrollPosition - oldPosition); event.direction = direction; dispatchEvent(event); } public function set lineScrollSize(value:Number):void{ _lineScrollSize = value; } public function set direction(value:String):void{ _direction = value; invalidateSize(); invalidateDisplayList(); dispatchEvent(new Event("directionChanged")); } public function get scrollPosition():Number{ return (_scrollPosition); } override protected function createChildren():void{ var scrollTrackClass:Class; super.createChildren(); if (!scrollTrack){ scrollTrackClass = getStyle("trackSkin"); scrollTrack = new (scrollTrackClass); if ((scrollTrack is ISimpleStyleClient)){ ISimpleStyleClient(scrollTrack).styleName = this; }; addChild(scrollTrack); }; if (!upArrow){ upArrow = new Button(); upArrow.enabled = false; upArrow.autoRepeat = true; upArrow.focusEnabled = false; upArrow.upSkinName = "upArrowUpSkin"; upArrow.overSkinName = "upArrowOverSkin"; upArrow.downSkinName = "upArrowDownSkin"; upArrow.disabledSkinName = "upArrowDisabledSkin"; upArrow.upIconName = ""; upArrow.overIconName = ""; upArrow.downIconName = ""; upArrow.disabledIconName = ""; addChild(upArrow); upArrow.styleName = this; upArrow.validateProperties(); upArrow.addEventListener(FlexEvent.BUTTON_DOWN, upArrow_buttonDownHandler); }; if (!downArrow){ downArrow = new Button(); downArrow.enabled = false; downArrow.autoRepeat = true; downArrow.focusEnabled = false; downArrow.upSkinName = "downArrowUpSkin"; downArrow.overSkinName = "downArrowOverSkin"; downArrow.downSkinName = "downArrowDownSkin"; downArrow.disabledSkinName = "downArrowDisabledSkin"; downArrow.upIconName = ""; downArrow.overIconName = ""; downArrow.downIconName = ""; downArrow.disabledIconName = ""; addChild(downArrow); downArrow.styleName = this; downArrow.validateProperties(); downArrow.addEventListener(FlexEvent.BUTTON_DOWN, downArrow_buttonDownHandler); }; } public function set maxScrollPosition(value:Number):void{ _maxScrollPosition = value; } public function get pageSize():Number{ return (_pageSize); } public function get direction():String{ return (_direction); } public function get lineScrollSize():Number{ return (_lineScrollSize); } mx_internal function lineScroll(direction:int):void{ var delta:Number; var newPos:Number; var oldPosition:Number; var detail:String; delta = _lineScrollSize; newPos = (_scrollPosition + (direction * delta)); if (newPos > maxScrollPosition){ newPos = maxScrollPosition; } else { if (newPos < minScrollPosition){ newPos = minScrollPosition; }; }; if (newPos != scrollPosition){ oldPosition = scrollPosition; scrollPosition = newPos; detail = ((direction < 0)) ? lineMinusDetail : linePlusDetail; dispatchScrollEvent(oldPosition, detail); }; } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ if ($height == 1){ return; }; if (!upArrow){ return; }; super.updateDisplayList(unscaledWidth, unscaledHeight); if (cacheAsBitmap){ cacheHeuristic = (scrollThumb.cacheHeuristic = false); }; upArrow.move(0, 0); upArrow.setActualSize(upArrow.getExplicitOrMeasuredWidth(), upArrow.getExplicitOrMeasuredHeight()); scrollTrack.y = 0; scrollTrack.height = virtualHeight; downArrow.move(0, (virtualHeight - downArrow.getExplicitOrMeasuredHeight())); downArrow.setActualSize(downArrow.getExplicitOrMeasuredWidth(), downArrow.getExplicitOrMeasuredHeight()); setScrollProperties(pageSize, minScrollPosition, maxScrollPosition, _pageScrollSize); scrollPosition = _scrollPosition; } private function scrollTrack_mouseMoveHandler(event:MouseEvent):void{ var pt:Point; if (trackScrolling){ pt = new Point(event.stageX, event.stageY); pt = globalToLocal(pt); trackPosition = pt.y; }; } } }//package mx.controls.scrollClasses
Section 30
//ScrollBarDirection (mx.controls.scrollClasses.ScrollBarDirection) package mx.controls.scrollClasses { import mx.core.*; public final class ScrollBarDirection { public static const HORIZONTAL:String = "horizontal"; public static const VERTICAL:String = "vertical"; mx_internal static const VERSION:String = "2.0.1.0"; public function ScrollBarDirection(){ super(); } } }//package mx.controls.scrollClasses
Section 31
//ScrollThumb (mx.controls.scrollClasses.ScrollThumb) package mx.controls.scrollClasses { import flash.events.*; import mx.core.*; import flash.geom.*; import mx.events.*; import mx.controls.*; public class ScrollThumb extends Button { private var lastY:Number; private var datamax:Number; private var datamin:Number; private var ymax:Number; private var ymin:Number; mx_internal static const VERSION:String = "2.0.1.0"; public function ScrollThumb(){ super(); explicitMinHeight = 10; stickyHighlighting = true; } private function mouseMoveHandler(event:MouseEvent):void{ var pt:Point; var scrollMove:Number; var scrollBar:ScrollBar; var oldPosition:Number; var pos:Number; if (ymin == ymax){ return; }; pt = new Point(event.stageX, event.stageY); pt = globalToLocal(pt); scrollMove = (pt.y - lastY); scrollMove = (scrollMove + y); if (scrollMove < ymin){ scrollMove = ymin; } else { if (scrollMove > ymax){ scrollMove = ymax; }; }; scrollBar = ScrollBar(parent); scrollBar.isScrolling = true; $y = scrollMove; oldPosition = scrollBar.scrollPosition; pos = (Math.round((((datamax - datamin) * (y - ymin)) / (ymax - ymin))) + datamin); scrollBar.scrollPosition = pos; scrollBar.dispatchScrollEvent(oldPosition, ScrollEventDetail.THUMB_TRACK); } override protected function measure():void{ super.measure(); measuredWidth = 14; measuredHeight = 10; } mx_internal function setRange(ymin:Number, ymax:Number, datamin:Number, datamax:Number):void{ this.ymin = ymin; this.ymax = ymax; this.datamin = datamin; this.datamax = datamax; } override protected function mouseDownHandler(event:MouseEvent):void{ var scrollBar:ScrollBar; super.mouseDownHandler(event); scrollBar = ScrollBar(parent); scrollBar.oldPosition = scrollBar.scrollPosition; lastY = event.localY; systemManager.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler, true); systemManager.stage.addEventListener(MouseEvent.MOUSE_MOVE, stage_mouseMoveHandler); } override mx_internal function buttonReleased():void{ super.buttonReleased(); stopDragThumb(); } private function stopDragThumb():void{ var scrollBar:ScrollBar; scrollBar = ScrollBar(parent); scrollBar.isScrolling = false; scrollBar.dispatchScrollEvent(scrollBar.oldPosition, ScrollEventDetail.THUMB_POSITION); scrollBar.oldPosition = NaN; systemManager.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler, true); systemManager.stage.removeEventListener(MouseEvent.MOUSE_MOVE, stage_mouseMoveHandler); } private function stage_mouseMoveHandler(event:MouseEvent):void{ if (event.target != stage){ return; }; mouseMoveHandler(event); } } }//package mx.controls.scrollClasses
Section 32
//Button (mx.controls.Button) package mx.controls { import flash.events.*; import mx.core.*; import flash.display.*; import flash.utils.*; import mx.styles.*; import mx.events.*; import mx.managers.*; import flash.text.*; import mx.controls.listClasses.*; import mx.skins.*; import mx.controls.dataGridClasses.*; import flash.ui.*; public class Button extends UIComponent implements IDataRenderer, IDropInListItemRenderer, IFocusManagerComponent, IListItemRenderer { private var enabledChanged:Boolean;// = false private var skinMeasuredWidth:Number; mx_internal var disabledSkinName:String;// = "disabledSkin" mx_internal var downSkinName:String;// = "downSkin" mx_internal var _labelPlacement:String;// = "right" private var _data:Object; private var _phase:String;// = "up" mx_internal var _toggle:Boolean;// = false mx_internal var selectedOverSkinName:String;// = "selectedOverSkin" mx_internal var selectedDisabledSkinName:String;// = "selectedDisabledSkin" private var labelSet:Boolean; mx_internal var toggleChanged:Boolean;// = false private var labelChanged:Boolean;// = false private var autoRepeatTimer:Timer; mx_internal var disabledIconName:String;// = "disabledIcon" mx_internal var upSkinName:String;// = "upSkin" private var toolTipSet:Boolean;// = false mx_internal var downIconName:String;// = "downIcon" mx_internal var currentIcon:IFlexDisplayObject; private var styleChangedFlag:Boolean;// = true private var _autoRepeat:Boolean;// = false mx_internal var selectedOverIconName:String;// = "selectedOverIcon" private var _label:String;// = "" mx_internal var selectedDisabledIconName:String;// = "selectedDisabledIcon" mx_internal var extraSpacing:Number; mx_internal var selectedUpSkinName:String;// = "selectedUpSkin" mx_internal var upIconName:String;// = "upIcon" mx_internal var buttonOffset:Number;// = 0 private var skinMeasuredHeight:Number; mx_internal var centerContent:Boolean;// = true private var oldUnscaledWidth:Number; private var skins:Array; mx_internal var overSkinName:String;// = "overSkin" mx_internal var currentSkin:IFlexDisplayObject; mx_internal var selectedDownSkinName:String;// = "selectedDownSkin" private var _listData:BaseListData; mx_internal var iconName:String;// = "icon" mx_internal var _emphasized:Boolean;// = false public var selectedField:String;// = null private var icons:Array; public var stickyHighlighting:Boolean;// = false mx_internal var selectedUpIconName:String;// = "selectedUpIcon" mx_internal var selectedDownIconName:String;// = "selectedDownIcon" mx_internal var overIconName:String;// = "overIcon" private var selectedSet:Boolean; protected var textField:UITextField; mx_internal var _selected:Boolean;// = false mx_internal static const VERSION:String = "2.0.1.0"; mx_internal static var createAccessibilityImplementation:Function; public function Button(){ skins = []; icons = []; buttonOffset = 0; centerContent = true; extraSpacing = (10 + 10); styleChangedFlag = true; upSkinName = "upSkin"; overSkinName = "overSkin"; downSkinName = "downSkin"; disabledSkinName = "disabledSkin"; selectedUpSkinName = "selectedUpSkin"; selectedOverSkinName = "selectedOverSkin"; selectedDownSkinName = "selectedDownSkin"; selectedDisabledSkinName = "selectedDisabledSkin"; iconName = "icon"; upIconName = "upIcon"; overIconName = "overIcon"; downIconName = "downIcon"; disabledIconName = "disabledIcon"; selectedUpIconName = "selectedUpIcon"; selectedOverIconName = "selectedOverIcon"; selectedDownIconName = "selectedDownIcon"; selectedDisabledIconName = "selectedDisabledIcon"; enabledChanged = false; toolTipSet = false; _autoRepeat = false; _emphasized = false; _label = ""; labelChanged = false; _labelPlacement = ButtonLabelPlacement.RIGHT; _phase = ButtonPhase.UP; _selected = false; selectedField = null; stickyHighlighting = false; _toggle = false; toggleChanged = false; super(); mouseChildren = false; addEventListener(MouseEvent.ROLL_OVER, rollOverHandler); addEventListener(MouseEvent.ROLL_OUT, rollOutHandler); addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); addEventListener(MouseEvent.CLICK, clickHandler); } override protected function adjustFocusRect(object:DisplayObject=null):void{ super.adjustFocusRect((currentSkin) ? this : DisplayObject(currentIcon)); } mx_internal function getCurrentIcon():IFlexDisplayObject{ var tempIconName:String; var newIcon:IFlexDisplayObject; var newIconClass:Class; tempIconName = getCurrentIconName(); if (!tempIconName){ return (null); }; newIcon = IFlexDisplayObject(getChildByName(tempIconName)); if (newIcon == null){ newIconClass = Class(getStyle(tempIconName)); if (newIconClass == null){ newIconClass = Class(getStyle(iconName)); }; if (newIconClass != null){ newIcon = IFlexDisplayObject(new (newIconClass)); newIcon.name = tempIconName; if ((newIcon is ISimpleStyleClient)){ ISimpleStyleClient(newIcon).styleName = this; }; addChild(DisplayObject(newIcon)); icons.push(newIcon); }; }; return (newIcon); } mx_internal function layoutContents(unscaledWidth:Number, unscaledHeight:Number, offset:Boolean):void{ var labelWidth:Number; var labelHeight:Number; var labelX:Number; var labelY:Number; var iconWidth:Number; var iconHeight:Number; var iconX:Number; var iconY:Number; var horizontalGap:Number; var verticalGap:Number; var paddingLeft:Number; var paddingRight:Number; var paddingTop:Number; var paddingBottom:Number; var textWidth:Number; var textHeight:Number; var lineMetrics:TextLineMetrics; var n:Number; var textAlign:String; var bm:EdgeMetrics; var viewWidth:Number; var viewHeight:Number; var buffX:Number; var buffY:Number; var disp:Number; labelWidth = 0; labelHeight = 0; labelX = 0; labelY = 0; iconWidth = 0; iconHeight = 0; iconX = 0; iconY = 0; horizontalGap = 2; verticalGap = 2; paddingLeft = getStyle("paddingLeft"); paddingRight = getStyle("paddingRight"); paddingTop = getStyle("paddingTop"); paddingBottom = getStyle("paddingBottom"); textWidth = 0; textHeight = 0; if (label){ lineMetrics = measureText(label); if (lineMetrics.width > 0){ textWidth = (((paddingLeft + paddingRight) + getStyle("textIndent")) + lineMetrics.width); }; textHeight = lineMetrics.height; } else { lineMetrics = measureText("Wj"); textHeight = lineMetrics.height; }; n = (offset) ? buttonOffset : 0; textAlign = getStyle("textAlign"); bm = (((currentSkin) && ((currentSkin is RectangularBorder)))) ? RectangularBorder(currentSkin).borderMetrics : null; viewWidth = unscaledWidth; viewHeight = ((unscaledHeight - paddingTop) - paddingBottom); if (bm){ viewWidth = (viewWidth - (bm.left + bm.right)); viewHeight = (viewHeight - (bm.top + bm.bottom)); }; if (currentIcon){ iconWidth = currentIcon.width; iconHeight = currentIcon.height; }; if ((((labelPlacement == ButtonLabelPlacement.LEFT)) || ((labelPlacement == ButtonLabelPlacement.RIGHT)))){ horizontalGap = getStyle("horizontalGap"); if ((((iconWidth == 0)) || ((textWidth == 0)))){ horizontalGap = 0; }; if (textWidth > 0){ labelWidth = Math.max(((((viewWidth - iconWidth) - horizontalGap) - paddingLeft) - paddingRight), 0); textField.width = labelWidth; } else { labelWidth = 0; textField.width = labelWidth; }; labelHeight = Math.min((viewHeight + 2), (textHeight + UITextField.TEXT_HEIGHT_PADDING)); textField.height = labelHeight; if (labelPlacement == ButtonLabelPlacement.RIGHT){ labelX = (iconWidth + horizontalGap); if (centerContent){ if (textAlign == "left"){ labelX = (labelX + paddingLeft); } else { if (textAlign == "right"){ labelX = (labelX + ((((viewWidth - labelWidth) - iconWidth) - horizontalGap) - paddingLeft)); } else { disp = ((((viewWidth - labelWidth) - iconWidth) - horizontalGap) / 2); labelX = (labelX + Math.max(disp, paddingLeft)); }; }; }; iconX = (labelX - (iconWidth + horizontalGap)); if (!centerContent){ labelX = (labelX + paddingLeft); }; } else { labelX = ((((viewWidth - labelWidth) - iconWidth) - horizontalGap) - paddingRight); if (centerContent){ if (textAlign == "left"){ labelX = 2; } else { if (textAlign == "right"){ labelX--; } else { if (labelX > 0){ labelX = (labelX / 2); }; }; }; }; iconX = ((labelX + labelWidth) + horizontalGap); }; labelY = 0; iconY = labelY; if (centerContent){ iconY = (Math.round(((viewHeight - iconHeight) / 2)) + paddingTop); labelY = (Math.round(((viewHeight - labelHeight) / 2)) + paddingTop); } else { labelY = (labelY + (Math.max(0, ((viewHeight - labelHeight) / 2)) + paddingTop)); iconY = (iconY + (Math.max(0, (((viewHeight - iconHeight) / 2) - 1)) + paddingTop)); }; } else { verticalGap = getStyle("verticalGap"); if ((((iconHeight == 0)) || ((textHeight == 0)))){ verticalGap = 0; }; if (textWidth > 0){ labelWidth = Math.min(viewWidth, (textWidth + UITextField.TEXT_WIDTH_PADDING)); textField.width = labelWidth; labelHeight = Math.min(((viewHeight - iconHeight) + 1), (textHeight + 5)); textField.height = labelHeight; } else { labelWidth = 0; textField.width = labelWidth; labelHeight = 0; textField.height = labelHeight; }; labelX = ((viewWidth - labelWidth) / 2); iconX = ((viewWidth - iconWidth) / 2); if (labelPlacement == ButtonLabelPlacement.TOP){ labelY = (((viewHeight - labelHeight) - iconHeight) - verticalGap); if (((centerContent) && ((labelY > 0)))){ labelY = (labelY / 2); }; labelY = (labelY + paddingTop); iconY = (((labelY + labelHeight) + verticalGap) - 3); } else { labelY = ((iconHeight + verticalGap) + paddingTop); if (centerContent){ labelY = (labelY + (((((viewHeight - labelHeight) - iconHeight) - verticalGap) / 2) + 1)); }; iconY = (((labelY - iconHeight) - verticalGap) + 3); }; }; buffX = n; buffY = n; if (bm){ buffX = (buffX + bm.left); buffY = (buffY + bm.top); }; textField.x = (labelX + buffX); textField.y = (labelY + buffY); if (currentIcon){ iconX = (iconX + buffX); iconY = (iconY + buffY); currentIcon.x = Math.round(iconX); currentIcon.y = Math.round(iconY); }; if (currentSkin){ setChildIndex(DisplayObject(currentSkin), (numChildren - 1)); }; if (currentIcon){ setChildIndex(DisplayObject(currentIcon), (numChildren - 1)); }; if (textField){ setChildIndex(textField, (numChildren - 1)); }; } override protected function keyDownHandler(event:KeyboardEvent):void{ if (!enabled){ return; }; if (event.keyCode == Keyboard.SPACE){ buttonPressed(); }; } public function get autoRepeat():Boolean{ return (_autoRepeat); } protected function rollOutHandler(event:MouseEvent):void{ if (phase == ButtonPhase.OVER){ phase = ButtonPhase.UP; event.updateAfterEvent(); } else { if ((((phase == ButtonPhase.DOWN)) && (!(stickyHighlighting)))){ phase = ButtonPhase.OVER; event.updateAfterEvent(); if (autoRepeatTimer){ autoRepeatTimer.stop(); }; }; }; } override protected function keyUpHandler(event:KeyboardEvent):void{ if (!enabled){ return; }; if (event.keyCode == Keyboard.SPACE){ buttonReleased(); if (phase == ButtonPhase.DOWN){ dispatchEvent(new MouseEvent(MouseEvent.CLICK)); }; phase = ButtonPhase.UP; }; } public function set autoRepeat(value:Boolean):void{ _autoRepeat = value; if (value){ autoRepeatTimer = new Timer(1); } else { autoRepeatTimer = null; }; } mx_internal function buttonPressed():void{ phase = ButtonPhase.DOWN; dispatchEvent(new FlexEvent(FlexEvent.BUTTON_DOWN)); if (autoRepeat){ autoRepeatTimer.delay = getStyle("repeatDelay"); autoRepeatTimer.addEventListener(TimerEvent.TIMER, autoRepeatTimer_timerDelayHandler); autoRepeatTimer.start(); }; } mx_internal function viewIcon():void{ var tempIconName:String; tempIconName = getCurrentIconName(); viewIconForPhase(tempIconName); } mx_internal function changeSkins():void{ var n:int; var i:int; n = skins.length; i = 0; while (i < n) { removeChild(skins[i]); i++; }; skins = []; } private function autoRepeatTimer_timerHandler(event:Event):void{ if (!enabled){ return; }; dispatchEvent(new FlexEvent(FlexEvent.BUTTON_DOWN)); } private function systemManager_mouseUpHandler(event:MouseEvent):void{ if (contains(DisplayObject(event.target))){ return; }; phase = ButtonPhase.UP; buttonReleased(); event.updateAfterEvent(); } protected function mouseUpHandler(event:MouseEvent):void{ if (!enabled){ return; }; phase = ButtonPhase.OVER; buttonReleased(); event.updateAfterEvent(); } public function set labelPlacement(value:String):void{ _labelPlacement = value; invalidateSize(); invalidateDisplayList(); dispatchEvent(new Event("labelPlacementChanged")); } mx_internal function viewIconForPhase(tempIconName:String):void{ var newIcon:IFlexDisplayObject; var newIconClass:Class; newIcon = IFlexDisplayObject(getChildByName(tempIconName)); if (newIcon == null){ newIconClass = Class(getStyle(tempIconName)); if (newIconClass == null){ newIconClass = Class(getStyle(iconName)); }; if (newIconClass != null){ newIcon = IFlexDisplayObject(new (newIconClass)); newIcon.name = tempIconName; if ((newIcon is ISimpleStyleClient)){ ISimpleStyleClient(newIcon).styleName = this; }; addChild(DisplayObject(newIcon)); icons.push(newIcon); }; }; if (currentIcon != null){ currentIcon.visible = false; }; currentIcon = newIcon; if (currentIcon != null){ currentIcon.visible = true; }; } mx_internal function getTextField():UITextField{ return (textField); } mx_internal function setSelected(value:Boolean):void{ if (_selected != value){ _selected = value; invalidateDisplayList(); if (toggle){ dispatchEvent(new Event(Event.CHANGE)); }; dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT)); }; } protected function clickHandler(event:MouseEvent):void{ if (!enabled){ event.stopImmediatePropagation(); return; }; if (toggle){ setSelected(!(selected)); }; } mx_internal function getCurrentIconName():String{ var tempIconName:String; if (!enabled){ tempIconName = (selected) ? selectedDisabledIconName : disabledIconName; } else { if (phase == ButtonPhase.UP){ tempIconName = (selected) ? selectedUpIconName : upIconName; } else { if (phase == ButtonPhase.OVER){ tempIconName = (selected) ? selectedOverIconName : overIconName; } else { if (phase == ButtonPhase.DOWN){ tempIconName = (selected) ? selectedDownIconName : downIconName; }; }; }; }; return (tempIconName); } public function get emphasized():Boolean{ return (_emphasized); } override protected function measure():void{ var textWidth:Number; var textHeight:Number; var bm:EdgeMetrics; var tempCurrentIcon:IFlexDisplayObject; var iconWidth:Number; var iconHeight:Number; var w:Number; var h:Number; var lineMetrics:TextLineMetrics; super.measure(); textWidth = 0; textHeight = 0; if (label){ lineMetrics = measureText(label); textWidth = lineMetrics.width; textHeight = lineMetrics.height; textWidth = (textWidth + ((getStyle("paddingLeft") + getStyle("paddingRight")) + getStyle("textIndent"))); textHeight = (textHeight + (getStyle("paddingTop") + getStyle("paddingBottom"))); }; bm = currentSkin["borderMetrics"]; //unresolved jump var _slot1 = e; bm = new EdgeMetrics(3, 3, 3, 3); tempCurrentIcon = getCurrentIcon(); iconWidth = (tempCurrentIcon) ? tempCurrentIcon.width : 0; iconHeight = (tempCurrentIcon) ? tempCurrentIcon.height : 0; w = 0; h = 0; if ((((labelPlacement == ButtonLabelPlacement.LEFT)) || ((labelPlacement == ButtonLabelPlacement.RIGHT)))){ w = (textWidth + iconWidth); if (iconWidth != 0){ w = (w + (getStyle("horizontalGap") - 2)); }; h = Math.max(textHeight, (iconHeight + 6)); } else { w = Math.max(textWidth, iconWidth); h = (textHeight + iconHeight); if (iconHeight != 0){ h = (h + getStyle("verticalGap")); }; }; if (bm){ w = (w + (bm.left + bm.right)); h = (h + (bm.top + bm.bottom)); }; if (((label) && (!((label.length == 0))))){ w = (w + extraSpacing); } else { w = (w + 6); }; if (((currentSkin) && (((isNaN(skinMeasuredWidth)) || (isNaN(skinMeasuredHeight)))))){ skinMeasuredWidth = currentSkin.measuredWidth; skinMeasuredHeight = currentSkin.measuredHeight; }; if (!isNaN(skinMeasuredWidth)){ w = Math.max(skinMeasuredWidth, w); }; if (!isNaN(skinMeasuredHeight)){ h = Math.max(skinMeasuredHeight, h); }; measuredMinWidth = (measuredWidth = w); measuredMinHeight = (measuredHeight = h); } mx_internal function get phase():String{ return (_phase); } public function set selected(value:Boolean):void{ selectedSet = true; setSelected(value); } mx_internal function changeIcons():void{ var n:int; var i:int; n = icons.length; i = 0; while (i < n) { removeChild(icons[i]); i++; }; icons = []; } override protected function commitProperties():void{ super.commitProperties(); if (!initialized){ viewSkin(); viewIcon(); }; if (enabledChanged){ textField.enabled = enabled; enabledChanged = false; }; if (toggleChanged){ if (!toggle){ selected = false; }; toggleChanged = false; }; } public function get listData():BaseListData{ return (_listData); } mx_internal function viewSkin():void{ var skinName:String; if (!enabled){ skinName = (selected) ? selectedDisabledSkinName : disabledSkinName; } else { if (phase == ButtonPhase.UP){ skinName = (selected) ? selectedUpSkinName : upSkinName; } else { if (phase == ButtonPhase.OVER){ skinName = (selected) ? selectedOverSkinName : overSkinName; } else { if (phase == ButtonPhase.DOWN){ skinName = (selected) ? selectedDownSkinName : downSkinName; }; }; }; }; viewSkinForPhase(skinName); } public function set label(value:String):void{ labelSet = true; if (_label != value){ _label = value; labelChanged = true; invalidateSize(); invalidateDisplayList(); dispatchEvent(new Event("labelChanged")); }; } mx_internal function viewSkinForPhase(skinName:String):void{ var newSkin:IFlexDisplayObject; var labelColor:Number; var newSkinClass:Class; var styleableSkin:ISimpleStyleClient; newSkin = IFlexDisplayObject(getChildByName(skinName)); if (!newSkin){ newSkinClass = Class(getStyle(skinName)); if (newSkinClass){ newSkin = IFlexDisplayObject(new (newSkinClass)); newSkin.name = skinName; styleableSkin = (newSkin as ISimpleStyleClient); if (styleableSkin){ styleableSkin.styleName = this; }; addChild(DisplayObject(newSkin)); newSkin.setActualSize(unscaledWidth, unscaledHeight); if ((((newSkin is IInvalidating)) && (initialized))){ IInvalidating(newSkin).validateNow(); } else { if ((((newSkin is ProgrammaticSkin)) && (initialized))){ ProgrammaticSkin(newSkin).validateDisplayList(); }; }; skins.push(newSkin); }; }; if (currentSkin){ currentSkin.visible = false; }; currentSkin = newSkin; if (currentSkin){ currentSkin.visible = true; }; if (enabled){ if (phase == ButtonPhase.OVER){ labelColor = textField.getStyle("textRollOverColor"); } else { if (phase == ButtonPhase.DOWN){ labelColor = textField.getStyle("textSelectedColor"); } else { labelColor = textField.getStyle("color"); }; }; textField.setColor(labelColor); }; } private function autoRepeatTimer_timerDelayHandler(event:Event):void{ if (!enabled){ return; }; dispatchEvent(new FlexEvent(FlexEvent.BUTTON_DOWN)); if (autoRepeat){ autoRepeatTimer.reset(); autoRepeatTimer.removeEventListener(TimerEvent.TIMER, autoRepeatTimer_timerDelayHandler); autoRepeatTimer.delay = getStyle("repeatInterval"); autoRepeatTimer.addEventListener(TimerEvent.TIMER, autoRepeatTimer_timerHandler); autoRepeatTimer.start(); }; } protected function mouseDownHandler(event:MouseEvent):void{ if (!enabled){ return; }; systemManager.addEventListener(MouseEvent.MOUSE_UP, systemManager_mouseUpHandler, true); systemManager.stage.addEventListener(Event.MOUSE_LEAVE, stage_mouseLeaveHandler); buttonPressed(); event.updateAfterEvent(); } override public function set enabled(value:Boolean):void{ if (super.enabled == value){ return; }; super.enabled = value; enabledChanged = true; invalidateProperties(); invalidateDisplayList(); } public function get labelPlacement():String{ return (_labelPlacement); } override public function get baselinePosition():Number{ var t:String; var lineMetrics:TextLineMetrics; t = label; if (!t){ t = "Wj"; }; validateNow(); if (((!(label)) && ((((labelPlacement == ButtonLabelPlacement.TOP)) || ((labelPlacement == ButtonLabelPlacement.BOTTOM)))))){ lineMetrics = measureText(t); return ((((measuredHeight - lineMetrics.height) / 2) + lineMetrics.ascent)); }; return ((textField.y + measureText(t).ascent)); } public function set toggle(value:Boolean):void{ _toggle = value; toggleChanged = true; invalidateProperties(); invalidateDisplayList(); dispatchEvent(new Event("toggleChanged")); } public function set emphasized(value:Boolean):void{ _emphasized = value; changeSkins(); invalidateDisplayList(); } public function get selected():Boolean{ return (_selected); } mx_internal function buttonReleased():void{ systemManager.removeEventListener(MouseEvent.MOUSE_UP, systemManager_mouseUpHandler, true); systemManager.stage.removeEventListener(Event.MOUSE_LEAVE, stage_mouseLeaveHandler); if (autoRepeatTimer){ autoRepeatTimer.removeEventListener(TimerEvent.TIMER, autoRepeatTimer_timerDelayHandler); autoRepeatTimer.removeEventListener(TimerEvent.TIMER, autoRepeatTimer_timerHandler); autoRepeatTimer.reset(); }; } public function set listData(value:BaseListData):void{ _listData = value; } mx_internal function set phase(value:String):void{ _phase = value; invalidateSize(); invalidateDisplayList(); } private function stage_mouseLeaveHandler(event:Event):void{ phase = ButtonPhase.UP; buttonReleased(); } public function get label():String{ return (_label); } override protected function focusOutHandler(event:FocusEvent):void{ super.focusOutHandler(event); if (phase != ButtonPhase.UP){ phase = ButtonPhase.UP; }; } override protected function createChildren():void{ super.createChildren(); if (!textField){ textField = new UITextField(); textField.styleName = this; addChild(textField); }; } protected function rollOverHandler(event:MouseEvent):void{ if (phase == ButtonPhase.UP){ if (event.buttonDown){ return; }; phase = ButtonPhase.OVER; event.updateAfterEvent(); } else { if (phase == ButtonPhase.OVER){ phase = ButtonPhase.DOWN; event.updateAfterEvent(); if (autoRepeatTimer){ autoRepeatTimer.start(); }; }; }; } public function set data(value:Object):void{ var newSelected:*; var newLabel:*; _data = value; if (((_listData) && ((_listData is DataGridListData)))){ newSelected = _data[DataGridListData(_listData).dataField]; newLabel = ""; } else { if (_listData){ if (selectedField){ newSelected = _data[selectedField]; }; newLabel = _listData.label; } else { newSelected = _data; }; }; if (((!((newSelected === undefined))) && (!(selectedSet)))){ selected = (newSelected as Boolean); selectedSet = false; }; if (((!((newLabel === undefined))) && (!(labelSet)))){ label = newLabel; labelSet = false; }; dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE)); } override protected function initializeAccessibility():void{ if (Button.createAccessibilityImplementation != null){ Button.createAccessibilityImplementation(this); }; } public function get data():Object{ if (!_data){ _data = {}; }; return (_data); } public function get toggle():Boolean{ return (_toggle); } override public function styleChanged(styleProp:String):void{ styleChangedFlag = true; super.styleChanged(styleProp); if (((!(styleProp)) || ((styleProp == "styleName")))){ changeSkins(); changeIcons(); } else { if (styleProp.toLowerCase().indexOf("skin") != -1){ changeSkins(); } else { if (styleProp.toLowerCase().indexOf("icon") != -1){ changeIcons(); invalidateSize(); }; }; }; } override public function set toolTip(value:String):void{ super.toolTip = value; if (value){ toolTipSet = true; } else { toolTipSet = false; invalidateDisplayList(); }; } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ var n:int; var i:int; var skin:IFlexDisplayObject; var truncated:Boolean; super.updateDisplayList(unscaledWidth, unscaledHeight); n = skins.length; i = 0; while (i < n) { skin = IFlexDisplayObject(skins[i]); skin.setActualSize(unscaledWidth, unscaledHeight); i++; }; viewSkin(); viewIcon(); if (((currentIcon) && ((currentIcon is IUIComponent)))){ IUIComponent(currentIcon).enabled = enabled; }; layoutContents(unscaledWidth, unscaledHeight, (phase == ButtonPhase.DOWN)); if ((((((((oldUnscaledWidth > unscaledWidth)) || (!((textField.text == label))))) || (labelChanged))) || (styleChangedFlag))){ textField.text = label; truncated = textField.truncateToFit(); if (!toolTipSet){ if (truncated){ super.toolTip = label; } else { super.toolTip = null; }; }; styleChangedFlag = false; labelChanged = false; }; oldUnscaledWidth = unscaledWidth; } } }//package mx.controls
Section 33
//ButtonLabelPlacement (mx.controls.ButtonLabelPlacement) package mx.controls { import mx.core.*; public final class ButtonLabelPlacement { public static const TOP:String = "top"; public static const LEFT:String = "left"; mx_internal static const VERSION:String = "2.0.1.0"; public static const BOTTOM:String = "bottom"; public static const RIGHT:String = "right"; public function ButtonLabelPlacement(){ super(); } } }//package mx.controls
Section 34
//ButtonPhase (mx.controls.ButtonPhase) package mx.controls { import mx.core.*; public final class ButtonPhase { public static const DOWN:String = "down"; public static const OVER:String = "over"; mx_internal static const VERSION:String = "2.0.1.0"; public static const UP:String = "up"; public function ButtonPhase(){ super(); } } }//package mx.controls
Section 35
//HScrollBar (mx.controls.HScrollBar) package mx.controls { import mx.core.*; import mx.controls.scrollClasses.*; import flash.ui.*; public class HScrollBar extends ScrollBar { mx_internal static const VERSION:String = "2.0.1.0"; public function HScrollBar(){ super(); super.direction = ScrollBarDirection.HORIZONTAL; scaleX = -1; rotation = -90; } override mx_internal function get virtualHeight():Number{ return (unscaledWidth); } override mx_internal function isScrollBarKey(key:uint):Boolean{ if (key == Keyboard.LEFT){ lineScroll(-1); return (true); }; if (key == Keyboard.RIGHT){ lineScroll(1); return (true); }; return (super.isScrollBarKey(key)); } override protected function measure():void{ super.measure(); measuredWidth = _minHeight; measuredHeight = _minWidth; } override public function get minHeight():Number{ return (_minWidth); } override public function get minWidth():Number{ return (_minHeight); } override public function set direction(value:String):void{ } } }//package mx.controls
Section 36
//ToolTip (mx.controls.ToolTip) package mx.controls { import mx.core.*; import flash.display.*; import mx.styles.*; import flash.text.*; import mx.skins.*; public class ToolTip extends UIComponent implements IToolTip { mx_internal var border:IFlexDisplayObject; private var textChanged:Boolean; private var _text:String; protected var textField:UITextField; mx_internal static const VERSION:String = "2.0.1.0"; public static var maxWidth:Number = 300; public function ToolTip(){ super(); mouseEnabled = false; } mx_internal function getTextField():UITextField{ return (textField); } public function get text():String{ return (_text); } override protected function measure():void{ var bm:EdgeMetrics; var leftInset:Number; var topInset:Number; var rightInset:Number; var bottomInset:Number; var widthSlop:Number; var heightSlop:Number; super.measure(); bm = borderMetrics; leftInset = (bm.left + getStyle("paddingLeft")); topInset = (bm.top + getStyle("paddingTop")); rightInset = (bm.right + getStyle("paddingRight")); bottomInset = (bm.bottom + getStyle("paddingBottom")); widthSlop = (leftInset + rightInset); heightSlop = (topInset + bottomInset); textField.wordWrap = false; if ((textField.textWidth + widthSlop) > ToolTip.maxWidth){ textField.width = (ToolTip.maxWidth - widthSlop); textField.wordWrap = true; }; measuredWidth = (textField.width + widthSlop); measuredHeight = (textField.height + heightSlop); } override protected function commitProperties():void{ var textFormat:TextFormat; super.commitProperties(); if (textChanged){ textFormat = textField.getTextFormat(); textFormat.leftMargin = 0; textFormat.rightMargin = 0; textField.defaultTextFormat = textFormat; textField.text = _text; textChanged = false; }; } public function set text(value:String):void{ _text = value; textChanged = true; invalidateProperties(); invalidateSize(); invalidateDisplayList(); } override protected function createChildren():void{ var borderClass:Class; super.createChildren(); if (!border){ borderClass = getStyle("borderSkin"); border = new (borderClass); if ((border is ISimpleStyleClient)){ ISimpleStyleClient(border).styleName = this; }; addChild(DisplayObject(border)); }; if (!textField){ textField = new UITextField(); textField.autoSize = TextFieldAutoSize.LEFT; textField.mouseEnabled = false; textField.multiline = true; textField.selectable = false; textField.wordWrap = false; textField.styleName = this; addChild(textField); }; } private function get borderMetrics():EdgeMetrics{ if ((border is RectangularBorder)){ return (RectangularBorder(border).borderMetrics); }; return (EdgeMetrics.EMPTY); } override public function styleChanged(styleProp:String):void{ super.styleChanged(styleProp); if ((((((styleProp == "borderStyle")) || ((styleProp == "styleName")))) || ((styleProp == null)))){ invalidateDisplayList(); }; } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ var bm:EdgeMetrics; var leftInset:Number; var topInset:Number; var rightInset:Number; var bottomInset:Number; var widthSlop:Number; var heightSlop:Number; super.updateDisplayList(unscaledWidth, unscaledHeight); bm = borderMetrics; leftInset = (bm.left + getStyle("paddingLeft")); topInset = (bm.top + getStyle("paddingTop")); rightInset = (bm.right + getStyle("paddingRight")); bottomInset = (bm.bottom + getStyle("paddingBottom")); widthSlop = (leftInset + rightInset); heightSlop = (topInset + bottomInset); border.setActualSize(unscaledWidth, unscaledHeight); textField.move(leftInset, topInset); textField.setActualSize((unscaledWidth - widthSlop), (unscaledHeight - heightSlop)); } } }//package mx.controls
Section 37
//VScrollBar (mx.controls.VScrollBar) package mx.controls { import mx.core.*; import mx.controls.scrollClasses.*; import flash.ui.*; public class VScrollBar extends ScrollBar { mx_internal static const VERSION:String = "2.0.1.0"; public function VScrollBar(){ super(); super.direction = ScrollBarDirection.VERTICAL; } override mx_internal function isScrollBarKey(key:uint):Boolean{ if (key == Keyboard.UP){ lineScroll(-1); return (true); }; if (key == Keyboard.DOWN){ lineScroll(1); return (true); }; if (key == Keyboard.PAGE_UP){ pageScroll(-1); return (true); }; if (key == Keyboard.PAGE_DOWN){ pageScroll(1); return (true); }; return (super.isScrollBarKey(key)); } override protected function measure():void{ super.measure(); measuredWidth = _minWidth; measuredHeight = _minHeight; } override public function get minHeight():Number{ return (_minHeight); } override public function get minWidth():Number{ return (_minWidth); } override public function set direction(value:String):void{ } } }//package mx.controls
Section 38
//Application (mx.core.Application) package mx.core { import flash.events.*; import mx.resources.*; import flash.system.*; import flash.display.*; import flash.utils.*; import mx.styles.*; import mx.events.*; import mx.managers.*; import mx.effects.*; import flash.net.*; import mx.containers.utilityClasses.*; import flash.ui.*; import flash.external.*; public class Application extends LayoutContainer { public var frameRate:Number; private var _viewSourceURL:String; public var scriptTimeLimit:Number; public var resetHistory:Boolean;// = true mx_internal var _url:String; public var preloader:Object; public var pageTitle:String; private var processingCreationQueue:Boolean;// = false private var creationQueue:Array; private var resizeWidth:Boolean;// = true public var controlBar:IUIComponent; private var _applicationViewMetrics:EdgeMetrics; private var preloadObj:Object; public var usePreloader:Boolean; private var resizeHandlerAdded:Boolean;// = false private var resizeHeight:Boolean;// = true public var scriptRecursionLimit:int; mx_internal var _parameters:Object; mx_internal static const VERSION:String = "2.0.1.0"; private static var viewSourceMenuItem:String; mx_internal static var useProgressiveLayout:Boolean = false; private static var packageResources:ResourceBundle = ResourceBundle.getResourceBundle("core", ApplicationDomain.currentDomain); public function Application(){ resizeHandlerAdded = false; creationQueue = []; processingCreationQueue = false; resizeWidth = true; resizeHeight = true; resetHistory = true; name = "application"; UIComponentGlobals.layoutManager = (Singleton.getInstance("mx.managers::ILayoutManager") as ILayoutManager); UIComponentGlobals.layoutManager.usePhasedInstantiation = true; if (!ApplicationGlobals.application){ ApplicationGlobals.application = this; }; super(); layoutObject = new ApplicationLayout(); layoutObject.target = this; boxLayoutClass = ApplicationLayout; showInAutomationHierarchy = true; } mx_internal function dockControlBar(controlBar:IUIComponent, dock:Boolean):void{ var controlBar = controlBar; var dock = dock; if (dock){ removeChild(DisplayObject(controlBar)); //unresolved jump var _slot1 = e; return; rawChildren.addChildAt(DisplayObject(controlBar), firstChildIndex); setControlBar(controlBar); } else { rawChildren.removeChild(DisplayObject(controlBar)); //unresolved jump var _slot1 = e; return; setControlBar(null); addChildAt(DisplayObject(controlBar), 0); }; } override mx_internal function initThemeColor():Boolean{ var result:Boolean; var tc:Object; var rc:Number; var sc:Number; var globalSelector:CSSStyleDeclaration; result = super.initThemeColor(); if (!result){ globalSelector = StyleManager.getStyleDeclaration("global"); if (globalSelector){ tc = globalSelector.getStyle("themeColor"); rc = globalSelector.getStyle("rollOverColor"); sc = globalSelector.getStyle("selectionColor"); }; if (((((tc) && (isNaN(rc)))) && (isNaN(sc)))){ setThemeColor(tc); }; result = true; }; return (result); } private function resizeHandler(event:Event):void{ var w:Number; var h:Number; if (resizeWidth){ if (isNaN(percentWidth)){ w = DisplayObject(systemManager).width; } else { super.percentWidth = Math.max(percentWidth, 0); super.percentWidth = Math.min(percentWidth, 100); w = ((percentWidth * screen.width) / 100); }; if (!isNaN(explicitMaxWidth)){ w = Math.min(w, explicitMaxWidth); }; if (!isNaN(explicitMinWidth)){ w = Math.max(w, explicitMinWidth); }; } else { w = width; }; if (resizeHeight){ if (isNaN(percentHeight)){ h = DisplayObject(systemManager).height; } else { super.percentHeight = Math.max(percentHeight, 0); super.percentHeight = Math.min(percentHeight, 100); h = ((percentHeight * screen.height) / 100); }; if (!isNaN(explicitMaxHeight)){ h = Math.min(h, explicitMaxHeight); }; if (!isNaN(explicitMinHeight)){ h = Math.max(h, explicitMinHeight); }; } else { h = height; }; if (((!((w == width))) || (!((h == height))))){ invalidateProperties(); invalidateSize(); }; setActualSize(w, h); invalidateDisplayList(); } override public function set tabIndex(value:int):void{ } public function set viewSourceURL(value:String):void{ _viewSourceURL = value; } override mx_internal function get usePadding():Boolean{ return (!((layout == ContainerLayout.ABSOLUTE))); } private function initContextMenu():void{ var defaultMenu:ContextMenu; var item:ContextMenuItem; defaultMenu = new ContextMenu(); defaultMenu.hideBuiltInItems(); defaultMenu.builtInItems.print = true; if (_viewSourceURL){ item = new ContextMenuItem(viewSourceMenuItem, true); item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler); defaultMenu.customItems.push(item); }; contextMenu = defaultMenu; } override public function set icon(value:Class):void{ } override public function set percentWidth(value:Number):void{ super.percentWidth = value; invalidateDisplayList(); } override public function getChildIndex(child:DisplayObject):int{ if (((controlBar) && ((child == controlBar)))){ return (-1); }; return (super.getChildIndex(child)); } override public function get id():String{ if (((((!(super.id)) && ((this == Application.application)))) && (ExternalInterface.available))){ return (ExternalInterface.objectID); }; return (super.id); } override protected function measure():void{ var bm:EdgeMetrics; var controlWidth:Number; super.measure(); bm = borderMetrics; if (((controlBar) && (controlBar.includeInLayout))){ controlWidth = ((controlBar.getExplicitOrMeasuredWidth() + bm.left) + bm.right); measuredWidth = Math.max(measuredWidth, controlWidth); measuredMinWidth = Math.max(measuredMinWidth, controlWidth); }; } public function get url():String{ return (_url); } private function debugTickler():void{ var i:int; i = 0; } override public function finishPrint(obj:Object, target:IFlexDisplayObject):void{ if (target == this){ setActualSize(obj.width, obj.height); if (horizontalScrollBar){ horizontalScrollBar.visible = obj.horizontalScrollBarVisible; }; if (verticalScrollBar){ verticalScrollBar.visible = obj.verticalScrollBarVisible; }; if (whiteBox){ whiteBox.visible = obj.whiteBoxVisible; }; horizontalScrollPosition = obj.horizontalScrollPosition; verticalScrollPosition = obj.verticalScrollPosition; updateDisplayList(unscaledWidth, unscaledHeight); }; super.finishPrint(obj.scrollRect, target); } override public function set label(value:String):void{ } public function get parameters():Object{ return (_parameters); } override public function prepareToPrint(target:IFlexDisplayObject):Object{ var objData:Object; objData = {}; if (target == this){ objData.width = width; objData.height = height; objData.verticalScrollPosition = verticalScrollPosition; objData.horizontalScrollPosition = horizontalScrollPosition; objData.horizontalScrollBarVisible = !((horizontalScrollBar == null)); objData.verticalScrollBarVisible = !((verticalScrollBar == null)); objData.whiteBoxVisible = !((whiteBox == null)); setActualSize(measuredWidth, measuredHeight); horizontalScrollPosition = 0; verticalScrollPosition = 0; if (horizontalScrollBar){ horizontalScrollBar.visible = false; }; if (verticalScrollBar){ verticalScrollBar.visible = false; }; if (whiteBox){ whiteBox.visible = false; }; updateDisplayList(unscaledWidth, unscaledHeight); }; objData.scrollRect = super.prepareToPrint(target); return (objData); } public function get viewSourceURL():String{ return (_viewSourceURL); } override protected function layoutChrome(unscaledWidth:Number, unscaledHeight:Number):void{ var bm:EdgeMetrics; var thickness:Number; var em:EdgeMetrics; super.layoutChrome(unscaledWidth, unscaledHeight); if (!doingLayout){ createBorder(); }; bm = borderMetrics; thickness = getStyle("borderThickness"); em = new EdgeMetrics(); em.left = (bm.left - thickness); em.top = (bm.top - thickness); em.right = (bm.right - thickness); em.bottom = (bm.bottom - thickness); if (((controlBar) && (controlBar.includeInLayout))){ if ((controlBar is IInvalidating)){ IInvalidating(controlBar).invalidateDisplayList(); }; controlBar.setActualSize((width - (em.left + em.right)), controlBar.getExplicitOrMeasuredHeight()); controlBar.move(em.left, em.top); }; } override public function get viewMetrics():EdgeMetrics{ var vm:EdgeMetrics; var o:EdgeMetrics; var thickness:Number; if (!_applicationViewMetrics){ _applicationViewMetrics = new EdgeMetrics(); }; vm = _applicationViewMetrics; o = super.viewMetrics; thickness = getStyle("borderThickness"); vm.left = o.left; vm.top = o.top; vm.right = o.right; vm.bottom = o.bottom; if (((controlBar) && (controlBar.includeInLayout))){ vm.top = (vm.top - thickness); vm.top = (vm.top + Math.max(controlBar.getExplicitOrMeasuredHeight(), thickness)); }; return (vm); } private function addedHandler(event:Event):void{ if ((((event.target == this)) && ((creationQueue.length > 0)))){ doNextQueueItem(); }; } private function menuItemSelectHandler(event:Event):void{ navigateToURL(new URLRequest(_viewSourceURL), "_blank"); } private function doNextQueueItem(event:FlexEvent=null):void{ processingCreationQueue = true; Application.useProgressiveLayout = true; callLater(processNextQueueItem); } private function setControlBar(newControlBar:IUIComponent):void{ if (newControlBar == controlBar){ return; }; if (((controlBar) && ((controlBar is IStyleClient)))){ IStyleClient(controlBar).clearStyle("cornerRadius"); IStyleClient(controlBar).clearStyle("docked"); }; controlBar = newControlBar; if (((controlBar) && ((controlBar is IStyleClient)))){ IStyleClient(controlBar).setStyle("cornerRadius", 0); IStyleClient(controlBar).setStyle("docked", true); }; invalidateSize(); invalidateDisplayList(); invalidateViewMetricsAndPadding(); } override public function initialize():void{ var sm:ISystemManager; var properties:Object; sm = systemManager; _url = sm.loaderInfo.url; _parameters = sm.loaderInfo.parameters; initManagers(sm); _descriptor = null; if (documentDescriptor){ (creationPolicy == documentDescriptor.properties.creationPolicy); if ((((creationPolicy == null)) || ((creationPolicy.length == 0)))){ creationPolicy = ContainerCreationPolicy.AUTO; }; properties = documentDescriptor.properties; if (properties.width != null){ width = properties.width; delete properties.width; }; if (properties.height != null){ height = properties.height; delete properties.height; }; documentDescriptor.events = null; }; initContextMenu(); super.initialize(); addEventListener(Event.ADDED, addedHandler); if (((sm.isTopLevel()) && ((Capabilities.isDebugger == true)))){ setInterval(debugTickler, 1500); }; } private function initManagers(sm:ISystemManager):void{ if (sm.isTopLevel()){ focusManager = new FocusManager(this); sm.activate(this); }; } override public function set percentHeight(value:Number):void{ super.percentHeight = value; invalidateDisplayList(); } private function printCreationQueue():void{ var msg:String; var n:Number; var i:int; var child:Object; msg = ""; n = creationQueue.length; i = 0; while (i < n) { child = creationQueue[i]; msg = (msg + (((((" [" + i) + "] ") + child.id) + " ") + child.index)); i++; }; } override public function set toolTip(value:String):void{ } override public function styleChanged(styleProp:String):void{ super.styleChanged(styleProp); if ((((styleProp == "backgroundColor")) && ((getStyle("backgroundImage") == getStyle("defaultBackgroundImage"))))){ clearStyle("backgroundImage"); }; } private function processNextQueueItem():void{ var queueItem:Object; var nextChild:IUIComponent; if (EffectManager.effectsPlaying.length > 0){ callLater(processNextQueueItem); } else { if (creationQueue.length > 0){ queueItem = creationQueue.shift(); nextChild = ((queueItem.id is String)) ? document[queueItem.id] : queueItem.id; if ((nextChild is Container)){ Container(nextChild).createComponentsFromDescriptors(true); }; if ((((nextChild is Container)) && ((Container(nextChild).creationPolicy == ContainerCreationPolicy.QUEUED)))){ doNextQueueItem(); } else { nextChild.addEventListener("childrenCreationComplete", doNextQueueItem); }; //unresolved jump var _slot1 = e; processNextQueueItem(); } else { processingCreationQueue = false; Application.useProgressiveLayout = false; }; }; } public function addToCreationQueue(id:Object, preferredIndex:int=-1, callbackFunc:Function=null, parent:IFlexDisplayObject=null):void{ var queueLength:int; var queueObj:Object; var insertedItem:Boolean; var insertIndex:int; var pointerIndex:int; var pointerLevel:int; var i:int; var parentLevel:int; queueLength = creationQueue.length; queueObj = {}; insertedItem = false; queueObj.id = id; queueObj.parent = parent; queueObj.callbackFunc = callbackFunc; queueObj.index = preferredIndex; i = 0; while (i < queueLength) { pointerIndex = creationQueue[i].index; pointerLevel = (creationQueue[i].parent) ? creationQueue[i].parent.nestLevel : 0; if (queueObj.index != -1){ if ((((pointerIndex == -1)) || ((queueObj.index < pointerIndex)))){ insertIndex = i; insertedItem = true; break; }; } else { parentLevel = (queueObj.parent) ? queueObj.parent.nestLevel : 0; if ((((pointerIndex == -1)) && ((pointerLevel < parentLevel)))){ insertIndex = i; insertedItem = true; break; }; }; i++; }; if (!insertedItem){ creationQueue.push(queueObj); insertedItem = true; } else { creationQueue.splice(insertIndex, 0, queueObj); }; if (((initialized) && (!(processingCreationQueue)))){ doNextQueueItem(); }; } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ super.updateDisplayList(unscaledWidth, unscaledHeight); resizeWidth = isNaN(explicitWidth); resizeHeight = isNaN(explicitHeight); if (((resizeWidth) || (resizeHeight))){ resizeHandler(new Event(Event.RESIZE)); if (!resizeHandlerAdded){ systemManager.addEventListener(Event.RESIZE, resizeHandler, false, 0, true); resizeHandlerAdded = true; }; } else { if (resizeHandlerAdded){ systemManager.removeEventListener(Event.RESIZE, resizeHandler); resizeHandlerAdded = false; }; }; createBorder(); } private static function loadResources():void{ viewSourceMenuItem = packageResources.getString("viewSource"); } public static function get application():Object{ return (ApplicationGlobals.application); } loadResources(); } }//package mx.core
Section 39
//ApplicationGlobals (mx.core.ApplicationGlobals) package mx.core { public class ApplicationGlobals { public static var application:Object; public function ApplicationGlobals(){ super(); } } }//package mx.core
Section 40
//BitmapAsset (mx.core.BitmapAsset) package mx.core { import flash.display.*; public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject { mx_internal static const VERSION:String = "2.0.1.0"; public function BitmapAsset(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){ super(bitmapData, pixelSnapping, smoothing); } public function get measuredWidth():Number{ if (bitmapData){ return (bitmapData.width); }; return (0); } public function get measuredHeight():Number{ if (bitmapData){ return (bitmapData.height); }; return (0); } public function setActualSize(newWidth:Number, newHeight:Number):void{ width = newWidth; height = newHeight; } public function move(x:Number, y:Number):void{ this.x = x; this.y = y; } } }//package mx.core
Section 41
//ByteArrayAsset (mx.core.ByteArrayAsset) package mx.core { import flash.utils.*; public class ByteArrayAsset extends ByteArray implements IFlexAsset { mx_internal static const VERSION:String = "2.0.1.0"; public function ByteArrayAsset(){ super(); } } }//package mx.core
Section 42
//ComponentDescriptor (mx.core.ComponentDescriptor) package mx.core { public class ComponentDescriptor { public var events:Object; public var document:Object; public var type:Class; public var propertiesFactory:Function; private var _properties:Object; public var id:String; mx_internal static const VERSION:String = "2.0.1.0"; public function ComponentDescriptor(descriptorProperties:Object){ var p:String; super(); for (p in descriptorProperties) { this[p] = descriptorProperties[p]; }; } public function toString():String{ return (("ComponentDescriptor_" + id)); } public function invalidateProperties():void{ _properties = null; } public function get properties():Object{ var cd:Array; var n:int; var i:int; if (_properties){ return (_properties); }; if (propertiesFactory != null){ _properties = propertiesFactory.call(document); }; if (_properties){ cd = _properties.childDescriptors; if (cd){ n = cd.length; i = 0; while (i < n) { cd[i].document = document; i++; }; }; } else { _properties = {}; }; return (_properties); } } }//package mx.core
Section 43
//Container (mx.core.Container) package mx.core { import flash.events.*; import mx.resources.*; import flash.system.*; import flash.display.*; import flash.geom.*; import mx.styles.*; import mx.events.*; import mx.managers.*; import flash.text.*; import mx.graphics.*; import mx.controls.scrollClasses.*; import mx.binding.*; import mx.controls.listClasses.*; import mx.skins.*; import mx.controls.*; import flash.ui.*; public class Container extends UIComponent implements IContainer, IDataRenderer, IFocusManagerContainer, IListItemRenderer, IRawChildrenContainer { private var _horizontalLineScrollSize:Number;// = 5 mx_internal var border:IFlexDisplayObject; private var _viewMetricsAndPadding:EdgeMetrics; private var scrollableWidth:Number;// = 0 private var _rawChildren:ContainerRawChildrenList; private var _data:Object; private var _viewMetrics:EdgeMetrics; private var changedStyles:String;// = null private var _verticalPageScrollSize:Number;// = 0 private var mouseEventReferenceCount:int;// = 0 protected var whiteBox:Shape; private var _verticalScrollBar:ScrollBar; private var _horizontalPageScrollSize:Number;// = 0 private var _clipContent:Boolean;// = true private var _icon:Class;// = null mx_internal var doingLayout:Boolean;// = false private var _createdComponents:Array; private var _firstChildIndex:int;// = 0 private var scrollableHeight:Number;// = 0 mx_internal var _numChildren:int;// = 0 private var recursionFlag:Boolean;// = true private var forceLayout:Boolean;// = false mx_internal var blocker:Sprite; private var _label:String;// = "" private var _numChildrenCreated:int;// = -1 protected var actualCreationPolicy:String; private var _childRepeaters:Array; private var _childDescriptors:Array; private var scrollPropertiesChanged:Boolean;// = false private var scrollPositionChanged:Boolean;// = true private var _focusPane:Sprite; private var _defaultButton:IFlexDisplayObject; private var _forceClippingCount:int; mx_internal var creatingContentPane:Boolean;// = false private var _creationPolicy:String; private var _creationIndex:int;// = -1 private var _verticalScrollPosition:Number;// = 0 private var _autoLayout:Boolean;// = true private var _horizontalScrollBar:ScrollBar; private var viewableHeight:Number;// = 0 private var viewableWidth:Number;// = 0 mx_internal var contentPane:Sprite;// = null private var numChildrenBefore:int; private var _verticalLineScrollSize:Number;// = 5 private var _horizontalScrollPosition:Number;// = 0 mx_internal var _horizontalScrollPolicy:String;// = "auto" private var verticalScrollPositionPending:Number; mx_internal var _verticalScrollPolicy:String;// = "auto" private var horizontalScrollPositionPending:Number; private static const MULTIPLE_PROPERTIES:String = "<MULTIPLE>"; mx_internal static const VERSION:String = "2.0.1.0"; private static var resourceMultipleChildSets_ClassAndInstance:String; private static var resourceMultipleChildSets_ClassAndSubclass:String; private static var resourceScrollDirection:String; private static var packageResources:ResourceBundle = ResourceBundle.getResourceBundle("core", ApplicationDomain.currentDomain); public function Container(){ recursionFlag = true; forceLayout = false; doingLayout = false; changedStyles = null; creatingContentPane = false; contentPane = null; scrollPropertiesChanged = false; scrollPositionChanged = true; scrollableWidth = 0; scrollableHeight = 0; viewableWidth = 0; viewableHeight = 0; mouseEventReferenceCount = 0; _numChildren = 0; _autoLayout = true; _clipContent = true; _creationIndex = -1; _firstChildIndex = 0; _horizontalLineScrollSize = 5; _horizontalPageScrollSize = 0; _horizontalScrollPosition = 0; _horizontalScrollPolicy = ScrollPolicy.AUTO; _icon = null; _label = ""; _numChildrenCreated = -1; _verticalLineScrollSize = 5; _verticalPageScrollSize = 0; _verticalScrollPosition = 0; _verticalScrollPolicy = ScrollPolicy.AUTO; super(); tabChildren = true; tabEnabled = false; showInAutomationHierarchy = false; } mx_internal function get firstChildIndex():int{ return (_firstChildIndex); } mx_internal function rawChildren_getObjectsUnderPoint(pt:Point):Array{ return (super.getObjectsUnderPoint(pt)); } protected function scrollChildren():void{ var vm:EdgeMetrics; var x:Number; var y:Number; var w:Number; var h:Number; var sr:Rectangle; if (!contentPane){ return; }; vm = viewMetrics; x = 0; y = 0; w = ((unscaledWidth - vm.left) - vm.right); h = ((unscaledHeight - vm.top) - vm.bottom); if (_clipContent){ x = (x + _horizontalScrollPosition); if (horizontalScrollBar){ w = viewableWidth; }; y = (y + _verticalScrollPosition); if (verticalScrollBar){ h = viewableHeight; }; } else { w = scrollableWidth; h = scrollableHeight; }; sr = getScrollableRect(); if ((((((((((((((x == 0)) && ((y == 0)))) && ((w >= sr.right)))) && ((h >= sr.bottom)))) && ((sr.left >= 0)))) && ((sr.top >= 0)))) && ((_forceClippingCount <= 0)))){ contentPane.scrollRect = null; contentPane.opaqueBackground = null; contentPane.cacheAsBitmap = false; } else { contentPane.scrollRect = new Rectangle(x, y, w, h); }; if (focusPane){ focusPane.scrollRect = contentPane.scrollRect; }; if (((((border) && ((border is RectangularBorder)))) && (RectangularBorder(border).hasBackgroundImage))){ RectangularBorder(border).adjustBackgroundImage(); }; } mx_internal function get createdComponents():Array{ return (_createdComponents); } public function get childDescriptors():Array{ return (_childDescriptors); } public function get verticalScrollPosition():Number{ if (!isNaN(verticalScrollPositionPending)){ return (verticalScrollPositionPending); }; return (_verticalScrollPosition); } mx_internal function set createdComponents(value:Array):void{ _createdComponents = value; } mx_internal function get childRepeaters():Array{ return (_childRepeaters); } public function get horizontalScrollPosition():Number{ if (!isNaN(horizontalScrollPositionPending)){ return (horizontalScrollPositionPending); }; return (_horizontalScrollPosition); } override public function get focusPane():Sprite{ return (_focusPane); } private function createOrDestroyScrollbars(needHorizontal:Boolean, needVertical:Boolean, needContentPane:Boolean):Boolean{ var changed:Boolean; var fm:IFocusManager; var horizontalScrollBarStyleName:String; var verticalScrollBarStyleName:String; var g:Graphics; changed = false; if (((((needHorizontal) || (needVertical))) || (needContentPane))){ createContentPane(); }; if (needHorizontal){ if (!horizontalScrollBar){ horizontalScrollBar = new HScrollBar(); horizontalScrollBar.name = "horizontalScrollBar"; horizontalScrollBarStyleName = getStyle("horizontalScrollBarStyleName"); if (((horizontalScrollBarStyleName) && ((horizontalScrollBar is ISimpleStyleClient)))){ ISimpleStyleClient(horizontalScrollBar).styleName = horizontalScrollBarStyleName; }; rawChildren.addChild(DisplayObject(horizontalScrollBar)); horizontalScrollBar.lineScrollSize = horizontalLineScrollSize; horizontalScrollBar.pageScrollSize = horizontalPageScrollSize; horizontalScrollBar.addEventListener(ScrollEvent.SCROLL, horizontalScrollBar_scrollHandler); horizontalScrollBar.enabled = enabled; if ((horizontalScrollBar is IInvalidating)){ IInvalidating(horizontalScrollBar).validateNow(); }; invalidateDisplayList(); invalidateViewMetricsAndPadding(); changed = true; if (!verticalScrollBar){ addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); }; }; } else { if (horizontalScrollBar){ horizontalScrollBar.removeEventListener(ScrollEvent.SCROLL, horizontalScrollBar_scrollHandler); rawChildren.removeChild(DisplayObject(horizontalScrollBar)); horizontalScrollBar = null; viewableWidth = (scrollableWidth = 0); if (_horizontalScrollPosition != 0){ _horizontalScrollPosition = 0; scrollPositionChanged = true; }; invalidateDisplayList(); invalidateViewMetricsAndPadding(); changed = true; fm = focusManager; if (((!(verticalScrollBar)) && (((!(fm)) || (!((fm.getFocus() == this))))))){ removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); }; }; }; if (needVertical){ if (!verticalScrollBar){ verticalScrollBar = new VScrollBar(); verticalScrollBar.name = "verticalScrollBar"; verticalScrollBarStyleName = getStyle("verticalScrollBarStyleName"); if (((verticalScrollBarStyleName) && ((verticalScrollBar is ISimpleStyleClient)))){ ISimpleStyleClient(verticalScrollBar).styleName = verticalScrollBarStyleName; }; rawChildren.addChild(DisplayObject(verticalScrollBar)); verticalScrollBar.lineScrollSize = verticalLineScrollSize; verticalScrollBar.pageScrollSize = verticalPageScrollSize; verticalScrollBar.addEventListener(ScrollEvent.SCROLL, verticalScrollBar_scrollHandler); verticalScrollBar.enabled = enabled; if ((verticalScrollBar is IInvalidating)){ IInvalidating(verticalScrollBar).validateNow(); }; invalidateDisplayList(); invalidateViewMetricsAndPadding(); changed = true; if (!horizontalScrollBar){ addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); }; addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler); }; } else { if (verticalScrollBar){ verticalScrollBar.removeEventListener(ScrollEvent.SCROLL, verticalScrollBar_scrollHandler); rawChildren.removeChild(DisplayObject(verticalScrollBar)); verticalScrollBar = null; viewableHeight = (scrollableHeight = 0); if (_verticalScrollPosition != 0){ _verticalScrollPosition = 0; scrollPositionChanged = true; }; invalidateDisplayList(); invalidateViewMetricsAndPadding(); changed = true; fm = focusManager; if (((!(horizontalScrollBar)) && (((!(fm)) || (!((fm.getFocus() == this))))))){ removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); }; removeEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler); }; }; if (((horizontalScrollBar) && (verticalScrollBar))){ if (!whiteBox){ whiteBox = new FlexShape(); whiteBox.name = "whiteBox"; g = whiteBox.graphics; g.beginFill(0xFFFFFF); g.drawRect(0, 0, verticalScrollBar.minWidth, horizontalScrollBar.minHeight); g.endFill(); rawChildren.addChild(whiteBox); }; } else { if (whiteBox){ rawChildren.removeChild(whiteBox); whiteBox = null; }; }; return (changed); } override protected function keyDownHandler(event:KeyboardEvent):void{ var focusObj:Object; var direction:String; var oldPos:Number; focusObj = getFocus(); if ((focusObj is TextField)){ return; }; if (verticalScrollBar){ direction = ScrollEventDirection.VERTICAL; oldPos = verticalScrollPosition; switch (event.keyCode){ case Keyboard.DOWN: verticalScrollPosition = (verticalScrollPosition + verticalLineScrollSize); dispatchScrollEvent(direction, oldPos, verticalScrollPosition, ScrollEventDetail.LINE_DOWN); event.stopPropagation(); break; case Keyboard.UP: verticalScrollPosition = (verticalScrollPosition - verticalLineScrollSize); dispatchScrollEvent(direction, oldPos, verticalScrollPosition, ScrollEventDetail.LINE_UP); event.stopPropagation(); break; case Keyboard.PAGE_UP: verticalScrollPosition = (verticalScrollPosition - verticalPageScrollSize); dispatchScrollEvent(direction, oldPos, verticalScrollPosition, ScrollEventDetail.PAGE_UP); event.stopPropagation(); break; case Keyboard.PAGE_DOWN: verticalScrollPosition = (verticalScrollPosition + verticalPageScrollSize); dispatchScrollEvent(direction, oldPos, verticalScrollPosition, ScrollEventDetail.PAGE_DOWN); event.stopPropagation(); break; case Keyboard.HOME: verticalScrollPosition = verticalScrollBar.minScrollPosition; dispatchScrollEvent(direction, oldPos, verticalScrollPosition, ScrollEventDetail.AT_TOP); event.stopPropagation(); break; case Keyboard.END: verticalScrollPosition = verticalScrollBar.maxScrollPosition; dispatchScrollEvent(direction, oldPos, verticalScrollPosition, ScrollEventDetail.AT_BOTTOM); event.stopPropagation(); break; }; }; if (horizontalScrollBar){ direction = ScrollEventDirection.HORIZONTAL; oldPos = horizontalScrollPosition; switch (event.keyCode){ case Keyboard.LEFT: horizontalScrollPosition = (horizontalScrollPosition - horizontalLineScrollSize); dispatchScrollEvent(direction, oldPos, horizontalScrollPosition, ScrollEventDetail.LINE_LEFT); event.stopPropagation(); break; case Keyboard.RIGHT: horizontalScrollPosition = (horizontalScrollPosition + horizontalLineScrollSize); dispatchScrollEvent(direction, oldPos, horizontalScrollPosition, ScrollEventDetail.LINE_RIGHT); event.stopPropagation(); break; }; }; } protected function createBorder():void{ var borderClass:Class; if (((!(border)) && (isBorderNeeded()))){ borderClass = getStyle("borderSkin"); border = new (borderClass); border.name = "border"; if ((border is IUIComponent)){ IUIComponent(border).enabled = enabled; }; if ((border is ISimpleStyleClient)){ ISimpleStyleClient(border).styleName = this; }; rawChildren.addChildAt(DisplayObject(border), 0); invalidateDisplayList(); }; } public function set verticalScrollPosition(value:Number):void{ if (_verticalScrollPosition == value){ return; }; _verticalScrollPosition = value; scrollPositionChanged = true; if (!initialized){ verticalScrollPositionPending = value; }; invalidateDisplayList(); dispatchEvent(new Event("viewChanged")); } private function horizontalScrollBar_scrollHandler(event:Event):void{ var oldPos:Number; if ((event is ScrollEvent)){ oldPos = horizontalScrollPosition; horizontalScrollPosition = horizontalScrollBar.scrollPosition; dispatchScrollEvent(ScrollEventDirection.HORIZONTAL, oldPos, horizontalScrollPosition, ScrollEvent(event).detail); }; } public function get icon():Class{ return (_icon); } public function set horizontalScrollBar(value:ScrollBar):void{ _horizontalScrollBar = value; } mx_internal function set childRepeaters(value:Array):void{ _childRepeaters = value; } public function createComponentFromDescriptor(descriptor:ComponentDescriptor, recurse:Boolean):IFlexDisplayObject{ var childDescriptor:UIComponentDescriptor; var childProperties:Object; var childType:Class; var child:IDeferredInstantiationUIComponent; var p:String; var childEvents:Object; var childEffects:Array; var rChild:IRepeaterClient; var scChild:IStyleClient; var eventName:String; var eventHandler:String; childDescriptor = UIComponentDescriptor(descriptor); childProperties = childDescriptor.properties; if (((((((!((numChildrenBefore == 0))) || (!((numChildrenCreated == -1))))) && ((childDescriptor.instanceIndices == null)))) && (hasChildMatchingDescriptor(childDescriptor)))){ return (null); }; UIComponentGlobals.layoutManager.usePhasedInstantiation = true; childType = childDescriptor.type; child = new (childType); child.id = childDescriptor.id; if (((child.id) && (!((child.id == ""))))){ child.name = child.id; }; child.descriptor = childDescriptor; if (((childProperties.childDescriptors) && ((child is Container)))){ Container(child)._childDescriptors = childProperties.childDescriptors; delete childProperties.childDescriptors; }; for (p in childProperties) { child[p] = childProperties[p]; }; if ((child is Container)){ Container(child).recursionFlag = recurse; }; if (childDescriptor.instanceIndices){ if ((child is IRepeaterClient)){ rChild = IRepeaterClient(child); rChild.instanceIndices = childDescriptor.instanceIndices; rChild.repeaters = childDescriptor.repeaters; rChild.repeaterIndices = childDescriptor.repeaterIndices; }; }; if ((child is IStyleClient)){ scChild = IStyleClient(child); if (childDescriptor.stylesFactory != null){ if (!scChild.styleDeclaration){ scChild.styleDeclaration = new CSSStyleDeclaration(); }; scChild.styleDeclaration.factory = childDescriptor.stylesFactory; }; }; childEvents = childDescriptor.events; if (childEvents){ for (eventName in childEvents) { eventHandler = childEvents[eventName]; child.addEventListener(eventName, childDescriptor.document[eventHandler]); }; }; childEffects = childDescriptor.effects; if (childEffects){ child.registerEffects(childEffects); }; if ((child is IRepeaterClient)){ IRepeaterClient(child).initializeRepeaterArrays(this); }; child.createReferenceOnParentDocument(IFlexDisplayObject(childDescriptor.document)); if (!child.document){ child.document = childDescriptor.document; }; if ((child is IRepeater)){ if (!childRepeaters){ childRepeaters = []; }; childRepeaters.push(child); child.executeBindings(); IRepeater(child).initializeRepeater(this, recurse); } else { addChild(DisplayObject(child)); child.executeBindings(); if ((((creationPolicy == ContainerCreationPolicy.QUEUED)) || ((creationPolicy == ContainerCreationPolicy.NONE)))){ child.addEventListener(FlexEvent.CREATION_COMPLETE, creationCompleteHandler); }; }; return (child); } mx_internal function get usePadding():Boolean{ return (true); } public function set horizontalScrollPosition(value:Number):void{ if (_horizontalScrollPosition == value){ return; }; _horizontalScrollPosition = value; scrollPositionChanged = true; if (!initialized){ horizontalScrollPositionPending = value; }; invalidateDisplayList(); dispatchEvent(new Event("viewChanged")); } override public function set focusPane(o:Sprite):void{ var oldInvalidateSizeFlag:Boolean; var oldInvalidateDisplayListFlag:Boolean; oldInvalidateSizeFlag = invalidateSizeFlag; oldInvalidateDisplayListFlag = invalidateDisplayListFlag; invalidateSizeFlag = true; invalidateDisplayListFlag = true; if (o){ rawChildren.addChild(o); o.x = 0; o.y = 0; o.scrollRect = null; _focusPane = o; } else { rawChildren.removeChild(_focusPane); _focusPane = null; }; if (((o) && (contentPane))){ o.x = contentPane.x; o.y = contentPane.y; o.scrollRect = contentPane.scrollRect; }; invalidateSizeFlag = oldInvalidateSizeFlag; invalidateDisplayListFlag = oldInvalidateDisplayListFlag; } public function get horizontalScrollPolicy():String{ return (_horizontalScrollPolicy); } public function get horizontalLineScrollSize():Number{ return (_horizontalLineScrollSize); } private function updateBackgroundImageRect():void{ var rectBorder:RectangularBorder; var vm:EdgeMetrics; var bkWidth:Number; var bkHeight:Number; rectBorder = (border as RectangularBorder); if (!rectBorder){ return; }; if ((((viewableWidth == 0)) && ((viewableHeight == 0)))){ rectBorder.backgroundImageRect = null; return; }; vm = viewMetrics; bkWidth = (viewableWidth) ? viewableWidth : ((unscaledWidth - vm.left) - vm.right); bkHeight = (viewableHeight) ? viewableHeight : ((unscaledHeight - vm.top) - vm.bottom); if (getStyle("backgroundAttachment") == "fixed"){ rectBorder.backgroundImageRect = new Rectangle(vm.left, vm.top, bkWidth, bkHeight); } else { rectBorder.backgroundImageRect = new Rectangle(vm.left, vm.top, Math.max(scrollableWidth, bkWidth), Math.max(scrollableHeight, bkHeight)); }; } mx_internal function invalidateViewMetricsAndPadding():void{ _viewMetricsAndPadding = null; } public function get verticalLineScrollSize():Number{ return (_verticalLineScrollSize); } private function mouseWheelHandler(event:MouseEvent):void{ var scrollDirection:int; var lineScrollSize:int; var scrollAmount:Number; var oldPosition:Number; if (verticalScrollBar){ event.stopPropagation(); scrollDirection = ((event.delta <= 0)) ? 1 : -1; lineScrollSize = (verticalScrollBar) ? verticalScrollBar.lineScrollSize : 1; scrollAmount = Math.max(Math.abs(event.delta), lineScrollSize); oldPosition = verticalScrollPosition; verticalScrollPosition = (verticalScrollPosition + ((3 * scrollAmount) * scrollDirection)); dispatchScrollEvent(ScrollEventDirection.VERTICAL, oldPosition, verticalScrollPosition, ((event.delta <= 0)) ? ScrollEventDetail.LINE_UP : ScrollEventDetail.LINE_DOWN); }; } mx_internal function createContentPane():void{ var n:int; var newPane:Sprite; var childIndex:int; var i:int; var child:IUIComponent; if (contentPane){ return; }; creatingContentPane = true; n = numChildren; newPane = new FlexSprite(); newPane.name = "contentPane"; newPane.tabChildren = true; if (border){ childIndex = (rawChildren.getChildIndex(DisplayObject(border)) + 1); if ((((border is RectangularBorder)) && (RectangularBorder(border).hasBackgroundImage))){ childIndex++; }; } else { childIndex = 0; }; rawChildren.addChildAt(newPane, childIndex); i = 0; while (i < n) { child = IUIComponent(super.getChildAt(_firstChildIndex)); newPane.addChild(DisplayObject(child)); child.parentChanged(newPane); _numChildren--; i++; }; contentPane = newPane; creatingContentPane = false; contentPane.visible = true; } public function get creationPolicy():String{ return (_creationPolicy); } public function get defaultButton():IFlexDisplayObject{ return (_defaultButton); } public function get verticalScrollPolicy():String{ return (_verticalScrollPolicy); } private function verticalScrollBar_scrollHandler(event:Event):void{ var oldPos:Number; if ((event is ScrollEvent)){ oldPos = verticalScrollPosition; verticalScrollPosition = verticalScrollBar.scrollPosition; dispatchScrollEvent(ScrollEventDirection.VERTICAL, oldPos, verticalScrollPosition, ScrollEvent(event).detail); }; } mx_internal function rawChildren_removeChild(child:DisplayObject):DisplayObject{ var index:int; index = rawChildren_getChildIndex(child); return (rawChildren_removeChildAt(index)); } final mx_internal function get $numChildren():int{ return (super.numChildren); } override public function addChild(child:DisplayObject):DisplayObject{ return (addChildAt(child, numChildren)); } override public function getChildIndex(child:DisplayObject):int{ var index:int; if (contentPane){ return (contentPane.getChildIndex(child)); }; index = (super.getChildIndex(child) - _firstChildIndex); return (index); } public function set icon(value:Class):void{ _icon = value; dispatchEvent(new Event("iconChanged")); } mx_internal function rawChildren_contains(child:DisplayObject):Boolean{ return (super.contains(child)); } override public function executeBindings(recurse:Boolean=false):void{ var bindingsHost:Object; bindingsHost = (((descriptor) && (descriptor.document))) ? descriptor.document : parentDocument; BindingManager.executeBindings(bindingsHost, id, this); if (recurse){ executeChildBindings(recurse); }; } mx_internal function rawChildren_getChildIndex(child:DisplayObject):int{ return (super.getChildIndex(child)); } public function set verticalLineScrollSize(value:Number):void{ scrollPropertiesChanged = true; _verticalLineScrollSize = value; invalidateDisplayList(); dispatchEvent(new Event("verticalLineScrollSizeChanged")); } mx_internal function getScrollableRect():Rectangle{ var left:Number; var top:Number; var right:Number; var bottom:Number; var n:int; var i:int; var vm:EdgeMetrics; var bounds:Rectangle; var child:DisplayObject; left = 0; top = 0; right = 0; bottom = 0; n = numChildren; i = 0; while (i < n) { child = getChildAt(i); if ((((child is IUIComponent)) && (!(IUIComponent(child).includeInLayout)))){ } else { left = Math.min(left, child.x); top = Math.min(top, child.y); if (!isNaN(child.width)){ right = Math.max(right, (child.x + child.width)); }; if (!isNaN(child.height)){ bottom = Math.max(bottom, (child.y + child.height)); }; }; i++; }; vm = viewMetrics; bounds = new Rectangle(); bounds.left = left; bounds.top = top; bounds.right = right; bounds.bottom = bottom; if (usePadding){ bounds.right = (bounds.right + getStyle("paddingRight")); bounds.bottom = (bounds.bottom + getStyle("paddingBottom")); }; return (bounds); } mx_internal function get numRepeaters():int{ return ((childRepeaters) ? childRepeaters.length : 0); } public function get creationIndex():int{ return (_creationIndex); } override mx_internal function childAdded(child:DisplayObject):void{ var event:ChildExistenceChangedEvent; dispatchEvent(new Event("childrenChanged")); event = new ChildExistenceChangedEvent(ChildExistenceChangedEvent.CHILD_ADD); event.relatedObject = child; dispatchEvent(event); child.dispatchEvent(new FlexEvent(FlexEvent.ADD)); super.childAdded(child); } public function set horizontalScrollPolicy(value:String):void{ if (_horizontalScrollPolicy != value){ _horizontalScrollPolicy = value; invalidateDisplayList(); dispatchEvent(new Event("horizontalScrollPolicyChanged")); }; } override public function removeChildAt(index:int):DisplayObject{ return (removeChild(getChildAt(index))); } override mx_internal function fillOverlay(overlay:UIComponent, color:uint, targetArea:RoundedRectangle=null):void{ var vm:EdgeMetrics; var cornerRadius:Number; var g:Graphics; vm = viewMetrics; cornerRadius = 0; if (!targetArea){ targetArea = new RoundedRectangle(vm.left, vm.top, ((unscaledWidth - vm.right) - vm.left), ((unscaledHeight - vm.bottom) - vm.top), cornerRadius); }; if (((((((((isNaN(targetArea.x)) || (isNaN(targetArea.y)))) || (isNaN(targetArea.width)))) || (isNaN(targetArea.height)))) || (isNaN(targetArea.cornerRadius)))){ return; }; g = overlay.graphics; g.clear(); g.beginFill(color); g.drawRoundRect(targetArea.x, targetArea.y, targetArea.width, targetArea.height, (targetArea.cornerRadius * 2), (targetArea.cornerRadius * 2)); g.endFill(); } public function createComponentsFromDescriptors(recurse:Boolean=true):void{ var n:int; var i:int; var component:IFlexDisplayObject; numChildrenBefore = numChildren; createdComponents = []; n = (childDescriptors) ? childDescriptors.length : 0; i = 0; while (i < n) { component = createComponentFromDescriptor(childDescriptors[i], recurse); createdComponents.push(component); i++; }; if ((((creationPolicy == ContainerCreationPolicy.QUEUED)) || ((creationPolicy == ContainerCreationPolicy.NONE)))){ UIComponentGlobals.layoutManager.usePhasedInstantiation = false; }; numChildrenCreated = (numChildren - numChildrenBefore); processedDescriptors = true; } override public function globalToContent(point:Point):Point{ if (contentPane){ return (contentPane.globalToLocal(point)); }; return (globalToLocal(point)); } override mx_internal function removingChild(child:DisplayObject):void{ var event:ChildExistenceChangedEvent; super.removingChild(child); child.dispatchEvent(new FlexEvent(FlexEvent.REMOVE)); event = new ChildExistenceChangedEvent(ChildExistenceChangedEvent.CHILD_REMOVE); event.relatedObject = child; dispatchEvent(event); } private function isBorderNeeded():Boolean{ var v:Object; v = getStyle("borderStyle"); if (v){ if (((!((v == "none"))) || ((((v == "none")) && (getStyle("mouseShield")))))){ return (true); }; }; v = getStyle("backgroundColor"); if (((!((v === null))) && (!((v === ""))))){ return (true); }; v = getStyle("backgroundImage"); return (((!((v == null))) && (!((v == ""))))); } mx_internal function rawChildren_removeChildAt(index:int):DisplayObject{ var child:DisplayObject; child = super.getChildAt(index); super.removingChild(child); $removeChildAt(index); super.childRemoved(child); if ((((_firstChildIndex < index)) && ((index < (_firstChildIndex + _numChildren))))){ _numChildren--; } else { if ((((_numChildren == 0)) || ((index < _firstChildIndex)))){ _firstChildIndex--; }; }; invalidateSize(); invalidateDisplayList(); dispatchEvent(new Event("childrenChanged")); return (child); } public function get verticalPageScrollSize():Number{ return (_verticalPageScrollSize); } override public function validateDisplayList():void{ var vm:EdgeMetrics; var w:Number; var h:Number; var bgColor:Object; var blockerAlpha:Number; var widthToBlock:Number; var heightToBlock:Number; if (((_autoLayout) || (forceLayout))){ doingLayout = true; super.validateDisplayList(); doingLayout = false; } else { layoutChrome(unscaledWidth, unscaledHeight); }; invalidateDisplayListFlag = true; if (createContentPaneAndScrollbarsIfNeeded()){ if (((_autoLayout) || (forceLayout))){ doingLayout = true; super.validateDisplayList(); doingLayout = false; }; createContentPaneAndScrollbarsIfNeeded(); }; if (contentPane){ vm = viewMetrics; if (overlay){ overlay.x = 0; overlay.y = 0; overlay.width = unscaledWidth; overlay.height = unscaledHeight; }; if (((horizontalScrollBar) || (verticalScrollBar))){ if (((verticalScrollBar) && ((verticalScrollPolicy == ScrollPolicy.ON)))){ vm.right = (vm.right - verticalScrollBar.minWidth); }; if (((horizontalScrollBar) && ((horizontalScrollPolicy == ScrollPolicy.ON)))){ vm.bottom = (vm.bottom - horizontalScrollBar.minHeight); }; if (horizontalScrollBar){ w = ((unscaledWidth - vm.left) - vm.right); if (verticalScrollBar){ w = (w - verticalScrollBar.minWidth); }; horizontalScrollBar.setActualSize(w, horizontalScrollBar.minHeight); horizontalScrollBar.move(vm.left, ((unscaledHeight - vm.bottom) - horizontalScrollBar.minHeight)); }; if (verticalScrollBar){ h = ((unscaledHeight - vm.top) - vm.bottom); if (horizontalScrollBar){ h = (h - horizontalScrollBar.minHeight); }; verticalScrollBar.setActualSize(verticalScrollBar.minWidth, h); verticalScrollBar.move(((unscaledWidth - vm.right) - verticalScrollBar.minWidth), vm.top); }; if (whiteBox){ whiteBox.x = verticalScrollBar.x; whiteBox.y = horizontalScrollBar.y; }; }; contentPane.x = vm.left; contentPane.y = vm.top; if (focusPane){ focusPane.x = vm.left; focusPane.y = vm.top; }; scrollChildren(); }; invalidateDisplayListFlag = false; if (blocker){ vm = viewMetrics; bgColor = (enabled) ? null : getStyle("backgroundDisabledColor"); if (!bgColor){ bgColor = getStyle("backgroundColor"); }; if ((((bgColor === null)) || (isNaN(Number(bgColor))))){ bgColor = 0xFFFFFF; }; blockerAlpha = getStyle("disabledOverlayAlpha"); if (isNaN(blockerAlpha)){ blockerAlpha = 0.6; }; blocker.x = vm.left; blocker.y = vm.top; widthToBlock = (unscaledWidth - (vm.left + vm.right)); heightToBlock = (unscaledHeight - (vm.top + vm.bottom)); blocker.graphics.clear(); blocker.graphics.beginFill(uint(bgColor), blockerAlpha); blocker.graphics.drawRect(0, 0, widthToBlock, heightToBlock); blocker.graphics.endFill(); rawChildren.setChildIndex(blocker, (rawChildren.numChildren - 1)); }; } public function set horizontalLineScrollSize(value:Number):void{ scrollPropertiesChanged = true; _horizontalLineScrollSize = value; invalidateDisplayList(); dispatchEvent(new Event("horizontalLineScrollSizeChanged")); } override public function contentToGlobal(point:Point):Point{ if (contentPane){ return (contentPane.localToGlobal(point)); }; return (localToGlobal(point)); } mx_internal function set forceClipping(value:Boolean):void{ if (_clipContent){ if (value){ _forceClippingCount++; } else { _forceClippingCount--; }; createContentPane(); scrollChildren(); }; } public function get horizontalPageScrollSize():Number{ return (_horizontalPageScrollSize); } public function set defaultButton(value:IFlexDisplayObject):void{ _defaultButton = value; ContainerGlobals.focusedContainer = null; } private function hasChildMatchingDescriptor(descriptor:UIComponentDescriptor):Boolean{ var id:String; var n:int; var i:int; var child:IUIComponent; id = descriptor.id; if (((!((id == null))) && ((document[id] == null)))){ return (false); }; n = numChildren; i = 0; while (i < n) { child = IUIComponent(getChildAt(i)); if ((((child is IDeferredInstantiationUIComponent)) && ((IDeferredInstantiationUIComponent(child).descriptor == descriptor)))){ return (true); }; i++; }; if (childRepeaters){ n = childRepeaters.length; i = 0; while (i < n) { if (IDeferredInstantiationUIComponent(childRepeaters[i]).descriptor == descriptor){ return (true); }; i++; }; }; return (false); } override protected function commitProperties():void{ var styleProp:String; super.commitProperties(); if (changedStyles){ styleProp = ((changedStyles == MULTIPLE_PROPERTIES)) ? null : changedStyles; super.notifyStyleChangeInChildren(styleProp, true); changedStyles = null; }; createOrDestroyBlocker(); } override public function finishPrint(obj:Object, target:IFlexDisplayObject):void{ if (obj){ contentPane.scrollRect = Rectangle(obj); }; super.finishPrint(obj, target); } public function get autoLayout():Boolean{ return (_autoLayout); } public function get maxHorizontalScrollPosition():Number{ return ((horizontalScrollBar) ? horizontalScrollBar.maxScrollPosition : Math.max((scrollableWidth - viewableWidth), 0)); } public function set creationPolicy(value:String):void{ _creationPolicy = value; setActualCreationPolicies(value); } public function set verticalScrollPolicy(value:String):void{ if (_verticalScrollPolicy != value){ _verticalScrollPolicy = value; invalidateDisplayList(); dispatchEvent(new Event("verticalScrollPolicyChanged")); }; } override public function prepareToPrint(target:IFlexDisplayObject):Object{ var rect:Rectangle; rect = (((contentPane) && (contentPane.scrollRect))) ? contentPane.scrollRect : null; if (rect){ contentPane.scrollRect = null; }; super.prepareToPrint(target); return (rect); } public function set label(value:String):void{ _label = value; dispatchEvent(new Event("labelChanged")); } override protected function initializationComplete():void{ } override mx_internal function addingChild(child:DisplayObject):void{ var uiChild:IUIComponent; uiChild = IUIComponent(child); super.addingChild(child); invalidateSize(); invalidateDisplayList(); if (!contentPane){ if (_numChildren == 0){ _firstChildIndex = super.numChildren; }; _numChildren++; }; if (((contentPane) && (!(autoLayout)))){ forceLayout = true; UIComponentGlobals.layoutManager.addEventListener("updateComplete", layoutCompleteHandler, false, 0, true); }; } mx_internal function setActualCreationPolicies(policy:String):void{ var childPolicy:String; var n:int; var i:int; var child:IFlexDisplayObject; var childContainer:Container; actualCreationPolicy = policy; childPolicy = policy; if (policy == ContainerCreationPolicy.QUEUED){ childPolicy = ContainerCreationPolicy.AUTO; }; n = numChildren; i = 0; while (i < n) { child = IFlexDisplayObject(getChildAt(i)); if ((child is Container)){ childContainer = Container(child); if (childContainer.creationPolicy == null){ childContainer.setActualCreationPolicies(childPolicy); }; }; i++; }; } override public function set doubleClickEnabled(value:Boolean):void{ var n:int; var i:int; var child:InteractiveObject; super.doubleClickEnabled = value; if (contentPane){ n = contentPane.numChildren; i = 0; while (i < n) { child = (contentPane.getChildAt(i) as InteractiveObject); if (child){ child.doubleClickEnabled = value; }; i++; }; }; } override public function contains(child:DisplayObject):Boolean{ if (contentPane){ return (contentPane.contains(child)); }; return (super.contains(child)); } public function set clipContent(value:Boolean):void{ if (_clipContent != value){ _clipContent = value; invalidateDisplayList(); }; } override public function notifyStyleChangeInChildren(styleProp:String, recursive:Boolean):void{ var n:int; var i:int; var child:ISimpleStyleClient; n = super.numChildren; i = 0; while (i < n) { if (((((contentPane) || ((i < _firstChildIndex)))) || ((i >= (_firstChildIndex + _numChildren))))){ child = (super.getChildAt(i) as ISimpleStyleClient); if (child){ child.styleChanged(styleProp); if ((child is IStyleClient)){ IStyleClient(child).notifyStyleChangeInChildren(styleProp, recursive); }; }; }; i++; }; if (recursive){ changedStyles = (((!((changedStyles == null))) || ((styleProp == null)))) ? MULTIPLE_PROPERTIES : styleProp; invalidateProperties(); }; } override public function get contentMouseX():Number{ if (contentPane){ return (contentPane.mouseX); }; return (super.contentMouseX); } override public function get contentMouseY():Number{ if (contentPane){ return (contentPane.mouseY); }; return (super.contentMouseY); } override public function validateSize(recursive:Boolean=false):void{ var n:int; var i:int; var child:DisplayObject; if ((((autoLayout == false)) && ((forceLayout == false)))){ if (recursive){ n = super.numChildren; i = 0; while (i < n) { child = super.getChildAt(i); if ((child is ILayoutManagerClient)){ ILayoutManagerClient(child).validateSize(true); }; i++; }; }; adjustSizesForScaleChanges(); } else { super.validateSize(recursive); }; } override public function getChildAt(index:int):DisplayObject{ if (contentPane){ return (contentPane.getChildAt(index)); }; return (super.getChildAt((_firstChildIndex + index))); } protected function layoutChrome(unscaledWidth:Number, unscaledHeight:Number):void{ if (border){ updateBackgroundImageRect(); border.move(0, 0); border.setActualSize(unscaledWidth, unscaledHeight); }; } override public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void{ super.addEventListener(type, listener, useCapture, priority, useWeakReference); if ((((((((((((((((type == MouseEvent.CLICK)) || ((type == MouseEvent.DOUBLE_CLICK)))) || ((type == MouseEvent.MOUSE_DOWN)))) || ((type == MouseEvent.MOUSE_MOVE)))) || ((type == MouseEvent.MOUSE_OVER)))) || ((type == MouseEvent.MOUSE_OUT)))) || ((type == MouseEvent.MOUSE_UP)))) || ((type == MouseEvent.MOUSE_WHEEL)))){ if ((((mouseEventReferenceCount < 2147483647)) && ((mouseEventReferenceCount++ == 0)))){ setStyle("mouseShield", true); setStyle("mouseShieldChildren", true); }; }; } override protected function attachOverlay():void{ rawChildren_addChild(overlay); } override public function localToContent(point:Point):Point{ if (!contentPane){ return (point); }; point = localToGlobal(point); return (globalToContent(point)); } public function get rawChildren():IChildList{ if (!_rawChildren){ _rawChildren = new ContainerRawChildrenList(this); }; return (_rawChildren); } public function get viewMetrics():EdgeMetrics{ var bm:EdgeMetrics; var verticalScrollBarIncluded:Boolean; var horizontalScrollBarIncluded:Boolean; bm = borderMetrics; verticalScrollBarIncluded = ((!((verticalScrollBar == null))) && (((doingLayout) || ((verticalScrollPolicy == ScrollPolicy.ON))))); horizontalScrollBarIncluded = ((!((horizontalScrollBar == null))) && (((doingLayout) || ((horizontalScrollPolicy == ScrollPolicy.ON))))); if (((!(verticalScrollBarIncluded)) && (!(horizontalScrollBarIncluded)))){ return (bm); }; if (!_viewMetrics){ _viewMetrics = bm.clone(); } else { _viewMetrics.left = bm.left; _viewMetrics.right = bm.right; _viewMetrics.top = bm.top; _viewMetrics.bottom = bm.bottom; }; if (verticalScrollBarIncluded){ _viewMetrics.right = (_viewMetrics.right + verticalScrollBar.minWidth); }; if (horizontalScrollBarIncluded){ _viewMetrics.bottom = (_viewMetrics.bottom + horizontalScrollBar.minHeight); }; return (_viewMetrics); } public function set creationIndex(value:int):void{ _creationIndex = value; } public function executeChildBindings(recurse:Boolean):void{ var n:int; var i:int; var child:IUIComponent; n = numChildren; i = 0; while (i < n) { child = IUIComponent(getChildAt(i)); if ((child is IDeferredInstantiationUIComponent)){ IDeferredInstantiationUIComponent(child).executeBindings(recurse); }; i++; }; } public function set verticalScrollBar(value:ScrollBar):void{ _verticalScrollBar = value; } public function get horizontalScrollBar():ScrollBar{ return (_horizontalScrollBar); } private function createOrDestroyBlocker():void{ var o:DisplayObject; var sm:ISystemManager; if (enabled){ if (blocker){ rawChildren.removeChild(blocker); blocker = null; }; } else { if (!blocker){ blocker = new FlexSprite(); blocker.name = "blocker"; blocker.mouseEnabled = true; rawChildren.addChild(blocker); blocker.addEventListener(MouseEvent.CLICK, blocker_clickHandler); o = (focusManager) ? DisplayObject(focusManager.getFocus()) : null; while (o) { if (o == this){ sm = systemManager; if (((sm) && (sm.stage))){ sm.stage.focus = null; }; break; }; o = o.parent; }; }; }; } override public function set enabled(value:Boolean):void{ super.enabled = value; if (horizontalScrollBar){ horizontalScrollBar.enabled = value; }; if (verticalScrollBar){ verticalScrollBar.enabled = value; }; invalidateProperties(); } override public function getChildByName(name:String):DisplayObject{ var child:DisplayObject; var index:int; if (contentPane){ return (contentPane.getChildByName(name)); }; child = super.getChildByName(name); if (!child){ return (null); }; index = (super.getChildIndex(child) - _firstChildIndex); if ((((index < 0)) || ((index >= _numChildren)))){ return (null); }; return (child); } override public function addChildAt(child:DisplayObject, index:int):DisplayObject{ addingChild(child); if (contentPane){ contentPane.addChildAt(child, index); } else { $addChildAt(child, (_firstChildIndex + index)); }; childAdded(child); return (child); } override public function get baselinePosition():Number{ var child:IUIComponent; if ((((getStyle("verticalAlign") == "top")) && ((numChildren > 0)))){ child = (getChildAt(0) as IUIComponent); if (child){ return ((child.y + child.baselinePosition)); }; }; return (super.baselinePosition); } private function blocker_clickHandler(event:Event):void{ event.stopPropagation(); } public function get maxVerticalScrollPosition():Number{ return ((verticalScrollBar) ? verticalScrollBar.maxScrollPosition : Math.max((scrollableHeight - viewableHeight), 0)); } public function set verticalPageScrollSize(value:Number):void{ scrollPropertiesChanged = true; _verticalPageScrollSize = value; invalidateDisplayList(); dispatchEvent(new Event("verticalPageScrollSizeChanged")); } private function creationCompleteHandler(event:FlexEvent):void{ numChildrenCreated--; if (numChildrenCreated <= 0){ dispatchEvent(new FlexEvent("childrenCreationComplete")); }; } override public function contentToLocal(point:Point):Point{ if (!contentPane){ return (point); }; point = contentToGlobal(point); return (globalToLocal(point)); } override public function removeChild(child:DisplayObject):DisplayObject{ removingChild(child); if (contentPane){ contentPane.removeChild(child); } else { $removeChild(child); }; childRemoved(child); return (child); } private function dispatchScrollEvent(direction:String, oldPosition:Number, newPosition:Number, detail:String):void{ var event:ScrollEvent; event = new ScrollEvent(ScrollEvent.SCROLL); event.direction = direction; event.position = newPosition; event.delta = (newPosition - oldPosition); event.detail = detail; dispatchEvent(event); } public function get label():String{ return (_label); } mx_internal function setDocumentDescriptor(desc:UIComponentDescriptor):void{ if (processedDescriptors){ return; }; if (((_documentDescriptor) && (_documentDescriptor.properties.childDescriptors))){ if (desc.properties.childDescriptors){ throw (new Error(resourceMultipleChildSets_ClassAndSubclass)); }; } else { _documentDescriptor = desc; _documentDescriptor.document = this; }; } override public function setChildIndex(child:DisplayObject, newIndex:int):void{ var oldIndex:int; var eventOldIndex:int; var eventNewIndex:int; var event:IndexChangedEvent; eventOldIndex = oldIndex; eventNewIndex = newIndex; if (contentPane){ contentPane.setChildIndex(child, newIndex); if (((_autoLayout) || (forceLayout))){ invalidateDisplayList(); }; } else { oldIndex = super.getChildIndex(child); newIndex = (newIndex + _firstChildIndex); if (newIndex == oldIndex){ return; }; super.setChildIndex(child, newIndex); invalidateDisplayList(); eventOldIndex = (oldIndex - _firstChildIndex); eventNewIndex = (newIndex - _firstChildIndex); }; event = new IndexChangedEvent(IndexChangedEvent.CHILD_INDEX_CHANGE); event.relatedObject = child; event.oldIndex = eventOldIndex; event.newIndex = eventNewIndex; dispatchEvent(event); dispatchEvent(new Event("childrenChanged")); } override public function regenerateStyleCache(recursive:Boolean):void{ var n:int; var i:int; var child:DisplayObject; super.regenerateStyleCache(recursive); if (contentPane){ n = contentPane.numChildren; i = 0; while (i < n) { child = getChildAt(i); if (((recursive) && ((child is UIComponent)))){ if (UIComponent(child).inheritingStyles != UIComponent.STYLE_UNINITIALIZED){ UIComponent(child).regenerateStyleCache(recursive); }; } else { if ((((child is UITextField)) && (UITextField(child).inheritingStyles))){ StyleProtoChain.initTextField(UITextField(child)); }; }; i++; }; }; } override protected function createChildren():void{ var mainApp:Application; super.createChildren(); createBorder(); createOrDestroyScrollbars((horizontalScrollPolicy == ScrollPolicy.ON), (verticalScrollPolicy == ScrollPolicy.ON), (((horizontalScrollPolicy == ScrollPolicy.ON)) || ((verticalScrollPolicy == ScrollPolicy.ON)))); if (creationPolicy != null){ actualCreationPolicy = creationPolicy; } else { if ((parent is Container)){ if (Container(parent).actualCreationPolicy == ContainerCreationPolicy.QUEUED){ actualCreationPolicy = ContainerCreationPolicy.AUTO; } else { actualCreationPolicy = Container(parent).actualCreationPolicy; }; }; }; if (actualCreationPolicy == ContainerCreationPolicy.NONE){ actualCreationPolicy = ContainerCreationPolicy.AUTO; } else { if (actualCreationPolicy == ContainerCreationPolicy.QUEUED){ mainApp = (parentApplication) ? Application(parentApplication) : Application(Application.application); mainApp.addToCreationQueue(this, creationIndex, null, this); } else { if (recursionFlag){ createComponentsFromDescriptors(); }; }; }; if (autoLayout == false){ forceLayout = true; }; UIComponentGlobals.layoutManager.addEventListener("updateComplete", layoutCompleteHandler, false, 0, true); } mx_internal function set numChildrenCreated(value:int):void{ _numChildrenCreated = value; } public function get borderMetrics():EdgeMetrics{ return ((((border) && ((border is RectangularBorder)))) ? RectangularBorder(border).borderMetrics : EdgeMetrics.EMPTY); } public function get clipContent():Boolean{ return (_clipContent); } mx_internal function rawChildren_setChildIndex(child:DisplayObject, newIndex:int):void{ var oldIndex:int; oldIndex = super.getChildIndex(child); super.setChildIndex(child, newIndex); if ((((oldIndex < _firstChildIndex)) && ((newIndex >= _firstChildIndex)))){ _firstChildIndex--; } else { if ((((oldIndex >= _firstChildIndex)) && ((newIndex <= _firstChildIndex)))){ _firstChildIndex++; }; }; dispatchEvent(new Event("childrenChanged")); } mx_internal function rawChildren_getChildAt(index:int):DisplayObject{ return (super.getChildAt(index)); } public function get verticalScrollBar():ScrollBar{ return (_verticalScrollBar); } public function get viewMetricsAndPadding():EdgeMetrics{ var o:EdgeMetrics; var vm:EdgeMetrics; if (((((_viewMetricsAndPadding) && (((!(horizontalScrollBar)) || ((horizontalScrollPolicy == ScrollPolicy.ON)))))) && (((!(verticalScrollBar)) || ((verticalScrollPolicy == ScrollPolicy.ON)))))){ return (_viewMetricsAndPadding); }; if (!_viewMetricsAndPadding){ _viewMetricsAndPadding = new EdgeMetrics(); }; o = _viewMetricsAndPadding; vm = viewMetrics; o.left = (vm.left + getStyle("paddingLeft")); o.right = (vm.right + getStyle("paddingRight")); o.top = (vm.top + getStyle("paddingTop")); o.bottom = (vm.bottom + getStyle("paddingBottom")); return (o); } public function set horizontalPageScrollSize(value:Number):void{ scrollPropertiesChanged = true; _horizontalPageScrollSize = value; invalidateDisplayList(); dispatchEvent(new Event("horizontalPageScrollSizeChanged")); } private function layoutCompleteHandler(event:Event):void{ var needToScrollChildren:Boolean; UIComponentGlobals.layoutManager.removeEventListener("updateComplete", layoutCompleteHandler); forceLayout = false; needToScrollChildren = false; if (!isNaN(horizontalScrollPositionPending)){ if (horizontalScrollPositionPending < 0){ horizontalScrollPositionPending = 0; } else { if (horizontalScrollPositionPending > maxHorizontalScrollPosition){ horizontalScrollPositionPending = maxHorizontalScrollPosition; }; }; if (((horizontalScrollBar) && (!((horizontalScrollBar.scrollPosition == horizontalScrollPositionPending))))){ _horizontalScrollPosition = horizontalScrollPositionPending; horizontalScrollBar.scrollPosition = horizontalScrollPositionPending; needToScrollChildren = true; }; horizontalScrollPositionPending = NaN; }; if (!isNaN(verticalScrollPositionPending)){ if (verticalScrollPositionPending < 0){ verticalScrollPositionPending = 0; } else { if (verticalScrollPositionPending > maxVerticalScrollPosition){ verticalScrollPositionPending = maxVerticalScrollPosition; }; }; if (((verticalScrollBar) && (!((verticalScrollBar.scrollPosition == verticalScrollPositionPending))))){ _verticalScrollPosition = verticalScrollPositionPending; verticalScrollBar.scrollPosition = verticalScrollPositionPending; needToScrollChildren = true; }; verticalScrollPositionPending = NaN; }; if (needToScrollChildren){ scrollChildren(); }; } override public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void{ super.removeEventListener(type, listener, useCapture); if ((((((((((((((((type == MouseEvent.CLICK)) || ((type == MouseEvent.DOUBLE_CLICK)))) || ((type == MouseEvent.MOUSE_DOWN)))) || ((type == MouseEvent.MOUSE_MOVE)))) || ((type == MouseEvent.MOUSE_OVER)))) || ((type == MouseEvent.MOUSE_OUT)))) || ((type == MouseEvent.MOUSE_UP)))) || ((type == MouseEvent.MOUSE_WHEEL)))){ if ((((mouseEventReferenceCount > 0)) && ((--mouseEventReferenceCount == 0)))){ setStyle("mouseShield", false); setStyle("mouseShieldChildren", false); }; }; } public function set autoLayout(value:Boolean):void{ var p:IInvalidating; _autoLayout = value; if (value){ invalidateSize(); invalidateDisplayList(); p = (parent as IInvalidating); if (p){ p.invalidateSize(); p.invalidateDisplayList(); }; }; } mx_internal function rawChildren_getChildByName(name:String):DisplayObject{ return (super.getChildByName(name)); } mx_internal function get numChildrenCreated():int{ return (_numChildrenCreated); } override public function initialize():void{ var props:*; if (((((isDocument) && (documentDescriptor))) && (!(processedDescriptors)))){ props = documentDescriptor.properties; if (((props) && (props.childDescriptors))){ if (_childDescriptors){ throw (new Error(resourceMultipleChildSets_ClassAndInstance)); }; _childDescriptors = props.childDescriptors; }; }; super.initialize(); } mx_internal function rawChildren_addChildAt(child:DisplayObject, index:int):DisplayObject{ if ((((_firstChildIndex < index)) && ((index < ((_firstChildIndex + $numChildren) + 1))))){ _numChildren++; } else { if (index <= _firstChildIndex){ _firstChildIndex++; }; }; super.addingChild(child); $addChildAt(child, index); super.childAdded(child); dispatchEvent(new Event("childrenChanged")); return (child); } public function set data(value:Object):void{ _data = value; dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE)); invalidateDisplayList(); } private function createScrollbarsIfNeeded(bounds:Rectangle):Boolean{ var newScrollableWidth:Number; var newScrollableHeight:Number; var newViewableWidth:Number; var newViewableHeight:Number; var hasNegativeCoords:Boolean; var vm:EdgeMetrics; var needHorizontal:Boolean; var needVertical:Boolean; var needContentPane:Boolean; var changed:Boolean; newScrollableWidth = bounds.right; newScrollableHeight = bounds.bottom; newViewableWidth = unscaledWidth; newViewableHeight = unscaledHeight; hasNegativeCoords = (((bounds.left < 0)) || ((bounds.top < 0))); vm = viewMetrics; if (scaleX != 1){ newViewableWidth = (newViewableWidth + (1 / Math.abs(scaleX))); }; if (scaleY != 1){ newViewableHeight = (newViewableHeight + (1 / Math.abs(scaleY))); }; newViewableWidth = Math.floor(newViewableWidth); newViewableHeight = Math.floor(newViewableHeight); newScrollableWidth = Math.floor(newScrollableWidth); newScrollableHeight = Math.floor(newScrollableHeight); if (((horizontalScrollBar) && (!((horizontalScrollPolicy == ScrollPolicy.ON))))){ newViewableHeight = (newViewableHeight - horizontalScrollBar.minHeight); }; if (((verticalScrollBar) && (!((verticalScrollPolicy == ScrollPolicy.ON))))){ newViewableWidth = (newViewableWidth - verticalScrollBar.minWidth); }; newViewableWidth = (newViewableWidth - (vm.left + vm.right)); newViewableHeight = (newViewableHeight - (vm.top + vm.bottom)); needHorizontal = (horizontalScrollPolicy == ScrollPolicy.ON); needVertical = (verticalScrollPolicy == ScrollPolicy.ON); needContentPane = ((((((((((needHorizontal) || (needVertical))) || (hasNegativeCoords))) || (!((overlay == null))))) || ((vm.left > 0)))) || ((vm.top > 0))); if (newViewableWidth < newScrollableWidth){ needContentPane = true; if ((((((horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((((unscaledHeight - vm.top) - vm.bottom) >= 18)))) && ((((unscaledWidth - vm.left) - vm.right) >= 32)))){ needHorizontal = true; }; }; if (newViewableHeight < newScrollableHeight){ needContentPane = true; if ((((((verticalScrollPolicy == ScrollPolicy.AUTO)) && ((((unscaledWidth - vm.left) - vm.right) >= 18)))) && ((((unscaledHeight - vm.top) - vm.bottom) >= 32)))){ needVertical = true; }; }; if (((((((((((((((needHorizontal) && (needVertical))) && ((horizontalScrollPolicy == ScrollPolicy.AUTO)))) && ((verticalScrollPolicy == ScrollPolicy.AUTO)))) && (horizontalScrollBar))) && (verticalScrollBar))) && (((newViewableWidth + verticalScrollBar.minWidth) >= newScrollableWidth)))) && (((newViewableHeight + horizontalScrollBar.minHeight) >= newScrollableHeight)))){ needVertical = false; needHorizontal = needVertical; } else { if (((((((((needHorizontal) && (!(needVertical)))) && (verticalScrollBar))) && ((horizontalScrollPolicy == ScrollPolicy.AUTO)))) && (((newViewableWidth + verticalScrollBar.minWidth) >= newScrollableWidth)))){ needHorizontal = false; }; }; changed = createOrDestroyScrollbars(needHorizontal, needVertical, needContentPane); if (((((!((scrollableWidth == newScrollableWidth))) || (!((viewableWidth == newViewableWidth))))) || (changed))){ if (horizontalScrollBar){ horizontalScrollBar.setScrollProperties((newViewableWidth - borderMetrics.right), 0, (newScrollableWidth - newViewableWidth), horizontalPageScrollSize); scrollPositionChanged = true; }; viewableWidth = newViewableWidth; scrollableWidth = newScrollableWidth; }; if (((((!((scrollableHeight == newScrollableHeight))) || (!((viewableHeight == newViewableHeight))))) || (changed))){ if (verticalScrollBar){ verticalScrollBar.setScrollProperties((newViewableHeight - borderMetrics.bottom), 0, (newScrollableHeight - newViewableHeight), verticalPageScrollSize); scrollPositionChanged = true; }; viewableHeight = newViewableHeight; scrollableHeight = newScrollableHeight; }; return (changed); } public function getChildren():Array{ var results:Array; var n:int; var i:int; results = []; n = numChildren; i = 0; while (i < n) { results.push(getChildAt(i)); i++; }; return (results); } public function removeAllChildren():void{ while (numChildren > 0) { removeChildAt(0); }; } override mx_internal function childRemoved(child:DisplayObject):void{ super.childRemoved(child); invalidateSize(); invalidateDisplayList(); if (!contentPane){ _numChildren--; if (_numChildren == 0){ _firstChildIndex = super.numChildren; }; }; if (((contentPane) && (!(autoLayout)))){ forceLayout = true; UIComponentGlobals.layoutManager.addEventListener("updateComplete", layoutCompleteHandler, false, 0, true); }; dispatchEvent(new Event("childrenChanged")); } override public function get numChildren():int{ return ((contentPane) ? contentPane.numChildren : _numChildren); } public function get data():Object{ return (_data); } override public function styleChanged(styleProp:String):void{ var allStyles:Boolean; var horizontalScrollBarStyleName:String; var verticalScrollBarStyleName:String; allStyles = (((styleProp == null)) || ((styleProp == "styleName"))); if (((allStyles) || (StyleManager.isSizeInvalidatingStyle(styleProp)))){ invalidateDisplayList(); }; if (((allStyles) || ((styleProp == "borderSkin")))){ if (border){ rawChildren.removeChild(DisplayObject(border)); border = null; createBorder(); }; }; if (((((((((((allStyles) || ((styleProp == "borderStyle")))) || ((styleProp == "backgroundColor")))) || ((styleProp == "backgroundImage")))) || ((styleProp == "mouseShield")))) || ((styleProp == "mouseShieldChildren")))){ createBorder(); }; super.styleChanged(styleProp); if (((allStyles) || (StyleManager.isSizeInvalidatingStyle(styleProp)))){ invalidateViewMetricsAndPadding(); }; if (((allStyles) || ((styleProp == "horizontalScrollBarStyleName")))){ if (((horizontalScrollBar) && ((horizontalScrollBar is ISimpleStyleClient)))){ horizontalScrollBarStyleName = getStyle("horizontalScrollBarStyleName"); ISimpleStyleClient(horizontalScrollBar).styleName = horizontalScrollBarStyleName; }; }; if (((allStyles) || ((styleProp == "verticalScrollBarStyleName")))){ if (((verticalScrollBar) && ((verticalScrollBar is ISimpleStyleClient)))){ verticalScrollBarStyleName = getStyle("verticalScrollBarStyleName"); ISimpleStyleClient(verticalScrollBar).styleName = verticalScrollBarStyleName; }; }; } private function createContentPaneAndScrollbarsIfNeeded():Boolean{ var bounds:Rectangle; var changed:Boolean; if (_clipContent){ bounds = getScrollableRect(); changed = createScrollbarsIfNeeded(bounds); if (border){ updateBackgroundImageRect(); }; return (changed); //unresolved jump }; changed = createOrDestroyScrollbars(false, false, false); bounds = getScrollableRect(); scrollableWidth = bounds.right; scrollableHeight = bounds.bottom; if (((changed) && (border))){ updateBackgroundImageRect(); }; return (changed); } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ var backgroundColor:Object; var backgroundAlpha:Number; super.updateDisplayList(unscaledWidth, unscaledHeight); layoutChrome(unscaledWidth, unscaledHeight); if (scrollPositionChanged){ if (_horizontalScrollPosition < 0){ _horizontalScrollPosition = 0; } else { if (_horizontalScrollPosition > maxHorizontalScrollPosition){ _horizontalScrollPosition = maxHorizontalScrollPosition; }; }; if (((horizontalScrollBar) && (!((horizontalScrollBar.scrollPosition == _horizontalScrollPosition))))){ horizontalScrollBar.scrollPosition = _horizontalScrollPosition; }; if (_verticalScrollPosition < 0){ _verticalScrollPosition = 0; } else { if (_verticalScrollPosition > maxVerticalScrollPosition){ _verticalScrollPosition = maxVerticalScrollPosition; }; }; if (((verticalScrollBar) && (!((verticalScrollBar.scrollPosition == _verticalScrollPosition))))){ verticalScrollBar.scrollPosition = _verticalScrollPosition; }; scrollChildren(); scrollPositionChanged = false; }; if (scrollPropertiesChanged){ if (horizontalScrollBar){ horizontalScrollBar.lineScrollSize = horizontalLineScrollSize; horizontalScrollBar.pageScrollSize = horizontalPageScrollSize; }; if (verticalScrollBar){ verticalScrollBar.lineScrollSize = verticalLineScrollSize; verticalScrollBar.pageScrollSize = verticalPageScrollSize; }; scrollPropertiesChanged = false; }; if (((contentPane) && (contentPane.scrollRect))){ backgroundColor = (enabled) ? null : getStyle("backgroundDisabledColor"); if (!backgroundColor){ backgroundColor = getStyle("backgroundColor"); }; backgroundAlpha = getStyle("backgroundAlpha"); if (((((((!(_clipContent)) || (isNaN(Number(backgroundColor))))) || ((backgroundColor === "")))) || (((!(((horizontalScrollBar) || (verticalScrollBar)))) && (!(cacheAsBitmap)))))){ backgroundColor = null; } else { if (((getStyle("backgroundImage")) || (getStyle("background")))){ backgroundColor = null; } else { if (backgroundAlpha != 1){ backgroundColor = null; }; }; }; contentPane.opaqueBackground = backgroundColor; contentPane.cacheAsBitmap = !((backgroundColor == null)); }; } mx_internal function rawChildren_addChild(child:DisplayObject):DisplayObject{ if (_numChildren == 0){ _firstChildIndex++; }; super.addingChild(child); $addChild(child); super.childAdded(child); dispatchEvent(new Event("childrenChanged")); return (child); } private static function loadResources():void{ resourceScrollDirection = packageResources.getString("scrollDirection"); resourceMultipleChildSets_ClassAndInstance = packageResources.getString("multipleChildSets_ClassAndInstance"); resourceMultipleChildSets_ClassAndSubclass = packageResources.getString("multipleChildSets_ClassAndSubclass"); } mx_internal static function checkFocus(oldObj:InteractiveObject, newObj:InteractiveObject):void{ var objParent:InteractiveObject; var currObj:InteractiveObject; var lastUIComp:IUIComponent; var fm:IFocusManager; var defButton:Button; objParent = newObj; currObj = newObj; lastUIComp = null; if (((!((newObj == null))) && ((oldObj == newObj)))){ return; }; while (currObj) { if (currObj.parent){ objParent = currObj.parent; } else { objParent = null; }; if ((currObj is IUIComponent)){ lastUIComp = IUIComponent(currObj); }; currObj = objParent; if (((((currObj) && ((currObj is Container)))) && (Container(currObj).defaultButton))){ break; }; }; if (ContainerGlobals.focusedContainer != currObj){ if (!currObj){ currObj = InteractiveObject(lastUIComp); }; if (((currObj) && ((currObj is Container)))){ fm = UIComponent(currObj).focusManager; defButton = (Container(currObj).defaultButton as Button); if (defButton){ ContainerGlobals.focusedContainer = Container(currObj); fm.defaultButton = defButton; } else { ContainerGlobals.focusedContainer = Container(currObj); fm.defaultButton = null; }; }; }; } loadResources(); } }//package mx.core
Section 44
//ContainerCreationPolicy (mx.core.ContainerCreationPolicy) package mx.core { public final class ContainerCreationPolicy { public static const ALL:String = "all"; public static const QUEUED:String = "queued"; public static const NONE:String = "none"; mx_internal static const VERSION:String = "2.0.1.0"; public static const AUTO:String = "auto"; public function ContainerCreationPolicy(){ super(); } } }//package mx.core
Section 45
//ContainerGlobals (mx.core.ContainerGlobals) package mx.core { import flash.display.*; public class ContainerGlobals { public static var focusedContainer:InteractiveObject; public function ContainerGlobals(){ super(); } } }//package mx.core
Section 46
//ContainerLayout (mx.core.ContainerLayout) package mx.core { public final class ContainerLayout { public static const HORIZONTAL:String = "horizontal"; public static const VERTICAL:String = "vertical"; public static const ABSOLUTE:String = "absolute"; mx_internal static const VERSION:String = "2.0.1.0"; public function ContainerLayout(){ super(); } } }//package mx.core
Section 47
//ContainerRawChildrenList (mx.core.ContainerRawChildrenList) package mx.core { import flash.display.*; import flash.geom.*; public class ContainerRawChildrenList implements IChildList { private var owner:Container; mx_internal static const VERSION:String = "2.0.1.0"; public function ContainerRawChildrenList(owner:Container){ super(); this.owner = owner; } public function getChildAt(index:int):DisplayObject{ return (owner.mx_internal::rawChildren_getChildAt(index)); } public function getChildByName(name:String):DisplayObject{ return (owner.mx_internal::rawChildren_getChildByName(name)); } public function removeChildAt(index:int):DisplayObject{ return (owner.mx_internal::rawChildren_removeChildAt(index)); } public function getChildIndex(child:DisplayObject):int{ return (owner.mx_internal::rawChildren_getChildIndex(child)); } public function addChildAt(child:DisplayObject, index:int):DisplayObject{ return (owner.mx_internal::rawChildren_addChildAt(child, index)); } public function getObjectsUnderPoint(point:Point):Array{ return (owner.mx_internal::rawChildren_getObjectsUnderPoint(point)); } public function setChildIndex(child:DisplayObject, newIndex:int):void{ var _local3 = owner; _local3.mx_internal::rawChildren_setChildIndex(child, newIndex); } public function get numChildren():int{ return (owner.mx_internal::$numChildren); } public function contains(child:DisplayObject):Boolean{ return (owner.mx_internal::rawChildren_contains(child)); } public function removeChild(child:DisplayObject):DisplayObject{ return (owner.mx_internal::rawChildren_removeChild(child)); } public function addChild(child:DisplayObject):DisplayObject{ return (owner.mx_internal::rawChildren_addChild(child)); } } }//package mx.core
Section 48
//DragSource (mx.core.DragSource) package mx.core { public class DragSource { private var formatHandlers:Object; private var dataHolder:Object; private var _formats:Array; mx_internal static const VERSION:String = "2.0.1.0"; public function DragSource(){ dataHolder = {}; formatHandlers = {}; _formats = []; super(); } public function dataForFormat(format:String):Object{ var data:Object; data = dataHolder[format]; if (data){ return (data); }; if (formatHandlers[format]){ return (formatHandlers[format]()); }; return (null); } public function addHandler(handler:Function, format:String):void{ _formats.push(format); formatHandlers[format] = handler; } public function addData(data:Object, format:String):void{ _formats.push(format); dataHolder[format] = data; } public function hasFormat(format:String):Boolean{ var n:int; var i:int; n = _formats.length; i = 0; while (i < n) { if (_formats[i] == format){ return (true); }; i++; }; return (false); } public function get formats():Array{ return (_formats); } } }//package mx.core
Section 49
//EdgeMetrics (mx.core.EdgeMetrics) package mx.core { public class EdgeMetrics { public var bottom:Number; public var top:Number; public var right:Number; public var left:Number; mx_internal static const VERSION:String = "2.0.1.0"; public static var EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0); ; public function EdgeMetrics(left:Number=0, top:Number=0, right:Number=0, bottom:Number=0){ super(); this.left = left; this.top = top; this.right = right; this.bottom = bottom; } public function clone():EdgeMetrics{ return (new EdgeMetrics(left, top, right, bottom)); } } }//package mx.core
Section 50
//EventPriority (mx.core.EventPriority) package mx.core { public final class EventPriority { public static const DEFAULT:int = 0; public static const BINDING:int = 100; public static const DEFAULT_HANDLER:int = -50; public static const EFFECT:int = -100; public static const CURSOR_MANAGEMENT:int = 200; mx_internal static const VERSION:String = "2.0.1.0"; public function EventPriority(){ super(); } } }//package mx.core
Section 51
//FlexBitmap (mx.core.FlexBitmap) package mx.core { import flash.display.*; import mx.utils.*; public class FlexBitmap extends Bitmap { mx_internal static const VERSION:String = "2.0.1.0"; public function FlexBitmap(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){ var bitmapData = bitmapData; var pixelSnapping = pixelSnapping; var smoothing = smoothing; super(bitmapData, pixelSnapping, smoothing); name = NameUtil.createUniqueName(this); //unresolved jump var _slot1 = e; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 52
//FlexLoader (mx.core.FlexLoader) package mx.core { import flash.display.*; import mx.utils.*; public class FlexLoader extends Loader { mx_internal static const VERSION:String = "2.0.1.0"; public function FlexLoader(){ super(); name = NameUtil.createUniqueName(this); //unresolved jump var _slot1 = e; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 53
//FlexMovieClip (mx.core.FlexMovieClip) package mx.core { import flash.display.*; import mx.utils.*; public class FlexMovieClip extends MovieClip { mx_internal static const VERSION:String = "2.0.1.0"; public function FlexMovieClip(){ super(); name = NameUtil.createUniqueName(this); //unresolved jump var _slot1 = e; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 54
//FlexShape (mx.core.FlexShape) package mx.core { import flash.display.*; import mx.utils.*; public class FlexShape extends Shape { mx_internal static const VERSION:String = "2.0.1.0"; public function FlexShape(){ super(); name = NameUtil.createUniqueName(this); //unresolved jump var _slot1 = e; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 55
//FlexSprite (mx.core.FlexSprite) package mx.core { import flash.display.*; import mx.utils.*; public class FlexSprite extends Sprite { mx_internal static const VERSION:String = "2.0.1.0"; public function FlexSprite(){ super(); name = NameUtil.createUniqueName(this); //unresolved jump var _slot1 = e; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 56
//FlexTextField (mx.core.FlexTextField) package mx.core { import flash.text.*; import mx.utils.*; public class FlexTextField extends TextField { mx_internal static const VERSION:String = "2.0.1.0"; public function FlexTextField(){ super(); name = NameUtil.createUniqueName(this); //unresolved jump var _slot1 = e; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 57
//IChildList (mx.core.IChildList) package mx.core { import flash.display.*; import flash.geom.*; public interface IChildList { function get numChildren():int; function contains(flash.display:DisplayObject):Boolean; function getChildByName(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IChildList.as:String):DisplayObject; function removeChildAt(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IChildList.as:int):DisplayObject; function getChildIndex(:DisplayObject):int; function addChildAt(_arg1:DisplayObject, _arg2:int):DisplayObject; function getObjectsUnderPoint(child:Point):Array; function removeChild(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IChildList.as:DisplayObject):DisplayObject; function getChildAt(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IChildList.as:int):DisplayObject; function addChild(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IChildList.as:DisplayObject):DisplayObject; function setChildIndex(_arg1:DisplayObject, _arg2:int):void; } }//package mx.core
Section 58
//IContainer (mx.core.IContainer) package mx.core { public interface IContainer { } }//package mx.core
Section 59
//IDataRenderer (mx.core.IDataRenderer) package mx.core { public interface IDataRenderer { function set data(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IDataRenderer.as:Object):void; function get data():Object; } }//package mx.core
Section 60
//IDeferredInstantiationUIComponent (mx.core.IDeferredInstantiationUIComponent) package mx.core { public interface IDeferredInstantiationUIComponent extends IUIComponent { function get descriptor():UIComponentDescriptor; function createReferenceOnParentDocument(:IFlexDisplayObject):void; function set descriptor(:UIComponentDescriptor):void; function deleteReferenceOnParentDocument(:IFlexDisplayObject):void; function executeBindings(:Boolean=false):void; function get id():String; function set cacheHeuristic(:Boolean):void; function get cachePolicy():String; function registerEffects(:Array):void; function set id(:String):void; } }//package mx.core
Section 61
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 62
//IFlexDisplayObject (mx.core.IFlexDisplayObject) package mx.core { import flash.events.*; import flash.display.*; public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher { function get name():String; function set width(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IFlexDisplayObject.as:Number):void; function get measuredHeight():Number; function set height(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IFlexDisplayObject.as:Number):void; function get scaleY():Number; function move(_arg1:Number, _arg2:Number):void; function get scaleX():Number; function set mask(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IFlexDisplayObject.as:DisplayObject):void; function set scaleX(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IFlexDisplayObject.as:Number):void; function set name(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IFlexDisplayObject.as:String):void; function set scaleY(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IFlexDisplayObject.as:Number):void; function get visible():Boolean; function get measuredWidth():Number; function set visible(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IFlexDisplayObject.as:Boolean):void; function get alpha():Number; function get height():Number; function get width():Number; function get parent():DisplayObjectContainer; function get mask():DisplayObject; function set x(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IFlexDisplayObject.as:Number):void; function setActualSize(_arg1:Number, _arg2:Number):void; function set y(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IFlexDisplayObject.as:Number):void; function get x():Number; function get y():Number; function set alpha(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IFlexDisplayObject.as:Number):void; } }//package mx.core
Section 63
//IFlexModule (mx.core.IFlexModule) package mx.core { public interface IFlexModule { function set moduleFactory(:IFlexModuleFactory):void; function get moduleFactory():IFlexModuleFactory; } }//package mx.core
Section 64
//IFlexModuleFactory (mx.core.IFlexModuleFactory) package mx.core { public interface IFlexModuleFactory { function create(... _args):Object; function info():Object; } }//package mx.core
Section 65
//IIMESupport (mx.core.IIMESupport) package mx.core { public interface IIMESupport { function get imeMode():String; function set imeMode(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IIMESupport.as:String):void; } }//package mx.core
Section 66
//IInvalidating (mx.core.IInvalidating) package mx.core { public interface IInvalidating { function validateNow():void; function invalidateDisplayList():void; function invalidateSize():void; function invalidateProperties():void; } }//package mx.core
Section 67
//IPropertyChangeNotifier (mx.core.IPropertyChangeNotifier) package mx.core { import flash.events.*; public interface IPropertyChangeNotifier extends IEventDispatcher, IUID { } }//package mx.core
Section 68
//IRawChildrenContainer (mx.core.IRawChildrenContainer) package mx.core { public interface IRawChildrenContainer { function get rawChildren():IChildList; } }//package mx.core
Section 69
//IRepeater (mx.core.IRepeater) package mx.core { public interface IRepeater { function get container():Container; function set recycleChildren(mx.core:IRepeater/mx.core:IRepeater:container/get:Boolean):void; function get startingIndex():int; function set startingIndex(mx.core:IRepeater/mx.core:IRepeater:container/get:int):void; function get currentItem():Object; function get count():int; function get recycleChildren():Boolean; function executeChildBindings():void; function set dataProvider(mx.core:IRepeater/mx.core:IRepeater:container/get:Object):void; function initializeRepeater(_arg1:Container, _arg2:Boolean):void; function get currentIndex():int; function get dataProvider():Object; function set count(mx.core:IRepeater/mx.core:IRepeater:container/get:int):void; } }//package mx.core
Section 70
//IRepeaterClient (mx.core.IRepeaterClient) package mx.core { public interface IRepeaterClient { function set instanceIndices(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IRepeaterClient.as:Array):void; function get isDocument():Boolean; function get repeaters():Array; function get instanceIndices():Array; function set repeaters(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IRepeaterClient.as:Array):void; function initializeRepeaterArrays(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IRepeaterClient.as:IRepeaterClient):void; function set repeaterIndices(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IRepeaterClient.as:Array):void; function get repeaterIndices():Array; } }//package mx.core
Section 71
//IToolTip (mx.core.IToolTip) package mx.core { import flash.geom.*; public interface IToolTip extends IUIComponent { function get screen():Rectangle; function get text():String; function set text(mx.core:IToolTip/mx.core:IToolTip:screen/get:String):void; } }//package mx.core
Section 72
//IUIComponent (mx.core.IUIComponent) package mx.core { import flash.display.*; import flash.geom.*; import mx.managers.*; public interface IUIComponent extends IFlexDisplayObject { function set enabled(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Boolean):void; function set measuredMinWidth(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Number):void; function set isPopUp(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Boolean):void; function get percentWidth():Number; function set percentWidth(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Number):void; function get baselinePosition():Number; function initialize():void; function getExplicitOrMeasuredWidth():Number; function set percentHeight(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Number):void; function get minHeight():Number; function getExplicitOrMeasuredHeight():Number; function get document():Object; function get explicitMaxWidth():Number; function set scrollRect(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Rectangle):void; function get cacheAsBitmap():Boolean; function get maxHeight():Number; function get minWidth():Number; function owns(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IUIComponent.as:DisplayObject):Boolean; function get opaqueBackground():Object; function setVisible(_arg1:Boolean, _arg2:Boolean=false):void; function get owner():DisplayObjectContainer; function set document(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Object):void; function get tweeningProperties():Array; function get enabled():Boolean; function get isPopUp():Boolean; function get explicitMinHeight():Number; function set focusPane(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Sprite):void; function get maxWidth():Number; function get percentHeight():Number; function set tweeningProperties(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Array):void; function get explicitMaxHeight():Number; function get focusPane():Sprite; function parentChanged(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:DisplayObjectContainer):void; function set opaqueBackground(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Object):void; function set measuredMinHeight(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Number):void; function set cacheAsBitmap(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Boolean):void; function get scrollRect():Rectangle; function set explicitWidth(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Number):void; function set owner(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:DisplayObjectContainer):void; function set includeInLayout(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Boolean):void; function get explicitMinWidth():Number; function get explicitWidth():Number; function get measuredMinHeight():Number; function set explicitHeight(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:Number):void; function get includeInLayout():Boolean; function get measuredMinWidth():Number; function get explicitHeight():Number; function set systemManager(mx.core:IUIComponent/mx.core:IUIComponent:baselinePosition/get:ISystemManager):void; function get systemManager():ISystemManager; } }//package mx.core
Section 73
//IUID (mx.core.IUID) package mx.core { public interface IUID { function get uid():String; function set uid(C:\dev\flex_201_ja\sdk\frameworks;mx\core;IUID.as:String):void; } }//package mx.core
Section 74
//LayoutContainer (mx.core.LayoutContainer) package mx.core { import flash.events.*; import mx.resources.*; import flash.system.*; import mx.containers.utilityClasses.*; import mx.containers.*; public class LayoutContainer extends Container { private var _layout:String;// = "vertical" private var processingCreationQueue:Boolean;// = false private var creationQueue:Array; protected var boxLayoutClass:Class; private var preloadObj:Object; private var resizeHandlerAdded:Boolean;// = false protected var layoutObject:Layout; protected var canvasLayoutClass:Class; mx_internal static const VERSION:String = "2.0.1.0"; private static var viewSourceMenuItem:String; mx_internal static var useProgressiveLayout:Boolean = false; private static var packageResources:ResourceBundle = ResourceBundle.getResourceBundle("core", ApplicationDomain.currentDomain); public function LayoutContainer(){ layoutObject = new BoxLayout(); canvasLayoutClass = CanvasLayout; boxLayoutClass = BoxLayout; resizeHandlerAdded = false; creationQueue = []; processingCreationQueue = false; _layout = ContainerLayout.VERTICAL; super(); layoutObject.target = this; } override mx_internal function get usePadding():Boolean{ return (!((layout == ContainerLayout.ABSOLUTE))); } override protected function measure():void{ super.measure(); layoutObject.measure(); } override protected function layoutChrome(unscaledWidth:Number, unscaledHeight:Number):void{ super.layoutChrome(unscaledWidth, unscaledHeight); if (!doingLayout){ createBorder(); }; } public function set layout(value:String):void{ if (_layout != value){ _layout = value; if (layoutObject){ layoutObject.target = null; }; if (_layout == ContainerLayout.ABSOLUTE){ layoutObject = new canvasLayoutClass(); } else { layoutObject = new boxLayoutClass(); if (_layout == ContainerLayout.VERTICAL){ BoxLayout(layoutObject).direction = BoxDirection.VERTICAL; } else { BoxLayout(layoutObject).direction = BoxDirection.HORIZONTAL; }; }; if (layoutObject){ layoutObject.target = this; }; invalidateSize(); invalidateDisplayList(); dispatchEvent(new Event("layoutChanged")); }; } public function get layout():String{ return (_layout); } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ super.updateDisplayList(unscaledWidth, unscaledHeight); layoutObject.updateDisplayList(unscaledWidth, unscaledHeight); createBorder(); } private static function loadResources():void{ viewSourceMenuItem = packageResources.getString("viewSource"); } loadResources(); } }//package mx.core
Section 75
//MovieClipAsset (mx.core.MovieClipAsset) package mx.core { public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject { private var _measuredWidth:Number; private var _measuredHeight:Number; mx_internal static const VERSION:String = "2.0.1.0"; public function MovieClipAsset(){ super(); _measuredWidth = width; _measuredHeight = height; } public function get measuredWidth():Number{ return (_measuredWidth); } public function get measuredHeight():Number{ return (_measuredHeight); } public function setActualSize(newWidth:Number, newHeight:Number):void{ width = newWidth; height = newHeight; } public function move(x:Number, y:Number):void{ this.x = x; this.y = y; } } }//package mx.core
Section 76
//MovieClipLoaderAsset (mx.core.MovieClipLoaderAsset) package mx.core { import flash.events.*; import flash.system.*; import flash.display.*; import flash.utils.*; public class MovieClipLoaderAsset extends MovieClipAsset implements IFlexAsset, IFlexDisplayObject { private var requestedWidth:Number; private var loader:Loader;// = null private var requestedHeight:Number; private var initialized:Boolean;// = false protected var initialWidth:Number;// = 0 protected var initialHeight:Number;// = 0 mx_internal static const VERSION:String = "2.0.1.0"; public function MovieClipLoaderAsset(){ var loaderContext:LoaderContext; loader = null; initialized = false; initialWidth = 0; initialHeight = 0; super(); loaderContext = new LoaderContext(); loaderContext.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain); loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler); loader.loadBytes(movieClipData, loaderContext); addChild(loader); } private function completeHandler(event:Event):void{ initialized = true; initialWidth = loader.width; initialHeight = loader.height; if (!isNaN(requestedWidth)){ loader.width = requestedWidth; }; if (!isNaN(requestedHeight)){ loader.height = requestedHeight; }; dispatchEvent(event); } override public function get height():Number{ if (!initialized){ return (initialHeight); }; return (super.height); } override public function set height(value:Number):void{ if (!initialized){ requestedHeight = value; } else { loader.height = value; }; } public function get movieClipData():ByteArray{ return (null); } override public function set width(value:Number):void{ if (!initialized){ requestedWidth = value; } else { loader.width = value; }; } override public function get measuredWidth():Number{ return (initialWidth); } override public function get measuredHeight():Number{ return (initialHeight); } override public function get width():Number{ if (!initialized){ return (initialWidth); }; return (super.width); } } }//package mx.core
Section 77
//mx_internal (mx.core.mx_internal) package mx.core { public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal"; }//package mx.core
Section 78
//ScrollPolicy (mx.core.ScrollPolicy) package mx.core { public final class ScrollPolicy { public static const AUTO:String = "auto"; public static const ON:String = "on"; mx_internal static const VERSION:String = "2.0.1.0"; public static const OFF:String = "off"; public function ScrollPolicy(){ super(); } } }//package mx.core
Section 79
//Singleton (mx.core.Singleton) package mx.core { public class Singleton { private static var classMap:Object = {}; public function Singleton(){ super(); } public static function getClass(name:String):Class{ return (classMap[name]); } public static function getInstance(name:String):Object{ var clazz:Class; clazz = classMap[name]; return (Object(clazz).getInstance()); } public static function registerClass(name:String, clazz:Class):void{ var c:Class; c = classMap[name]; if (!c){ classMap[name] = clazz; }; } } }//package mx.core
Section 80
//UIComponent (mx.core.UIComponent) package mx.core { import flash.events.*; import mx.resources.*; import flash.system.*; import flash.display.*; import flash.utils.*; import flash.geom.*; import mx.styles.*; import mx.modules.*; import mx.events.*; import mx.managers.*; import mx.automation.*; import flash.text.*; import mx.states.*; import mx.effects.*; import mx.graphics.*; import mx.binding.*; import mx.skins.*; import mx.utils.*; import mx.validators.*; public class UIComponent extends FlexSprite implements IAutomationObject, IChildList, IDeferredInstantiationUIComponent, IFlexDisplayObject, IFlexModule, IInvalidating, ILayoutManagerClient, IPropertyChangeNotifier, IRepeaterClient, ISimpleStyleClient, IStyleClient, IToolTipManagerClient, IUIComponent, IValidatorListener { private var errorStringChanged:Boolean;// = false mx_internal var overlay:UIComponent; mx_internal var automaticRadioButtonGroups:Object; private var _currentState:String; private var _isPopUp:Boolean; private var _repeaters:Array; private var packageResources:ResourceBundle; private var _systemManager:ISystemManager; private var _measuredWidth:Number;// = 0 private var methodQueue:Array; mx_internal var _width:Number; private var _tweeningProperties:Array; private var _validationSubField:String; private var _endingEffectInstances:Array; mx_internal var saveBorderColor:Boolean;// = true mx_internal var overlayColor:uint; private var _repeaterIndices:Array; private var oldExplicitWidth:Number; mx_internal var _descriptor:UIComponentDescriptor; private var _initialized:Boolean;// = false private var requestedCurrentState:String; private var _focusEnabled:Boolean;// = true private var cacheAsBitmapCount:int;// = 0 mx_internal var overlayReferenceCount:int;// = 0 private var listeningForRender:Boolean;// = false mx_internal var invalidateDisplayListFlag:Boolean;// = false private var oldScaleX:Number;// = 1 private var oldScaleY:Number;// = 1 mx_internal var _explicitMaxHeight:Number; mx_internal var invalidatePropertiesFlag:Boolean;// = false private var hasFocusRect:Boolean;// = false private var _scaleX:Number;// = 1 private var _scaleY:Number;// = 1 mx_internal var invalidateSizeFlag:Boolean;// = false private var _styleDeclaration:CSSStyleDeclaration; mx_internal var _documentDescriptor:UIComponentDescriptor; mx_internal var _affectedProperties:Object; private var _processedDescriptors:Boolean;// = false mx_internal var origBorderColor:Number; private var _focusManager:IFocusManager; private var _cachePolicy:String;// = "auto" private var _measuredHeight:Number;// = 0 private var _id:String; private var _owner:DisplayObjectContainer; public var transitions:Array; mx_internal var _parent:DisplayObjectContainer; private var _measuredMinWidth:Number;// = 0 private var oldMinWidth:Number; private var _enabled:Boolean;// = false public var states:Array; private var _explicitWidth:Number; private var _mouseFocusEnabled:Boolean;// = true private var oldHeight:Number;// = 0 private var _currentStateChanged:Boolean; private var cachedTextFormat:UITextFormat; private var _automationDelegate:IAutomationObject; mx_internal var _height:Number; private var _percentWidth:Number; private var _automationName:String;// = null private var _isEffectStarted:Boolean;// = false private var _styleName:Object; mx_internal var _document:Object; private var _errorString:String;// = "" private var oldExplicitHeight:Number; private var _nestLevel:int;// = 0 private var _explicitHeight:Number; private var _filters:Array; private var _toolTip:String; private var _focusPane:Sprite; private var playStateTransition:Boolean;// = true private var _nonInheritingStyles:Object; private var _showInAutomationHierarchy:Boolean;// = true private var _moduleFactory:IFlexModuleFactory; private var oldX:Number;// = 0 private var oldY:Number;// = 0 private var _instanceIndices:Array; private var _visible:Boolean;// = true private var _inheritingStyles:Object; private var _includeInLayout:Boolean;// = true mx_internal var _effectsStarted:Array; private var _explicitMinWidth:Number; private var resourceStateUndefined:String;// = null mx_internal var _explicitMaxWidth:Number; private var _measuredMinHeight:Number;// = 0 private var _uid:String; private var _currentTransitionEffect:Effect; private var _updateCompletePendingFlag:Boolean;// = false private var oldMinHeight:Number; mx_internal var _explicitMinHeight:Number; private var _percentHeight:Number; private var oldWidth:Number;// = 0 public static const DEFAULT_MEASURED_WIDTH:Number = 160; public static const DEFAULT_MAX_WIDTH:Number = 10000; public static const DEFAULT_MEASURED_MIN_HEIGHT:Number = 22; public static const DEFAULT_MAX_HEIGHT:Number = 10000; public static const DEFAULT_MEASURED_HEIGHT:Number = 22; mx_internal static const VERSION:String = "2.0.1.0"; public static const DEFAULT_MEASURED_MIN_WIDTH:Number = 40; mx_internal static var dispatchEventHook:Function; private static var fakeMouseY:QName = new QName(mx_internal, "_mouseY"); mx_internal static var createAccessibilityImplementation:Function; mx_internal static var STYLE_UNINITIALIZED:Object = {}; private static var fakeMouseX:QName = new QName(mx_internal, "_mouseX"); public function UIComponent(){ packageResources = ResourceBundle.getResourceBundle("core", ApplicationDomain.currentDomain); resourceStateUndefined = null; listeningForRender = false; methodQueue = []; hasFocusRect = false; _initialized = false; _processedDescriptors = false; _updateCompletePendingFlag = false; invalidatePropertiesFlag = false; invalidateSizeFlag = false; invalidateDisplayListFlag = false; oldX = 0; oldY = 0; oldWidth = 0; oldHeight = 0; oldScaleX = 1; oldScaleY = 1; overlayReferenceCount = 0; saveBorderColor = true; _scaleX = 1; _scaleY = 1; _visible = true; _enabled = false; _nestLevel = 0; _inheritingStyles = UIComponent.STYLE_UNINITIALIZED; _nonInheritingStyles = UIComponent.STYLE_UNINITIALIZED; _cachePolicy = UIComponentCachePolicy.AUTO; cacheAsBitmapCount = 0; _focusEnabled = true; _mouseFocusEnabled = true; _measuredMinWidth = 0; _measuredMinHeight = 0; _measuredWidth = 0; _measuredHeight = 0; _includeInLayout = true; playStateTransition = true; states = []; transitions = []; _automationName = null; _showInAutomationHierarchy = true; _errorString = ""; errorStringChanged = false; _effectsStarted = []; _affectedProperties = {}; _isEffectStarted = false; _endingEffectInstances = []; super(); focusRect = false; tabEnabled = (this is IFocusManagerComponent); tabChildren = false; enabled = true; $visible = false; addEventListener(Event.ADDED, addedHandler); addEventListener(Event.REMOVED, removedHandler); if ((this is IFocusManagerComponent)){ addEventListener(FocusEvent.FOCUS_IN, focusInHandler); addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler); addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); addEventListener(KeyboardEvent.KEY_UP, keyUpHandler); }; _width = super.width; _height = super.height; } public function getStyle(styleProp:String){ return ((StyleManager.inheritingStyles[styleProp]) ? _inheritingStyles[styleProp] : _nonInheritingStyles[styleProp]); } public function get toolTip():String{ return (_toolTip); } private function transition_effectEndHandler(event:EffectEvent):void{ _currentTransitionEffect = null; } public function get nestLevel():int{ return (_nestLevel); } protected function adjustFocusRect(obj:DisplayObject=null):void{ var fm:IFocusManager; var focusObj:IFlexDisplayObject; var rectCol:Number; var thickness:Number; var pt:Point; var rotRad:Number; if (!obj){ obj = this; }; if (((isNaN(obj.width)) || (isNaN(obj.height)))){ return; }; fm = focusManager; if (!fm){ return; }; focusObj = IFlexDisplayObject(getFocusObject()); if (focusObj){ if (((errorString) && (!((errorString == ""))))){ rectCol = getStyle("errorColor"); } else { rectCol = getStyle("themeColor"); }; thickness = getStyle("focusThickness"); if ((focusObj is IStyleClient)){ IStyleClient(focusObj).setStyle("focusColor", rectCol); }; focusObj.setActualSize((obj.width + (2 * thickness)), (obj.height + (2 * thickness))); if (rotation){ rotRad = ((rotation * Math.PI) / 180); pt = new Point((obj.x - (thickness * (Math.cos(rotRad) - Math.sin(rotRad)))), (obj.y - (thickness * (Math.cos(rotRad) + Math.sin(rotRad))))); DisplayObject(focusObj).rotation = rotation; } else { pt = new Point((obj.x - thickness), (obj.y - thickness)); }; if (obj.parent == this){ pt.x = (pt.x + x); pt.y = (pt.y + y); }; pt = parent.localToGlobal(pt); pt = parent.globalToLocal(pt); focusObj.move(pt.x, pt.y); if ((focusObj is IInvalidating)){ IInvalidating(focusObj).validateNow(); } else { if ((focusObj is ProgrammaticSkin)){ ProgrammaticSkin(focusObj).validateNow(); }; }; }; } public function set nestLevel(value:int):void{ var childList:IChildList; var n:int; var i:int; var ui:ILayoutManagerClient; var textField:UITextField; if ((((value > 1)) && (!((_nestLevel == value))))){ _nestLevel = value; updateCallbacks(); childList = ((this is IRawChildrenContainer)) ? IRawChildrenContainer(this).rawChildren : IChildList(this); n = childList.numChildren; i = 0; while (i < n) { ui = (childList.getChildAt(i) as ILayoutManagerClient); if (ui){ ui.nestLevel = (value + 1); } else { textField = (childList.getChildAt(i) as UITextField); if (textField){ textField.nestLevel = (value + 1); }; }; i++; }; }; } public function getExplicitOrMeasuredHeight():Number{ return ((isNaN(explicitHeight)) ? measuredHeight : explicitHeight); } private function callLaterDispatcher(event:Event):void{ var layoutErrorEvent:DynamicEvent; var event = event; UIComponentGlobals.callLaterDispatcherCount++; if (!UIComponentGlobals.designTime){ callLaterDispatcher2(event); } else { callLaterDispatcher2(event); //unresolved jump var _slot1 = e; layoutErrorEvent = new DynamicEvent("layoutError"); layoutErrorEvent.error = _slot1; systemManager.dispatchEvent(layoutErrorEvent); }; UIComponentGlobals.callLaterDispatcherCount--; } final mx_internal function get $width():Number{ return (super.width); } public function get className():String{ var name:String; var index:int; name = getQualifiedClassName(this); index = name.indexOf("::"); if (index != -1){ name = name.substr((index + 2)); }; return (name); } public function verticalGradientMatrix(x:Number, y:Number, width:Number, height:Number):Matrix{ UIComponentGlobals.tempMatrix.createGradientBox(width, height, (Math.PI / 2), x, y); return (UIComponentGlobals.tempMatrix); } public function setCurrentState(stateName:String, playTransition:Boolean=true):void{ if (((!((stateName == currentState))) && (!(((isBaseState(stateName)) && (isBaseState(currentState))))))){ requestedCurrentState = stateName; playStateTransition = playTransition; if (initialized){ commitCurrentState(); } else { _currentStateChanged = true; addEventListener(FlexEvent.CREATION_COMPLETE, creationCompleteHandler); }; }; } private function getBaseStates(state:State):Array{ var baseStates:Array; baseStates = []; while (((state) && (!((state.basedOn == ""))))) { baseStates.push(state.basedOn); state = getState(state.basedOn); }; return (baseStates); } public function set minHeight(value:Number):void{ if (explicitMinHeight == value){ return; }; explicitMinHeight = value; } public function get errorString():String{ return (_errorString); } protected function isOurFocus(target:DisplayObject):Boolean{ return ((target == this)); } public function get automationName():String{ if (_automationName){ return (_automationName); }; if (automationDelegate){ return (automationDelegate.automationName); }; return (""); } final mx_internal function set $width(value:Number):void{ super.width = value; } public function invalidateDisplayList():void{ if (!invalidateDisplayListFlag){ invalidateDisplayListFlag = true; if (((parent) && (UIComponentGlobals.layoutManager))){ UIComponentGlobals.layoutManager.invalidateDisplayList(this); }; }; } override public function get scaleX():Number{ return (_scaleX); } override public function get scaleY():Number{ return (_scaleY); } mx_internal function initThemeColor():Boolean{ var styleName:Object; var tc:Object; var rc:Number; var sc:Number; var classSelector:Object; var typeSelectors:Array; var i:int; var typeSelector:CSSStyleDeclaration; styleName = _styleName; if (_styleDeclaration){ tc = _styleDeclaration.getStyle("themeColor"); rc = _styleDeclaration.getStyle("rollOverColor"); sc = _styleDeclaration.getStyle("selectionColor"); }; if (((((!(tc)) && (styleName))) && (!((styleName is ISimpleStyleClient))))){ classSelector = ((styleName is String)) ? StyleManager.getStyleDeclaration(("." + styleName)) : styleName; if (classSelector){ tc = classSelector.getStyle("themeColor"); rc = classSelector.getStyle("rollOverColor"); sc = classSelector.getStyle("selectionColor"); }; }; if (!tc){ typeSelectors = getClassStyleDeclarations(); i = 0; while (i < typeSelectors.length) { typeSelector = typeSelectors[i]; if (typeSelector){ tc = typeSelector.getStyle("themeColor"); rc = typeSelector.getStyle("rollOverColor"); sc = typeSelector.getStyle("selectionColor"); }; if (tc){ break; }; i++; }; }; if (((((tc) && (isNaN(rc)))) && (isNaN(sc)))){ setThemeColor(tc); return (true); }; return (((((tc) && (!(isNaN(rc))))) && (!(isNaN(sc))))); } override public function get mouseX():Number{ if (((!(root)) || ((root[fakeMouseX] === undefined)))){ return (super.mouseX); }; return (globalToLocal(new Point(root[fakeMouseX], 0)).x); } override public function get mouseY():Number{ if (((!(root)) || ((root[fakeMouseY] === undefined)))){ return (super.mouseY); }; return (globalToLocal(new Point(0, root[fakeMouseY])).y); } override public function stopDrag():void{ super.stopDrag(); invalidateProperties(); dispatchEvent(new Event("xChanged")); dispatchEvent(new Event("yChanged")); } public function get uid():String{ if (!_uid){ _uid = toString(); }; return (_uid); } public function set tweeningProperties(value:Array):void{ _tweeningProperties = value; } public function get focusPane():Sprite{ return (_focusPane); } public function horizontalGradientMatrix(x:Number, y:Number, width:Number, height:Number):Matrix{ UIComponentGlobals.tempMatrix.createGradientBox(width, height, 0, x, y); return (UIComponentGlobals.tempMatrix); } public function set validationSubField(value:String):void{ _validationSubField = value; } protected function keyDownHandler(event:KeyboardEvent):void{ } public function get isDocument():Boolean{ return ((document == this)); } mx_internal function addOverlay(color:uint, targetArea:RoundedRectangle=null):void{ if (!overlay){ overlayColor = color; overlay = new UIComponent(); overlay.name = "overlay"; fillOverlay(overlay, color, targetArea); attachOverlay(); if (!targetArea){ addEventListener(ResizeEvent.RESIZE, overlay_resizeHandler); }; overlay.x = 0; overlay.y = 0; invalidateDisplayList(); overlayReferenceCount = 1; } else { overlayReferenceCount++; }; dispatchEvent(new ChildExistenceChangedEvent(ChildExistenceChangedEvent.OVERLAY_CREATED, true, false, overlay)); } override public function get visible():Boolean{ return (_visible); } public function get screen():Rectangle{ var sm:ISystemManager; sm = systemManager; return ((sm) ? sm.screen : null); } override public function get x():Number{ return (super.x); } override public function get y():Number{ return (super.y); } public function get explicitHeight():Number{ return (_explicitHeight); } protected function focusInHandler(event:FocusEvent):void{ var fm:IFocusManager; if (isOurFocus(DisplayObject(event.target))){ fm = focusManager; if (((fm) && (fm.showFocusIndicator))){ drawFocus(true); }; Container.checkFocus(event.relatedObject, this); }; } private function focusObj_scrollHandler(event:Event):void{ adjustFocusRect(); } public function get percentWidth():Number{ return (_percentWidth); } public function set automationName(value:String):void{ _automationName = value; } public function get mouseFocusEnabled():Boolean{ return (_mouseFocusEnabled); } public function set explicitMinHeight(value:Number):void{ var p:IInvalidating; if (_explicitMinHeight == value){ return; }; _explicitMinHeight = value; invalidateSize(); p = (parent as IInvalidating); if (p){ p.invalidateSize(); p.invalidateDisplayList(); }; dispatchEvent(new Event("explicitMinHeightChanged")); } public function stylesInitialized():void{ } public function set errorString(value:String):void{ ToolTipManager.registerErrorString(this, value); _errorString = value; errorStringChanged = true; invalidateProperties(); dispatchEvent(new Event("errorStringChanged")); } public function getExplicitOrMeasuredWidth():Number{ return ((isNaN(explicitWidth)) ? measuredWidth : explicitWidth); } final mx_internal function set $height(value:Number):void{ super.height = value; } final mx_internal function $removeChild(child:DisplayObject):DisplayObject{ return (super.removeChild(child)); } override public function set scaleX(value:Number):void{ if (_scaleX == value){ return; }; _scaleX = value; invalidateProperties(); invalidateSize(); dispatchEvent(new Event("scaleXChanged")); } override public function set scaleY(value:Number):void{ if (_scaleY == value){ return; }; _scaleY = value; invalidateProperties(); invalidateSize(); dispatchEvent(new Event("scaleYChanged")); } protected function keyUpHandler(event:KeyboardEvent):void{ } override public function get parent():DisplayObjectContainer{ return ((_parent) ? _parent : super.parent); } mx_internal function get isEffectStarted():Boolean{ return (_isEffectStarted); } public function set uid(uid:String):void{ this._uid = uid; } mx_internal function adjustSizesForScaleChanges():void{ var xScale:Number; var yScale:Number; var scalingFactor:Number; xScale = scaleX; yScale = scaleY; if (xScale != oldScaleX){ scalingFactor = Math.abs((xScale / oldScaleX)); if (explicitMinWidth){ explicitMinWidth = (explicitMinWidth * scalingFactor); }; if (!isNaN(explicitWidth)){ explicitWidth = (explicitWidth * scalingFactor); }; if (explicitMaxWidth){ explicitMaxWidth = (explicitMaxWidth * scalingFactor); }; oldScaleX = xScale; }; if (yScale != oldScaleY){ scalingFactor = Math.abs((yScale / oldScaleY)); if (explicitMinHeight){ explicitMinHeight = (explicitMinHeight * scalingFactor); }; if (explicitHeight){ explicitHeight = (explicitHeight * scalingFactor); }; if (explicitMaxHeight){ explicitMaxHeight = (explicitMaxHeight * scalingFactor); }; oldScaleY = yScale; }; } public function set focusPane(value:Sprite):void{ if (value){ addChild(value); value.x = 0; value.y = 0; value.scrollRect = null; _focusPane = value; } else { removeChild(_focusPane); _focusPane = null; }; } public function determineTextFormatFromStyles():UITextFormat{ var textFormat:UITextFormat; textFormat = cachedTextFormat; if (!textFormat){ textFormat = new UITextFormat(systemManager); textFormat.align = _inheritingStyles.textAlign; textFormat.bold = (_inheritingStyles.fontWeight == "bold"); textFormat.color = (enabled) ? _inheritingStyles.color : _inheritingStyles.disabledColor; textFormat.font = StringUtil.trimArrayElements(_inheritingStyles.fontFamily, ","); textFormat.indent = _inheritingStyles.textIndent; textFormat.italic = (_inheritingStyles.fontStyle == "italic"); textFormat.kerning = _inheritingStyles.kerning; textFormat.leading = _nonInheritingStyles.leading; textFormat.leftMargin = _nonInheritingStyles.paddingLeft; textFormat.letterSpacing = _inheritingStyles.letterSpacing; textFormat.rightMargin = _nonInheritingStyles.paddingRight; textFormat.size = _inheritingStyles.fontSize; textFormat.underline = (_nonInheritingStyles.textDecoration == "underline"); textFormat.antiAliasType = _inheritingStyles.fontAntiAliasType; textFormat.gridFitType = _inheritingStyles.fontGridFitType; textFormat.sharpness = _inheritingStyles.fontSharpness; textFormat.thickness = _inheritingStyles.fontThickness; cachedTextFormat = textFormat; }; return (textFormat); } public function getAutomationChildAt(index:int):IAutomationObject{ if (automationDelegate){ return (automationDelegate.getAutomationChildAt(index)); }; return (null); } private function focusObj_resizeHandler(event:ResizeEvent):void{ adjustFocusRect(); } public function validationResultHandler(event:ValidationResultEvent):void{ var msg:String; var result:ValidationResult; var i:int; if (event.type == ValidationResultEvent.VALID){ if (errorString != ""){ errorString = ""; dispatchEvent(new FlexEvent(FlexEvent.VALID)); }; } else { if (((((!((validationSubField == null))) && (!((validationSubField == ""))))) && (event.results))){ i = 0; while (i < event.results.length) { result = event.results[i]; if (result.subField == validationSubField){ if (result.isError){ msg = result.errorMessage; } else { if (errorString != ""){ errorString = ""; dispatchEvent(new FlexEvent(FlexEvent.VALID)); }; }; break; }; i++; }; } else { if (((event.results) && ((event.results.length > 0)))){ msg = event.results[0].errorMessage; }; }; if (((msg) && (!((errorString == msg))))){ errorString = msg; dispatchEvent(new FlexEvent(FlexEvent.INVALID)); }; }; } public function invalidateProperties():void{ if (!invalidatePropertiesFlag){ invalidatePropertiesFlag = true; if (((parent) && (UIComponentGlobals.layoutManager))){ UIComponentGlobals.layoutManager.invalidateProperties(this); }; }; } public function get inheritingStyles():Object{ return (_inheritingStyles); } public function setActualSize(w:Number, h:Number):void{ var changed:Boolean; changed = false; if (_width != w){ _width = w; dispatchEvent(new Event("widthChanged")); changed = true; }; if (_height != h){ _height = h; dispatchEvent(new Event("heightChanged")); changed = true; }; if (changed){ invalidateDisplayList(); dispatchResizeEvent(); }; } final mx_internal function get $x():Number{ return (super.x); } final mx_internal function get $y():Number{ return (super.y); } override public function set visible(value:Boolean):void{ setVisible(value); } public function registerEffects(effects:Array):void{ var n:int; var i:int; var event:String; n = effects.length; i = 0; while (i < n) { event = EffectManager.getEventForEffectTrigger(effects[i]); if (((!((event == null))) && (!((event == ""))))){ addEventListener(event, EffectManager.eventHandler, false, EventPriority.EFFECT); }; i++; }; } public function createAutomationIDPart(child:IAutomationObject):Object{ if (automationDelegate){ return (automationDelegate.createAutomationIDPart(child)); }; return (null); } public function get explicitMinWidth():Number{ return (_explicitMinWidth); } private function filterChangeHandler(event:Event):void{ super.filters = _filters; } override public function set x(value:Number):void{ if (super.x == value){ return; }; super.x = value; invalidateProperties(); dispatchEvent(new Event("xChanged")); } override public function set y(value:Number):void{ if (super.y == value){ return; }; super.y = value; invalidateProperties(); dispatchEvent(new Event("yChanged")); } public function set explicitHeight(value:Number):void{ var p:IInvalidating; if (_explicitHeight == value){ return; }; if (!isNaN(value)){ _percentHeight = NaN; }; _explicitHeight = value; invalidateSize(); p = (parent as IInvalidating); if (((p) && (includeInLayout))){ p.invalidateSize(); p.invalidateDisplayList(); }; dispatchEvent(new Event("explicitHeightChanged")); } public function set showInAutomationHierarchy(value:Boolean):void{ _showInAutomationHierarchy = value; } public function set systemManager(value:ISystemManager):void{ _systemManager = value; } mx_internal function getFocusObject():DisplayObject{ var fm:IFocusManager; fm = focusManager; if (((!(fm)) || (!(fm.focusPane)))){ return (null); }; return (((fm.focusPane.numChildren == 0)) ? null : fm.focusPane.getChildAt(0)); } override public function addChild(child:DisplayObject):DisplayObject{ var index:int; index = (((overlayReferenceCount) && (!((child == overlay))))) ? Math.max(0, (super.numChildren - 1)) : super.numChildren; addingChild(child); $addChildAt(child, index); childAdded(child); return (child); } public function get moduleFactory():IFlexModuleFactory{ return (_moduleFactory); } public function set percentWidth(value:Number):void{ var p:IInvalidating; if (_percentWidth == value){ return; }; if (!isNaN(value)){ _explicitWidth = NaN; }; _percentWidth = value; p = (parent as IInvalidating); if (p){ p.invalidateSize(); p.invalidateDisplayList(); }; } public function get document():Object{ return (_document); } public function set mouseFocusEnabled(value:Boolean):void{ _mouseFocusEnabled = value; } final mx_internal function $addChild(child:DisplayObject):DisplayObject{ return (super.addChild(child)); } mx_internal function setThemeColor(value:Object):void{ var newValue:Number; var newValueS:Number; var newValueR:Number; if ((newValue is String)){ newValue = parseInt(String(value)); } else { newValue = Number(value); }; if (isNaN(newValue)){ newValue = StyleManager.getColorName(value); }; newValueS = ColorUtil.adjustBrightness2(newValue, 50); newValueR = ColorUtil.adjustBrightness2(newValue, 70); setStyle("selectionColor", newValueS); setStyle("rollOverColor", newValueR); } override public function get height():Number{ return (_height); } public function get id():String{ return (_id); } public function set minWidth(value:Number):void{ if (explicitMinWidth == value){ return; }; explicitMinWidth = value; } public function set currentState(value:String):void{ setCurrentState(value, true); } public function getRepeaterItem(whichRepeater:int=-1):Object{ var repeaterArray:Array; repeaterArray = repeaters; if (whichRepeater == -1){ whichRepeater = (repeaterArray.length - 1); }; return (repeaterArray[whichRepeater].getItemAt(repeaterIndices[whichRepeater])); } public function executeBindings(recurse:Boolean=false):void{ var bindingsHost:Object; bindingsHost = (((descriptor) && (descriptor.document))) ? descriptor.document : parentDocument; BindingManager.executeBindings(bindingsHost, id, this); } public function replayAutomatableEvent(event:Event):Boolean{ if (automationDelegate){ return (automationDelegate.replayAutomatableEvent(event)); }; return (false); } public function get instanceIndex():int{ return ((_instanceIndices) ? _instanceIndices[(_instanceIndices.length - 1)] : -1); } public function get explicitMaxWidth():Number{ return (_explicitMaxWidth); } public function effectFinished(effectInst:EffectInstance):void{ _endingEffectInstances.push(effectInst); invalidateProperties(); UIComponentGlobals.layoutManager.addEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteHandler, false, 0, true); } public function set measuredWidth(value:Number):void{ _measuredWidth = value; } override public function removeChildAt(index:int):DisplayObject{ var child:DisplayObject; child = getChildAt(index); removingChild(child); $removeChild(child); childRemoved(child); return (child); } mx_internal function set isEffectStarted(value:Boolean):void{ _isEffectStarted = value; } mx_internal function fillOverlay(overlay:UIComponent, color:uint, targetArea:RoundedRectangle=null):void{ var g:Graphics; if (!targetArea){ targetArea = new RoundedRectangle(0, 0, unscaledWidth, unscaledHeight, 0); }; g = overlay.graphics; g.clear(); g.beginFill(color); g.drawRoundRect(targetArea.x, targetArea.y, targetArea.width, targetArea.height, (targetArea.cornerRadius * 2), (targetArea.cornerRadius * 2)); g.endFill(); } mx_internal function childAdded(child:DisplayObject):void{ if ((child is UIComponent)){ if (!UIComponent(child).initialized){ UIComponent(child).initialize(); }; } else { if ((child is IUIComponent)){ IUIComponent(child).initialize(); }; }; } public function globalToContent(point:Point):Point{ return (globalToLocal(point)); } public function get instanceIndices():Array{ return ((_instanceIndices) ? _instanceIndices.slice(0) : null); } mx_internal function removingChild(child:DisplayObject):void{ } private function getTransition(oldState:String, newState:String):Effect{ var result:Effect; var priority:int; var i:int; var t:Transition; result = null; priority = 0; if (!transitions){ return (null); }; if (!oldState){ oldState = ""; }; if (!newState){ newState = ""; }; i = 0; while (i < transitions.length) { t = transitions[i]; if ((((((t.fromState == "*")) && ((t.toState == "*")))) && ((priority < 1)))){ result = t.effect; priority = 1; } else { if ((((((t.fromState == oldState)) && ((t.toState == "*")))) && ((priority < 2)))){ result = t.effect; priority = 2; } else { if ((((((t.fromState == "*")) && ((t.toState == newState)))) && ((priority < 3)))){ result = t.effect; priority = 3; } else { if ((((((t.fromState == oldState)) && ((t.toState == newState)))) && ((priority < 4)))){ result = t.effect; priority = 4; break; }; }; }; }; i++; }; return (result); } public function set owner(value:DisplayObjectContainer):void{ _owner = value; } mx_internal function getEffectsForProperty(propertyName:String):Array{ return (((_affectedProperties[propertyName])!=undefined) ? _affectedProperties[propertyName] : []); } protected function get unscaledWidth():Number{ return ((width / Math.abs(scaleX))); } public function set processedDescriptors(value:Boolean):void{ _processedDescriptors = value; if (value){ dispatchEvent(new FlexEvent(FlexEvent.INITIALIZE)); }; } private function processEffectFinished(effectInsts:Array):void{ var i:int; var j:int; var effectInst:EffectInstance; var removedInst:EffectInstance; var aProps:Array; var k:int; var propName:String; var l:int; i = (_effectsStarted.length - 1); while (i >= 0) { j = 0; while (j < effectInsts.length) { effectInst = effectInsts[j]; if (effectInst == _effectsStarted[i]){ removedInst = _effectsStarted[i]; _effectsStarted.splice(i, 1); aProps = removedInst.effect.getAffectedProperties(); k = 0; while (k < aProps.length) { propName = aProps[k]; if (_affectedProperties[propName] != undefined){ l = 0; while (l < _affectedProperties[propName].length) { if (_affectedProperties[propName][l] == effectInst){ _affectedProperties[propName].splice(l, 1); break; }; l++; }; if (_affectedProperties[propName].length == 0){ delete _affectedProperties[propName]; }; }; k++; }; break; }; j++; }; i--; }; isEffectStarted = ((_effectsStarted.length > 0)) ? true : false; } protected function measure():void{ measuredWidth = (isNaN(_width)) ? 0 : _width; measuredHeight = (isNaN(_height)) ? 0 : _height; } private function dispatchResizeEvent():void{ var resizeEvent:ResizeEvent; resizeEvent = new ResizeEvent(ResizeEvent.RESIZE); resizeEvent.oldWidth = oldWidth; resizeEvent.oldHeight = oldHeight; dispatchEvent(resizeEvent); oldWidth = width; oldHeight = height; } public function get includeInLayout():Boolean{ return (_includeInLayout); } public function set maxWidth(value:Number):void{ if (explicitMaxWidth == value){ return; }; explicitMaxWidth = value; } public function validateDisplayList():void{ var sm:ISystemManager; if (invalidateDisplayListFlag){ sm = (parent as ISystemManager); if (sm){ if ((((sm == systemManager.topLevelSystemManager)) && (!((sm.document == this))))){ setActualSize(getExplicitOrMeasuredWidth(), getExplicitOrMeasuredHeight()); }; }; updateDisplayList(((scaleX == 0)) ? 0 : (width / scaleX), ((scaleY == 0)) ? 0 : (height / scaleY)); invalidateDisplayListFlag = false; }; } public function contentToGlobal(point:Point):Point{ return (localToGlobal(point)); } public function resolveAutomationIDPart(criteria:Object):Array{ if (automationDelegate){ return (automationDelegate.resolveAutomationIDPart(criteria)); }; return ([]); } public function setFocus():void{ var sm:ISystemManager; sm = systemManager; if (((sm) && (sm.stage))){ if (UIComponentGlobals.callLaterDispatcherCount == 0){ sm.stage.focus = this; UIComponentGlobals.nextFocusObject = null; } else { UIComponentGlobals.nextFocusObject = this; sm.stage.addEventListener(Event.ENTER_FRAME, setFocusLater); }; } else { UIComponentGlobals.nextFocusObject = this; callLater(setFocusLater); }; } public function set inheritingStyles(value:Object):void{ _inheritingStyles = value; } public function set initialized(value:Boolean):void{ _initialized = value; if (value){ setVisible(_visible, true); dispatchEvent(new FlexEvent(FlexEvent.CREATION_COMPLETE)); }; } public function owns(child:DisplayObject):Boolean{ var childList:IChildList; childList = ((this is IRawChildrenContainer)) ? IRawChildrenContainer(this).rawChildren : IChildList(this); if (childList.contains(child)){ return (true); }; while (((child) && (!((child == this))))) { if ((child is IUIComponent)){ child = IUIComponent(child).owner; } else { child = child.parent; }; }; return ((child == this)); } public function setVisible(value:Boolean, noEvent:Boolean=false):void{ _visible = value; if (!initialized){ return; }; if ($visible == value){ return; }; $visible = value; if (!noEvent){ dispatchEvent(new FlexEvent((value) ? FlexEvent.SHOW : FlexEvent.HIDE)); }; } final mx_internal function set $y(value:Number):void{ super.y = value; } final mx_internal function $addChildAt(child:DisplayObject, index:int):DisplayObject{ return (super.addChildAt(child, index)); } public function deleteReferenceOnParentDocument(parentDocument:IFlexDisplayObject):void{ var indices:Array; var r:Object; var stack:Array; var n:int; var i:int; var j:int; var s:Object; var event:PropertyChangeEvent; if (((id) && (!((id == ""))))){ indices = _instanceIndices; if (!indices){ parentDocument[id] = null; } else { r = parentDocument[id]; if (!r){ return; }; stack = []; stack.push(r); n = indices.length; i = 0; while (i < (n - 1)) { s = r[indices[i]]; if (!s){ return; }; r = s; stack.push(r); i++; }; r.splice(indices[(n - 1)], 1); j = (stack.length - 1); while (j > 0) { if (stack[j].length == 0){ stack[(j - 1)].splice(indices[j], 1); }; j--; }; if ((((stack.length > 0)) && ((stack[0].length == 0)))){ parentDocument[id] = null; } else { event = PropertyChangeEvent.createUpdateEvent(parentDocument, id, parentDocument[id], parentDocument[id]); parentDocument.dispatchEvent(event); }; }; }; } private function commitCurrentState():void{ var transition:Effect; var commonBaseState:String; var event:StateChangeEvent; var oldState:String; var destination:State; transition = (playStateTransition) ? getTransition(_currentState, requestedCurrentState) : null; commonBaseState = findCommonBaseState(_currentState, requestedCurrentState); oldState = (_currentState) ? _currentState : ""; destination = getState(requestedCurrentState); if (_currentTransitionEffect){ _currentTransitionEffect.end(); }; initializeState(requestedCurrentState); if (transition){ transition.captureStartValues(); }; event = new StateChangeEvent(StateChangeEvent.CURRENT_STATE_CHANGING); event.oldState = oldState; event.newState = (requestedCurrentState) ? requestedCurrentState : ""; dispatchEvent(event); if (isBaseState(_currentState)){ dispatchEvent(new FlexEvent(FlexEvent.EXIT_STATE)); }; removeState(_currentState, commonBaseState); _currentState = requestedCurrentState; if (isBaseState(currentState)){ dispatchEvent(new FlexEvent(FlexEvent.ENTER_STATE)); } else { applyState(_currentState, commonBaseState); }; event = new StateChangeEvent(StateChangeEvent.CURRENT_STATE_CHANGE); event.oldState = oldState; event.newState = (_currentState) ? _currentState : ""; dispatchEvent(event); if (transition){ UIComponentGlobals.layoutManager.validateNow(); _currentTransitionEffect = transition; transition.addEventListener(EffectEvent.EFFECT_END, transition_effectEndHandler); transition.play(); }; } public function get nonInheritingStyles():Object{ return (_nonInheritingStyles); } final mx_internal function set $x(value:Number):void{ super.x = value; } private function applyState(stateName:String, lastState:String):void{ var state:State; var overrides:Array; var i:int; state = getState(stateName); if (state){ if (state.basedOn != lastState){ applyState(state.basedOn, lastState); }; overrides = state.overrides; i = 0; while (i < overrides.length) { overrides[i].apply(this); i++; }; state.dispatchEnterState(); }; } override public function get width():Number{ return (_width); } public function effectStarted(effectInst:EffectInstance):void{ var aProps:Array; var j:int; var propName:String; _effectsStarted.push(effectInst); aProps = effectInst.effect.getAffectedProperties(); j = 0; while (j < aProps.length) { propName = aProps[j]; if (_affectedProperties[propName] == undefined){ _affectedProperties[propName] = []; }; _affectedProperties[propName].push(effectInst); j++; }; isEffectStarted = true; } protected function commitProperties():void{ var scalingFactorX:Number; var scalingFactorY:Number; if (_scaleX != oldScaleX){ scalingFactorX = Math.abs((_scaleX / oldScaleX)); if (!isNaN(explicitMinWidth)){ explicitMinWidth = (explicitMinWidth * scalingFactorX); }; if (!isNaN(explicitWidth)){ explicitWidth = (explicitWidth * scalingFactorX); }; if (!isNaN(explicitMaxWidth)){ explicitMaxWidth = (explicitMaxWidth * scalingFactorX); }; _width = (_width * scalingFactorX); super.scaleX = (oldScaleX = _scaleX); }; if (_scaleY != oldScaleY){ scalingFactorY = Math.abs((_scaleY / oldScaleY)); if (!isNaN(explicitMinHeight)){ explicitMinHeight = (explicitMinHeight * scalingFactorY); }; if (!isNaN(explicitHeight)){ explicitHeight = (explicitHeight * scalingFactorY); }; if (!isNaN(explicitMaxHeight)){ explicitMaxHeight = (explicitMaxHeight * scalingFactorY); }; _height = (_height * scalingFactorY); super.scaleY = (oldScaleY = _scaleY); }; if (((!((x == oldX))) || (!((y == oldY))))){ dispatchMoveEvent(); }; if (((!((width == oldWidth))) || (!((height == oldHeight))))){ dispatchResizeEvent(); }; if (errorStringChanged){ errorStringChanged = false; setBorderColorForErrorString(); }; } public function get percentHeight():Number{ return (_percentHeight); } final mx_internal function get $parent():DisplayObjectContainer{ return (super.parent); } public function set explicitMinWidth(value:Number):void{ var p:IInvalidating; if (_explicitMinWidth == value){ return; }; _explicitMinWidth = value; invalidateSize(); p = (parent as IInvalidating); if (p){ p.invalidateSize(); p.invalidateDisplayList(); }; dispatchEvent(new Event("explicitMinWidthChanged")); } public function get isPopUp():Boolean{ return (_isPopUp); } private function measureSizes():Boolean{ var changed:Boolean; var scalingFactor:Number; var newValue:Number; var xScale:Number; var yScale:Number; changed = false; if (!invalidateSizeFlag){ return (changed); }; if (((isNaN(explicitWidth)) || (isNaN(explicitHeight)))){ xScale = Math.abs(scaleX); yScale = Math.abs(scaleY); if (xScale != 1){ _measuredMinWidth = (_measuredMinWidth / xScale); _measuredWidth = (_measuredWidth / xScale); }; if (yScale != 1){ _measuredMinHeight = (_measuredMinHeight / yScale); _measuredHeight = (_measuredHeight / yScale); }; measure(); invalidateSizeFlag = false; if (((!(isNaN(explicitMinWidth))) && ((measuredWidth < explicitMinWidth)))){ measuredWidth = explicitMinWidth; }; if (((!(isNaN(explicitMaxWidth))) && ((measuredWidth > explicitMaxWidth)))){ measuredWidth = explicitMaxWidth; }; if (((!(isNaN(explicitMinHeight))) && ((measuredHeight < explicitMinHeight)))){ measuredHeight = explicitMinHeight; }; if (((!(isNaN(explicitMaxHeight))) && ((measuredHeight > explicitMaxHeight)))){ measuredHeight = explicitMaxHeight; }; if (xScale != 1){ _measuredMinWidth = (_measuredMinWidth * xScale); _measuredWidth = (_measuredWidth * xScale); }; if (yScale != 1){ _measuredMinHeight = (_measuredMinHeight * yScale); _measuredHeight = (_measuredHeight * yScale); }; } else { invalidateSizeFlag = false; _measuredMinWidth = 0; _measuredMinHeight = 0; }; adjustSizesForScaleChanges(); if (isNaN(oldMinWidth)){ oldMinWidth = (isNaN(explicitMinWidth)) ? measuredMinWidth : explicitMinWidth; oldMinHeight = (isNaN(explicitMinHeight)) ? measuredMinHeight : explicitMinHeight; oldExplicitWidth = (isNaN(explicitWidth)) ? measuredWidth : explicitWidth; oldExplicitHeight = (isNaN(explicitHeight)) ? measuredHeight : explicitHeight; changed = true; } else { newValue = (isNaN(explicitMinWidth)) ? measuredMinWidth : explicitMinWidth; if (newValue != oldMinWidth){ oldMinWidth = newValue; changed = true; }; newValue = (isNaN(explicitMinHeight)) ? measuredMinHeight : explicitMinHeight; if (newValue != oldMinHeight){ oldMinHeight = newValue; changed = true; }; newValue = (isNaN(explicitWidth)) ? measuredWidth : explicitWidth; if (newValue != oldExplicitWidth){ oldExplicitWidth = newValue; changed = true; }; newValue = (isNaN(explicitHeight)) ? measuredHeight : explicitHeight; if (newValue != oldExplicitHeight){ oldExplicitHeight = newValue; changed = true; }; }; return (changed); } public function get automationTabularData():Object{ if (automationDelegate){ return (automationDelegate.automationTabularData); }; return (null); } public function validateNow():void{ UIComponentGlobals.layoutManager.validateClient(this); } public function finishPrint(obj:Object, target:IFlexDisplayObject):void{ } public function get repeaters():Array{ return ((_repeaters) ? _repeaters.slice(0) : []); } private function dispatchMoveEvent():void{ var moveEvent:MoveEvent; moveEvent = new MoveEvent(MoveEvent.MOVE); moveEvent.oldX = oldX; moveEvent.oldY = oldY; dispatchEvent(moveEvent); oldX = x; oldY = y; } public function get measuredMinHeight():Number{ return (_measuredMinHeight); } public function drawFocus(isFocused:Boolean):void{ var focusObj:DisplayObject; var focusPane:Sprite; var focusOwner:DisplayObjectContainer; var focusClass:Class; if (!parent){ return; }; focusObj = getFocusObject(); focusPane = (focusManager) ? focusManager.focusPane : null; if (((isFocused) && (!(isEffectStarted)))){ focusOwner = focusPane.parent; if (focusOwner != parent){ if (focusOwner){ if ((focusOwner is ISystemManager)){ ISystemManager(focusOwner).focusPane = null; } else { IUIComponent(focusOwner).focusPane = null; }; }; if ((parent is ISystemManager)){ ISystemManager(parent).focusPane = focusPane; } else { IUIComponent(parent).focusPane = focusPane; }; }; focusClass = getStyle("focusSkin"); if (((focusObj) && (!((focusObj is focusClass))))){ focusPane.removeChild(focusObj); focusObj = null; }; if (!focusObj){ focusObj = new (focusClass); focusObj.name = "focus"; focusPane.addChild(focusObj); }; if ((focusObj is ILayoutManagerClient)){ ILayoutManagerClient(focusObj).nestLevel = nestLevel; }; if ((focusObj is ISimpleStyleClient)){ ISimpleStyleClient(focusObj).styleName = this; }; addEventListener(MoveEvent.MOVE, focusObj_moveHandler, true); addEventListener(MoveEvent.MOVE, focusObj_moveHandler); addEventListener(ResizeEvent.RESIZE, focusObj_resizeHandler, true); addEventListener(ResizeEvent.RESIZE, focusObj_resizeHandler); addEventListener(Event.REMOVED, focusObj_removedHandler, true); focusObj.visible = true; hasFocusRect = true; adjustFocusRect(); } else { if (hasFocusRect){ if (focusObj){ focusObj.visible = false; }; removeEventListener(MoveEvent.MOVE, focusObj_moveHandler); removeEventListener(MoveEvent.MOVE, focusObj_moveHandler, true); removeEventListener(ResizeEvent.RESIZE, focusObj_resizeHandler, true); removeEventListener(ResizeEvent.RESIZE, focusObj_resizeHandler); removeEventListener(Event.REMOVED, focusObj_removedHandler, true); }; }; } private function get indexedID():String{ var s:String; var indices:Array; s = id; indices = instanceIndices; if (indices){ s = (s + (("[" + indices.join("][")) + "]")); }; return (s); } mx_internal function addingChild(child:DisplayObject):void{ if ((((child is IUIComponent)) && (!(IUIComponent(child).document)))){ IUIComponent(child).document = (document) ? document : Application.application; }; if ((child is IUIComponent)){ IUIComponent(child).parentChanged(this); }; if ((child is ILayoutManagerClient)){ ILayoutManagerClient(child).nestLevel = (nestLevel + 1); } else { if ((child is UITextField)){ UITextField(child).nestLevel = (nestLevel + 1); }; }; if ((child is InteractiveObject)){ if (doubleClickEnabled){ InteractiveObject(child).doubleClickEnabled = true; }; }; if ((child is IStyleClient)){ IStyleClient(child).regenerateStyleCache(true); } else { if ((((child is UITextField)) && (UITextField(child).inheritingStyles))){ StyleProtoChain.initTextField(UITextField(child)); }; }; if ((child is ISimpleStyleClient)){ ISimpleStyleClient(child).styleChanged(null); }; if ((child is IStyleClient)){ IStyleClient(child).notifyStyleChangeInChildren(null, true); }; if ((child is UIComponent)){ UIComponent(child).initThemeColor(); }; if ((child is UIComponent)){ UIComponent(child).stylesInitialized(); }; } protected function initializationComplete():void{ processedDescriptors = true; } public function set moduleFactory(factory:IFlexModuleFactory):void{ _moduleFactory = factory; } public function set repeaterIndices(value:Array):void{ _repeaterIndices = value; } private function focusObj_removedHandler(event:Event):void{ var focusObject:DisplayObject; if (event.target != this){ return; }; focusObject = getFocusObject(); if (focusObject){ focusObject.visible = false; }; } mx_internal function updateCallbacks():void{ if (invalidateDisplayListFlag){ UIComponentGlobals.layoutManager.invalidateDisplayList(this); }; if (invalidateSizeFlag){ UIComponentGlobals.layoutManager.invalidateSize(this); }; if (invalidatePropertiesFlag){ UIComponentGlobals.layoutManager.invalidateProperties(this); }; if (systemManager){ if ((((methodQueue.length > 0)) && (!(listeningForRender)))){ _systemManager.stage.addEventListener(Event.RENDER, callLaterDispatcher); _systemManager.stage.addEventListener(Event.ENTER_FRAME, callLaterDispatcher); listeningForRender = true; }; _systemManager.stage.invalidate(); }; } public function set styleDeclaration(value:CSSStyleDeclaration):void{ _styleDeclaration = value; } override public function set doubleClickEnabled(value:Boolean):void{ var childList:IChildList; var i:int; var child:InteractiveObject; super.doubleClickEnabled = value; if ((this is IRawChildrenContainer)){ childList = IRawChildrenContainer(this).rawChildren; } else { childList = IChildList(this); }; i = 0; while (i < childList.numChildren) { child = (childList.getChildAt(i) as InteractiveObject); if (child){ child.doubleClickEnabled = value; }; i++; }; } public function prepareToPrint(target:IFlexDisplayObject):Object{ return (null); } public function get minHeight():Number{ if (!isNaN(explicitMinHeight)){ return (explicitMinHeight); }; return (measuredMinHeight); } public function notifyStyleChangeInChildren(styleProp:String, recursive:Boolean):void{ var n:int; var i:int; var child:ISimpleStyleClient; cachedTextFormat = null; n = numChildren; i = 0; while (i < n) { child = (getChildAt(i) as ISimpleStyleClient); if (child){ child.styleChanged(styleProp); if ((child is IStyleClient)){ IStyleClient(child).notifyStyleChangeInChildren(styleProp, recursive); }; }; i++; }; } public function get contentMouseX():Number{ return (mouseX); } public function get contentMouseY():Number{ return (mouseY); } public function get tweeningProperties():Array{ return (_tweeningProperties); } public function set explicitMaxWidth(value:Number):void{ var p:IInvalidating; if (_explicitMaxWidth == value){ return; }; _explicitMaxWidth = value; invalidateSize(); p = (parent as IInvalidating); if (p){ p.invalidateSize(); p.invalidateDisplayList(); }; dispatchEvent(new Event("explicitMaxWidthChanged")); } public function set document(value:Object):void{ var n:int; var i:int; var child:IUIComponent; n = numChildren; i = 0; while (i < n) { child = (getChildAt(i) as IUIComponent); if (!child){ } else { if ((((child.document == _document)) || ((child.document == Application.application)))){ child.document = value; }; }; i++; }; _document = value; } public function validateSize(recursive:Boolean=false):void{ var i:int; var child:DisplayObject; var sizeChanging:Boolean; var p:IInvalidating; if (recursive){ i = 0; while (i < numChildren) { child = getChildAt(i); if ((child is ILayoutManagerClient)){ (child as ILayoutManagerClient).validateSize(true); }; i++; }; }; if (invalidateSizeFlag){ sizeChanging = measureSizes(); if (((sizeChanging) && (includeInLayout))){ invalidateDisplayList(); p = (parent as IInvalidating); if (p){ p.invalidateSize(); p.invalidateDisplayList(); }; }; }; } override public function dispatchEvent(event:Event):Boolean{ if (dispatchEventHook != null){ dispatchEventHook(event, this); }; return (super.dispatchEvent(event)); } public function set updateCompletePendingFlag(value:Boolean):void{ _updateCompletePendingFlag = value; } final mx_internal function get $height():Number{ return (super.height); } override public function set height(value:Number):void{ var p:IInvalidating; if (explicitHeight != value){ explicitHeight = value; invalidateSize(); }; if (_height != value){ invalidateProperties(); invalidateDisplayList(); p = (parent as IInvalidating); if (((p) && (includeInLayout))){ p.invalidateSize(); p.invalidateDisplayList(); }; _height = value; dispatchEvent(new Event("heightChanged")); }; } protected function attachOverlay():void{ addChild(overlay); } private function overlay_resizeHandler(event:Event):void{ fillOverlay(overlay, overlayColor, null); } public function get numAutomationChildren():int{ if (automationDelegate){ return (automationDelegate.numAutomationChildren); }; return (0); } public function get explicitMinHeight():Number{ return (_explicitMinHeight); } public function localToContent(point:Point):Point{ return (point); } public function set id(value:String):void{ _id = value; } public function get parentApplication():Object{ var o:Object; var p:UIComponent; o = systemManager.document; if (o == this){ p = (o.systemManager.parent as UIComponent); o = (p) ? p.systemManager.document : null; }; return (o); } private function removeState(stateName:String, lastState:String):void{ var state:State; var overrides:Array; var i:int; state = getState(stateName); if (state){ state.dispatchExitState(); overrides = state.overrides; i = overrides.length; while (i) { overrides[(i - 1)].remove(this); i--; }; if (state.basedOn != lastState){ removeState(state.basedOn, lastState); }; }; } public function setStyle(styleProp:String, newValue):void{ var isInheritingStyle:Boolean; var isProtoChainInitialized:Boolean; var valueChanged:Boolean; if (styleProp == "styleName"){ styleName = newValue; return; }; if (EffectManager.getEventForEffectTrigger(styleProp) != ""){ EffectManager.setStyle(styleProp, this); }; isInheritingStyle = StyleManager.isInheritingStyle(styleProp); isProtoChainInitialized = !((inheritingStyles == UIComponent.STYLE_UNINITIALIZED)); valueChanged = !((getStyle(styleProp) == newValue)); if (!_styleDeclaration){ _styleDeclaration = new CSSStyleDeclaration(); _styleDeclaration.setStyle(styleProp, newValue); if (isProtoChainInitialized){ regenerateStyleCache(isInheritingStyle); }; } else { _styleDeclaration.setStyle(styleProp, newValue); }; if (((isProtoChainInitialized) && (valueChanged))){ styleChanged(styleProp); notifyStyleChangeInChildren(styleProp, isInheritingStyle); }; } public function get validationSubField():String{ return (_validationSubField); } public function get systemManager():ISystemManager{ var r:DisplayObject; var o:DisplayObjectContainer; var ui:IUIComponent; if (!_systemManager){ r = root; if (r){ _systemManager = (r as ISystemManager); } else { o = parent; while (o) { ui = (o as IUIComponent); if (ui){ _systemManager = ui.systemManager; break; }; o = o.parent; }; }; }; return (_systemManager); } public function get showInAutomationHierarchy():Boolean{ return (_showInAutomationHierarchy); } private function isBaseState(stateName:String):Boolean{ return (((!(stateName)) || ((stateName == "")))); } override public function addChildAt(child:DisplayObject, index:int):DisplayObject{ if (((overlayReferenceCount) && (!((child == overlay))))){ index = Math.min(index, Math.max(0, (super.numChildren - 1))); }; addingChild(child); $addChildAt(child, index); childAdded(child); return (child); } public function set enabled(value:Boolean):void{ _enabled = value; cachedTextFormat = null; invalidateDisplayList(); dispatchEvent(new Event("enabledChanged")); } public function get minWidth():Number{ if (!isNaN(explicitMinWidth)){ return (explicitMinWidth); }; return (measuredMinWidth); } private function setFocusLater(event:Event=null):void{ var sm:ISystemManager; sm = systemManager; if (((sm) && (sm.stage))){ sm.stage.removeEventListener(Event.ENTER_FRAME, setFocusLater); if (UIComponentGlobals.nextFocusObject){ sm.stage.focus = UIComponentGlobals.nextFocusObject; }; UIComponentGlobals.nextFocusObject = null; }; } public function get currentState():String{ return ((_currentStateChanged) ? requestedCurrentState : _currentState); } public function set focusEnabled(value:Boolean):void{ _focusEnabled = value; } public function get measuredWidth():Number{ return (_measuredWidth); } public function get baselinePosition():Number{ return (NaN); } public function set cachePolicy(value:String):void{ if (_cachePolicy != value){ _cachePolicy = value; if (value == UIComponentCachePolicy.OFF){ cacheAsBitmap = false; } else { if (value == UIComponentCachePolicy.ON){ cacheAsBitmap = true; } else { cacheAsBitmap = (cacheAsBitmapCount > 0); }; }; }; } public function get automationValue():Array{ if (automationDelegate){ return (automationDelegate.automationValue); }; return ([]); } public function set instanceIndices(value:Array):void{ _instanceIndices = value; } public function get repeaterIndex():int{ return ((_repeaterIndices) ? _repeaterIndices[(_repeaterIndices.length - 1)] : -1); } public function parentChanged(p:DisplayObjectContainer):void{ if (!p){ _parent = null; _nestLevel = 0; } else { if ((p is IStyleClient)){ _parent = p; } else { if ((p is SystemManager)){ _parent = p; } else { _parent = p.parent; }; }; }; } public function get owner():DisplayObjectContainer{ return ((_owner) ? _owner : parent); } public function get processedDescriptors():Boolean{ return (_processedDescriptors); } override public function set alpha(value:Number):void{ super.alpha = value; dispatchEvent(new Event("alphaChanged")); } public function initializeRepeaterArrays(parent:IRepeaterClient):void{ if (((((((parent) && (parent.instanceIndices))) && (!(_instanceIndices)))) && (!(parent.isDocument)))){ _instanceIndices = parent.instanceIndices; _repeaters = parent.repeaters; _repeaterIndices = parent.repeaterIndices; }; } public function get maxWidth():Number{ return ((isNaN(explicitMaxWidth)) ? DEFAULT_MAX_WIDTH : explicitMaxWidth); } private function removedHandler(event:Event):void{ if (event.eventPhase != EventPhase.AT_TARGET){ return; }; if ((((parent is Container)) && (Container(parent).creatingContentPane))){ event.stopImmediatePropagation(); return; }; } public function callLater(method:Function, args:Array=null):void{ var sm:ISystemManager; methodQueue.push(new MethodQueueElement(method, args)); sm = systemManager; if (((sm) && (sm.stage))){ if (!listeningForRender){ sm.stage.addEventListener(Event.RENDER, callLaterDispatcher); sm.stage.addEventListener(Event.ENTER_FRAME, callLaterDispatcher); listeningForRender = true; }; sm.stage.invalidate(); }; } private function addedHandler(event:Event):void{ if (event.eventPhase != EventPhase.AT_TARGET){ return; }; if ((((parent is Container)) && (Container(parent).creatingContentPane))){ event.stopImmediatePropagation(); return; }; } public function get initialized():Boolean{ return (_initialized); } private function callLaterDispatcher2(event:Event):void{ var sm:ISystemManager; var queue:Array; var n:int; var i:int; var mqe:MethodQueueElement; if (UIComponentGlobals.callLaterSuspendCount > 0){ return; }; sm = systemManager; if (((((sm) && (sm.stage))) && (listeningForRender))){ sm.stage.removeEventListener(Event.RENDER, callLaterDispatcher); sm.stage.removeEventListener(Event.ENTER_FRAME, callLaterDispatcher); listeningForRender = false; }; queue = methodQueue; methodQueue = []; n = queue.length; i = 0; while (i < n) { mqe = MethodQueueElement(queue[i]); mqe.method.apply(null, mqe.args); i++; }; } public function measureHTMLText(htmlText:String):TextLineMetrics{ return (determineTextFormatFromStyles().measureHTMLText(htmlText)); } public function set descriptor(value:UIComponentDescriptor):void{ _descriptor = value; } private function getState(stateName:String):State{ var i:int; if (((!(states)) || (isBaseState(stateName)))){ return (null); }; i = 0; while (i < states.length) { if (states[i].name == stateName){ return (states[i]); }; i++; }; if (resourceStateUndefined == null){ loadResources(); }; throw (new ArgumentError(StringUtil.substitute(resourceStateUndefined, stateName))); } mx_internal function get documentDescriptor():UIComponentDescriptor{ return (_documentDescriptor); } public function set includeInLayout(value:Boolean):void{ var p:IInvalidating; if (_includeInLayout != value){ _includeInLayout = value; p = (parent as IInvalidating); if (p){ p.invalidateSize(); p.invalidateDisplayList(); }; dispatchEvent(new Event("includeInLayoutChanged")); }; } public function getClassStyleDeclarations():Array{ var myApplicationDomain:ApplicationDomain; var factory:IFlexModuleFactory; var className:String; var cache:Array; var decls:Array; var classNames:Array; var caches:Array; var declcache:Array; var myRoot:DisplayObject; var s:CSSStyleDeclaration; factory = ModuleManager.getAssociatedFactory(this); if (factory != null){ myApplicationDomain = ApplicationDomain(factory.info()["currentDomain"]); } else { myRoot = SystemManager.getSWFRoot(this); if (!myRoot){ return ([]); }; myApplicationDomain = myRoot.loaderInfo.applicationDomain; }; className = getQualifiedClassName(this); className = className.replace("::", "."); cache = StyleManager.typeSelectorCache[className]; if (cache){ return (cache); }; decls = []; classNames = []; caches = []; declcache = []; while (((((!((className == null))) && (!((className == "mx.core.UIComponent"))))) && (!((className == "mx.core.UITextField"))))) { cache = StyleManager.typeSelectorCache[className]; if (cache){ decls = decls.concat(cache); break; }; s = StyleManager.getStyleDeclaration(className); if (s){ decls.unshift(s); classNames.push(className); caches.push(classNames); declcache.push(decls); decls = []; classNames = []; } else { classNames.push(className); }; className = getQualifiedSuperclassName(myApplicationDomain.getDefinition(className)); className = className.replace("::", "."); continue; var _slot1 = e; className = null; }; caches.push(classNames); declcache.push(decls); decls = []; while (caches.length) { classNames = caches.pop(); decls = decls.concat(declcache.pop()); while (classNames.length) { StyleManager.typeSelectorCache[classNames.pop()] = decls; }; }; return (decls); } public function validateProperties():void{ if (invalidatePropertiesFlag){ commitProperties(); invalidatePropertiesFlag = false; }; } public function set measuredMinWidth(value:Number):void{ _measuredMinWidth = value; } override public function removeChild(child:DisplayObject):DisplayObject{ removingChild(child); $removeChild(child); childRemoved(child); return (child); } private function initializeState(stateName:String):void{ var state:State; state = getState(stateName); while (state) { state.initialize(); state = getState(state.basedOn); }; } private function focusObj_moveHandler(event:MoveEvent):void{ adjustFocusRect(); } public function get styleDeclaration():CSSStyleDeclaration{ return (_styleDeclaration); } override public function get doubleClickEnabled():Boolean{ return (super.doubleClickEnabled); } mx_internal function initProtoChain():void{ var classSelector:CSSStyleDeclaration; var nonInheritChain:Object; var p:IStyleClient; var typeSelectors:Array; var n:int; var i:int; var inheritChain:Object; var typeSelector:CSSStyleDeclaration; if (styleName){ if ((styleName is CSSStyleDeclaration)){ classSelector = CSSStyleDeclaration(styleName); } else { if ((styleName is IFlexDisplayObject)){ StyleProtoChain.initProtoChainForUIComponentStyleName(this); return; }; if ((styleName is String)){ classSelector = StyleManager.getStyleDeclaration(("." + styleName)); }; }; }; nonInheritChain = StyleManager.stylesRoot; if (((nonInheritChain) && (nonInheritChain.effects))){ registerEffects(nonInheritChain.effects); }; p = (parent as IStyleClient); if (p){ inheritChain = p.inheritingStyles; if (inheritChain == UIComponent.STYLE_UNINITIALIZED){ inheritChain = nonInheritChain; }; } else { if (isPopUp){ inheritChain = Application.application.inheritingStyles; } else { inheritChain = StyleManager.stylesRoot; }; }; typeSelectors = getClassStyleDeclarations(); n = typeSelectors.length; i = 0; while (i < n) { typeSelector = typeSelectors[i]; inheritChain = typeSelector.addStyleToProtoChain(inheritChain, this); nonInheritChain = typeSelector.addStyleToProtoChain(nonInheritChain, this); if (typeSelector.effects){ registerEffects(typeSelector.effects); }; i++; }; if (classSelector){ inheritChain = classSelector.addStyleToProtoChain(inheritChain, this); nonInheritChain = classSelector.addStyleToProtoChain(nonInheritChain, this); if (classSelector.effects){ registerEffects(classSelector.effects); }; }; inheritingStyles = (_styleDeclaration) ? _styleDeclaration.addStyleToProtoChain(inheritChain, this) : inheritChain; nonInheritingStyles = (_styleDeclaration) ? _styleDeclaration.addStyleToProtoChain(nonInheritChain, this) : nonInheritChain; } public function get repeaterIndices():Array{ return ((_repeaterIndices) ? _repeaterIndices.slice() : []); } private function creationCompleteHandler(event:FlexEvent):void{ if (_currentStateChanged){ _currentStateChanged = false; commitCurrentState(); validateNow(); }; removeEventListener(FlexEvent.CREATION_COMPLETE, creationCompleteHandler); } override public function setChildIndex(child:DisplayObject, newIndex:int):void{ if (((overlayReferenceCount) && (!((child == overlay))))){ newIndex = Math.min(newIndex, Math.max(0, (super.numChildren - 2))); }; super.setChildIndex(child, newIndex); } public function set measuredHeight(value:Number):void{ _measuredHeight = value; } protected function createChildren():void{ } public function regenerateStyleCache(recursive:Boolean):void{ var childList:IChildList; var n:int; var i:int; var child:DisplayObject; initProtoChain(); childList = ((this is IRawChildrenContainer)) ? IRawChildrenContainer(this).rawChildren : IChildList(this); n = childList.numChildren; i = 0; while (i < n) { child = childList.getChildAt(i); if ((child is IStyleClient)){ if (IStyleClient(child).inheritingStyles != UIComponent.STYLE_UNINITIALIZED){ IStyleClient(child).regenerateStyleCache(recursive); }; } else { if ((child is UITextField)){ if (UITextField(child).inheritingStyles){ StyleProtoChain.initTextField(UITextField(child)); }; }; }; i++; }; } public function get updateCompletePendingFlag():Boolean{ return (_updateCompletePendingFlag); } protected function focusOutHandler(event:FocusEvent):void{ if (isOurFocus(DisplayObject(event.target))){ drawFocus(false); }; } public function contentToLocal(point:Point):Point{ return (point); } public function getFocus():InteractiveObject{ var sm:ISystemManager; sm = systemManager; if (!sm){ return (null); }; if (UIComponentGlobals.nextFocusObject){ return (UIComponentGlobals.nextFocusObject); }; return (sm.stage.focus); } public function endEffectsStarted():void{ var len:int; var i:int; len = _effectsStarted.length; i = 0; while (i < len) { _effectsStarted[i].end(); i++; }; } protected function get unscaledHeight():Number{ return ((height / Math.abs(scaleY))); } public function get enabled():Boolean{ return (_enabled); } override public function set cacheAsBitmap(value:Boolean):void{ super.cacheAsBitmap = value; cacheAsBitmapCount = (value) ? 1 : 0; } public function get focusEnabled():Boolean{ return (_focusEnabled); } mx_internal function removeOverlay():void{ if ((((((overlayReferenceCount > 0)) && ((--overlayReferenceCount == 0)))) && (overlay))){ removeEventListener("resize", overlay_resizeHandler); if (super.getChildByName("overlay")){ $removeChild(overlay); }; overlay = null; }; } public function set cacheHeuristic(value:Boolean):void{ if (_cachePolicy == UIComponentCachePolicy.AUTO){ if (value){ cacheAsBitmapCount++; } else { if (cacheAsBitmapCount != 0){ cacheAsBitmapCount--; }; }; super.cacheAsBitmap = !((cacheAsBitmapCount == 0)); }; } public function get cachePolicy():String{ return (_cachePolicy); } public function set maxHeight(value:Number):void{ if (explicitMaxHeight == value){ return; }; explicitMaxHeight = value; } public function set focusManager(value:IFocusManager):void{ _focusManager = value; } public function clearStyle(styleProp:String):void{ setStyle(styleProp, undefined); } public function get descriptor():UIComponentDescriptor{ return (_descriptor); } public function set nonInheritingStyles(value:Object):void{ _nonInheritingStyles = value; } public function set automationDelegate(value:Object):void{ _automationDelegate = (value as IAutomationObject); } public function get measuredMinWidth():Number{ return (_measuredMinWidth); } public function createReferenceOnParentDocument(parentDocument:IFlexDisplayObject):void{ var indices:Array; var r:Object; var n:int; var i:int; var event:PropertyChangeEvent; var s:Object; if (((id) && (!((id == ""))))){ indices = _instanceIndices; if (!indices){ parentDocument[id] = this; } else { r = parentDocument[id]; if (!(r is Array)){ r = (parentDocument[id] = []); }; n = indices.length; i = 0; while (i < (n - 1)) { s = r[indices[i]]; if (!(s is Array)){ s = (r[indices[i]] = []); }; r = s; i++; }; r[indices[(n - 1)]] = this; event = PropertyChangeEvent.createUpdateEvent(parentDocument, id, parentDocument[id], parentDocument[id]); parentDocument.dispatchEvent(event); }; }; } public function set isPopUp(value:Boolean):void{ _isPopUp = value; } override public function set width(value:Number):void{ var p:IInvalidating; if (explicitWidth != value){ explicitWidth = value; invalidateSize(); }; if (_width != value){ invalidateProperties(); invalidateDisplayList(); p = (parent as IInvalidating); if (((p) && (includeInLayout))){ p.invalidateSize(); p.invalidateDisplayList(); }; _width = value; dispatchEvent(new Event("widthChanged")); }; } public function get measuredHeight():Number{ return (_measuredHeight); } public function get repeater():IRepeater{ return ((_repeaters) ? _repeaters[(_repeaters.length - 1)] : null); } public function initialize():void{ if (initialized){ return; }; dispatchEvent(new FlexEvent(FlexEvent.PREINITIALIZE)); createChildren(); childrenCreated(); initializeAccessibility(); initializationComplete(); } public function set percentHeight(value:Number):void{ var p:IInvalidating; if (_percentHeight == value){ return; }; if (!isNaN(value)){ _explicitHeight = NaN; }; _percentHeight = value; p = (parent as IInvalidating); if (p){ p.invalidateSize(); p.invalidateDisplayList(); }; } final mx_internal function set $visible(value:Boolean):void{ super.visible = value; } protected function initializeAccessibility():void{ if (UIComponent.createAccessibilityImplementation != null){ UIComponent.createAccessibilityImplementation(this); }; } private function findCommonBaseState(state1:String, state2:String):String{ var firstState:State; var secondState:State; var firstBaseStates:Array; var secondBaseStates:Array; var commonBase:String; firstState = getState(state1); secondState = getState(state2); if (((!(firstState)) || (!(secondState)))){ return (""); }; if (((isBaseState(firstState.basedOn)) || (isBaseState(secondState.basedOn)))){ return (""); }; firstBaseStates = getBaseStates(firstState); secondBaseStates = getBaseStates(secondState); commonBase = ""; while (firstBaseStates[firstBaseStates.length] == secondBaseStates[secondBaseStates.length]) { commonBase = firstBaseStates.pop(); secondBaseStates.pop(); if (((!(firstBaseStates.length)) || (!(secondBaseStates.length)))){ break; }; }; return (commonBase); } mx_internal function childRemoved(child:DisplayObject):void{ if ((child is IUIComponent)){ if (IUIComponent(child).document != child){ IUIComponent(child).document = null; }; IUIComponent(child).parentChanged(null); }; } final mx_internal function $removeChildAt(index:int):DisplayObject{ return (super.removeChildAt(index)); } public function get maxHeight():Number{ return ((isNaN(explicitMaxHeight)) ? DEFAULT_MAX_HEIGHT : explicitMaxHeight); } public function get focusManager():IFocusManager{ var o:DisplayObject; if (_focusManager){ return (_focusManager); }; o = parent; while (o) { if ((o is IFocusManagerContainer)){ return (IFocusManagerContainer(o).focusManager); }; o = o.parent; }; return (null); } public function set styleName(value:Object):void{ if (_styleName === value){ return; }; _styleName = value; if (inheritingStyles == UIComponent.STYLE_UNINITIALIZED){ return; }; regenerateStyleCache(true); initThemeColor(); styleChanged("styleName"); notifyStyleChangeInChildren("styleName", true); } public function get automationDelegate():Object{ return (_automationDelegate); } public function set explicitMaxHeight(value:Number):void{ var p:IInvalidating; if (_explicitMaxHeight == value){ return; }; _explicitMaxHeight = value; invalidateSize(); p = (parent as IInvalidating); if (p){ p.invalidateSize(); p.invalidateDisplayList(); }; dispatchEvent(new Event("explicitMaxHeightChanged")); } mx_internal function cancelAllCallLaters():void{ var sm:ISystemManager; sm = systemManager; if (((sm) && (sm.stage))){ if (listeningForRender){ sm.stage.removeEventListener(Event.RENDER, callLaterDispatcher); sm.stage.removeEventListener(Event.ENTER_FRAME, callLaterDispatcher); listeningForRender = false; }; }; methodQueue.splice(0); } private function updateCompleteHandler(event:Event):void{ UIComponentGlobals.layoutManager.removeEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteHandler); processEffectFinished(_endingEffectInstances); _endingEffectInstances = []; } public function styleChanged(styleProp:String):void{ if (((((!(styleProp)) || ((styleProp == "styleName")))) || (StyleManager.isSizeInvalidatingStyle(styleProp)))){ invalidateSize(); }; if (((((!(styleProp)) || ((styleProp == "styleName")))) || ((styleProp == "themeColor")))){ initThemeColor(); }; invalidateDisplayList(); if ((parent is IInvalidating)){ if (StyleManager.isParentSizeInvalidatingStyle(styleProp)){ IInvalidating(parent).invalidateSize(); }; if (StyleManager.isParentDisplayListInvalidatingStyle(styleProp)){ IInvalidating(parent).invalidateDisplayList(); }; }; } final mx_internal function get $visible():Boolean{ return (super.visible); } public function drawRoundRect(x:Number, y:Number, w:Number, h:Number, r:Object=null, c:Object=null, alpha:Object=null, rot:Object=null, gradient:String=null, ratios:Array=null, hole:Object=null):void{ var g:Graphics; var ellipseSize:Number; var alphas:Array; var matrix:Matrix; var holeR:Object; g = graphics; if (((!(w)) || (!(h)))){ return; }; if (c !== null){ if ((c is Array)){ if ((alpha is Array)){ alphas = (alpha as Array); } else { alphas = [alpha, alpha]; }; if (!ratios){ ratios = [0, 0xFF]; }; matrix = null; if (rot){ if ((rot is Matrix)){ matrix = Matrix(rot); } else { matrix = new Matrix(); if ((rot is Number)){ matrix.createGradientBox(w, h, ((Number(rot) * Math.PI) / 180), x, y); } else { matrix.createGradientBox(rot.w, rot.h, rot.r, rot.x, rot.y); }; }; }; if (gradient == GradientType.RADIAL){ g.beginGradientFill(GradientType.RADIAL, (c as Array), alphas, ratios, matrix); } else { g.beginGradientFill(GradientType.LINEAR, (c as Array), alphas, ratios, matrix); }; } else { g.beginFill(Number(c), Number(alpha)); }; }; if (!r){ g.drawRect(x, y, w, h); } else { if ((r is Number)){ ellipseSize = (Number(r) * 2); g.drawRoundRect(x, y, w, h, ellipseSize, ellipseSize); } else { GraphicsUtil.drawRoundRectComplex(g, x, y, w, h, r.tl, r.tr, r.bl, r.br); }; }; if (hole){ holeR = hole.r; if ((holeR is Number)){ ellipseSize = (Number(holeR) * 2); g.drawRoundRect(hole.x, hole.y, hole.w, hole.h, ellipseSize, ellipseSize); } else { GraphicsUtil.drawRoundRectComplex(g, hole.x, hole.y, hole.w, hole.h, holeR.tl, holeR.tr, holeR.bl, holeR.br); }; }; if (c !== null){ g.endFill(); }; } public function move(x:Number, y:Number):void{ var changed:Boolean; changed = false; if (x != super.x){ super.x = x; dispatchEvent(new Event("xChanged")); changed = true; }; if (y != super.y){ super.y = y; dispatchEvent(new Event("yChanged")); changed = true; }; if (changed){ dispatchMoveEvent(); }; } public function set toolTip(value:String):void{ ToolTipManager.registerToolTip(this, value); _toolTip = value; dispatchEvent(new Event("toolTipChanged")); } public function set repeaters(value:Array):void{ _repeaters = value; } public function get explicitMaxHeight():Number{ return (_explicitMaxHeight); } public function get styleName():Object{ return (_styleName); } private function loadResources():void{ resourceStateUndefined = packageResources.getString("stateUndefined"); } public function set explicitWidth(value:Number):void{ var p:IInvalidating; if (_explicitWidth == value){ return; }; if (!isNaN(value)){ _percentWidth = NaN; }; _explicitWidth = value; invalidateSize(); p = (parent as IInvalidating); if (((p) && (includeInLayout))){ p.invalidateSize(); p.invalidateDisplayList(); }; dispatchEvent(new Event("explicitWidthChanged")); } public function get parentDocument():Object{ var p:IUIComponent; var sm:ISystemManager; if (document == this){ p = (parent as IUIComponent); if (p){ return (p.document); }; sm = (parent as ISystemManager); if (sm){ return (sm.document); }; return (null); //unresolved jump }; return (document); } public function set measuredMinHeight(value:Number):void{ _measuredMinHeight = value; } protected function childrenCreated():void{ invalidateProperties(); invalidateSize(); invalidateDisplayList(); } private function setBorderColorForErrorString():void{ var focusManager:IFocusManager; var focusObj:DisplayObject; if (((!(_errorString)) || ((_errorString.length == 0)))){ setStyle("borderColor", origBorderColor); saveBorderColor = true; } else { if (saveBorderColor){ saveBorderColor = false; origBorderColor = getStyle("borderColor"); }; setStyle("borderColor", getStyle("errorColor")); }; styleChanged("themeColor"); focusObj = (focusManager) ? DisplayObject(focusManager.getFocus()) : null; if (((((focusManager) && (focusManager.showFocusIndicator))) && ((focusObj == this)))){ drawFocus(true); }; } public function measureText(text:String):TextLineMetrics{ return (determineTextFormatFromStyles().measureText(text)); } public function get explicitWidth():Number{ return (_explicitWidth); } public function invalidateSize():void{ if (!invalidateSizeFlag){ invalidateSizeFlag = true; if (((parent) && (UIComponentGlobals.layoutManager))){ UIComponentGlobals.layoutManager.invalidateSize(this); }; }; } override public function set filters(value:Array):void{ var n:int; var i:int; var e:IEventDispatcher; if (_filters){ n = _filters.length; i = 0; while (i < n) { e = (_filters[i] as IEventDispatcher); if (e){ e.removeEventListener("change", filterChangeHandler); }; i++; }; }; _filters = value; if (_filters){ n = _filters.length; i = 0; while (i < n) { e = (_filters[i] as IEventDispatcher); if (e){ e.addEventListener("change", filterChangeHandler); }; i++; }; }; super.filters = _filters; } protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ } override public function get filters():Array{ return ((_filters) ? _filters : super.filters); } public static function resumeBackgroundProcessing():void{ var sm:SystemManager; if (UIComponentGlobals.callLaterSuspendCount > 0){ UIComponentGlobals.callLaterSuspendCount--; if (UIComponentGlobals.callLaterSuspendCount == 0){ sm = SystemManagerGlobals.topLevelSystemManagers[0]; if (((sm) && (sm.stage))){ sm.stage.invalidate(); }; }; }; } public static function suspendBackgroundProcessing():void{ UIComponentGlobals.callLaterSuspendCount++; } } }//package mx.core class MethodQueueElement { public var method:Function; public var args:Array; private function MethodQueueElement(method:Function, args:Array=null){ super(); this.method = method; this.args = args; } }
Section 81
//UIComponentCachePolicy (mx.core.UIComponentCachePolicy) package mx.core { public final class UIComponentCachePolicy { public static const AUTO:String = "auto"; public static const ON:String = "on"; mx_internal static const VERSION:String = "2.0.1.0"; public static const OFF:String = "off"; public function UIComponentCachePolicy(){ super(); } } }//package mx.core
Section 82
//UIComponentDescriptor (mx.core.UIComponentDescriptor) package mx.core { public class UIComponentDescriptor extends ComponentDescriptor { public var effects:Array; public var stylesFactory:Function; mx_internal var instanceIndices:Array; mx_internal var repeaters:Array; mx_internal var repeaterIndices:Array; mx_internal static const VERSION:String = "2.0.1.0"; public function UIComponentDescriptor(descriptorProperties:Object){ super(descriptorProperties); } override public function toString():String{ return (("UIComponentDescriptor_" + id)); } } }//package mx.core
Section 83
//UIComponentGlobals (mx.core.UIComponentGlobals) package mx.core { import flash.display.*; import flash.geom.*; import mx.managers.*; public class UIComponentGlobals { mx_internal static var callLaterSuspendCount:int = 0; mx_internal static var layoutManager:ILayoutManager; mx_internal static var nextFocusObject:InteractiveObject; mx_internal static var designTime:Boolean = false; mx_internal static var tempMatrix:Matrix = new Matrix(); mx_internal static var callLaterDispatcherCount:int = 0; public function UIComponentGlobals(){ super(); } } }//package mx.core
Section 84
//UITextField (mx.core.UITextField) package mx.core { import flash.events.*; import mx.resources.*; import flash.system.*; import flash.display.*; import flash.utils.*; import mx.styles.*; import mx.managers.*; import mx.automation.*; import flash.text.*; import mx.utils.*; public class UITextField extends FlexTextField implements IAutomationObject, IIMESupport, IFlexModule, IInvalidating, ISimpleStyleClient, IToolTipManagerClient, IUIComponent { private var _initialized:Boolean;// = false private var invalidateDisplayListFlag:Boolean;// = true mx_internal var explicitColor:uint;// = 4294967295 private var _processedDescriptors:Boolean;// = true private var explicitHTMLText:String;// = null private var _owner:DisplayObjectContainer; mx_internal var _parent:DisplayObjectContainer; mx_internal var styleChangedFlag:Boolean;// = true private var _explicitWidth:Number; private var _enabled:Boolean;// = true private var cachedTextFormat:TextFormat; private var _automationDelegate:IAutomationObject; private var _automationName:String; private var _document:Object; private var _styleName:Object; private var _nestLevel:int;// = 0 private var _explicitHeight:Number; private var _toolTip:String; private var _nonInheritingStyles:Object; private var _moduleFactory:IFlexModuleFactory; private var _inheritingStyles:Object; private var _includeInLayout:Boolean;// = true private var _updateCompletePendingFlag:Boolean;// = false private var _imeMode:String;// = null private var _ignorePadding:Boolean;// = true mx_internal static const VERSION:String = "2.0.1.0"; mx_internal static const TEXT_HEIGHT_PADDING:int = 4; mx_internal static const TEXT_WIDTH_PADDING:int = 5; private static var packageResources:ResourceBundle = ResourceBundle.getResourceBundle("core", ApplicationDomain.currentDomain); private static var resourceTruncationIndicator:String; public function UITextField(){ invalidateDisplayListFlag = true; styleChangedFlag = true; explicitHTMLText = null; explicitColor = StyleManager.NOT_A_COLOR; _enabled = true; _ignorePadding = true; _imeMode = null; _includeInLayout = true; _inheritingStyles = UIComponent.STYLE_UNINITIALIZED; _initialized = false; _nestLevel = 0; _nonInheritingStyles = UIComponent.STYLE_UNINITIALIZED; _processedDescriptors = true; _updateCompletePendingFlag = false; super(); focusRect = false; selectable = false; tabEnabled = false; addEventListener(Event.CHANGE, changeHandler); addEventListener("textFieldStyleChange", textFieldStyleChangeHandler); } public function get nestLevel():int{ return (_nestLevel); } public function set nestLevel(value:int):void{ if ((((value > 1)) && (!((_nestLevel == value))))){ _nestLevel = value; StyleProtoChain.initTextField(this); styleChangedFlag = true; validateNow(); }; } public function getExplicitOrMeasuredHeight():Number{ return ((isNaN(explicitHeight)) ? measuredHeight : explicitHeight); } public function get className():String{ var name:String; var index:int; name = getQualifiedClassName(this); index = name.indexOf("::"); if (index != -1){ name = name.substr((index + 2)); }; return (name); } public function setColor(color:uint):void{ explicitColor = color; styleChangedFlag = true; invalidateDisplayListFlag = true; validateNow(); } public function get automationName():String{ if (_automationName){ return (_automationName); }; if (automationDelegate){ return (automationDelegate.automationName); }; return (""); } private function creatingSystemManager():ISystemManager{ return ((((!((moduleFactory == null))) && ((moduleFactory is ISystemManager)))) ? ISystemManager(moduleFactory) : systemManager); } public function set tweeningProperties(value:Array):void{ } public function invalidateDisplayList():void{ invalidateDisplayListFlag = true; } public function get focusPane():Sprite{ return (null); } public function getExplicitOrMeasuredWidth():Number{ return ((isNaN(explicitWidth)) ? measuredWidth : explicitWidth); } public function getTextStyles():TextFormat{ var textFormat:TextFormat; textFormat = new TextFormat(); textFormat.align = getStyle("textAlign"); textFormat.bold = (getStyle("fontWeight") == "bold"); if (enabled){ if (explicitColor == StyleManager.NOT_A_COLOR){ textFormat.color = getStyle("color"); } else { textFormat.color = explicitColor; }; } else { textFormat.color = getStyle("disabledColor"); }; textFormat.font = StringUtil.trimArrayElements(getStyle("fontFamily"), ","); textFormat.indent = getStyle("textIndent"); textFormat.italic = (getStyle("fontStyle") == "italic"); textFormat.kerning = getStyle("kerning"); textFormat.leading = getStyle("leading"); textFormat.leftMargin = (ignorePadding) ? 0 : getStyle("paddingLeft"); textFormat.letterSpacing = getStyle("letterSpacing"); textFormat.rightMargin = (ignorePadding) ? 0 : getStyle("paddingRight"); textFormat.size = getStyle("fontSize"); textFormat.underline = (getStyle("textDecoration") == "underline"); cachedTextFormat = textFormat; return (textFormat); } public function get explicitHeight():Number{ return (_explicitHeight); } public function set automationName(value:String):void{ _automationName = value; } public function get percentWidth():Number{ return (NaN); } public function createAutomationIDPart(child:IAutomationObject):Object{ return (null); } override public function get parent():DisplayObjectContainer{ return ((_parent) ? _parent : super.parent); } public function setActualSize(w:Number, h:Number):void{ if (width != w){ width = w; }; if (height != h){ height = h; }; } public function set focusPane(value:Sprite):void{ } public function getAutomationChildAt(index:int):IAutomationObject{ return (null); } public function get inheritingStyles():Object{ return (_inheritingStyles); } public function invalidateProperties():void{ } public function get explicitMinWidth():Number{ return (NaN); } public function set explicitHeight(value:Number):void{ _explicitHeight = value; } public function set showInAutomationHierarchy(value:Boolean):void{ } public function set systemManager(value:ISystemManager):void{ } public function get moduleFactory():IFlexModuleFactory{ return (_moduleFactory); } public function set percentWidth(value:Number):void{ } public function get imeMode():String{ return (_imeMode); } public function get document():Object{ return (_document); } public function get explicitMaxWidth():Number{ return (NaN); } public function replayAutomatableEvent(event:Event):Boolean{ if (automationDelegate){ return (automationDelegate.replayAutomatableEvent(event)); }; return (false); } public function set owner(value:DisplayObjectContainer):void{ _owner = value; } public function set processedDescriptors(value:Boolean):void{ _processedDescriptors = value; } public function get includeInLayout():Boolean{ return (_includeInLayout); } private function changeHandler(event:Event):void{ explicitHTMLText = null; } override public function setTextFormat(format:TextFormat, beginIndex:int=-1, endIndex:int=-1):void{ if (styleSheet){ return; }; super.setTextFormat(format, beginIndex, endIndex); dispatchEvent(new Event("textFormatChange")); } public function resolveAutomationIDPart(criteria:Object):Array{ return ([]); } public function set inheritingStyles(value:Object):void{ _inheritingStyles = value; } public function setFocus():void{ systemManager.stage.focus = this; } public function set initialized(value:Boolean):void{ _initialized = value; } public function owns(child:DisplayObject):Boolean{ return ((child == this)); } public function setVisible(visible:Boolean, noEvent:Boolean=false):void{ this.visible = visible; } public function get nonInheritingStyles():Object{ return (_nonInheritingStyles); } public function get isPopUp():Boolean{ return (false); } public function get percentHeight():Number{ return (NaN); } public function truncateToFit(truncationIndicator:String=null):Boolean{ var originalText:String; var w:Number; var s:String; if (!truncationIndicator){ truncationIndicator = resourceTruncationIndicator; }; validateNow(); originalText = super.text; w = width; if (((!((originalText == ""))) && (((textWidth + TEXT_WIDTH_PADDING) > w)))){ var _local5 = originalText; super.text = _local5; s = _local5; originalText.slice(0, Math.floor(((w / (textWidth + TEXT_WIDTH_PADDING)) * originalText.length))); while ((((s.length > 1)) && (((textWidth + TEXT_WIDTH_PADDING) > w)))) { s = s.slice(0, -1); super.text = (s + truncationIndicator); }; return (true); }; return (false); } public function validateNow():void{ var textFormat:TextFormat; var sm:ISystemManager; if (!parent){ return; }; if (((!(isNaN(explicitWidth))) && (!((super.width == explicitWidth))))){ super.width = ((explicitWidth)>4) ? explicitWidth : 4; }; if (((!(isNaN(explicitHeight))) && (!((super.height == explicitHeight))))){ super.height = explicitHeight; }; if (styleChangedFlag){ textFormat = getTextStyles(); sm = creatingSystemManager(); embedFonts = (textFormat.font) ? ((!((sm == null))) && (sm.isFontFaceEmbedded(textFormat))) : getStyle("embedFonts"); antiAliasType = getStyle("fontAntiAliasType"); gridFitType = getStyle("fontGridFitType"); sharpness = getStyle("fontSharpness"); thickness = getStyle("fontThickness"); if (!styleSheet){ super.setTextFormat(textFormat); defaultTextFormat = textFormat; }; dispatchEvent(new Event("textFieldStyleChange")); }; styleChangedFlag = false; invalidateDisplayListFlag = false; } public function get ignorePadding():Boolean{ return (_ignorePadding); } public function get automationTabularData():Object{ return (null); } private function textFieldStyleChangeHandler(event:Event):void{ if (explicitHTMLText != null){ super.htmlText = explicitHTMLText; }; } public function set moduleFactory(factory:IFlexModuleFactory):void{ _moduleFactory = factory; } public function set imeMode(value:String):void{ _imeMode = value; } public function get measuredMinHeight():Number{ return (0); } public function get minHeight():Number{ return (0); } public function get tweeningProperties():Array{ return (null); } public function set document(value:Object):void{ _document = value; } public function set updateCompletePendingFlag(value:Boolean):void{ _updateCompletePendingFlag = value; } public function get explicitMinHeight():Number{ return (NaN); } override public function set text(value:String):void{ if (!value){ value = ""; }; if (((!(isHTML)) && ((super.text == value)))){ return; }; super.text = value; explicitHTMLText = null; if (invalidateDisplayListFlag){ validateNow(); }; } public function get numAutomationChildren():int{ return (0); } public function setStyle(styleProp:String, value):void{ } public function get showInAutomationHierarchy():Boolean{ return (true); } public function get systemManager():ISystemManager{ var o:DisplayObject; var ui:IUIComponent; o = parent; while (o) { ui = (o as IUIComponent); if (ui){ return (ui.systemManager); }; o = o.parent; }; return (null); } public function get baselinePosition():Number{ var tlm:TextLineMetrics; tlm = getLineMetrics(0); return (((height - 4) - tlm.descent)); } public function set enabled(value:Boolean):void{ mouseEnabled = value; _enabled = value; styleChanged("color"); } public function get minWidth():Number{ return (0); } public function get automationValue():Array{ if (automationDelegate){ return (automationDelegate.automationValue); }; return ([""]); } public function get measuredWidth():Number{ validateNow(); return ((textWidth + TEXT_WIDTH_PADDING)); } public function parentChanged(p:DisplayObjectContainer):void{ if (!p){ _parent = null; _nestLevel = 0; } else { if ((p is IStyleClient)){ _parent = p; } else { if ((p is SystemManager)){ _parent = p; } else { _parent = p.parent; }; }; }; } public function get processedDescriptors():Boolean{ return (_processedDescriptors); } public function get owner():DisplayObjectContainer{ return ((_owner) ? _owner : parent); } public function get maxWidth():Number{ return (UIComponent.DEFAULT_MAX_WIDTH); } public function get initialized():Boolean{ return (_initialized); } public function set includeInLayout(value:Boolean):void{ var p:IInvalidating; if (_includeInLayout != value){ _includeInLayout = value; p = (parent as IInvalidating); if (p){ p.invalidateSize(); p.invalidateDisplayList(); }; }; } override public function set htmlText(value:String):void{ if (!value){ value = ""; }; if (((isHTML) && ((super.htmlText == value)))){ return; }; if (((cachedTextFormat) && ((styleSheet == null)))){ defaultTextFormat = cachedTextFormat; }; super.htmlText = value; explicitHTMLText = value; if (invalidateDisplayListFlag){ validateNow(); }; } public function set measuredMinWidth(value:Number):void{ } public function get updateCompletePendingFlag():Boolean{ return (_updateCompletePendingFlag); } public function get enabled():Boolean{ return (_enabled); } public function set nonInheritingStyles(value:Object):void{ _nonInheritingStyles = value; } public function set automationDelegate(value:Object):void{ _automationDelegate = (value as IAutomationObject); } public function get measuredMinWidth():Number{ return (0); } public function set isPopUp(value:Boolean):void{ } public function get measuredHeight():Number{ validateNow(); return ((textHeight + TEXT_HEIGHT_PADDING)); } public function getUITextFormat():UITextFormat{ var textFormat:UITextFormat; validateNow(); textFormat = new UITextFormat(creatingSystemManager()); textFormat.copyFrom(getTextFormat()); textFormat.antiAliasType = antiAliasType; textFormat.gridFitType = gridFitType; textFormat.sharpness = sharpness; textFormat.thickness = thickness; return (textFormat); } public function initialize():void{ } public function set percentHeight(value:Number):void{ } public function get maxHeight():Number{ return (UIComponent.DEFAULT_MAX_HEIGHT); } public function set styleName(value:Object):void{ if (_styleName === value){ return; }; _styleName = value; if (parent){ StyleProtoChain.initTextField(this); styleChanged("styleName"); }; } public function get automationDelegate():Object{ return (_automationDelegate); } public function set ignorePadding(value:Boolean):void{ _ignorePadding = value; styleChanged(null); } public function set toolTip(value:String):void{ ToolTipManager.registerToolTip(this, value); _toolTip = value; } public function styleChanged(styleProp:String):void{ styleChangedFlag = true; if (!invalidateDisplayListFlag){ invalidateDisplayListFlag = true; UIComponent(parent).callLater(validateNow); }; } private function get isHTML():Boolean{ return (!((explicitHTMLText == null))); } public function get explicitMaxHeight():Number{ return (NaN); } public function invalidateSize():void{ invalidateDisplayListFlag = true; } public function set explicitWidth(value:Number):void{ _explicitWidth = value; } public function move(x:Number, y:Number):void{ if (this.x != x){ this.x = x; }; if (this.y != y){ this.y = y; }; } public function get toolTip():String{ return (_toolTip); } public function set measuredMinHeight(value:Number):void{ } public function get explicitWidth():Number{ return (_explicitWidth); } public function getStyle(styleProp:String){ if (StyleManager.inheritingStyles[styleProp]){ return ((inheritingStyles) ? inheritingStyles[styleProp] : IStyleClient(parent).getStyle(styleProp)); //unresolved jump }; return ((nonInheritingStyles) ? nonInheritingStyles[styleProp] : IStyleClient(parent).getStyle(styleProp)); } public function get styleName():Object{ return (_styleName); } private static function loadResources():void{ resourceTruncationIndicator = packageResources.getString("truncationIndicator"); } loadResources(); } }//package mx.core
Section 85
//UITextFormat (mx.core.UITextFormat) package mx.core { import mx.managers.*; import flash.text.*; public class UITextFormat extends TextFormat { public var sharpness:Number; public var gridFitType:String; public var antiAliasType:String; public var thickness:Number; private var systemManager:ISystemManager; mx_internal static const VERSION:String = "2.0.1.0"; private static var measurementTextField:TextField; public function UITextFormat(systemManager:ISystemManager, font:String=null, size:Object=null, color:Object=null, bold:Object=null, italic:Object=null, underline:Object=null, url:String=null, target:String=null, align:String=null, leftMargin:Object=null, rightMargin:Object=null, indent:Object=null, leading:Object=null){ this.systemManager = systemManager; super(font, size, color, bold, italic, underline, url, target, align, leftMargin, rightMargin, indent, leading); } public function measureText(text:String):TextLineMetrics{ return (measure(text, false)); } mx_internal function copyFrom(source:TextFormat):void{ font = source.font; size = source.size; color = source.color; bold = source.bold; italic = source.italic; underline = source.underline; url = source.url; target = source.target; align = source.align; leftMargin = source.leftMargin; rightMargin = source.rightMargin; indent = source.indent; leading = source.leading; } public function measureHTMLText(htmlText:String):TextLineMetrics{ return (measure(htmlText, true)); } private function measure(s:String, html:Boolean):TextLineMetrics{ var sm:ISystemManager; var lineMetrics:TextLineMetrics; if (!s){ s = ""; }; if (!measurementTextField){ measurementTextField = new TextField(); }; if (html){ measurementTextField.htmlText = ""; } else { measurementTextField.text = ""; }; measurementTextField.defaultTextFormat = this; sm = systemManager; if (font){ measurementTextField.embedFonts = ((!((sm == null))) && (sm.isFontFaceEmbedded(this))); } else { measurementTextField.embedFonts = false; }; measurementTextField.antiAliasType = antiAliasType; measurementTextField.gridFitType = gridFitType; measurementTextField.sharpness = sharpness; measurementTextField.thickness = thickness; if (html){ measurementTextField.htmlText = s; } else { measurementTextField.text = s; }; lineMetrics = measurementTextField.getLineMetrics(0); lineMetrics.width = Math.ceil(lineMetrics.width); lineMetrics.height = Math.ceil(lineMetrics.height); return (lineMetrics); } } }//package mx.core
Section 86
//AddRemoveEffectTargetFilter (mx.effects.effectClasses.AddRemoveEffectTargetFilter) package mx.effects.effectClasses { import mx.core.*; import mx.effects.*; public class AddRemoveEffectTargetFilter extends EffectTargetFilter { public var add:Boolean;// = true mx_internal static const VERSION:String = "2.0.1.0"; public function AddRemoveEffectTargetFilter(){ add = true; super(); filterProperties = ["parent"]; } override protected function defaultFilterFunction(propChanges:Array, instanceTarget:Object):Boolean{ var n:int; var i:int; var props:PropertyChanges; n = propChanges.length; i = 0; while (i < n) { props = propChanges[i]; if (props.target == instanceTarget){ if (add){ return ((((props.start["parent"] == null)) && (!((props.end["parent"] == null))))); }; return (((!((props.start["parent"] == null))) && ((props.end["parent"] == null)))); }; i++; }; return (false); } } }//package mx.effects.effectClasses
Section 87
//HideShowEffectTargetFilter (mx.effects.effectClasses.HideShowEffectTargetFilter) package mx.effects.effectClasses { import mx.core.*; import mx.effects.*; public class HideShowEffectTargetFilter extends EffectTargetFilter { public var show:Boolean;// = true mx_internal static const VERSION:String = "2.0.1.0"; public function HideShowEffectTargetFilter(){ show = true; super(); filterProperties = ["visible"]; } override protected function defaultFilterFunction(propChanges:Array, instanceTarget:Object):Boolean{ var n:int; var i:int; var props:PropertyChanges; n = propChanges.length; i = 0; while (i < n) { props = propChanges[i]; if (props.target == instanceTarget){ return ((props.end["visible"] == show)); }; i++; }; return (false); } } }//package mx.effects.effectClasses
Section 88
//PropertyChanges (mx.effects.effectClasses.PropertyChanges) package mx.effects.effectClasses { import mx.core.*; public class PropertyChanges { public var start:Object; public var target:IUIComponent; public var end:Object; mx_internal static const VERSION:String = "2.0.1.0"; public function PropertyChanges(target:IUIComponent){ end = {}; start = {}; super(); this.target = target; } } }//package mx.effects.effectClasses
Section 89
//TweenEffectInstance (mx.effects.effectClasses.TweenEffectInstance) package mx.effects.effectClasses { import mx.core.*; import mx.events.*; import mx.effects.*; public class TweenEffectInstance extends EffectInstance { mx_internal var needToLayout:Boolean;// = false private var _seekTime:Number;// = 0 public var tween:Tween; public var easingFunction:Function; mx_internal static const VERSION:String = "2.0.1.0"; public function TweenEffectInstance(target:Object){ needToLayout = false; _seekTime = 0; super(target); } override public function get playheadTime():Number{ if (tween){ return ((tween.playheadTime + super.playheadTime)); }; return (0); } override mx_internal function set playReversed(value:Boolean):void{ super.playReversed = value; if (tween){ tween.playReversed = value; }; } override public function resume():void{ super.resume(); if (tween){ tween.resume(); }; } public function onTweenUpdate(value:Object):void{ } mx_internal function applyTweenStartValues():void{ if (duration > 0){ onTweenUpdate(tween.getCurrentValue(0)); }; } protected function createTween(listener:Object, startValue:Object, endValue:Object, duration:Number=-1, minFps:Number=-1):Tween{ var newTween:Tween; newTween = new Tween(listener, startValue, endValue, duration, minFps); newTween.addEventListener(TweenEvent.TWEEN_START, tweenEventHandler); newTween.addEventListener(TweenEvent.TWEEN_UPDATE, tweenEventHandler); newTween.addEventListener(TweenEvent.TWEEN_END, tweenEventHandler); if (easingFunction != null){ newTween.easingFunction = easingFunction; }; if (_seekTime > 0){ newTween.seek(_seekTime); }; newTween.playReversed = playReversed; return (newTween); } override public function end():void{ stopRepeat = true; if (delayTimer){ delayTimer.reset(); }; if (tween){ tween.endTween(); tween = null; }; } override public function reverse():void{ super.reverse(); if (tween){ tween.reverse(); }; super.playReversed = !(playReversed); } private function tweenEventHandler(event:TweenEvent):void{ dispatchEvent(event); } public function seek(playheadTime:Number):void{ if (tween){ tween.seek(playheadTime); } else { _seekTime = playheadTime; }; } override public function pause():void{ super.pause(); if (tween){ tween.pause(); }; } public function onTweenEnd(value:Object):void{ onTweenUpdate(value); tween = null; if (needToLayout){ UIComponentGlobals.layoutManager.validateNow(); }; finishRepeat(); } } }//package mx.effects.effectClasses
Section 90
//ZoomInstance (mx.effects.effectClasses.ZoomInstance) package mx.effects.effectClasses { import flash.events.*; import mx.core.*; import mx.events.*; import mx.effects.*; public class ZoomInstance extends TweenEffectInstance { private var show:Boolean;// = true private var origPercentHeight:Number; public var zoomWidthFrom:Number; private var origX:Number; private var origY:Number; private var scaledOriginY:Number; private var scaledOriginX:Number; private var origPercentWidth:Number; public var zoomWidthTo:Number; public var zoomHeightFrom:Number; private var newX:Number; private var newY:Number; public var captureRollEvents:Boolean; private var origScaleX:Number; private var origScaleY:Number; public var originX:Number; public var originY:Number; public var zoomHeightTo:Number; private var _mouseHasMoved:Boolean;// = false mx_internal static const VERSION:String = "2.0.1.0"; public function ZoomInstance(target:Object){ _mouseHasMoved = false; show = true; super(target); } override public function finishEffect():void{ if (captureRollEvents){ target.removeEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false); target.removeEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false); target.removeEventListener(MouseEvent.MOUSE_MOVE, mouseEventHandler, false); }; super.finishEffect(); } private function getScaleFromWidth(value:Number):Number{ return ((value / (target.width / Math.abs(target.scaleX)))); } private function getScaleFromHeight(value:Number):Number{ return ((value / (target.height / Math.abs(target.scaleY)))); } override public function play():void{ super.play(); applyPropertyChanges(); if (((((((isNaN(zoomWidthFrom)) && (isNaN(zoomWidthTo)))) && (isNaN(zoomHeightFrom)))) && (isNaN(zoomHeightTo)))){ if (show){ zoomWidthFrom = (zoomHeightFrom = 0); zoomWidthTo = target.scaleX; zoomHeightTo = target.scaleY; } else { zoomWidthFrom = target.scaleX; zoomHeightFrom = target.scaleY; zoomWidthTo = (zoomHeightTo = 0); }; } else { if (((isNaN(zoomWidthFrom)) && (isNaN(zoomWidthTo)))){ zoomWidthFrom = (zoomWidthTo = target.scaleX); } else { if (((isNaN(zoomHeightFrom)) && (isNaN(zoomHeightTo)))){ zoomHeightFrom = (zoomHeightTo = target.scaleY); }; }; if (isNaN(zoomWidthFrom)){ zoomWidthFrom = target.scaleX; } else { if (isNaN(zoomWidthTo)){ zoomWidthTo = ((zoomWidthFrom)==1) ? 0 : 1; }; }; if (isNaN(zoomHeightFrom)){ zoomHeightFrom = target.scaleY; } else { if (isNaN(zoomHeightTo)){ zoomHeightTo = ((zoomHeightFrom)==1) ? 0 : 1; }; }; }; if (zoomWidthFrom < 0.01){ zoomWidthFrom = 0.01; }; if (zoomWidthTo < 0.01){ zoomWidthTo = 0.01; }; if (zoomHeightFrom < 0.01){ zoomHeightFrom = 0.01; }; if (zoomHeightTo < 0.01){ zoomHeightTo = 0.01; }; origScaleX = target.scaleX; origScaleY = target.scaleY; newX = (origX = target.x); newY = (origY = target.y); if (isNaN(originX)){ scaledOriginX = (target.width / 2); } else { scaledOriginX = (originX * origScaleX); }; if (isNaN(originY)){ scaledOriginY = (target.height / 2); } else { scaledOriginY = (originY * origScaleY); }; scaledOriginX = Number(scaledOriginX.toFixed(1)); scaledOriginY = Number(scaledOriginY.toFixed(1)); origPercentWidth = target.percentWidth; if (!isNaN(origPercentWidth)){ target.width = target.width; }; origPercentHeight = target.percentHeight; if (!isNaN(origPercentHeight)){ target.height = target.height; }; tween = createTween(this, [zoomWidthFrom, zoomHeightFrom], [zoomWidthTo, zoomHeightTo], duration); if (captureRollEvents){ target.addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false); target.addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false); target.addEventListener(MouseEvent.MOUSE_MOVE, mouseEventHandler, false); }; } override public function onTweenEnd(value:Object):void{ var curWidth:Number; var curHeight:Number; if (!isNaN(origPercentWidth)){ curWidth = target.width; target.percentWidth = origPercentWidth; if (((target.parent) && ((target.parent.autoLayout == false)))){ target._width = curWidth; }; }; if (!isNaN(origPercentHeight)){ curHeight = target.height; target.percentHeight = origPercentHeight; if (((target.parent) && ((target.parent.autoLayout == false)))){ target._height = curHeight; }; }; super.onTweenEnd(value); if (mx_internal::hideOnEffectEnd){ EffectManager.suspendEventHandling(); target.scaleX = origScaleX; target.scaleY = origScaleY; target.move(origX, origY); EffectManager.resumeEventHandling(); }; } private function mouseEventHandler(event:MouseEvent):void{ if (event.type == MouseEvent.MOUSE_MOVE){ _mouseHasMoved = true; } else { if ((((event.type == MouseEvent.ROLL_OUT)) || ((event.type == MouseEvent.ROLL_OVER)))){ if (!_mouseHasMoved){ event.stopImmediatePropagation(); }; _mouseHasMoved = false; }; }; } override public function onTweenUpdate(value:Object):void{ var ratioX:Number; var ratioY:Number; var newOriginX:Number; var newOriginY:Number; EffectManager.suspendEventHandling(); if (Math.abs((newX - Number(target.x.toFixed(1)))) > 0.1){ origX = (origX + (Number(target.x.toFixed(1)) - newX)); }; if (Math.abs((newY - Number(target.y.toFixed(1)))) > 0.1){ origY = (origY + (Number(target.y.toFixed(1)) - newY)); }; target.scaleX = value[0]; target.scaleY = value[1]; ratioX = (value[0] / origScaleX); ratioY = (value[1] / origScaleY); newOriginX = (scaledOriginX * ratioX); newOriginY = (scaledOriginY * ratioY); newX = ((scaledOriginX - newOriginX) + origX); newY = ((scaledOriginY - newOriginY) + origY); newX = Number(newX.toFixed(1)); newY = Number(newY.toFixed(1)); target.move(newX, newY); tween.mx_internal::needToLayout = true; EffectManager.resumeEventHandling(); } override public function initEffect(event:Event):void{ super.initEffect(event); if ((((event.type == FlexEvent.HIDE)) || ((event.type == Event.REMOVED)))){ show = false; }; } private function applyPropertyChanges():void{ var values:PropertyChanges; var useSize:Boolean; var useScale:Boolean; values = propertyChanges; if (values){ useSize = false; useScale = false; if (values.end["scaleX"] !== undefined){ zoomWidthFrom = (isNaN(zoomWidthFrom)) ? target.scaleX : zoomWidthFrom; zoomWidthTo = (isNaN(zoomWidthTo)) ? values.end["scaleX"] : zoomWidthTo; useScale = true; }; if (values.end["scaleY"] !== undefined){ zoomHeightFrom = (isNaN(zoomHeightFrom)) ? target.scaleY : zoomHeightFrom; zoomHeightTo = (isNaN(zoomHeightTo)) ? values.end["scaleY"] : zoomHeightTo; useScale = true; }; if (useScale){ return; }; if (values.end["width"] !== undefined){ zoomWidthFrom = (isNaN(zoomWidthFrom)) ? getScaleFromWidth(target.width) : zoomWidthFrom; zoomWidthTo = (isNaN(zoomWidthTo)) ? getScaleFromWidth(values.end["width"]) : zoomWidthTo; useSize = true; }; if (values.end["height"] !== undefined){ zoomHeightFrom = (isNaN(zoomHeightFrom)) ? getScaleFromHeight(target.height) : zoomHeightFrom; zoomHeightTo = (isNaN(zoomHeightTo)) ? getScaleFromHeight(values.end["height"]) : zoomHeightTo; useSize = true; }; if (useSize){ return; }; if (values.end["visible"] !== undefined){ show = values.end["visible"]; }; }; } } }//package mx.effects.effectClasses
Section 91
//Effect (mx.effects.Effect) package mx.effects { import flash.events.*; import mx.core.*; import flash.utils.*; import mx.events.*; import mx.managers.*; import mx.effects.effectClasses.*; public class Effect extends EventDispatcher { mx_internal var applyActualDimensions:Boolean;// = true private var _instances:Array; private var _filter:String; private var _customFilter:EffectTargetFilter; mx_internal var durationExplicitlySet:Boolean;// = false public var repeatCount:int;// = 1 public var repeatDelay:int;// = 0 public var suspendBackgroundProcessing:Boolean;// = false public var startDelay:int;// = 0 private var _targets:Array; mx_internal var propertyChangesArray:Array; private var _relevantProperties:Array; mx_internal var filterObject:EffectTargetFilter; private var _callValidateNow:Boolean;// = false mx_internal var initEvent:Event; public var instanceClass:Class; private var _duration:Number;// = 500 private var _relevantStyles:Array; private var isPaused:Boolean;// = false mx_internal static const VERSION:String = "2.0.1.0"; public function Effect(target:Object=null){ _instances = []; _callValidateNow = false; isPaused = false; applyActualDimensions = true; _duration = 500; durationExplicitlySet = false; _relevantStyles = []; instanceClass = IEffectInstance; repeatCount = 1; repeatDelay = 0; startDelay = 0; suspendBackgroundProcessing = false; _targets = []; super(); this.target = target; } public function set targets(value:Array):void{ var n:int; var i:int; n = value.length; i = (n - 1); while (i > 0) { if (value[i] == null){ value.splice(i, 1); }; i--; }; _targets = value; } public function end(effectInstance:IEffectInstance=null):void{ var n:int; var i:int; var instance:IEffectInstance; if (effectInstance){ effectInstance.end(); } else { n = _instances.length; i = n; while (i >= 0) { instance = IEffectInstance(_instances[i]); if (instance){ instance.end(); }; i--; }; }; } protected function filterInstance(propChanges:Array, targ:Object):Boolean{ if (filterObject){ return (filterObject.filterFunction(propChanges, targ)); }; return (true); } public function get target():Object{ if (_targets.length > 0){ return (_targets[0]); }; return (null); } public function get duration():Number{ return (_duration); } protected function getValueFromTarget(target:Object, property:String){ if ((property in target)){ return (target[property]); }; return (undefined); } public function set customFilter(value:EffectTargetFilter):void{ _customFilter = value; filterObject = value; } public function get targets():Array{ return (_targets); } public function captureStartValues():void{ var n:int; var i:int; if (targets.length > 0){ propertyChangesArray = []; _callValidateNow = true; n = targets.length; i = 0; while (i < n) { propertyChangesArray.push(new PropertyChanges(targets[i])); i++; }; propertyChangesArray = captureValues(propertyChangesArray, true); }; } public function set target(value:Object):void{ _targets.splice(0); if (value){ _targets[0] = value; }; } public function get className():String{ var name:String; var index:int; name = getQualifiedClassName(this); index = name.indexOf("::"); if (index != -1){ name = name.substr((index + 2)); }; return (name); } public function get isPlaying():Boolean{ return (((_instances) && ((_instances.length > 0)))); } mx_internal function captureValues(propChanges:Array, setStartValues:Boolean):Array{ var effectProps:Array; var valueMap:Object; var target:Object; var n:int; var i:int; var m:int; var j:int; var styles:Array; effectProps = (filterObject) ? mergeArrays(relevantProperties, filterObject.filterProperties) : relevantProperties; if (((effectProps) && ((effectProps.length > 0)))){ n = propChanges.length; i = 0; while (i < n) { target = propChanges[i].target; valueMap = (setStartValues) ? propChanges[i].start : propChanges[i].end; m = effectProps.length; j = 0; while (j < m) { valueMap[effectProps[j]] = getValueFromTarget(target, effectProps[j]); j++; }; i++; }; }; styles = (filterObject) ? mergeArrays(relevantStyles, filterObject.filterStyles) : relevantStyles; if (((styles) && ((styles.length > 0)))){ n = propChanges.length; i = 0; while (i < n) { target = propChanges[i].target; valueMap = (setStartValues) ? propChanges[i].start : propChanges[i].end; m = styles.length; j = 0; while (j < m) { valueMap[styles[j]] = target.getStyle(styles[j]); j++; }; i++; }; }; return (propChanges); } public function set duration(value:Number):void{ durationExplicitlySet = true; _duration = value; } public function get relevantProperties():Array{ if (_relevantProperties){ return (_relevantProperties); }; return (getAffectedProperties()); } public function createInstance(target:Object=null):IEffectInstance{ var newInstance:IEffectInstance; var props:PropertyChanges; var create:Boolean; var setPropsArray:Boolean; var n:int; var i:int; if (!target){ target = this.target; }; newInstance = null; props = null; create = true; setPropsArray = false; if (propertyChangesArray){ setPropsArray = true; create = filterInstance(propertyChangesArray, target); }; if (create){ newInstance = IEffectInstance(new instanceClass(target)); initInstance(newInstance); if (setPropsArray){ n = propertyChangesArray.length; i = 0; while (i < n) { if (propertyChangesArray[i].target == target){ newInstance.propertyChanges = propertyChangesArray[i]; }; i++; }; }; EventDispatcher(newInstance).addEventListener(EffectEvent.EFFECT_START, effectStartHandler); EventDispatcher(newInstance).addEventListener(EffectEvent.EFFECT_END, effectEndHandler); _instances.push(newInstance); if (initEvent){ newInstance.initEffect(initEvent); }; }; return (newInstance); } protected function applyValueToTarget(target:Object, property:String, value, props:Object):void{ var target = target; var property = property; var value = value; var props = props; if ((property in target)){ if (((((applyActualDimensions) && ((target is IFlexDisplayObject)))) && ((property == "height")))){ target.setActualSize(target.width, value); } else { if (((((applyActualDimensions) && ((target is IFlexDisplayObject)))) && ((property == "width")))){ target.setActualSize(value, target.height); } else { target[property] = value; }; }; //unresolved jump var _slot1 = e; }; } protected function effectStartHandler(event:EffectEvent):void{ dispatchEvent(event); } public function play(targets:Array=null, playReversedFromEnd:Boolean=false):Array{ var newInstances:Array; var n:int; var i:int; var newInstance:IEffectInstance; if ((((targets == null)) && (!((propertyChangesArray == null))))){ if (_callValidateNow){ LayoutManager.getInstance().validateNow(); }; propertyChangesArray = captureValues(propertyChangesArray, false); propertyChangesArray = stripUnchangedValues(propertyChangesArray); applyStartValues(propertyChangesArray, this.targets); }; newInstances = createInstances(targets); n = newInstances.length; i = 0; while (i < n) { newInstance = IEffectInstance(newInstances[i]); Object(newInstance).playReversed = playReversedFromEnd; newInstance.startEffect(); i++; }; return (newInstances); } public function resume():void{ var n:int; var i:int; if (((isPlaying) && (isPaused))){ isPaused = false; n = _instances.length; i = 0; while (i < n) { IEffectInstance(_instances[i]).resume(); i++; }; }; } public function set relevantStyles(values:Array):void{ _relevantStyles = values; } public function getAffectedProperties():Array{ return ([]); } protected function initInstance(instance:IEffectInstance):void{ instance.duration = duration; Object(instance).durationExplicitlySet = durationExplicitlySet; instance.effect = this; instance.repeatCount = repeatCount; instance.repeatDelay = repeatDelay; instance.startDelay = startDelay; instance.suspendBackgroundProcessing = suspendBackgroundProcessing; } public function get customFilter():EffectTargetFilter{ return (_customFilter); } mx_internal function applyStartValues(propChanges:Array, targets:Array):void{ var effectProps:Array; var n:int; var i:int; var m:int; var j:int; var target:Object; var apply:Boolean; effectProps = relevantProperties; n = propChanges.length; i = 0; while (i < n) { target = propChanges[i].target; apply = false; m = targets.length; j = 0; while (j < m) { if (targets[j] == target){ apply = filterInstance(propChanges, target); break; }; j++; }; if (apply){ m = effectProps.length; j = 0; while (j < m) { if ((((effectProps[j] in propChanges[i].start)) && ((effectProps[j] in target)))){ applyValueToTarget(target, effectProps[j], propChanges[i].start[effectProps[j]], propChanges[i].start); }; j++; }; m = relevantStyles.length; j = 0; while (j < m) { if ((relevantStyles[j] in propChanges[i].start)){ target.setStyle(relevantStyles[j], propChanges[i].start[relevantStyles[j]]); }; j++; }; }; i++; }; } public function get relevantStyles():Array{ return (_relevantStyles); } public function set relevantProperties(values:Array):void{ _relevantProperties = values; } public function createInstances(targets:Array=null):Array{ var newInstances:Array; var n:int; var i:int; var newInstance:IEffectInstance; if (!targets){ targets = this.targets; }; newInstances = []; n = targets.length; i = 0; while (i < n) { newInstance = createInstance(targets[i]); if (newInstance){ newInstances.push(newInstance); }; i++; }; initEvent = null; return (newInstances); } protected function effectEndHandler(event:EffectEvent):void{ var instance:IEffectInstance; var n:int; var i:int; instance = IEffectInstance(event.effectInstance); EventDispatcher(instance).removeEventListener(EffectEvent.EFFECT_START, effectStartHandler); EventDispatcher(instance).removeEventListener(EffectEvent.EFFECT_END, effectEndHandler); n = _instances.length; i = 0; while (i < n) { if (_instances[i] === instance){ _instances.splice(i, 1); }; i++; }; dispatchEvent(event); } public function reverse():void{ var n:int; var i:int; if (isPlaying){ n = _instances.length; i = 0; while (i < n) { IEffectInstance(_instances[i]).reverse(); i++; }; }; } public function set filter(value:String):void{ if (!customFilter){ _filter = value; switch (value){ case "add": case "remove": filterObject = new AddRemoveEffectTargetFilter(); AddRemoveEffectTargetFilter(filterObject).add = (value == "add"); break; case "hide": case "show": filterObject = new HideShowEffectTargetFilter(); HideShowEffectTargetFilter(filterObject).show = (value == "show"); break; case "move": filterObject = new EffectTargetFilter(); filterObject.filterProperties = ["x", "y"]; break; case "resize": filterObject = new EffectTargetFilter(); filterObject.filterProperties = ["width", "height"]; break; default: filterObject = null; break; }; }; } public function pause():void{ var n:int; var i:int; if (((isPlaying) && (!(isPaused)))){ isPaused = true; n = _instances.length; i = 0; while (i < n) { IEffectInstance(_instances[i]).pause(); i++; }; }; } public function get filter():String{ return (_filter); } private static function mergeArrays(a1:Array, a2:Array):Array{ var i2:int; var addIt:Boolean; var i1:int; if (a2){ i2 = 0; while (i2 < a2.length) { addIt = true; i1 = 0; while (i1 < a1.length) { if (a1[i1] == a2[i2]){ addIt = false; break; }; i1++; }; if (addIt){ a1.push(a2[i2]); }; i2++; }; }; return (a1); } private static function stripUnchangedValues(propChanges:Array):Array{ var i:int; var prop:Object; i = 0; while (i < propChanges.length) { for (prop in propChanges[i].start) { if ((((propChanges[i].start[prop] == propChanges[i].end[prop])) || ((((((((typeof(propChanges[i].start[prop]) == "number")) && ((typeof(propChanges[i].end[prop]) == "number")))) && (isNaN(propChanges[i].start[prop])))) && (isNaN(propChanges[i].end[prop])))))){ delete propChanges[i].start[prop]; delete propChanges[i].end[prop]; }; }; i++; }; return (propChanges); } } }//package mx.effects
Section 92
//EffectInstance (mx.effects.EffectInstance) package mx.effects { import flash.events.*; import mx.core.*; import flash.utils.*; import mx.events.*; import mx.effects.effectClasses.*; public class EffectInstance extends EventDispatcher implements IEffectInstance { private var delayStartTime:Number;// = 0 private var playCount:int;// = 0 mx_internal var stopRepeat:Boolean;// = false private var _repeatCount:int; private var _suspendBackgroundProcessing:Boolean;// = false mx_internal var delayTimer:Timer; private var _triggerEvent:Event; mx_internal var parentCompositeEffectInstance:EffectInstance; mx_internal var durationExplicitlySet:Boolean;// = false private var _effect:Effect; private var _target:Object; mx_internal var hideOnEffectEnd:Boolean;// = false private var _startDelay:int;// = 0 private var delayElapsedTime:Number;// = 0 private var _repeatDelay:int;// = 0 private var _propertyChanges:PropertyChanges; private var _duration:Number;// = 500 private var _playReversed:Boolean; mx_internal static const VERSION:String = "2.0.1.0"; public function EffectInstance(target:Object){ delayStartTime = 0; delayElapsedTime = 0; durationExplicitlySet = false; hideOnEffectEnd = false; playCount = 0; stopRepeat = false; _duration = 500; _repeatDelay = 0; _startDelay = 0; _suspendBackgroundProcessing = false; super(); this.target = target; } public function get playheadTime():Number{ return ((((Math.max((playCount - 1), 0) * duration) + (Math.max((playCount - 2), 0) * repeatDelay)) + (playReversed) ? 0 : startDelay)); } public function finishEffect():void{ playCount = 0; dispatchEvent(new EffectEvent(EffectEvent.EFFECT_END, false, false, this)); if (target){ target.dispatchEvent(new EffectEvent(EffectEvent.EFFECT_END, false, false, this)); }; if ((target is IUIComponent)){ Object(target).effectFinished(this); }; } public function finishRepeat():void{ if (((((!(stopRepeat)) && (!((playCount == 0))))) && ((((playCount < repeatCount)) || ((repeatCount == 0)))))){ if (repeatDelay > 0){ delayTimer = new Timer(repeatDelay, 1); delayStartTime = getTimer(); delayTimer.addEventListener(TimerEvent.TIMER, delayTimerHandler); delayTimer.start(); } else { play(); }; } else { finishEffect(); }; } mx_internal function get playReversed():Boolean{ return (_playReversed); } public function set effect(value:Effect):void{ _effect = value; } public function get className():String{ var name:String; var index:int; name = getQualifiedClassName(this); index = name.indexOf("::"); if (index != -1){ name = name.substr((index + 2)); }; return (name); } public function set duration(value:Number):void{ durationExplicitlySet = true; _duration = value; } mx_internal function set playReversed(value:Boolean):void{ _playReversed = value; } public function resume():void{ if (((((delayTimer) && (!(delayTimer.running)))) && (!(isNaN(delayElapsedTime))))){ delayTimer.delay = (playReversed) ? delayElapsedTime : (delayTimer.delay - delayElapsedTime); delayTimer.start(); }; } public function get propertyChanges():PropertyChanges{ return (_propertyChanges); } public function set target(value:Object):void{ _target = value; } public function get repeatCount():int{ return (_repeatCount); } mx_internal function playWithNoDuration():void{ duration = 0; repeatCount = 1; repeatDelay = 0; startDelay = 0; startEffect(); } public function get startDelay():int{ return (_startDelay); } mx_internal function get actualDuration():Number{ var value:Number; value = NaN; if (repeatCount > 0){ value = (((duration * repeatCount) + ((repeatDelay * repeatCount) - 1)) + startDelay); }; return (value); } public function get suspendBackgroundProcessing():Boolean{ return (_suspendBackgroundProcessing); } public function play():void{ playCount++; dispatchEvent(new EffectEvent(EffectEvent.EFFECT_START, false, false, this)); if (target){ target.dispatchEvent(new EffectEvent(EffectEvent.EFFECT_START, false, false, this)); }; } public function set repeatDelay(value:int):void{ _repeatDelay = value; } public function set propertyChanges(value:PropertyChanges):void{ _propertyChanges = value; } mx_internal function eventHandler(event:Event):void{ if ((((event.type == FlexEvent.SHOW)) && ((hideOnEffectEnd == true)))){ hideOnEffectEnd = false; event.target.removeEventListener(FlexEvent.SHOW, eventHandler); }; } public function set repeatCount(value:int):void{ _repeatCount = value; } private function delayTimerHandler(event:TimerEvent):void{ delayTimer.reset(); delayStartTime = NaN; delayElapsedTime = NaN; play(); } public function set suspendBackgroundProcessing(value:Boolean):void{ _suspendBackgroundProcessing = value; } public function set triggerEvent(value:Event):void{ _triggerEvent = value; } public function set startDelay(value:int):void{ _startDelay = value; } public function get effect():Effect{ return (_effect); } public function get duration():Number{ if (((!(durationExplicitlySet)) && (parentCompositeEffectInstance))){ return (parentCompositeEffectInstance.duration); }; return (_duration); } public function get target():Object{ return (_target); } public function startEffect():void{ if ((target is IUIComponent)){ Object(target).effectStarted(this); Object(target).drawFocus(false); }; if ((((startDelay > 0)) && (!(playReversed)))){ delayTimer = new Timer(startDelay, 1); delayStartTime = getTimer(); delayTimer.addEventListener(TimerEvent.TIMER, delayTimerHandler); delayTimer.start(); } else { play(); }; } public function get repeatDelay():int{ return (_repeatDelay); } public function initEffect(event:Event):void{ triggerEvent = event; switch (event.type){ case "resizeStart": case "resizeEnd": if (!durationExplicitlySet){ duration = 250; }; break; case FlexEvent.HIDE: target.setVisible(true, true); hideOnEffectEnd = true; target.addEventListener(FlexEvent.SHOW, eventHandler); break; }; } public function get triggerEvent():Event{ return (_triggerEvent); } public function end():void{ if (delayTimer){ delayTimer.reset(); }; stopRepeat = true; finishEffect(); } public function reverse():void{ if (repeatCount > 0){ playCount = ((repeatCount - playCount) + 1); }; } public function pause():void{ if (((((delayTimer) && (delayTimer.running))) && (!(isNaN(delayStartTime))))){ delayTimer.stop(); delayElapsedTime = (getTimer() - delayStartTime); }; } } }//package mx.effects
Section 93
//EffectManager (mx.effects.EffectManager) package mx.effects { import flash.events.*; import mx.core.*; import mx.resources.*; import flash.system.*; import flash.display.*; import mx.events.*; public class EffectManager extends EventDispatcher { mx_internal static const VERSION:String = "2.0.1.0"; private static var resourceIncorrectTrigger:String; mx_internal static var effectsPlaying:Array = []; private static var targetsInfo:Array = []; private static var effectTriggersForEvent:Object = {}; mx_internal static var lastEffectCreated:Effect; private static var eventHandlingSuspendCount:Number = 0; private static var eventsForEffectTriggers:Object = {}; private static var packageResources:ResourceBundle = ResourceBundle.getResourceBundle("effects", ApplicationDomain.currentDomain); public function EffectManager(){ super(); } private static function createAndPlayEffect(eventObj:Event, target:Object):void{ var effectInst:Effect; var n:int; var i:int; var m:int; var j:int; var instances:Array; var type:String; var tweeningProperties:Array; var effectProperties:Array; var affectedProps:Array; var runningInstances:Array; var otherInst:EffectInstance; effectInst = createEffectForType(target, eventObj.type); if (!effectInst){ return; }; if ((((effectInst is Zoom)) && ((eventObj.type == MoveEvent.MOVE)))){ throw (new Error(resourceIncorrectTrigger)); }; if (target.initialized == false){ type = eventObj.type; if ((((((((((type == MoveEvent.MOVE)) || ((type == ResizeEvent.RESIZE)))) || ((type == FlexEvent.SHOW)))) || ((type == FlexEvent.HIDE)))) || ((type == Event.CHANGE)))){ effectInst = null; return; }; }; if ((effectInst.target is IUIComponent)){ tweeningProperties = IUIComponent(effectInst.target).tweeningProperties; if (((tweeningProperties) && ((tweeningProperties.length > 0)))){ effectProperties = effectInst.getAffectedProperties(); n = tweeningProperties.length; m = effectProperties.length; i = 0; while (i < n) { j = 0; while (j < m) { if (tweeningProperties[i] == effectProperties[j]){ effectInst = null; return; }; j++; }; i++; }; }; }; if ((((effectInst.target is UIComponent)) && (UIComponent(effectInst.target).isEffectStarted))){ affectedProps = effectInst.getAffectedProperties(); i = 0; while (i < affectedProps.length) { runningInstances = effectInst.target.getEffectsForProperty(affectedProps[i]); if (runningInstances.length > 0){ if (eventObj.type == ResizeEvent.RESIZE){ return; }; j = 0; while (j < runningInstances.length) { otherInst = runningInstances[j]; if ((((eventObj.type == FlexEvent.SHOW)) && (otherInst.hideOnEffectEnd))){ otherInst.target.removeEventListener(FlexEvent.SHOW, otherInst.eventHandler); otherInst.hideOnEffectEnd = false; }; otherInst.end(); j++; }; }; i++; }; }; effectInst.initEvent = eventObj; effectInst.addEventListener(EffectEvent.EFFECT_END, EffectManager.effectEndHandler); lastEffectCreated = effectInst; instances = effectInst.play(); n = instances.length; i = 0; while (i < n) { effectsPlaying.push(new EffectNode(effectInst, instances[i])); i++; }; if (effectInst.suspendBackgroundProcessing){ UIComponent.suspendBackgroundProcessing(); }; } public static function suspendEventHandling():void{ eventHandlingSuspendCount++; } mx_internal static function registerEffectTrigger(name:String, event:String):void{ var strLen:Number; if (name != ""){ if (event == ""){ strLen = name.length; if ((((strLen > 6)) && ((name.substring((strLen - 6)) == "Effect")))){ event = name.substring(0, (strLen - 6)); }; }; if (event != ""){ effectTriggersForEvent[event] = name; eventsForEffectTriggers[name] = event; }; }; } private static function removedEffectHandler(target:DisplayObject, parent:DisplayObjectContainer, index:int, eventObj:Event):void{ suspendEventHandling(); parent.addChildAt(target, index); resumeEventHandling(); createAndPlayEffect(eventObj, target); } mx_internal static function endVectorEffect(target:IUIComponent):void{ cacheOrUncacheTargetAsBitmap(target, false, false); } public static function endEffectsForTarget(target:IUIComponent):void{ var n:int; var i:int; var otherInst:EffectInstance; n = effectsPlaying.length; i = (n - 1); while (i >= 0) { otherInst = effectsPlaying[i].instance; if (otherInst.target == target){ otherInst.end(); }; i--; }; } private static function cacheOrUncacheTargetAsBitmap(target:IUIComponent, effectStart:Boolean=true, bitmapEffect:Boolean=true):void{ var n:int; var i:int; var info:Object; info = null; n = targetsInfo.length; i = 0; while (i < n) { if (targetsInfo[i].target == target){ info = targetsInfo[i]; break; }; i++; }; if (!info){ info = {target:target, bitmapEffectsCount:0, vectorEffectsCount:0}; targetsInfo.push(info); }; if (effectStart){ if (bitmapEffect){ info.bitmapEffectsCount++; if ((((info.vectorEffectsCount == 0)) && ((target is IDeferredInstantiationUIComponent)))){ IDeferredInstantiationUIComponent(target).cacheHeuristic = true; }; } else { if ((((((info.vectorEffectsCount++ == 0)) && ((target is IDeferredInstantiationUIComponent)))) && ((IDeferredInstantiationUIComponent(target).cachePolicy == UIComponentCachePolicy.AUTO)))){ target.cacheAsBitmap = false; }; }; } else { if (bitmapEffect){ if (info.bitmapEffectsCount != 0){ info.bitmapEffectsCount--; }; if ((target is IDeferredInstantiationUIComponent)){ IDeferredInstantiationUIComponent(target).cacheHeuristic = false; }; } else { if (info.vectorEffectsCount != 0){ if ((((--info.vectorEffectsCount == 0)) && (!((info.bitmapEffectsCount == 0))))){ n = info.bitmapEffectsCount; i = 0; while (i < n) { if ((target is IDeferredInstantiationUIComponent)){ IDeferredInstantiationUIComponent(target).cacheHeuristic = true; }; i++; }; }; }; }; if ((((info.bitmapEffectsCount == 0)) && ((info.vectorEffectsCount == 0)))){ n = targetsInfo.length; i = 0; while (i < n) { if (targetsInfo[i].target == target){ targetsInfo.splice(i, 1); break; }; i++; }; }; }; } mx_internal static function eventHandler(eventObj:Event):void{ var focusEventObj:FocusEvent; var targ:DisplayObject; var i:int; var parent:DisplayObjectContainer; var index:int; if (!(eventObj.currentTarget is IFlexDisplayObject)){ return; }; if (eventHandlingSuspendCount > 0){ return; }; if ((((eventObj is FocusEvent)) && ((((eventObj.type == FocusEvent.FOCUS_OUT)) || ((eventObj.type == FocusEvent.FOCUS_IN)))))){ focusEventObj = FocusEvent(eventObj); if (((focusEventObj.relatedObject) && (((focusEventObj.currentTarget.contains(focusEventObj.relatedObject)) || ((focusEventObj.currentTarget == focusEventObj.relatedObject)))))){ return; }; }; if ((((((eventObj.type == Event.ADDED)) || ((eventObj.type == Event.REMOVED)))) && (!((eventObj.target == eventObj.currentTarget))))){ return; }; if (eventObj.type == Event.REMOVED){ if ((eventObj.target is UIComponent)){ if (UIComponent(eventObj.target).initialized == false){ return; }; if (UIComponent(eventObj.target).isEffectStarted){ i = 0; while (i < UIComponent(eventObj.target)._effectsStarted.length) { if (UIComponent(eventObj.target)._effectsStarted[i].triggerEvent.type == Event.REMOVED){ return; }; i++; }; }; }; targ = (eventObj.target as DisplayObject); if (targ != null){ parent = (targ.parent as DisplayObjectContainer); if (parent != null){ index = parent.getChildIndex(targ); if (index >= 0){ if ((targ is UIComponent)){ UIComponent(targ).callLater(removedEffectHandler, [targ, parent, index, eventObj]); }; }; }; }; } else { createAndPlayEffect(eventObj, eventObj.currentTarget); }; } mx_internal static function endBitmapEffect(target:IUIComponent):void{ cacheOrUncacheTargetAsBitmap(target, false, true); } private static function animateSameProperty(a:Effect, b:Effect, c:EffectInstance):Boolean{ var aProps:Array; var bProps:Array; var n:int; var m:int; var i:int; var j:int; if (a.target == c.target){ aProps = a.getAffectedProperties(); bProps = b.getAffectedProperties(); n = aProps.length; m = bProps.length; i = 0; while (i < n) { j = 0; while (j < m) { if (aProps[i] == bProps[j]){ return (true); }; j++; }; i++; }; }; return (false); } private static function loadResources():void{ resourceIncorrectTrigger = packageResources.getString("incorrectTrigger"); } mx_internal static function effectEndHandler(event:EffectEvent):void{ var effectInst:IEffectInstance; var n:int; var i:int; var targ:DisplayObject; var parent:DisplayObjectContainer; effectInst = event.effectInstance; n = effectsPlaying.length; i = (n - 1); while (i >= 0) { if (effectsPlaying[i].instance == effectInst){ effectsPlaying.splice(i, 1); break; }; i--; }; if (Object(effectInst).hideOnEffectEnd == true){ effectInst.target.removeEventListener(FlexEvent.SHOW, Object(effectInst).eventHandler); effectInst.target.setVisible(false, true); }; if (((effectInst.triggerEvent) && ((effectInst.triggerEvent.type == Event.REMOVED)))){ targ = (effectInst.target as DisplayObject); if (targ != null){ parent = (targ.parent as DisplayObjectContainer); if (parent != null){ suspendEventHandling(); parent.removeChild(targ); resumeEventHandling(); }; }; }; if (effectInst.suspendBackgroundProcessing){ UIComponent.resumeBackgroundProcessing(); }; } mx_internal static function startBitmapEffect(target:IUIComponent):void{ cacheOrUncacheTargetAsBitmap(target, true, true); } mx_internal static function setStyle(styleProp:String, target):void{ var eventName:String; eventName = eventsForEffectTriggers[styleProp]; if (((!((eventName == null))) && (!((eventName == ""))))){ target.addEventListener(eventName, EffectManager.eventHandler, false, EventPriority.EFFECT); }; } mx_internal static function getEventForEffectTrigger(effectTrigger:String):String{ var effectTrigger = effectTrigger; if (eventsForEffectTriggers){ return (eventsForEffectTriggers[effectTrigger]); //unresolved jump var _slot1 = e; return (""); }; return (""); } mx_internal static function createEffectForType(target:Object, type:String):Effect{ var trigger:String; var value:Object; var effectClass:Class; var cls:Class; var effectObj:Effect; var doc:Object; var target = target; var type = type; trigger = effectTriggersForEvent[type]; if (trigger == ""){ trigger = (type + "Effect"); }; value = target.getStyle(trigger); if (!value){ return (null); }; if ((value is Class)){ cls = Class(value); return (new cls(target)); }; if ((value is String)){ doc = target.parentDocument; if (!doc){ doc = Application.application; }; effectObj = doc[value]; } else { if ((value is Effect)){ effectObj = Effect(value); }; }; if (effectObj){ effectObj.target = target; return (effectObj); }; //unresolved jump var _slot1 = e; effectClass = Class(target.systemManager.getDefinitionByName(("mx.effects." + value))); if (effectClass){ return (new effectClass(target)); }; return (null); } public static function resumeEventHandling():void{ eventHandlingSuspendCount--; } mx_internal static function startVectorEffect(target:IUIComponent):void{ cacheOrUncacheTargetAsBitmap(target, true, false); } loadResources(); } }//package mx.effects class EffectNode { public var instance:EffectInstance; public var factory:Effect; private function EffectNode(factory:Effect, instance:EffectInstance){ super(); this.factory = factory; this.instance = instance; } }
Section 94
//EffectTargetFilter (mx.effects.EffectTargetFilter) package mx.effects { import mx.core.*; import mx.effects.effectClasses.*; public class EffectTargetFilter { public var filterFunction:Function; public var filterStyles:Array; public var filterProperties:Array; mx_internal static const VERSION:String = "2.0.1.0"; public function EffectTargetFilter(){ filterFunction = defaultFilterFunction; filterProperties = []; filterStyles = []; super(); } protected function defaultFilterFunction(propChanges:Array, instanceTarget:Object):Boolean{ var n:int; var i:int; var props:PropertyChanges; var triggers:Array; var m:int; var j:int; n = propChanges.length; i = 0; while (i < n) { props = propChanges[i]; if (props.target == instanceTarget){ triggers = filterProperties.concat(filterStyles); m = triggers.length; j = 0; while (j < m) { if (((!((props.start[triggers[j]] === undefined))) && (!((props.end[triggers[j]] == props.start[triggers[j]]))))){ return (true); }; j++; }; }; i++; }; return (false); } } }//package mx.effects
Section 95
//IEffectInstance (mx.effects.IEffectInstance) package mx.effects { import flash.events.*; import mx.effects.effectClasses.*; public interface IEffectInstance { function set startDelay(mx.effects:IEffectInstance/mx.effects:IEffectInstance:className/get:int):void; function set triggerEvent(mx.effects:IEffectInstance/mx.effects:IEffectInstance:className/get:Event):void; function get playheadTime():Number; function get triggerEvent():Event; function finishEffect():void; function finishRepeat():void; function initEffect(mx.effects:IEffectInstance/mx.effects:IEffectInstance:className/get:Event):void; function get effect():Effect; function startEffect():void; function get duration():Number; function set repeatDelay(mx.effects:IEffectInstance/mx.effects:IEffectInstance:className/get:int):void; function get target():Object; function get startDelay():int; function end():void; function set propertyChanges(mx.effects:IEffectInstance/mx.effects:IEffectInstance:className/get:PropertyChanges):void; function set effect(mx.effects:IEffectInstance/mx.effects:IEffectInstance:className/get:Effect):void; function get className():String; function get repeatDelay():int; function set target(mx.effects:IEffectInstance/mx.effects:IEffectInstance:className/get:Object):void; function resume():void; function get propertyChanges():PropertyChanges; function set duration(mx.effects:IEffectInstance/mx.effects:IEffectInstance:className/get:Number):void; function reverse():void; function get repeatCount():int; function pause():void; function set repeatCount(mx.effects:IEffectInstance/mx.effects:IEffectInstance:className/get:int):void; function set suspendBackgroundProcessing(mx.effects:IEffectInstance/mx.effects:IEffectInstance:className/get:Boolean):void; function play():void; function get suspendBackgroundProcessing():Boolean; } }//package mx.effects
Section 96
//Tween (mx.effects.Tween) package mx.effects { import flash.events.*; import mx.core.*; import flash.utils.*; import mx.events.*; public class Tween extends EventDispatcher { private var started:Boolean;// = false public var duration:Number;// = 3000 private var id:int; private var arrayMode:Boolean; private var _isPlaying:Boolean;// = true private var startValue:Object; public var listener:Object; private var userEquation:Function; private var previousUpdateTime:Number; mx_internal var needToLayout:Boolean;// = false private var updateFunction:Function; private var _doSeek:Boolean;// = false mx_internal var startTime:Number; private var endFunction:Function; private var endValue:Object; private var _doReverse:Boolean;// = false private var _playheadTime:Number;// = 0 private var _invertValues:Boolean;// = false private var maxDelay:Number;// = 87.5 mx_internal static const VERSION:String = "2.0.1.0"; private static var timer:Timer = null; private static var interval:Number = 10; private static var activeTweens:Array = []; mx_internal static var intervalTime:Number = NAN; public function Tween(listener:Object, startValue:Object, endValue:Object, duration:Number=-1, minFps:Number=-1){ needToLayout = false; maxDelay = 87.5; _doSeek = false; _isPlaying = true; _doReverse = false; userEquation = defaultEasingFunction; started = false; duration = 3000; _playheadTime = 0; _invertValues = false; super(); if (!listener){ return; }; if ((startValue is Array)){ arrayMode = true; }; this.listener = listener; this.startValue = startValue; this.endValue = endValue; if (((!(isNaN(duration))) && (!((duration == -1))))){ this.duration = duration; }; if (((!(isNaN(minFps))) && (!((minFps == -1))))){ maxDelay = (1000 / minFps); }; if (duration == 0){ endTween(); } else { Tween.addTween(this); }; } public function pause():void{ _isPlaying = false; } mx_internal function get playheadTime():Number{ return (_playheadTime); } mx_internal function get playReversed():Boolean{ return (_invertValues); } public function resume():void{ _isPlaying = true; startTime = (intervalTime - _playheadTime); if (_doReverse){ reverse(); _doReverse = false; }; } public function setTweenHandlers(updateFunction:Function, endFunction:Function):void{ this.updateFunction = updateFunction; this.endFunction = endFunction; } mx_internal function set playReversed(value:Boolean):void{ _invertValues = value; } public function set easingFunction(value:Function):void{ userEquation = value; } private function defaultEasingFunction(t:Number, b:Number, c:Number, d:Number):Number{ return ((((c / 2) * (Math.sin((Math.PI * ((t / d) - 0.5))) + 1)) + b)); } public function endTween():void{ var event:TweenEvent; var value:Object; event = new TweenEvent(TweenEvent.TWEEN_END); value = getCurrentValue(duration); event.value = value; dispatchEvent(event); if (endFunction != null){ endFunction(value); } else { listener.onTweenEnd(value); }; Tween.removeTweenAt(id); } public function reverse():void{ if (_isPlaying){ _doReverse = false; seek((duration - _playheadTime)); _invertValues = !(_invertValues); } else { _doReverse = !(_doReverse); }; } mx_internal function doInterval():Boolean{ var tweenEnded:Boolean; var currentTime:Number; var currentValue:Object; var event:TweenEvent; var startEvent:TweenEvent; tweenEnded = false; previousUpdateTime = intervalTime; if (((_isPlaying) || (_doSeek))){ currentTime = (intervalTime - startTime); _playheadTime = currentTime; currentValue = getCurrentValue(currentTime); if ((((currentTime >= duration)) && (!(_doSeek)))){ endTween(); tweenEnded = true; } else { if (!started){ startEvent = new TweenEvent(TweenEvent.TWEEN_START); dispatchEvent(startEvent); started = true; }; event = new TweenEvent(TweenEvent.TWEEN_UPDATE); event.value = currentValue; dispatchEvent(event); if (updateFunction != null){ updateFunction(currentValue); } else { listener.onTweenUpdate(currentValue); }; }; _doSeek = false; }; return (tweenEnded); } public function seek(playheadTime:Number):void{ var clockTime:Number; clockTime = intervalTime; previousUpdateTime = clockTime; startTime = (clockTime - playheadTime); _doSeek = true; } mx_internal function getCurrentValue(currentTime:Number):Object{ var returnArray:Array; var n:int; var i:int; if (duration == 0){ return (endValue); }; if (_invertValues){ currentTime = (duration - currentTime); }; if (arrayMode){ returnArray = []; n = startValue.length; i = 0; while (i < n) { returnArray[i] = userEquation(currentTime, startValue[i], (endValue[i] - startValue[i]), duration); i++; }; return (returnArray); //unresolved jump }; return (userEquation(currentTime, startValue, (Number(endValue) - Number(startValue)), duration)); } mx_internal static function removeTween(tween:Tween):void{ removeTweenAt(tween.id); } private static function addTween(tween:Tween):void{ tween.id = activeTweens.length; activeTweens.push(tween); if (!timer){ timer = new Timer(interval); timer.addEventListener(TimerEvent.TIMER, timerHandler); timer.start(); } else { timer.start(); }; if (isNaN(intervalTime)){ intervalTime = getTimer(); }; tween.startTime = (tween.previousUpdateTime = intervalTime); } private static function timerHandler(event:TimerEvent):void{ var needToLayout:Boolean; var oldTime:Number; var n:int; var i:int; var tween:Tween; needToLayout = false; oldTime = intervalTime; intervalTime = getTimer(); n = activeTweens.length; i = n; while (i >= 0) { tween = Tween(activeTweens[i]); if (tween){ tween.needToLayout = false; tween.doInterval(); if (tween.needToLayout){ needToLayout = true; }; }; i--; }; if (needToLayout){ UIComponentGlobals.layoutManager.validateNow(); }; event.updateAfterEvent(); } private static function removeTweenAt(index:int):void{ var n:int; var i:int; var curTween:Tween; if ((((index >= activeTweens.length)) || ((index < 0)))){ return; }; activeTweens.splice(index, 1); n = activeTweens.length; i = index; while (i < n) { curTween = Tween(activeTweens[i]); curTween.id--; i++; }; if (n == 0){ intervalTime = NaN; timer.reset(); }; } } }//package mx.effects
Section 97
//TweenEffect (mx.effects.TweenEffect) package mx.effects { import flash.events.*; import mx.core.*; import mx.events.*; import mx.effects.effectClasses.*; public class TweenEffect extends Effect { public var easingFunction:Function;// = null mx_internal static const VERSION:String = "2.0.1.0"; public function TweenEffect(target:Object=null){ easingFunction = null; super(target); instanceClass = TweenEffectInstance; } override protected function initInstance(instance:IEffectInstance):void{ super.initInstance(instance); TweenEffectInstance(instance).easingFunction = easingFunction; EventDispatcher(instance).addEventListener(TweenEvent.TWEEN_START, tweenEventHandler); EventDispatcher(instance).addEventListener(TweenEvent.TWEEN_UPDATE, tweenEventHandler); EventDispatcher(instance).addEventListener(TweenEvent.TWEEN_END, tweenEventHandler); } protected function tweenEventHandler(event:TweenEvent):void{ dispatchEvent(event); } } }//package mx.effects
Section 98
//Zoom (mx.effects.Zoom) package mx.effects { import mx.core.*; import mx.effects.effectClasses.*; public class Zoom extends TweenEffect { public var originY:Number; public var zoomWidthFrom:Number; public var zoomWidthTo:Number; public var zoomHeightFrom:Number; public var captureRollEvents:Boolean; public var zoomHeightTo:Number; public var originX:Number; mx_internal static const VERSION:String = "2.0.1.0"; private static var AFFECTED_PROPERTIES:Array = ["scaleX", "scaleY", "x", "y", "width", "height"]; public function Zoom(target:Object=null){ super(target); instanceClass = ZoomInstance; applyActualDimensions = false; relevantProperties = ["scaleX", "scaleY", "width", "height", "visible"]; } override public function getAffectedProperties():Array{ return (AFFECTED_PROPERTIES); } override protected function initInstance(instance:IEffectInstance):void{ var zoomInstance:ZoomInstance; super.initInstance(instance); zoomInstance = ZoomInstance(instance); zoomInstance.zoomWidthFrom = zoomWidthFrom; zoomInstance.zoomWidthTo = zoomWidthTo; zoomInstance.zoomHeightFrom = zoomHeightFrom; zoomInstance.zoomHeightTo = zoomHeightTo; zoomInstance.originX = originX; zoomInstance.originY = originY; zoomInstance.captureRollEvents = captureRollEvents; } } }//package mx.effects
Section 99
//ChildExistenceChangedEvent (mx.events.ChildExistenceChangedEvent) package mx.events { import flash.events.*; import mx.core.*; import flash.display.*; public class ChildExistenceChangedEvent extends Event { public var relatedObject:DisplayObject; public static const CHILD_REMOVE:String = "childRemove"; mx_internal static const VERSION:String = "2.0.1.0"; public static const OVERLAY_CREATED:String = "overlayCreated"; public static const CHILD_ADD:String = "childAdd"; public function ChildExistenceChangedEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, relatedObject:DisplayObject=null){ super(type, bubbles, cancelable); this.relatedObject = relatedObject; } override public function clone():Event{ return (new ChildExistenceChangedEvent(type, bubbles, cancelable, relatedObject)); } } }//package mx.events
Section 100
//DragEvent (mx.events.DragEvent) package mx.events { import flash.events.*; import mx.core.*; public class DragEvent extends MouseEvent { public var action:String; public var draggedItem:Object; public var dragSource:DragSource; public var dragInitiator:IUIComponent; public static const DRAG_DROP:String = "dragDrop"; public static const DRAG_COMPLETE:String = "dragComplete"; public static const DRAG_EXIT:String = "dragExit"; public static const DRAG_ENTER:String = "dragEnter"; public static const DRAG_START:String = "dragStart"; mx_internal static const VERSION:String = "2.0.1.0"; public static const DRAG_OVER:String = "dragOver"; public function DragEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=true, dragInitiator:IUIComponent=null, dragSource:DragSource=null, action:String=null, ctrlKey:Boolean=false, altKey:Boolean=false, shiftKey:Boolean=false){ super(type, bubbles, cancelable); this.dragInitiator = dragInitiator; this.dragSource = dragSource; this.action = action; this.ctrlKey = ctrlKey; this.altKey = altKey; this.shiftKey = shiftKey; } override public function clone():Event{ var cloneEvent:DragEvent; cloneEvent = new DragEvent(type, bubbles, cancelable, dragInitiator, dragSource, action, ctrlKey, altKey, shiftKey); cloneEvent.relatedObject = this.relatedObject; cloneEvent.localX = this.localX; cloneEvent.localY = this.localY; return (cloneEvent); } } }//package mx.events
Section 101
//DynamicEvent (mx.events.DynamicEvent) package mx.events { import flash.events.*; import mx.core.*; public dynamic class DynamicEvent extends Event { mx_internal static const VERSION:String = "2.0.1.0"; public function DynamicEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false){ super(type, bubbles, cancelable); } override public function clone():Event{ return (new DynamicEvent(type, bubbles, cancelable)); } } }//package mx.events
Section 102
//EffectEvent (mx.events.EffectEvent) package mx.events { import flash.events.*; import mx.core.*; import mx.effects.*; public class EffectEvent extends Event { public var effectInstance:IEffectInstance; public static const EFFECT_START:String = "effectStart"; mx_internal static const VERSION:String = "2.0.1.0"; public static const EFFECT_END:String = "effectEnd"; public function EffectEvent(eventType:String, bubbles:Boolean=false, cancelable:Boolean=false, effectInstance:IEffectInstance=null){ super(eventType, bubbles, cancelable); this.effectInstance = effectInstance; } override public function clone():Event{ return (new EffectEvent(type, bubbles, cancelable, effectInstance)); } } }//package mx.events
Section 103
//FlexEvent (mx.events.FlexEvent) package mx.events { import flash.events.*; import mx.core.*; public class FlexEvent extends Event { public static const ADD:String = "add"; public static const TRANSFORM_CHANGE:String = "transformChange"; public static const INIT_COMPLETE:String = "initComplete"; public static const REMOVE:String = "remove"; public static const BUTTON_DOWN:String = "buttonDown"; public static const EXIT_STATE:String = "exitState"; public static const CREATION_COMPLETE:String = "creationComplete"; public static const REPEAT:String = "repeat"; public static const LOADING:String = "loading"; public static const REPEAT_START:String = "repeatStart"; public static const INITIALIZE:String = "initialize"; public static const ENTER_STATE:String = "enterState"; public static const URL_CHANGED:String = "urlChanged"; public static const REPEAT_END:String = "repeatEnd"; mx_internal static const VERSION:String = "2.0.1.0"; public static const HIDE:String = "hide"; public static const ENTER:String = "enter"; public static const PRELOADER_DONE:String = "preloaderDone"; public static const CURSOR_UPDATE:String = "cursorUpdate"; public static const PREINITIALIZE:String = "preinitialize"; public static const INVALID:String = "invalid"; public static const IDLE:String = "idle"; public static const VALID:String = "valid"; public static const DATA_CHANGE:String = "dataChange"; public static const APPLICATION_COMPLETE:String = "applicationComplete"; public static const VALUE_COMMIT:String = "valueCommit"; public static const UPDATE_COMPLETE:String = "updateComplete"; public static const INIT_PROGRESS:String = "initProgress"; public static const SHOW:String = "show"; public function FlexEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false){ super(type, bubbles, cancelable); } override public function clone():Event{ return (new FlexEvent(type, bubbles, cancelable)); } } }//package mx.events
Section 104
//FlexMouseEvent (mx.events.FlexMouseEvent) package mx.events { import flash.events.*; import mx.core.*; import flash.display.*; public class FlexMouseEvent extends MouseEvent { public static const MOUSE_DOWN_OUTSIDE:String = "mouseDownOutside"; public static const MOUSE_WHEEL_OUTSIDE:String = "mouseWheelOutside"; mx_internal static const VERSION:String = "2.0.1.0"; public function FlexMouseEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, localX:Number=0, localY:Number=0, relatedObject:InteractiveObject=null, ctrlKey:Boolean=false, altKey:Boolean=false, shiftKey:Boolean=false, buttonDown:Boolean=false, delta:int=0){ super(type, bubbles, cancelable, localX, localY, relatedObject, ctrlKey, altKey, shiftKey, buttonDown, delta); } override public function clone():Event{ return (new FlexMouseEvent(type, bubbles, cancelable, localX, localY, relatedObject, ctrlKey, altKey, shiftKey, buttonDown, delta)); } } }//package mx.events
Section 105
//IndexChangedEvent (mx.events.IndexChangedEvent) package mx.events { import flash.events.*; import mx.core.*; import flash.display.*; public class IndexChangedEvent extends Event { public var triggerEvent:Event; public var relatedObject:DisplayObject; public var newIndex:Number; public var oldIndex:Number; public static const HEADER_SHIFT:String = "headerShift"; public static const CHANGE:String = "change"; mx_internal static const VERSION:String = "2.0.1.0"; public static const CHILD_INDEX_CHANGE:String = "childIndexChange"; public function IndexChangedEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, relatedObject:DisplayObject=null, oldIndex:Number=-1, newIndex:Number=-1, triggerEvent:Event=null){ super(type, bubbles, cancelable); this.relatedObject = relatedObject; this.oldIndex = oldIndex; this.newIndex = newIndex; this.triggerEvent = triggerEvent; } override public function clone():Event{ return (new IndexChangedEvent(type, bubbles, cancelable, relatedObject, oldIndex, newIndex, triggerEvent)); } } }//package mx.events
Section 106
//ModuleEvent (mx.events.ModuleEvent) package mx.events { import flash.events.*; import mx.core.*; import mx.modules.*; public class ModuleEvent extends ProgressEvent { public var errorText:String; mx_internal static const VERSION:String = "2.0.1.0"; public static var READY:String = "ready"; public static var ERROR:String = "error"; public static var PROGRESS:String = "progress"; public static var SETUP:String = "setup"; public static var UNLOAD:String = "unload"; public function ModuleEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, bytesLoaded:uint=0, bytesTotal:uint=0, errorText:String=null){ super(type, bubbles, cancelable, bytesLoaded, bytesTotal); this.errorText = errorText; } public function get module():IModuleInfo{ return ((target as IModuleInfo)); } override public function clone():Event{ return (new ModuleEvent(type, bubbles, cancelable, bytesLoaded, bytesTotal, errorText)); } } }//package mx.events
Section 107
//MoveEvent (mx.events.MoveEvent) package mx.events { import flash.events.*; import mx.core.*; public class MoveEvent extends Event { public var oldY:Number; public var oldX:Number; mx_internal static const VERSION:String = "2.0.1.0"; public static const MOVE:String = "move"; public function MoveEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, oldX:Number=NaN, oldY:Number=NaN){ super(type, bubbles, cancelable); this.oldX = oldX; this.oldY = oldY; } override public function clone():Event{ return (new MoveEvent(type, bubbles, cancelable, oldX, oldY)); } } }//package mx.events
Section 108
//PropertyChangeEvent (mx.events.PropertyChangeEvent) package mx.events { import flash.events.*; import mx.core.*; public class PropertyChangeEvent extends Event { public var oldValue:Object; public var property:Object; public var source:Object; public var kind:String; public var newValue:Object; mx_internal static const VERSION:String = "2.0.1.0"; public static const PROPERTY_CHANGE:String = "propertyChange"; public function PropertyChangeEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, kind:String=null, property:Object=null, oldValue:Object=null, newValue:Object=null, source:Object=null){ super(type, bubbles, cancelable); this.kind = kind; this.property = property; this.oldValue = oldValue; this.newValue = newValue; this.source = source; } override public function clone():Event{ return (new PropertyChangeEvent(type, bubbles, cancelable, kind, property, oldValue, newValue, source)); } public static function createUpdateEvent(source:Object, property:Object, oldValue:Object, newValue:Object):PropertyChangeEvent{ var event:PropertyChangeEvent; event = new PropertyChangeEvent(PROPERTY_CHANGE); event.kind = PropertyChangeEventKind.UPDATE; event.oldValue = oldValue; event.newValue = newValue; event.source = source; event.property = property; return (event); } } }//package mx.events
Section 109
//PropertyChangeEventKind (mx.events.PropertyChangeEventKind) package mx.events { import mx.core.*; public final class PropertyChangeEventKind { mx_internal static const VERSION:String = "2.0.1.0"; public static const UPDATE:String = "update"; public static const DELETE:String = "delete"; public function PropertyChangeEventKind(){ super(); } } }//package mx.events
Section 110
//ResizeEvent (mx.events.ResizeEvent) package mx.events { import flash.events.*; import mx.core.*; public class ResizeEvent extends Event { public var oldHeight:Number; public var oldWidth:Number; mx_internal static const VERSION:String = "2.0.1.0"; public static const RESIZE:String = "resize"; public function ResizeEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, oldWidth:Number=NaN, oldHeight:Number=NaN){ super(type, bubbles, cancelable); this.oldWidth = oldWidth; this.oldHeight = oldHeight; } override public function clone():Event{ return (new ResizeEvent(type, bubbles, cancelable, oldWidth, oldHeight)); } } }//package mx.events
Section 111
//RSLEvent (mx.events.RSLEvent) package mx.events { import flash.events.*; import mx.core.*; import flash.net.*; public class RSLEvent extends ProgressEvent { public var errorText:String; public var rslIndex:int; public var rslTotal:int; public var url:URLRequest; public static const RSL_PROGRESS:String = "rslProgress"; public static const RSL_ERROR:String = "rslError"; mx_internal static const VERSION:String = "2.0.1.0"; public static const RSL_COMPLETE:String = "rslComplete"; public function RSLEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, bytesLoaded:int=-1, bytesTotal:int=-1, rslIndex:int=-1, rslTotal:int=-1, url:URLRequest=null, errorText:String=null){ super(type, bubbles, cancelable, bytesLoaded, bytesTotal); this.rslIndex = rslIndex; this.rslTotal = rslTotal; this.url = url; this.errorText = errorText; } override public function clone():Event{ return (new RSLEvent(type, bubbles, cancelable, bytesLoaded, bytesTotal, rslIndex, rslTotal, url, errorText)); } } }//package mx.events
Section 112
//ScrollEvent (mx.events.ScrollEvent) package mx.events { import flash.events.*; import mx.core.*; public class ScrollEvent extends Event { public var detail:String; public var position:Number; public var delta:Number; public var direction:String; mx_internal static const VERSION:String = "2.0.1.0"; public static const SCROLL:String = "scroll"; public function ScrollEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, detail:String=null, position:Number=NaN, direction:String=null, delta:Number=NaN){ super(type, bubbles, cancelable); this.detail = detail; this.position = position; this.direction = direction; this.delta = delta; } override public function clone():Event{ return (new ScrollEvent(type, bubbles, cancelable, detail, position, direction, delta)); } } }//package mx.events
Section 113
//ScrollEventDetail (mx.events.ScrollEventDetail) package mx.events { import mx.core.*; public final class ScrollEventDetail { public static const LINE_UP:String = "lineUp"; public static const AT_RIGHT:String = "atRight"; public static const PAGE_UP:String = "pageUp"; public static const LINE_DOWN:String = "lineDown"; public static const PAGE_DOWN:String = "pageDown"; public static const AT_LEFT:String = "atLeft"; public static const PAGE_RIGHT:String = "pageRight"; public static const THUMB_POSITION:String = "thumbPosition"; public static const AT_TOP:String = "atTop"; public static const LINE_LEFT:String = "lineLeft"; public static const AT_BOTTOM:String = "atBottom"; public static const LINE_RIGHT:String = "lineRight"; public static const THUMB_TRACK:String = "thumbTrack"; public static const PAGE_LEFT:String = "pageLeft"; mx_internal static const VERSION:String = "2.0.1.0"; public function ScrollEventDetail(){ super(); } } }//package mx.events
Section 114
//ScrollEventDirection (mx.events.ScrollEventDirection) package mx.events { import mx.core.*; public final class ScrollEventDirection { public static const HORIZONTAL:String = "horizontal"; public static const VERTICAL:String = "vertical"; mx_internal static const VERSION:String = "2.0.1.0"; public function ScrollEventDirection(){ super(); } } }//package mx.events
Section 115
//StateChangeEvent (mx.events.StateChangeEvent) package mx.events { import flash.events.*; import mx.core.*; public class StateChangeEvent extends Event { public var oldState:String; public var newState:String; public static const CURRENT_STATE_CHANGING:String = "currentStateChanging"; public static const CURRENT_STATE_CHANGE:String = "currentStateChange"; mx_internal static const VERSION:String = "2.0.1.0"; public function StateChangeEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, oldState:String=null, newState:String=null){ super(type, bubbles, cancelable); this.oldState = oldState; this.newState = newState; } override public function clone():Event{ return (new StateChangeEvent(type, bubbles, cancelable, oldState, newState)); } } }//package mx.events
Section 116
//StyleEvent (mx.events.StyleEvent) package mx.events { import flash.events.*; import mx.core.*; public class StyleEvent extends ProgressEvent { public var errorText:String; mx_internal static const VERSION:String = "2.0.1.0"; public static const COMPLETE:String = "complete"; public static const PROGRESS:String = "progress"; public static const ERROR:String = "error"; public function StyleEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, bytesLoaded:uint=0, bytesTotal:uint=0, errorText:String=null){ super(type, bubbles, cancelable, bytesLoaded, bytesTotal); this.errorText = errorText; } override public function clone():Event{ return (new StyleEvent(type, bubbles, cancelable, bytesLoaded, bytesTotal, errorText)); } } }//package mx.events
Section 117
//ToolTipEvent (mx.events.ToolTipEvent) package mx.events { import flash.events.*; import mx.core.*; public class ToolTipEvent extends Event { public var toolTip:IToolTip; public static const TOOL_TIP_SHOWN:String = "toolTipShown"; public static const TOOL_TIP_CREATE:String = "toolTipCreate"; public static const TOOL_TIP_SHOW:String = "toolTipShow"; public static const TOOL_TIP_HIDE:String = "toolTipHide"; public static const TOOL_TIP_END:String = "toolTipEnd"; mx_internal static const VERSION:String = "2.0.1.0"; public static const TOOL_TIP_START:String = "toolTipStart"; public function ToolTipEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, toolTip:IToolTip=null){ super(type, bubbles, cancelable); this.toolTip = toolTip; } override public function clone():Event{ return (new ToolTipEvent(type, bubbles, cancelable, toolTip)); } } }//package mx.events
Section 118
//TweenEvent (mx.events.TweenEvent) package mx.events { import flash.events.*; import mx.core.*; public class TweenEvent extends Event { public var value:Object; public static const TWEEN_END:String = "tweenEnd"; mx_internal static const VERSION:String = "2.0.1.0"; public static const TWEEN_UPDATE:String = "tweenUpdate"; public static const TWEEN_START:String = "tweenStart"; public function TweenEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, value:Object=null){ super(type, bubbles, cancelable); this.value = value; } override public function clone():Event{ return (new TweenEvent(type, bubbles, cancelable, value)); } } }//package mx.events
Section 119
//ValidationResultEvent (mx.events.ValidationResultEvent) package mx.events { import flash.events.*; import mx.core.*; public class ValidationResultEvent extends Event { public var results:Array; public var field:String; public static const INVALID:String = "invalid"; mx_internal static const VERSION:String = "2.0.1.0"; public static const VALID:String = "valid"; public function ValidationResultEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, field:String=null, results:Array=null){ super(type, bubbles, cancelable); this.field = field; this.results = results; } public function get message():String{ var msg:String; var n:int; var i:int; msg = ""; n = results.length; i = 0; while (i < n) { if (results[i].isError){ msg = (msg + ((msg == "")) ? "" : "\n"); msg = (msg + results[i].errorMessage); }; i++; }; return (msg); } override public function clone():Event{ return (new ValidationResultEvent(type, bubbles, cancelable, field, results)); } } }//package mx.events
Section 120
//RectangularDropShadow (mx.graphics.RectangularDropShadow) package mx.graphics { import mx.core.*; import flash.display.*; import flash.geom.*; import mx.utils.*; import flash.filters.*; public class RectangularDropShadow { private var leftShadow:BitmapData; private var _tlRadius:Number;// = 0 private var _angle:Number;// = 45 private var topShadow:BitmapData; private var _distance:Number;// = 4 private var rightShadow:BitmapData; private var _alpha:Number;// = 0.4 private var shadow:BitmapData; private var _brRadius:Number;// = 0 private var _blRadius:Number;// = 0 private var _color:int;// = 0 private var _trRadius:Number;// = 0 private var bottomShadow:BitmapData; private var changed:Boolean;// = true mx_internal static const VERSION:String = "2.0.1.0"; public function RectangularDropShadow(){ changed = true; _alpha = 0.4; _angle = 45; _color = 0; _distance = 4; _tlRadius = 0; _trRadius = 0; _blRadius = 0; _brRadius = 0; super(); } public function set trRadius(value:Number):void{ if (_trRadius != value){ _trRadius = value; changed = true; }; } public function get blRadius():Number{ return (_blRadius); } public function set brRadius(value:Number):void{ if (_brRadius != value){ _brRadius = value; changed = true; }; } public function set color(value:int):void{ if (_color != value){ _color = value; changed = true; }; } public function drawShadow(g:Graphics, x:Number, y:Number, width:Number, height:Number):void{ var leftThickness:int; var rightThickness:int; var topThickness:int; var bottomThickness:int; var widthThickness:int; var heightThickness:int; var maxCornerHeight:Number; var maxCornerWidth:Number; var matrix:Matrix; var tlWidth:Number; var tlHeight:Number; var trWidth:Number; var trHeight:Number; var blWidth:Number; var blHeight:Number; var brWidth:Number; var brHeight:Number; if (changed){ createShadowBitmaps(); changed = false; }; width = Math.ceil(width); height = Math.ceil(height); leftThickness = (leftShadow) ? leftShadow.width : 0; rightThickness = (rightShadow) ? rightShadow.width : 0; topThickness = (topShadow) ? topShadow.height : 0; bottomThickness = (bottomShadow) ? bottomShadow.height : 0; widthThickness = (leftThickness + rightThickness); heightThickness = (topThickness + bottomThickness); maxCornerHeight = ((height + heightThickness) / 2); maxCornerWidth = ((width + widthThickness) / 2); matrix = new Matrix(); if (((leftShadow) || (topShadow))){ tlWidth = Math.min((tlRadius + widthThickness), maxCornerWidth); tlHeight = Math.min((tlRadius + heightThickness), maxCornerHeight); matrix.tx = (x - leftThickness); matrix.ty = (y - topThickness); g.beginBitmapFill(shadow, matrix); g.drawRect((x - leftThickness), (y - topThickness), tlWidth, tlHeight); g.endFill(); }; if (((rightShadow) || (topShadow))){ trWidth = Math.min((trRadius + widthThickness), maxCornerWidth); trHeight = Math.min((trRadius + heightThickness), maxCornerHeight); matrix.tx = (((x + width) + rightThickness) - shadow.width); matrix.ty = (y - topThickness); g.beginBitmapFill(shadow, matrix); g.drawRect((((x + width) + rightThickness) - trWidth), (y - topThickness), trWidth, trHeight); g.endFill(); }; if (((leftShadow) || (bottomShadow))){ blWidth = Math.min((blRadius + widthThickness), maxCornerWidth); blHeight = Math.min((blRadius + heightThickness), maxCornerHeight); matrix.tx = (x - leftThickness); matrix.ty = (((y + height) + bottomThickness) - shadow.height); g.beginBitmapFill(shadow, matrix); g.drawRect((x - leftThickness), (((y + height) + bottomThickness) - blHeight), blWidth, blHeight); g.endFill(); }; if (((rightShadow) || (bottomShadow))){ brWidth = Math.min((brRadius + widthThickness), maxCornerWidth); brHeight = Math.min((brRadius + heightThickness), maxCornerHeight); matrix.tx = (((x + width) + rightThickness) - shadow.width); matrix.ty = (((y + height) + bottomThickness) - shadow.height); g.beginBitmapFill(shadow, matrix); g.drawRect((((x + width) + rightThickness) - brWidth), (((y + height) + bottomThickness) - brHeight), brWidth, brHeight); g.endFill(); }; if (leftShadow){ matrix.tx = (x - leftThickness); matrix.ty = 0; g.beginBitmapFill(leftShadow, matrix); g.drawRect((x - leftThickness), ((y - topThickness) + tlHeight), leftThickness, ((((height + topThickness) + bottomThickness) - tlHeight) - blHeight)); g.endFill(); }; if (rightShadow){ matrix.tx = (x + width); matrix.ty = 0; g.beginBitmapFill(rightShadow, matrix); g.drawRect((x + width), ((y - topThickness) + trHeight), rightThickness, ((((height + topThickness) + bottomThickness) - trHeight) - brHeight)); g.endFill(); }; if (topShadow){ matrix.tx = 0; matrix.ty = (y - topThickness); g.beginBitmapFill(topShadow, matrix); g.drawRect(((x - leftThickness) + tlWidth), (y - topThickness), ((((width + leftThickness) + rightThickness) - tlWidth) - trWidth), topThickness); g.endFill(); }; if (bottomShadow){ matrix.tx = 0; matrix.ty = (y + height); g.beginBitmapFill(bottomShadow, matrix); g.drawRect(((x - leftThickness) + blWidth), (y + height), ((((width + leftThickness) + rightThickness) - blWidth) - brWidth), bottomThickness); g.endFill(); }; } public function get angle():Number{ return (_angle); } private function createShadowBitmaps():void{ var roundRectWidth:Number; var roundRectHeight:Number; var roundRect:Shape; var g:Graphics; var roundRectBitmap:BitmapData; var filter:DropShadowFilter; var inputRect:Rectangle; var outputRect:Rectangle; var leftThickness:Number; var rightThickness:Number; var topThickness:Number; var bottomThickness:Number; var origin:Point; var rect:Rectangle; roundRectWidth = ((Math.max(tlRadius, blRadius) + (2 * distance)) + Math.max(trRadius, brRadius)); roundRectHeight = ((Math.max(tlRadius, trRadius) + (2 * distance)) + Math.max(blRadius, brRadius)); if ((((roundRectWidth < 0)) || ((roundRectHeight < 0)))){ return; }; roundRect = new FlexShape(); g = roundRect.graphics; g.beginFill(0xFFFFFF); GraphicsUtil.drawRoundRectComplex(g, 0, 0, roundRectWidth, roundRectHeight, tlRadius, trRadius, blRadius, brRadius); g.endFill(); roundRectBitmap = new BitmapData(roundRectWidth, roundRectHeight, true, 0); roundRectBitmap.draw(roundRect, new Matrix()); filter = new DropShadowFilter(distance, angle, color, alpha); filter.knockout = true; inputRect = new Rectangle(0, 0, roundRectWidth, roundRectHeight); outputRect = roundRectBitmap.generateFilterRect(inputRect, filter); leftThickness = (inputRect.left - outputRect.left); rightThickness = (outputRect.right - inputRect.right); topThickness = (inputRect.top - outputRect.top); bottomThickness = (outputRect.bottom - inputRect.bottom); shadow = new BitmapData(outputRect.width, outputRect.height); shadow.applyFilter(roundRectBitmap, inputRect, new Point(leftThickness, topThickness), filter); origin = new Point(0, 0); rect = new Rectangle(); if (leftThickness > 0){ rect.x = 0; rect.y = ((tlRadius + topThickness) + bottomThickness); rect.width = leftThickness; rect.height = 1; leftShadow = new BitmapData(leftThickness, 1); leftShadow.copyPixels(shadow, rect, origin); } else { leftShadow = null; }; if (rightThickness > 0){ rect.x = (shadow.width - rightThickness); rect.y = ((trRadius + topThickness) + bottomThickness); rect.width = rightThickness; rect.height = 1; rightShadow = new BitmapData(rightThickness, 1); rightShadow.copyPixels(shadow, rect, origin); } else { rightShadow = null; }; if (topThickness > 0){ rect.x = ((tlRadius + leftThickness) + rightThickness); rect.y = 0; rect.width = 1; rect.height = topThickness; topShadow = new BitmapData(1, topThickness); topShadow.copyPixels(shadow, rect, origin); } else { topShadow = null; }; if (bottomThickness > 0){ rect.x = ((blRadius + leftThickness) + rightThickness); rect.y = (shadow.height - bottomThickness); rect.width = 1; rect.height = bottomThickness; bottomShadow = new BitmapData(1, bottomThickness); bottomShadow.copyPixels(shadow, rect, origin); } else { bottomShadow = null; }; } public function get brRadius():Number{ return (_brRadius); } public function get alpha():Number{ return (_alpha); } public function get color():int{ return (_color); } public function set angle(value:Number):void{ if (_angle != value){ _angle = value; changed = true; }; } public function set tlRadius(value:Number):void{ if (_tlRadius != value){ _tlRadius = value; changed = true; }; } public function get trRadius():Number{ return (_trRadius); } public function set distance(value:Number):void{ if (_distance != value){ _distance = value; changed = true; }; } public function get distance():Number{ return (_distance); } public function get tlRadius():Number{ return (_tlRadius); } public function set alpha(value:Number):void{ if (_alpha != value){ _alpha = value; changed = true; }; } public function set blRadius(value:Number):void{ if (_blRadius != value){ _blRadius = value; changed = true; }; } } }//package mx.graphics
Section 121
//RoundedRectangle (mx.graphics.RoundedRectangle) package mx.graphics { import mx.core.*; import flash.geom.*; public class RoundedRectangle extends Rectangle { public var cornerRadius:Number;// = 0 mx_internal static const VERSION:String = "2.0.1.0"; public function RoundedRectangle(x:Number=0, y:Number=0, width:Number=0, height:Number=0, cornerRadius:Number=0){ cornerRadius = 0; super(x, y, width, height); this.cornerRadius = cornerRadius; } } }//package mx.graphics
Section 122
//PriorityQueue (mx.managers.layoutClasses.PriorityQueue) package mx.managers.layoutClasses { import mx.core.*; import flash.display.*; import mx.managers.*; public class PriorityQueue { private var maxPriority:int;// = -1 private var arrayOfArrays:Array; private var minPriority:int;// = 0 mx_internal static const VERSION:String = "2.0.1.0"; public function PriorityQueue(){ arrayOfArrays = []; minPriority = 0; maxPriority = -1; super(); } public function addObject(obj:Object, priority:int):void{ if (!arrayOfArrays[priority]){ arrayOfArrays[priority] = []; }; arrayOfArrays[priority].push(obj); if (maxPriority < minPriority){ minPriority = (maxPriority = priority); } else { if (priority < minPriority){ minPriority = priority; }; if (priority > maxPriority){ maxPriority = priority; }; }; } public function removeSmallest():Object{ var obj:Object; obj = null; if (minPriority <= maxPriority){ while (((!(arrayOfArrays[minPriority])) || ((arrayOfArrays[minPriority].length == 0)))) { minPriority++; if (minPriority > maxPriority){ return (null); }; }; obj = arrayOfArrays[minPriority].shift(); while (((!(arrayOfArrays[minPriority])) || ((arrayOfArrays[minPriority].length == 0)))) { minPriority++; if (minPriority > maxPriority){ break; }; }; }; return (obj); } public function removeLargestChild(client:ILayoutManagerClient):Object{ var obj:Object; var max:int; var min:int; var i:int; obj = null; max = maxPriority; min = client.nestLevel; while (min <= max) { if (((arrayOfArrays[max]) && ((arrayOfArrays[max].length > 0)))){ i = 0; while (i < arrayOfArrays[max].length) { if (contains(DisplayObject(client), arrayOfArrays[max][i])){ obj = arrayOfArrays[max][i]; arrayOfArrays[max].splice(i, 1); return (obj); }; i++; }; max--; } else { if (max == maxPriority){ maxPriority--; }; max--; if (max < min){ break; }; }; }; return (obj); } public function isEmpty():Boolean{ return ((minPriority > maxPriority)); } public function removeLargest():Object{ var obj:Object; obj = null; if (minPriority <= maxPriority){ while (((!(arrayOfArrays[maxPriority])) || ((arrayOfArrays[maxPriority].length == 0)))) { maxPriority--; if (maxPriority < minPriority){ return (null); }; }; obj = arrayOfArrays[maxPriority].shift(); while (((!(arrayOfArrays[maxPriority])) || ((arrayOfArrays[maxPriority].length == 0)))) { maxPriority--; if (maxPriority < minPriority){ break; }; }; }; return (obj); } public function removeSmallestChild(client:ILayoutManagerClient):Object{ var obj:Object; var min:int; var i:int; obj = null; min = client.nestLevel; while (min <= maxPriority) { if (((arrayOfArrays[min]) && ((arrayOfArrays[min].length > 0)))){ i = 0; while (i < arrayOfArrays[min].length) { if (contains(DisplayObject(client), arrayOfArrays[min][i])){ obj = arrayOfArrays[min][i]; arrayOfArrays[min].splice(i, 1); return (obj); }; i++; }; min++; } else { if (min == minPriority){ minPriority++; }; min++; if (min > maxPriority){ break; }; }; }; return (obj); } public function removeAll():void{ arrayOfArrays.splice(0); minPriority = 0; maxPriority = -1; } private function contains(parent:DisplayObject, child:DisplayObject):Boolean{ var rawChildren:IChildList; if ((parent is IRawChildrenContainer)){ rawChildren = IRawChildrenContainer(parent).rawChildren; return (rawChildren.contains(child)); }; if ((parent is DisplayObjectContainer)){ return (DisplayObjectContainer(parent).contains(child)); }; return ((parent == child)); } } }//package mx.managers.layoutClasses
Section 123
//FocusManager (mx.managers.FocusManager) package mx.managers { import flash.events.*; import mx.core.*; import flash.system.*; import flash.display.*; import mx.events.*; import flash.text.*; import mx.controls.*; import flash.ui.*; public class FocusManager implements IFocusManager { private var _showFocusIndicator:Boolean;// = false private var focusableCandidates:Array; private var LARGE_TAB_INDEX:int;// = 99999 private var browserFocusComponent:InteractiveObject; private var calculateCandidates:Boolean;// = true private var lastAction:String; private var focusableObjects:Array; private var defButton:Button; private var _form:IFocusManagerContainer; private var _defaultButtonEnabled:Boolean;// = true private var activated:Boolean;// = false private var _defaultButton:Button; private var _focusPane:Sprite; private var lastFocus:IFocusManagerComponent; private var browserMode:Boolean; mx_internal static const VERSION:String = "2.0.1.0"; public function FocusManager(container:IFocusManagerContainer, popup:Boolean=false){ LARGE_TAB_INDEX = 99999; calculateCandidates = true; activated = false; _showFocusIndicator = false; _defaultButtonEnabled = true; super(); browserMode = (((Capabilities.playerType == "ActiveX")) && (!(popup))); container.focusManager = this; _form = container; focusableObjects = []; focusPane = new FlexSprite(); focusPane.name = "focusPane"; addFocusables(DisplayObject(container)); container.addEventListener(Event.ADDED, addedHandler); container.addEventListener(Event.REMOVED, removedHandler); container.addEventListener(FlexEvent.SHOW, showHandler); container.addEventListener(FlexEvent.HIDE, hideHandler); if (container != SystemManager(container.systemManager).application){ container.addEventListener(FlexEvent.CREATION_COMPLETE, creationCompleteHandler); }; container.systemManager.addFocusManager(container); } private function addFocusables(o:DisplayObject, skipTopLevel:Boolean=false):void{ var focusable:IFocusManagerComponent; var doc:DisplayObjectContainer; var i:int; var rawChildren:IChildList; var o = o; var skipTopLevel = skipTopLevel; if ((((o is IFocusManagerComponent)) && (!(skipTopLevel)))){ focusable = IFocusManagerComponent(o); if (focusable.focusEnabled){ if (((focusable.tabEnabled) && (isTabVisible(o)))){ focusableObjects.push(o); calculateCandidates = true; }; o.addEventListener("tabEnabledChange", tabEnabledChangeHandler); o.addEventListener("tabIndexChange", tabIndexChangeHandler); }; }; if ((o is DisplayObjectContainer)){ doc = DisplayObjectContainer(o); o.addEventListener("tabChildrenChange", tabChildrenChangeHandler); if (doc.tabChildren){ if ((o is IRawChildrenContainer)){ rawChildren = IRawChildrenContainer(o).rawChildren; i = 0; for (;i < rawChildren.numChildren;(i = (i + 1))) { addFocusables(rawChildren.getChildAt(i)); continue; var _slot1 = error; }; } else { i = 0; for (;i < doc.numChildren;(i = (i + 1))) { addFocusables(doc.getChildAt(i)); continue; var _slot1 = error; }; }; }; }; } private function getChildIndex(parent:DisplayObjectContainer, child:DisplayObject):int{ var parent = parent; var child = child; return (parent.getChildIndex(child)); //unresolved jump var _slot1 = e; if ((parent is IRawChildrenContainer)){ return (IRawChildrenContainer(parent).rawChildren.getChildIndex(child)); }; throw (_slot1); throw (new Error("FocusManager.getChildIndex failed")); } private function mouseFocusChangeHandler(event:FocusEvent):void{ var tf:TextField; if ((event.relatedObject is TextField)){ tf = (event.relatedObject as TextField); if ((((tf.type == "input")) || (tf.selectable))){ return; }; }; event.preventDefault(); } private function focusOutHandler(event:FocusEvent):void{ var target:InteractiveObject; target = InteractiveObject(event.target); } private function isValidFocusCandidate(o:DisplayObject, g:String):Boolean{ var tg:IFocusManagerGroup; if (!isEnabledAndVisible(o)){ return (false); }; if ((o is IFocusManagerGroup)){ tg = IFocusManagerGroup(o); if (g == tg.groupName){ return (false); }; }; return (true); } private function removeFocusables(o:DisplayObject, dontRemoveTabChildrenHandler:Boolean):void{ var i:int; if ((o is DisplayObjectContainer)){ if (!dontRemoveTabChildrenHandler){ o.removeEventListener("tabChildrenChange", tabChildrenChangeHandler); }; i = 0; while (i < focusableObjects.length) { if (isParent(DisplayObjectContainer(o), focusableObjects[i])){ if (focusableObjects[i] == lastFocus){ lastFocus.drawFocus(false); lastFocus = null; }; focusableObjects[i].removeEventListener("tabEnabledChange", tabEnabledChangeHandler); focusableObjects[i].removeEventListener("tabIndexChange", tabIndexChangeHandler); focusableObjects.splice(i, 1); i--; calculateCandidates = true; }; i++; }; }; } public function getFocus():IFocusManagerComponent{ var o:InteractiveObject; o = form.systemManager.stage.focus; return (findFocusManagerComponent(o)); } private function addedHandler(event:Event):void{ var target:DisplayObject; target = DisplayObject(event.target); if (target.stage){ addFocusables(DisplayObject(event.target)); }; } private function tabChildrenChangeHandler(event:Event):void{ var o:DisplayObjectContainer; if (event.target != event.currentTarget){ return; }; calculateCandidates = true; o = DisplayObjectContainer(event.target); if (o.tabChildren){ addFocusables(o, true); } else { removeFocusables(o, true); }; } private function sortByDepth(aa:IFocusManagerComponent, bb:IFocusManagerComponent):Number{ var val1:String; var val2:String; var index:int; var tmp:String; var tmp2:String; var zeros:String; var a:DisplayObject; var b:DisplayObject; val1 = ""; val2 = ""; zeros = "0000"; a = DisplayObject(aa); b = DisplayObject(bb); while (((!((a == DisplayObject(form)))) && (a.parent))) { index = getChildIndex(a.parent, a); tmp = index.toString(16); if (tmp.length < 4){ tmp2 = (zeros.substring(0, (4 - tmp.length)) + tmp); }; val1 = (tmp2 + val1); a = a.parent; }; while (((!((b == DisplayObject(form)))) && (b.parent))) { index = getChildIndex(b.parent, b); tmp = index.toString(16); if (tmp.length < 4){ tmp2 = (zeros.substring(0, (4 - tmp.length)) + tmp); }; val2 = (tmp2 + val2); b = b.parent; }; return (((val1 > val2)) ? 1 : ((val1 < val2)) ? -1 : 0); } mx_internal function sendDefaultButtonEvent():void{ defButton.dispatchEvent(new MouseEvent("click")); } private function deactivateHandler(event:Event):void{ var target:InteractiveObject; target = InteractiveObject(event.target); } private function tabIndexChangeHandler(event:Event):void{ calculateCandidates = true; } private function sortFocusableObjects():void{ var n:int; var i:int; var c:InteractiveObject; focusableCandidates = []; n = focusableObjects.length; i = 0; while (i < n) { c = focusableObjects[i]; if (((((c.tabIndex) && (!(isNaN(Number(c.tabIndex)))))) && ((c.tabIndex > 0)))){ sortFocusableObjectsTabIndex(); return; }; focusableCandidates.push(c); i++; }; focusableCandidates.sort(sortByDepth); } private function keyFocusChangeHandler(event:FocusEvent):void{ showFocusIndicator = true; if ((((event.keyCode == Keyboard.TAB)) && (!(event.isDefaultPrevented())))){ if (browserFocusComponent){ if (browserFocusComponent.tabIndex == LARGE_TAB_INDEX){ browserFocusComponent.tabIndex = -1; }; browserFocusComponent = null; return; }; setFocusToNextObject(event); event.preventDefault(); }; } private function getIndexOfFocusedObject(o:DisplayObject):int{ var n:int; var i:int; n = focusableCandidates.length; i = 0; i = 0; while (i < n) { if (focusableCandidates[i] == o){ return (i); }; i++; }; return (-1); } public function get nextTabIndex():int{ return ((getMaxTabIndex() + 1)); } public function get focusPane():Sprite{ return (_focusPane); } private function mouseDownHandler(event:MouseEvent):void{ var o:DisplayObject; if (event.isDefaultPrevented()){ return; }; o = getTopLevelFocusTarget(InteractiveObject(event.target)); if (!o){ return; }; showFocusIndicator = false; if (((((!((o == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((o is TextField))))){ setFocus(IFocusManagerComponent(o)); }; lastAction = "MOUSEDOWN"; } private function keyDownHandler(event:KeyboardEvent):void{ var sm:SystemManager; var o:DisplayObject; var g:String; var i:int; var j:int; var tg:IFocusManagerGroup; sm = SystemManager(form.systemManager); sm.idleCounter = 0; if (event.keyCode == Keyboard.TAB){ lastAction = "KEY"; if (calculateCandidates){ sortFocusableObjects(); calculateCandidates = false; }; }; if (browserMode){ if ((((event.keyCode == Keyboard.TAB)) && ((focusableCandidates.length > 0)))){ o = form.systemManager.stage.focus; o = DisplayObject(findFocusManagerComponent(InteractiveObject(o))); g = ""; if ((o is IFocusManagerGroup)){ tg = IFocusManagerGroup(o); g = tg.groupName; }; i = getIndexOfFocusedObject(o); j = getIndexOfNextObject(i, event.shiftKey, false, g); if (event.shiftKey){ if (j >= i){ browserFocusComponent = form.systemManager.stage.focus; if (browserFocusComponent.tabIndex == -1){ browserFocusComponent.tabIndex = LARGE_TAB_INDEX; }; }; } else { if (j <= i){ browserFocusComponent = form.systemManager.stage.focus; if (browserFocusComponent.tabIndex == -1){ browserFocusComponent.tabIndex = LARGE_TAB_INDEX; }; }; }; }; }; if (((((((defaultButtonEnabled) && ((event.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){ defButton.callLater(sendDefaultButtonEvent); }; } public function toString():String{ return ((Object(form).toString() + ".focusManager")); } private function focusInHandler(event:FocusEvent):void{ var target:InteractiveObject; var x:Button; target = InteractiveObject(event.target); if (isParent(DisplayObjectContainer(form), target)){ lastFocus = findFocusManagerComponent(InteractiveObject(target)); if ((lastFocus is Button)){ x = Button(lastFocus); if (defButton){ defButton.emphasized = false; defButton = x; x.emphasized = true; }; } else { if (((defButton) && (!((defButton == _defaultButton))))){ defButton.emphasized = false; defButton = _defaultButton; _defaultButton.emphasized = true; }; }; }; } public function deactivate():void{ form.systemManager.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler); form.systemManager.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler); form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true); form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true); form.systemManager.stage.removeEventListener(Event.ACTIVATE, activateHandler); form.systemManager.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler); form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true); activated = false; } private function isParent(p:DisplayObjectContainer, o:DisplayObject):Boolean{ if ((p is IRawChildrenContainer)){ return (IRawChildrenContainer(p).rawChildren.contains(o)); }; return (p.contains(o)); } private function getIndexOfNextObject(i:int, shiftKey:Boolean, bSearchAll:Boolean, groupName:String):int{ var n:int; var start:int; var o:DisplayObject; var tg1:IFocusManagerGroup; var j:int; var obj:DisplayObject; var tg2:IFocusManagerGroup; n = focusableCandidates.length; start = i; while (true) { if (shiftKey){ i--; } else { i++; }; if (bSearchAll){ if (((shiftKey) && ((i < 0)))){ break; }; if (((!(shiftKey)) && ((i == n)))){ break; }; } else { i = ((i + n) % n); if (start == i){ break; }; }; if (isValidFocusCandidate(focusableCandidates[i], groupName)){ o = DisplayObject(findFocusManagerComponent(focusableCandidates[i])); if ((o is IFocusManagerGroup)){ tg1 = IFocusManagerGroup(o); j = 0; while (j < focusableCandidates.length) { obj = focusableCandidates[j]; if ((obj is IFocusManagerGroup)){ tg2 = IFocusManagerGroup(obj); if ((((tg2.groupName == tg1.groupName)) && (tg2.selected))){ i = j; break; }; }; j++; }; }; return (i); }; }; return (i); } private function getMaxTabIndex():int{ var z:Number; var n:int; var i:int; var t:Number; z = 0; n = focusableObjects.length; i = 0; while (i < n) { t = focusableObjects[i].tabIndex; if (!isNaN(t)){ z = Math.max(z, t); }; i++; }; return (z); } private function showHandler(event:Event):void{ form.systemManager.activate(form); } public function findFocusManagerComponent(o:InteractiveObject):IFocusManagerComponent{ while (o) { if ((((o is IFocusManagerComponent)) && (IFocusManagerComponent(o).focusEnabled))){ return (IFocusManagerComponent(o)); }; o = o.parent; }; return (null); } public function setFocus(o:IFocusManagerComponent):void{ o.setFocus(); } mx_internal function set form(value:IFocusManagerContainer):void{ _form = value; } private function sortFocusableObjectsTabIndex():void{ var n:int; var i:int; var c:IFocusManagerComponent; focusableCandidates = []; n = focusableObjects.length; i = 0; while (i < n) { c = focusableObjects[i]; if (((c.tabIndex) && (!(isNaN(Number(c.tabIndex)))))){ focusableCandidates.push(c); }; i++; }; focusableCandidates.sort(sortByTabIndex); } public function set defaultButton(value:IUIComponent):void{ var button:Button; button = (value) ? Button(value) : null; if (button != _defaultButton){ if (_defaultButton){ _defaultButton.emphasized = false; }; if (defButton){ defButton.emphasized = false; }; _defaultButton = button; defButton = button; if (button){ button.emphasized = true; }; }; } private function setFocusToNextObject(event:FocusEvent):void{ var o:IFocusManagerComponent; if (focusableObjects.length == 0){ return; }; o = getNextFocusManagerComponent(event.shiftKey); if (o){ setFocus(o); }; } private function getTopLevelFocusTarget(o:InteractiveObject):InteractiveObject{ while (o != InteractiveObject(form)) { if ((((((((o is IFocusManagerComponent)) && (IFocusManagerComponent(o).focusEnabled))) && (IFocusManagerComponent(o).mouseFocusEnabled))) && (IUIComponent(o).enabled))){ return (o); }; o = o.parent; if (o == null){ break; }; }; return (null); } private function hideHandler(event:Event):void{ form.systemManager.deactivate(form); } private function isEnabledAndVisible(o:DisplayObject):Boolean{ var formParent:DisplayObjectContainer; formParent = DisplayObject(form).parent; while (o != formParent) { if ((o is IUIComponent)){ if (!IUIComponent(o).enabled){ return (false); }; }; if (!o.visible){ return (false); }; o = o.parent; }; return (true); } public function hideFocus():void{ if (showFocusIndicator){ showFocusIndicator = false; if (lastFocus){ lastFocus.drawFocus(false); }; }; } public function get showFocusIndicator():Boolean{ return (_showFocusIndicator); } mx_internal function get form():IFocusManagerContainer{ return (_form); } public function set focusPane(value:Sprite):void{ _focusPane = value; } private function removedHandler(event:Event):void{ var i:int; var o:DisplayObject; o = DisplayObject(event.target); if ((o is IFocusManagerComponent)){ i = 0; while (i < focusableObjects.length) { if (o == focusableObjects[i]){ if (o == lastFocus){ lastFocus.drawFocus(false); lastFocus = null; }; o.removeEventListener("tabEnabledChange", tabEnabledChangeHandler); o.removeEventListener("tabIndexChange", tabIndexChangeHandler); focusableObjects.splice(i, 1); calculateCandidates = true; break; }; i++; }; }; removeFocusables(o, false); } private function activateHandler(event:Event):void{ var target:InteractiveObject; target = InteractiveObject(event.target); if (((lastFocus) && (!(browserMode)))){ lastFocus.setFocus(); }; lastAction = "ACTIVATE"; } public function get defaultButton():IUIComponent{ return (_defaultButton); } public function showFocus():void{ if (!showFocusIndicator){ showFocusIndicator = true; if (lastFocus){ lastFocus.drawFocus(true); }; }; } public function getNextFocusManagerComponent(backward:Boolean=false):IFocusManagerComponent{ var o:DisplayObject; var g:String; var i:int; var bSearchAll:Boolean; var start:int; var j:int; var tg:IFocusManagerGroup; if (focusableObjects.length == 0){ return (null); }; if (calculateCandidates){ sortFocusableObjects(); calculateCandidates = false; }; o = form.systemManager.stage.focus; o = DisplayObject(findFocusManagerComponent(InteractiveObject(o))); g = ""; if ((o is IFocusManagerGroup)){ tg = IFocusManagerGroup(o); g = tg.groupName; }; i = getIndexOfFocusedObject(o); bSearchAll = false; start = i; if (i == -1){ if (backward){ i = focusableCandidates.length; }; bSearchAll = true; }; j = getIndexOfNextObject(i, backward, bSearchAll, g); return (findFocusManagerComponent(focusableCandidates[j])); } public function set defaultButtonEnabled(value:Boolean):void{ _defaultButtonEnabled = value; } private function isTabVisible(o:DisplayObject):Boolean{ var s:DisplayObject; var p:DisplayObjectContainer; s = DisplayObject(form.systemManager); if (!s){ return (false); }; p = o.parent; while (((p) && (!((p == s))))) { if (!p.tabChildren){ return (false); }; p = p.parent; }; return (true); } public function set showFocusIndicator(value:Boolean):void{ _showFocusIndicator = value; } private function sortByTabIndex(a:IFocusManagerComponent, b:IFocusManagerComponent):int{ var aa:int; var bb:int; aa = a.tabIndex; bb = b.tabIndex; if (aa == -1){ aa = int.MAX_VALUE; }; if (bb == -1){ bb = int.MAX_VALUE; }; return (((aa > bb)) ? 1 : ((aa < bb)) ? -1 : sortByDepth(a, b)); } public function activate():void{ if (activated){ return; }; form.systemManager.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true); form.systemManager.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.systemManager.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true); form.systemManager.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 get defaultButtonEnabled():Boolean{ return (_defaultButtonEnabled); } private function creationCompleteHandler(event:FlexEvent):void{ if (((DisplayObject(form).visible) && (!(activated)))){ form.systemManager.activate(form); }; } private function tabEnabledChangeHandler(event:Event):void{ var o:InteractiveObject; var n:int; var i:int; calculateCandidates = true; o = InteractiveObject(event.target); n = focusableObjects.length; i = 0; while (i < n) { if (focusableObjects[i] == o){ break; }; i++; }; if (o.tabEnabled){ if ((((i == n)) && (isTabVisible(o)))){ focusableObjects.push(o); }; } else { if (i < n){ focusableObjects.splice(i, 1); }; }; } } }//package mx.managers
Section 124
//IFocusManager (mx.managers.IFocusManager) package mx.managers { import mx.core.*; import flash.display.*; public interface IFocusManager { function get focusPane():Sprite; function getFocus():IFocusManagerComponent; function deactivate():void; function hideFocus():void; function set defaultButton(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;IFocusManager.as:IUIComponent):void; function set showFocusIndicator(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;IFocusManager.as:Boolean):void; function get defaultButtonEnabled():Boolean; function set focusPane(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;IFocusManager.as:Sprite):void; function get nextTabIndex():int; function get defaultButton():IUIComponent; function get showFocusIndicator():Boolean; function activate():void; function showFocus():void; function set defaultButtonEnabled(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;IFocusManager.as:Boolean):void; function setFocus(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;IFocusManager.as:IFocusManagerComponent):void; function findFocusManagerComponent(value:InteractiveObject):IFocusManagerComponent; function getNextFocusManagerComponent(value:Boolean=false):IFocusManagerComponent; } }//package mx.managers
Section 125
//IFocusManagerComponent (mx.managers.IFocusManagerComponent) package mx.managers { public interface IFocusManagerComponent { function set focusEnabled(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;IFocusManagerComponent.as:Boolean):void; function drawFocus(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;IFocusManagerComponent.as:Boolean):void; function setFocus():void; function get focusEnabled():Boolean; function get tabEnabled():Boolean; function get tabIndex():int; function get mouseFocusEnabled():Boolean; } }//package mx.managers
Section 126
//IFocusManagerContainer (mx.managers.IFocusManagerContainer) package mx.managers { import flash.events.*; import flash.display.*; public interface IFocusManagerContainer extends IEventDispatcher { function set focusManager(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;IFocusManagerContainer.as:IFocusManager):void; function get focusManager():IFocusManager; function get systemManager():ISystemManager; function contains(mx.managers:DisplayObject):Boolean; } }//package mx.managers
Section 127
//IFocusManagerGroup (mx.managers.IFocusManagerGroup) package mx.managers { public interface IFocusManagerGroup { function set groupName(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;IFocusManagerGroup.as:String):void; function set selected(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;IFocusManagerGroup.as:Boolean):void; function get groupName():String; function get selected():Boolean; } }//package mx.managers
Section 128
//ILayoutManager (mx.managers.ILayoutManager) package mx.managers { import flash.events.*; public interface ILayoutManager extends IEventDispatcher { function invalidateDisplayList(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;ILayoutManager.as:ILayoutManagerClient):void; function validateClient(_arg1:ILayoutManagerClient, _arg2:Boolean=false):void; function invalidateProperties(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;ILayoutManager.as:ILayoutManagerClient):void; function isInvalid():Boolean; function validateNow():void; function set usePhasedInstantiation(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;ILayoutManager.as:Boolean):void; function invalidateSize(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;ILayoutManager.as:ILayoutManagerClient):void; function get usePhasedInstantiation():Boolean; } }//package mx.managers
Section 129
//ILayoutManagerClient (mx.managers.ILayoutManagerClient) package mx.managers { import flash.events.*; public interface ILayoutManagerClient extends IEventDispatcher { function set updateCompletePendingFlag(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;ILayoutManagerClient.as:Boolean):void; function set initialized(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;ILayoutManagerClient.as:Boolean):void; function validateProperties():void; function get nestLevel():int; function get updateCompletePendingFlag():Boolean; function validateDisplayList():void; function set processedDescriptors(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;ILayoutManagerClient.as:Boolean):void; function get processedDescriptors():Boolean; function validateSize(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;ILayoutManagerClient.as:Boolean=false):void; function set nestLevel(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;ILayoutManagerClient.as:int):void; function get initialized():Boolean; } }//package mx.managers
Section 130
//ISystemManager (mx.managers.ISystemManager) package mx.managers { import flash.events.*; import mx.core.*; import flash.display.*; import flash.geom.*; import flash.text.*; public interface ISystemManager extends IEventDispatcher, IChildList, IFlexModuleFactory { function get toolTipChildren():IChildList; function get numModalWindows():int; function isTopLevel():Boolean; function isFontFaceEmbedded(mx.managers:ISystemManager/mx.managers:ISystemManager:focusPane/get:TextFormat):Boolean; function removeFocusManager(mx.managers:ISystemManager/mx.managers:ISystemManager:cursorChildren/get:IFocusManagerContainer):void; function get document():Object; function get topLevelSystemManager():ISystemManager; function get focusPane():Sprite; function get loaderInfo():LoaderInfo; function set focusPane(mx.managers:ISystemManager/mx.managers:ISystemManager:cursorChildren/get:Sprite):void; function get rawChildren():IChildList; function get popUpChildren():IChildList; function get screen():Rectangle; function deactivate(mx.managers:ISystemManager/mx.managers:ISystemManager:cursorChildren/get:IFocusManagerContainer):void; function getDefinitionByName(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;ISystemManager.as:String):Object; function activate(mx.managers:ISystemManager/mx.managers:ISystemManager:cursorChildren/get:IFocusManagerContainer):void; function get cursorChildren():IChildList; function set document(mx.managers:ISystemManager/mx.managers:ISystemManager:cursorChildren/get:Object):void; function get embeddedFontList():Object; function addFocusManager(mx.managers:ISystemManager/mx.managers:ISystemManager:cursorChildren/get:IFocusManagerContainer):void; function get stage():Stage; function set numModalWindows(mx.managers:ISystemManager/mx.managers:ISystemManager:cursorChildren/get:int):void; } }//package mx.managers
Section 131
//IToolTipManager (mx.managers.IToolTipManager) package mx.managers { import mx.core.*; import flash.display.*; import mx.effects.*; public interface IToolTipManager { function registerToolTip(_arg1:DisplayObject, _arg2:String):void; function set enabled(y:Boolean):void; function get showDelay():Number; function createToolTip(_arg1:String, _arg2:Number, _arg3:Number, _arg4:String=null, _arg5:IUIComponent=null):IToolTip; function get enabled():Boolean; function destroyToolTip(y:IToolTip):void; function set showDelay(y:Number):void; function set hideDelay(y:Number):void; function get scrubDelay():Number; function get toolTipClass():Class; function registerErrorString(_arg1:DisplayObject, _arg2:String):void; function sizeTip(y:IToolTip):void; function set currentTarget(y:DisplayObject):void; function set showEffect(y:Effect):void; function get hideDelay():Number; function set currentToolTip(y:IToolTip):void; function set hideEffect(y:Effect):void; function set scrubDelay(y:Number):void; function get currentToolTip():IToolTip; function get showEffect():Effect; function get currentTarget():DisplayObject; function get hideEffect():Effect; function set toolTipClass(y:Class):void; } }//package mx.managers
Section 132
//IToolTipManagerClient (mx.managers.IToolTipManagerClient) package mx.managers { import mx.core.*; public interface IToolTipManagerClient extends IFlexDisplayObject { function set toolTip(C:\dev\flex_201_ja\sdk\frameworks;mx\managers;IToolTipManagerClient.as:String):void; function get toolTip():String; } }//package mx.managers
Section 133
//LayoutManager (mx.managers.LayoutManager) package mx.managers { import flash.events.*; import mx.core.*; import flash.display.*; import mx.events.*; import mx.managers.layoutClasses.*; public class LayoutManager extends EventDispatcher implements ILayoutManager { private var invalidateClientSizeFlag:Boolean;// = false private var invalidateSizeQueue:PriorityQueue; private var updateCompleteQueue:PriorityQueue; private var originalFrameRate:Number; private var _usePhasedInstantiation:Boolean;// = false private var callLaterObject:UIComponent; private var invalidateClientPropertiesFlag:Boolean;// = false private var invalidateDisplayListQueue:PriorityQueue; private var invalidateDisplayListFlag:Boolean;// = false private var invalidatePropertiesFlag:Boolean;// = false private var invalidatePropertiesQueue:PriorityQueue; private var invalidateSizeFlag:Boolean;// = false private var callLaterPending:Boolean;// = false private var targetLevel:int;// = 2147483647 mx_internal static const VERSION:String = "2.0.1.0"; private static var instance:LayoutManager; public function LayoutManager(){ updateCompleteQueue = new PriorityQueue(); invalidatePropertiesQueue = new PriorityQueue(); invalidatePropertiesFlag = false; invalidateClientPropertiesFlag = false; invalidateSizeQueue = new PriorityQueue(); invalidateSizeFlag = false; invalidateClientSizeFlag = false; invalidateDisplayListQueue = new PriorityQueue(); invalidateDisplayListFlag = false; callLaterPending = false; targetLevel = int.MAX_VALUE; _usePhasedInstantiation = false; super(); } private function waitAFrame():void{ callLaterObject.callLater(doPhasedInstantiation); } public function get usePhasedInstantiation():Boolean{ return (_usePhasedInstantiation); } public function validateClient(target:ILayoutManagerClient, skipDisplayList:Boolean=false):void{ var obj:ILayoutManagerClient; var i:int; var done:Boolean; var oldTargetLevel:int; i = 0; done = false; oldTargetLevel = targetLevel; if (targetLevel == int.MAX_VALUE){ targetLevel = target.nestLevel; }; while (!(done)) { done = true; obj = ILayoutManagerClient(invalidatePropertiesQueue.removeSmallestChild(target)); while (obj) { obj.validateProperties(); if (!obj.updateCompletePendingFlag){ updateCompleteQueue.addObject(obj, obj.nestLevel); obj.updateCompletePendingFlag = true; }; obj = ILayoutManagerClient(invalidatePropertiesQueue.removeSmallestChild(target)); }; if (invalidatePropertiesQueue.isEmpty()){ invalidatePropertiesFlag = false; invalidateClientPropertiesFlag = false; }; obj = ILayoutManagerClient(invalidateSizeQueue.removeLargestChild(target)); while (obj) { obj.validateSize(); if (!obj.updateCompletePendingFlag){ updateCompleteQueue.addObject(obj, obj.nestLevel); obj.updateCompletePendingFlag = true; }; if (invalidateClientPropertiesFlag){ obj = ILayoutManagerClient(invalidatePropertiesQueue.removeSmallestChild(target)); if (obj){ invalidatePropertiesQueue.addObject(obj, obj.nestLevel); done = false; break; }; }; obj = ILayoutManagerClient(invalidateSizeQueue.removeLargestChild(target)); }; if (invalidateSizeQueue.isEmpty()){ invalidateSizeFlag = false; invalidateClientSizeFlag = false; }; if (!skipDisplayList){ obj = ILayoutManagerClient(invalidateDisplayListQueue.removeSmallestChild(target)); while (obj) { obj.validateDisplayList(); if (!obj.updateCompletePendingFlag){ updateCompleteQueue.addObject(obj, obj.nestLevel); obj.updateCompletePendingFlag = true; }; if (invalidateClientPropertiesFlag){ obj = ILayoutManagerClient(invalidatePropertiesQueue.removeSmallestChild(target)); if (obj){ invalidatePropertiesQueue.addObject(obj, obj.nestLevel); done = false; break; }; }; if (invalidateClientSizeFlag){ obj = ILayoutManagerClient(invalidateSizeQueue.removeLargestChild(target)); if (obj){ invalidateSizeQueue.addObject(obj, obj.nestLevel); done = false; break; }; }; obj = ILayoutManagerClient(invalidateDisplayListQueue.removeSmallestChild(target)); }; if (invalidateDisplayListQueue.isEmpty()){ invalidateDisplayListFlag = false; }; }; }; if (oldTargetLevel == int.MAX_VALUE){ targetLevel = int.MAX_VALUE; if (!skipDisplayList){ obj = ILayoutManagerClient(updateCompleteQueue.removeLargestChild(target)); while (obj) { if (!obj.initialized){ obj.initialized = true; }; obj.dispatchEvent(new FlexEvent(FlexEvent.UPDATE_COMPLETE)); obj.updateCompletePendingFlag = false; obj = ILayoutManagerClient(updateCompleteQueue.removeLargestChild(target)); }; }; }; } private function validateDisplayList():void{ var obj:ILayoutManagerClient; obj = ILayoutManagerClient(invalidateDisplayListQueue.removeSmallest()); while (obj) { obj.validateDisplayList(); if (!obj.updateCompletePendingFlag){ updateCompleteQueue.addObject(obj, obj.nestLevel); obj.updateCompletePendingFlag = true; }; obj = ILayoutManagerClient(invalidateDisplayListQueue.removeSmallest()); }; if (invalidateDisplayListQueue.isEmpty()){ invalidateDisplayListFlag = false; }; } private function validateSize():void{ var obj:ILayoutManagerClient; obj = ILayoutManagerClient(invalidateSizeQueue.removeLargest()); while (obj) { obj.validateSize(); if (!obj.updateCompletePendingFlag){ updateCompleteQueue.addObject(obj, obj.nestLevel); obj.updateCompletePendingFlag = true; }; obj = ILayoutManagerClient(invalidateSizeQueue.removeLargest()); }; if (invalidateSizeQueue.isEmpty()){ invalidateSizeFlag = false; }; } public function invalidateProperties(obj:ILayoutManagerClient):void{ if (((!(invalidatePropertiesFlag)) && (Application.application.systemManager))){ invalidatePropertiesFlag = true; if (!callLaterPending){ if (!callLaterObject){ callLaterObject = new UIComponent(); callLaterObject.systemManager = Application.application.systemManager; callLaterObject.callLater(waitAFrame); } else { callLaterObject.callLater(doPhasedInstantiation); }; callLaterPending = true; }; }; if (targetLevel <= obj.nestLevel){ invalidateClientPropertiesFlag = true; }; invalidatePropertiesQueue.addObject(obj, obj.nestLevel); } public function invalidateDisplayList(obj:ILayoutManagerClient):void{ if (((!(invalidateDisplayListFlag)) && (Application.application.systemManager))){ invalidateDisplayListFlag = true; if (!callLaterPending){ if (!callLaterObject){ callLaterObject = new UIComponent(); callLaterObject.systemManager = Application.application.systemManager; callLaterObject.callLater(waitAFrame); } else { callLaterObject.callLater(doPhasedInstantiation); }; callLaterPending = true; }; }; invalidateDisplayListQueue.addObject(obj, obj.nestLevel); } public function validateNow():void{ var infiniteLoopGuard:int; if (!usePhasedInstantiation){ infiniteLoopGuard = 0; while (((callLaterPending) && ((infiniteLoopGuard < 100)))) { doPhasedInstantiation(); }; }; } public function invalidateSize(obj:ILayoutManagerClient):void{ if (((!(invalidateSizeFlag)) && (Application.application.systemManager))){ invalidateSizeFlag = true; if (!callLaterPending){ if (!callLaterObject){ callLaterObject = new UIComponent(); callLaterObject.systemManager = Application.application.systemManager; callLaterObject.callLater(waitAFrame); } else { callLaterObject.callLater(doPhasedInstantiation); }; callLaterPending = true; }; }; if (targetLevel <= obj.nestLevel){ invalidateClientSizeFlag = true; }; invalidateSizeQueue.addObject(obj, obj.nestLevel); } public function isInvalid():Boolean{ return (((((invalidatePropertiesFlag) || (invalidateSizeFlag))) || (invalidateDisplayListFlag))); } private function validateProperties():void{ var obj:ILayoutManagerClient; obj = ILayoutManagerClient(invalidatePropertiesQueue.removeSmallest()); while (obj) { obj.validateProperties(); if (!obj.updateCompletePendingFlag){ updateCompleteQueue.addObject(obj, obj.nestLevel); obj.updateCompletePendingFlag = true; }; obj = ILayoutManagerClient(invalidatePropertiesQueue.removeSmallest()); }; if (invalidatePropertiesQueue.isEmpty()){ invalidatePropertiesFlag = false; }; } private function doPhasedInstantiation():void{ var obj:ILayoutManagerClient; if (usePhasedInstantiation){ if (invalidatePropertiesFlag){ validateProperties(); Application.application.dispatchEvent(new Event("validatePropertiesComplete")); } else { if (invalidateSizeFlag){ validateSize(); Application.application.dispatchEvent(new Event("validateSizeComplete")); } else { if (invalidateDisplayListFlag){ validateDisplayList(); Application.application.dispatchEvent(new Event("validateDisplayListComplete")); }; }; }; } else { if (invalidatePropertiesFlag){ validateProperties(); }; if (invalidateSizeFlag){ validateSize(); }; if (invalidateDisplayListFlag){ validateDisplayList(); }; }; if (((((invalidatePropertiesFlag) || (invalidateSizeFlag))) || (invalidateDisplayListFlag))){ callLaterObject.callLater(doPhasedInstantiation); } else { usePhasedInstantiation = false; callLaterPending = false; obj = ILayoutManagerClient(updateCompleteQueue.removeLargest()); while (obj) { if (((!(obj.initialized)) && (obj.processedDescriptors))){ obj.initialized = true; }; obj.dispatchEvent(new FlexEvent(FlexEvent.UPDATE_COMPLETE)); obj.updateCompletePendingFlag = false; obj = ILayoutManagerClient(updateCompleteQueue.removeLargest()); }; dispatchEvent(new FlexEvent(FlexEvent.UPDATE_COMPLETE)); }; } public function set usePhasedInstantiation(value:Boolean):void{ var stage:Stage; if (_usePhasedInstantiation != value){ _usePhasedInstantiation = value; stage = SystemManagerGlobals.topLevelSystemManagers[0].stage; if (value){ originalFrameRate = stage.frameRate; stage.frameRate = 1000; } else { stage.frameRate = originalFrameRate; }; }; } public static function getInstance():LayoutManager{ if (!instance){ instance = new (LayoutManager); }; return (instance); } } }//package mx.managers
Section 134
//SystemChildrenList (mx.managers.SystemChildrenList) package mx.managers { import mx.core.*; import flash.display.*; import flash.geom.*; public class SystemChildrenList implements IChildList { private var lowerBoundReference:QName; private var upperBoundReference:QName; private var owner:SystemManager; mx_internal static const VERSION:String = "2.0.1.0"; public function SystemChildrenList(owner:SystemManager, lowerBoundReference:QName, upperBoundReference:QName){ super(); this.owner = owner; this.lowerBoundReference = lowerBoundReference; this.upperBoundReference = upperBoundReference; } public function getChildAt(index:int):DisplayObject{ var retval:DisplayObject; var _local3 = owner; retval = _local3.mx_internal::rawChildren_getChildAt((owner[lowerBoundReference] + index)); return (retval); } public function addChild(child:DisplayObject):DisplayObject{ var _local2 = owner; _local2.mx_internal::rawChildren_addChildAt(child, owner[upperBoundReference]); _local2 = owner; var _local3 = upperBoundReference; var _local4 = (_local2[_local3] + 1); _local2[_local3] = _local4; return (child); } public function getChildByName(name:String):DisplayObject{ return (owner.mx_internal::rawChildren_getChildByName(name)); } public function removeChildAt(index:int):DisplayObject{ var child:DisplayObject; var _local3 = owner; child = _local3.mx_internal::rawChildren_removeChildAt((index + owner[lowerBoundReference])); _local3 = owner; var _local4 = upperBoundReference; var _local5 = (_local3[_local4] - 1); _local3[_local4] = _local5; return (child); } public function getChildIndex(child:DisplayObject):int{ var retval:int; retval = owner.mx_internal::rawChildren_getChildIndex(child); retval = (retval - owner[lowerBoundReference]); return (retval); } public function addChildAt(child:DisplayObject, index:int):DisplayObject{ var _local3 = owner; _local3.mx_internal::rawChildren_addChildAt(child, (owner[lowerBoundReference] + index)); _local3 = owner; var _local4 = upperBoundReference; var _local5 = (_local3[_local4] + 1); _local3[_local4] = _local5; return (child); } public function getObjectsUnderPoint(point:Point):Array{ return (owner.mx_internal::rawChildren_getObjectsUnderPoint(point)); } public function setChildIndex(child:DisplayObject, newIndex:int):void{ var _local3 = owner; _local3.mx_internal::rawChildren_setChildIndex(child, (owner[lowerBoundReference] + newIndex)); } public function get numChildren():int{ return ((owner[upperBoundReference] - owner[lowerBoundReference])); } public function contains(child:DisplayObject):Boolean{ var childIndex:int; if (owner.mx_internal::rawChildren_contains(child)){ while (child.parent != owner) { child = child.parent; }; childIndex = owner.mx_internal::rawChildren_getChildIndex(child); if ((((childIndex >= owner[lowerBoundReference])) && ((childIndex < owner[upperBoundReference])))){ return (true); }; }; return (false); } public function removeChild(child:DisplayObject):DisplayObject{ var index:int; index = owner.mx_internal::rawChildren_getChildIndex(child); if ((((owner[lowerBoundReference] <= index)) && ((index < owner[upperBoundReference])))){ var _local3 = owner; _local3.mx_internal::rawChildren_removeChild(child); _local3 = owner; var _local4 = upperBoundReference; var _local5 = (_local3[_local4] - 1); _local3[_local4] = _local5; }; return (child); } } }//package mx.managers
Section 135
//SystemManager (mx.managers.SystemManager) package mx.managers { import flash.events.*; import mx.core.*; import flash.system.*; import flash.display.*; import flash.utils.*; import flash.geom.*; import mx.styles.*; import mx.events.*; import flash.text.*; import mx.preloaders.*; import mx.messaging.config.*; public class SystemManager extends MovieClip implements IChildList, IFlexDisplayObject, IFlexModuleFactory, ISystemManager { mx_internal var nestLevel:int;// = 0 private var forms:Array; private var mouseCatcher:Sprite; private var _height:Number; private var preloader:Preloader; private var _topLevelSystemManager:ISystemManager; private var _rawChildren:SystemRawChildrenList; private var _toolTipIndex:int;// = 0 private var _explicitHeight:Number; private var _document:Object; private var form:IFocusManagerContainer; private var _width:Number; private var _toolTipChildren:SystemChildrenList; private var initialized:Boolean;// = false private var _focusPane:Sprite; private var isStageRoot:Boolean;// = true private var rslSizes:Array;// = null private var _fontList:Object;// = null private var nextFrameTimer:Timer;// = null private var topLevel:Boolean;// = true private var _popUpChildren:SystemChildrenList; private var _cursorIndex:int;// = 0 private var _topMostIndex:int;// = 0 mx_internal var _mouseX; mx_internal var _mouseY; private var _numModalWindows:int;// = 0 private var _screen:Rectangle; mx_internal var idleCounter:int;// = 0 private var initCallbackFunctions:Array; private var _cursorChildren:SystemChildrenList; private var _noTopMostIndex:int;// = 0 private var _applicationIndex:int;// = 1 private var idleTimer:Timer; private var doneExecutingInitCallbacks:Boolean;// = false private var _explicitWidth:Number; mx_internal var topLevelWindow:IUIComponent; private static const IDLE_THRESHOLD:Number = 1000; private static const IDLE_INTERVAL:Number = 100; mx_internal static const VERSION:String = "2.0.1.0"; mx_internal static var lastSystemManager:SystemManager; mx_internal static var allSystemManagers:Dictionary = new Dictionary(true); public function SystemManager(){ doneExecutingInitCallbacks = false; initCallbackFunctions = []; initialized = false; topLevel = true; isStageRoot = true; nestLevel = 0; rslSizes = null; forms = []; idleCounter = 0; nextFrameTimer = null; _applicationIndex = 1; _cursorIndex = 0; _fontList = null; _noTopMostIndex = 0; _numModalWindows = 0; _toolTipIndex = 0; _topMostIndex = 0; super(); if (stage){ stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; }; if ((((SystemManagerGlobals.topLevelSystemManagers.length > 0)) && (!(stage)))){ topLevel = false; }; if (!stage){ isStageRoot = false; }; if (topLevel){ SystemManagerGlobals.topLevelSystemManagers.push(this); }; lastSystemManager = this; executeCallbacks(); stop(); if (((topLevel) && (!((currentFrame == 1))))){ throw (new Error((("The SystemManager constructor was called when the currentFrame was at " + currentFrame) + " Please add this SWF to bug 129782."))); }; root.loaderInfo.addEventListener(Event.INIT, initHandler); } mx_internal function addingChild(child:DisplayObject):void{ var newNestLevel:int; var uiComponentClassName:Class; var obj:DisplayObjectContainer; newNestLevel = 1; if (!topLevel){ obj = parent.parent; while (obj) { if ((obj is ILayoutManagerClient)){ newNestLevel = (ILayoutManagerClient(obj).nestLevel + 1); break; }; obj = obj.parent; }; }; nestLevel = newNestLevel; if ((child is IUIComponent)){ IUIComponent(child).systemManager = this; }; uiComponentClassName = Class(getDefinitionByName("mx.core.UIComponent")); if ((((child is IUIComponent)) && (!(IUIComponent(child).document)))){ IUIComponent(child).document = document; }; if ((child is ILayoutManagerClient)){ ILayoutManagerClient(child).nestLevel = (nestLevel + 1); }; if ((child is InteractiveObject)){ if (doubleClickEnabled){ InteractiveObject(child).doubleClickEnabled = true; }; }; if ((child is IUIComponent)){ IUIComponent(child).parentChanged(this); }; if ((child is IStyleClient)){ IStyleClient(child).regenerateStyleCache(true); }; if ((child is ISimpleStyleClient)){ ISimpleStyleClient(child).styleChanged(null); }; if ((child is IStyleClient)){ IStyleClient(child).notifyStyleChangeInChildren(null, true); }; if (((uiComponentClassName) && ((child is uiComponentClassName)))){ uiComponentClassName(child).initThemeColor(); }; if (((uiComponentClassName) && ((child is uiComponentClassName)))){ uiComponentClassName(child).stylesInitialized(); }; } mx_internal function rawChildren_addChild(child:DisplayObject):DisplayObject{ addingChild(child); super.addChild(child); childAdded(child); return (child); } public function getExplicitOrMeasuredHeight():Number{ return ((isNaN(explicitHeight)) ? measuredHeight : explicitHeight); } mx_internal function notifyStyleChangeInChildren(styleProp:String, recursive:Boolean):void{ var foundTopLevelWindow:Boolean; var n:int; var i:int; var child:IStyleClient; foundTopLevelWindow = false; n = rawChildren.numChildren; i = 0; while (i < n) { child = (rawChildren.getChildAt(i) as IStyleClient); if (child){ child.styleChanged(styleProp); child.notifyStyleChangeInChildren(styleProp, recursive); }; if (isTopLevelWindow(DisplayObject(child))){ foundTopLevelWindow = true; }; n = rawChildren.numChildren; i++; }; if (((!(foundTopLevelWindow)) && ((topLevelWindow is IStyleClient)))){ IStyleClient(topLevelWindow).styleChanged(styleProp); IStyleClient(topLevelWindow).notifyStyleChangeInChildren(styleProp, recursive); }; } mx_internal function rawChildren_getObjectsUnderPoint(pt:Point):Array{ return (super.getObjectsUnderPoint(pt)); } override public function contains(child:DisplayObject):Boolean{ var childIndex:int; var i:int; var myChild:DisplayObject; if (super.contains(child)){ if (child.parent == this){ childIndex = super.getChildIndex(child); if (childIndex < noTopMostIndex){ return (true); }; } else { i = 0; while (i < noTopMostIndex) { myChild = super.getChildAt(i); if ((myChild is IRawChildrenContainer)){ if (IRawChildrenContainer(myChild).rawChildren.contains(child)){ return (true); }; }; if ((myChild is DisplayObjectContainer)){ if (DisplayObjectContainer(myChild).contains(child)){ return (true); }; }; i++; }; }; }; return (false); } private function idleTimer_timerHandler(event:TimerEvent):void{ idleCounter++; if ((idleCounter * IDLE_INTERVAL) > IDLE_THRESHOLD){ dispatchEvent(new FlexEvent(FlexEvent.IDLE)); }; } private function initHandler(event:Event):void{ var docFrame:int; var f:int; allSystemManagers[this] = this.loaderInfo.url; root.loaderInfo.removeEventListener(Event.INIT, initHandler); docFrame = ((totalFrames)==1) ? 0 : 1; addFrameScript(docFrame, docFrameHandler); f = (docFrame + 1); while (f < totalFrames) { addFrameScript(f, extraFrameHandler); f++; }; initialize(); } public function getDefinitionByName(name:String):Object{ var domain:ApplicationDomain; var definition:Object; domain = (((!(topLevel)) && ((parent is Loader)))) ? Loader(parent).contentLoaderInfo.applicationDomain : (info()["currentDomain"] as ApplicationDomain); if (domain.hasDefinition(name)){ definition = domain.getDefinition(name); }; return (definition); } public function get embeddedFontList():Object{ var o:Object; var p:String; var fl:Object; if (_fontList == null){ _fontList = {}; o = info()["fonts"]; for (p in o) { _fontList[p] = o[p]; }; if (((!(topLevel)) && (_topLevelSystemManager))){ fl = _topLevelSystemManager.embeddedFontList; for (p in fl) { _fontList[p] = fl[p]; }; }; }; return (_fontList); } mx_internal function set cursorIndex(value:int):void{ var delta:int; delta = (value - _cursorIndex); _cursorIndex = value; } override public function getChildAt(index:int):DisplayObject{ return (super.getChildAt((applicationIndex + index))); } public function set document(value:Object):void{ _document = value; } override public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void{ if ((((type == FlexEvent.IDLE)) && (!(idleTimer)))){ idleTimer = new Timer(IDLE_INTERVAL); idleTimer.addEventListener(TimerEvent.TIMER, idleTimer_timerHandler); idleTimer.start(); addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler, true); addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler, true); }; super.addEventListener(type, listener, useCapture, priority, useWeakReference); } override public function get mouseX():Number{ if (_mouseX === undefined){ return (super.mouseX); }; return (_mouseX); } override public function get mouseY():Number{ if (_mouseY === undefined){ return (super.mouseY); }; return (_mouseY); } public function removeFocusManager(f:IFocusManagerContainer):void{ var n:int; var i:int; n = forms.length; i = 0; while (i < n) { if (forms[i] == f){ if (form == f){ deactivate(f); }; forms.splice(i, 1); return; }; i++; }; } private function mouseMoveHandler(event:MouseEvent):void{ idleCounter = 0; } public function get rawChildren():IChildList{ if (!topLevel){ return (_topLevelSystemManager.rawChildren); }; if (!_rawChildren){ _rawChildren = new SystemRawChildrenList(this); }; return (_rawChildren); } public function get focusPane():Sprite{ return (_focusPane); } private function mouseDownHandler(event:MouseEvent):void{ var n:int; var p:DisplayObject; var isApplication:Boolean; var i:int; var j:int; var index:int; var newIndex:int; var childList:IChildList; idleCounter = 0; if (numModalWindows == 0){ if (forms.length > 1){ n = forms.length; p = DisplayObject(event.target); isApplication = document.rawChildren.contains(p); while (p) { i = 0; while (i < n) { if (forms[i] == p){ j = 0; if (((!((p == form))) && ((p is IFocusManagerContainer)))){ activate(IFocusManagerContainer(p)); }; if (popUpChildren.contains(p)){ childList = popUpChildren; } else { childList = this; }; index = childList.getChildIndex(p); newIndex = index; n = forms.length; j = 0; while (j < n) { if (childList.contains(forms[j])){ if (childList.getChildIndex(forms[j]) > index){ newIndex = childList.getChildIndex(forms[j]); }; }; j++; }; if ((((newIndex > index)) && (!(isApplication)))){ childList.setChildIndex(p, newIndex); }; return; }; i++; }; p = p.parent; }; }; }; } public function get screen():Rectangle{ if (!_screen){ Stage_resizeHandler(); }; return (_screen); } public function get preloaderBackgroundSize():String{ return (info()["backgroundSize"]); } private function docFrameHandler(event:Event=null):void{ var mixinList:Array; var n:int; var i:int; var c:Class; Singleton.registerClass("mx.managers::ICursorManager", Class(getDefinitionByName("mx.managers::CursorManagerImpl"))); Singleton.registerClass("mx.managers::IDragManager", Class(getDefinitionByName("mx.managers::DragManagerImpl"))); Singleton.registerClass("mx.managers::IHistoryManager", Class(getDefinitionByName("mx.managers::HistoryManagerImpl"))); Singleton.registerClass("mx.managers::ILayoutManager", Class(getDefinitionByName("mx.managers::LayoutManager"))); Singleton.registerClass("mx.managers::IPopUpManager", Class(getDefinitionByName("mx.managers::PopUpManagerImpl"))); Singleton.registerClass("mx.styles::IStyleManager", Class(getDefinitionByName("mx.styles::StyleManagerImpl"))); Singleton.registerClass("mx.managers::IToolTipManager", Class(getDefinitionByName("mx.managers::ToolTipManagerImpl"))); executeCallbacks(); doneExecutingInitCallbacks = true; mixinList = info()["mixins"]; if (((mixinList) && ((mixinList.length > 0)))){ n = mixinList.length; i = 0; while (i < n) { c = Class(getDefinitionByName(mixinList[i])); var _local6 = c; _local6["init"](this); i++; }; }; initializeTopLevelWindow(null); deferredNextFrame(); } private function Stage_resizeHandler(event:Event=null):void{ var w:Number; var h:Number; var m:Number; var n:Number; var x:Number; var y:Number; var align:String; w = stage.stageWidth; h = stage.stageHeight; m = loaderInfo.width; n = loaderInfo.height; x = ((m - w) / 2); y = ((n - h) / 2); align = stage.align; if (align == StageAlign.TOP){ y = 0; } else { if (align == StageAlign.BOTTOM){ y = (n - h); } else { if (align == StageAlign.LEFT){ x = 0; } else { if (align == StageAlign.RIGHT){ x = (m - w); } else { if ((((align == StageAlign.TOP_LEFT)) || ((align == "LT")))){ y = 0; x = 0; } else { if (align == StageAlign.TOP_RIGHT){ y = 0; x = (m - w); } else { if (align == StageAlign.BOTTOM_LEFT){ y = (n - h); x = 0; } else { if (align == StageAlign.BOTTOM_RIGHT){ y = (n - h); x = (m - w); }; }; }; }; }; }; }; }; if (!_screen){ _screen = new Rectangle(); }; _screen.x = x; _screen.y = y; _screen.width = w; _screen.height = h; if (isStageRoot){ _width = stage.stageWidth; _height = stage.stageHeight; }; if (event){ resizeMouseCatcher(); dispatchEvent(event); }; } public function get explicitHeight():Number{ return (_explicitHeight); } mx_internal function set topMostIndex(value:int):void{ var delta:int; delta = (value - _topMostIndex); _topMostIndex = value; toolTipIndex = (toolTipIndex + delta); } override public function getChildByName(name:String):DisplayObject{ return (super.getChildByName(name)); } override public function addChildAt(child:DisplayObject, index:int):DisplayObject{ noTopMostIndex++; return (rawChildren_addChildAt(child, (applicationIndex + index))); } public function isTopLevel():Boolean{ return (topLevel); } public function deactivate(f:IFocusManagerContainer):void{ var newForm:IFocusManagerContainer; var n:int; var i:int; var g:IFocusManagerContainer; if (form){ if ((((form == f)) && ((forms.length > 1)))){ form.focusManager.deactivate(); n = forms.length; i = 0; while (i < n) { g = forms[i]; if (g == f){ i = (i + 1); while (i < n) { g = forms[i]; if ((((Sprite(g).visible == true)) && (IUIComponent(g).enabled))){ newForm = g; }; i++; }; form = newForm; break; } else { if (((Sprite(g).visible) && (IUIComponent(g).enabled))){ newForm = g; }; }; i++; }; if (form){ form.focusManager.activate(); }; }; }; } public function getExplicitOrMeasuredWidth():Number{ return ((isNaN(explicitWidth)) ? measuredWidth : explicitWidth); } public function info():Object{ return ({}); } public function get measuredWidth():Number{ return ((topLevelWindow) ? topLevelWindow.getExplicitOrMeasuredWidth() : loaderInfo.width); } mx_internal function get toolTipIndex():int{ return (_toolTipIndex); } public function setActualSize(newWidth:Number, newHeight:Number):void{ if (isStageRoot){ return; }; _width = newWidth; _height = newHeight; if (mouseCatcher){ mouseCatcher.width = newWidth; mouseCatcher.height = newHeight; }; dispatchEvent(new Event(Event.RESIZE)); } mx_internal function set applicationIndex(value:int):void{ _applicationIndex = value; } public function set focusPane(value:Sprite):void{ if (value){ addChild(value); value.x = 0; value.y = 0; value.scrollRect = null; _focusPane = value; } else { removeChild(_focusPane); _focusPane = null; }; } private function executeCallbacks():void{ var initFunction:Function; if (!parent){ return; }; while (initCallbackFunctions.length > 0) { initFunction = initCallbackFunctions.shift(); initFunction(this); }; } override public function addChild(child:DisplayObject):DisplayObject{ noTopMostIndex++; return (rawChildren_addChildAt(child, (noTopMostIndex - 1))); } public function set explicitHeight(value:Number):void{ _explicitHeight = value; } override public function removeChild(child:DisplayObject):DisplayObject{ noTopMostIndex--; return (rawChildren_removeChild(child)); } mx_internal function rawChildren_removeChild(child:DisplayObject):DisplayObject{ removingChild(child); super.removeChild(child); childRemoved(child); return (child); } final mx_internal function get $numChildren():int{ return (super.numChildren); } override public function get stage():Stage{ var s:Stage; s = super.stage; if (s){ return (s); }; if (((!(topLevel)) && (_topLevelSystemManager))){ return (_topLevelSystemManager.stage); }; return (null); } public function create(... _args):Object{ var mainClassName:String; var mainClass:Class; var url:String; var dot:int; var slash:int; mainClassName = info()["mainClassName"]; if (mainClassName == null){ url = loaderInfo.loaderURL; dot = url.lastIndexOf("."); slash = url.lastIndexOf("/"); mainClassName = url.substring((slash + 1), dot); }; mainClass = Class(getDefinitionByName(mainClassName)); return ((mainClass) ? new (mainClass) : null); } override public function getChildIndex(child:DisplayObject):int{ return ((super.getChildIndex(child) - applicationIndex)); } public function get popUpChildren():IChildList{ if (!topLevel){ return (_topLevelSystemManager.popUpChildren); }; if (!_popUpChildren){ _popUpChildren = new SystemChildrenList(this, new QName(mx_internal, "noTopMostIndex"), new QName(mx_internal, "topMostIndex")); }; return (_popUpChildren); } public function activate(f:IFocusManagerContainer):void{ var z:IFocusManagerContainer; if (form){ if (((!((form == f))) && ((forms.length > 1)))){ z = form; z.focusManager.deactivate(); }; }; form = f; if (f.focusManager){ f.focusManager.activate(); }; } override public function setChildIndex(child:DisplayObject, newIndex:int):void{ super.setChildIndex(child, (applicationIndex + newIndex)); } public function get toolTipChildren():IChildList{ if (!topLevel){ return (_topLevelSystemManager.toolTipChildren); }; if (!_toolTipChildren){ _toolTipChildren = new SystemChildrenList(this, new QName(mx_internal, "topMostIndex"), new QName(mx_internal, "toolTipIndex")); }; return (_toolTipChildren); } private function deferredNextFrame():void{ if ((currentFrame + 1) > totalFrames){ return; }; if ((currentFrame + 1) <= framesLoaded){ nextFrame(); } else { nextFrameTimer = new Timer(100); nextFrameTimer.addEventListener(TimerEvent.TIMER, nextFrameTimerHandler); nextFrameTimer.start(); }; } mx_internal function get cursorIndex():int{ return (_cursorIndex); } override public function getObjectsUnderPoint(point:Point):Array{ var children:Array; var n:int; var i:int; var child:DisplayObject; var temp:Array; children = []; n = topMostIndex; i = 0; while (i < n) { child = super.getChildAt(i); if ((child is DisplayObjectContainer)){ temp = DisplayObjectContainer(child).getObjectsUnderPoint(point); if (temp){ children = children.concat(temp); }; }; i++; }; return (children); } mx_internal function rawChildren_contains(child:DisplayObject):Boolean{ return (super.contains(child)); } public function get document():Object{ return (_document); } private function resizeMouseCatcher():void{ var g:Graphics; if (mouseCatcher){ g = mouseCatcher.graphics; g.clear(); g.beginFill(0, 0); g.drawRect(0, 0, stage.stageWidth, stage.stageHeight); g.endFill(); }; } override public function get height():Number{ return (_height); } mx_internal function rawChildren_getChildIndex(child:DisplayObject):int{ return (super.getChildIndex(child)); } mx_internal function get topMostIndex():int{ return (_topMostIndex); } public function addFocusManager(f:IFocusManagerContainer):void{ forms.push(f); } mx_internal function set noTopMostIndex(value:int):void{ var delta:int; delta = (value - _noTopMostIndex); _noTopMostIndex = value; topMostIndex = (topMostIndex + delta); } mx_internal function rawChildren_setChildIndex(child:DisplayObject, newIndex:int):void{ super.setChildIndex(child, newIndex); } private function mouseUpHandler(event:MouseEvent):void{ idleCounter = 0; } mx_internal function childAdded(child:DisplayObject):void{ child.dispatchEvent(new FlexEvent(FlexEvent.ADD)); if ((child is IUIComponent)){ IUIComponent(child).initialize(); }; } public function isFontFaceEmbedded(textFormat:TextFormat):Boolean{ var fontName:String; var fl:Array; var f:int; var info:Object; var font:Font; var style:String; fontName = textFormat.font; fl = Font.enumerateFonts(); f = 0; while (f < fl.length) { font = Font(fl[f]); if (font.fontName == fontName){ style = "regular"; if (((textFormat.bold) && (textFormat.italic))){ style = "boldItalic"; } else { if (textFormat.bold){ style = "bold"; } else { if (textFormat.italic){ style = "italic"; }; }; }; if (font.fontStyle == style){ return (true); }; }; f++; }; if (((((!(fontName)) || (!(embeddedFontList)))) || (!(embeddedFontList[fontName])))){ return (false); }; info = embeddedFontList[fontName]; return (!(((((((textFormat.bold) && (!(info.bold)))) || (((textFormat.italic) && (!(info.italic)))))) || (((((!(textFormat.bold)) && (!(textFormat.italic)))) && (!(info.regular))))))); } mx_internal function rawChildren_getChildAt(index:int):DisplayObject{ return (super.getChildAt(index)); } override public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void{ if (type == FlexEvent.IDLE){ super.removeEventListener(type, listener, useCapture); if (((!(hasEventListener(FlexEvent.IDLE))) && (idleTimer))){ idleTimer.stop(); idleTimer = null; removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); }; } else { super.removeEventListener(type, listener, useCapture); }; } override public function removeChildAt(index:int):DisplayObject{ noTopMostIndex--; return (rawChildren_removeChildAt((applicationIndex + index))); } private function extraFrameHandler(event:Event=null):void{ var frameList:Object; var c:Class; frameList = info()["frames"]; if (((frameList) && (frameList[currentLabel]))){ c = Class(getDefinitionByName(frameList[currentLabel])); var _local4 = c; _local4["frame"](this); }; deferredNextFrame(); } public function get application():IUIComponent{ return (IUIComponent(_document)); } mx_internal function rawChildren_removeChildAt(index:int):DisplayObject{ var child:DisplayObject; child = super.getChildAt(index); removingChild(child); super.removeChildAt(index); childRemoved(child); return (child); } mx_internal function removingChild(child:DisplayObject):void{ child.dispatchEvent(new FlexEvent(FlexEvent.REMOVE)); } mx_internal function get applicationIndex():int{ return (_applicationIndex); } mx_internal function set toolTipIndex(value:int):void{ var delta:int; delta = (value - _toolTipIndex); _toolTipIndex = value; cursorIndex = (cursorIndex + delta); } public function get cursorChildren():IChildList{ if (!topLevel){ return (_topLevelSystemManager.cursorChildren); }; if (!_cursorChildren){ _cursorChildren = new SystemChildrenList(this, new QName(mx_internal, "toolTipIndex"), new QName(mx_internal, "cursorIndex")); }; return (_cursorChildren); } public function get preloaderBackgroundImage():Object{ return (info()["backgroundImage"]); } public function set numModalWindows(value:int):void{ _numModalWindows = value; } public function get preloaderBackgroundAlpha():Number{ return (info()["backgroundAlpha"]); } private function preloader_preloaderDoneHandler(event:Event):void{ var app:IUIComponent; app = topLevelWindow; preloader.removeEventListener(FlexEvent.PRELOADER_DONE, preloader_preloaderDoneHandler); _popUpChildren.removeChild(preloader); mouseCatcher = new FlexSprite(); mouseCatcher.name = "mouseCatcher"; noTopMostIndex++; super.addChildAt(mouseCatcher, 0); resizeMouseCatcher(); if (!topLevel){ mouseCatcher.visible = false; mask = mouseCatcher; }; noTopMostIndex++; super.addChildAt(DisplayObject(app), 1); app.dispatchEvent(new FlexEvent(FlexEvent.APPLICATION_COMPLETE)); dispatchEvent(new FlexEvent(FlexEvent.APPLICATION_COMPLETE)); } mx_internal function rawChildren_getChildByName(name:String):DisplayObject{ return (super.getChildByName(name)); } mx_internal function initialize():void{ var rslURLList:Array; var rslSizes:Array; var rsls:Array; var i:int; var usePreloader:Boolean; var preloaderDisplayClass:Class; if (isStageRoot){ _width = stage.stageWidth; _height = stage.stageHeight; } else { _width = loaderInfo.width; _height = loaderInfo.height; }; preloader = new Preloader(); preloader.addEventListener(FlexEvent.INIT_PROGRESS, preloader_initProgressHandler); preloader.addEventListener(FlexEvent.PRELOADER_DONE, preloader_preloaderDoneHandler); if (!_popUpChildren){ _popUpChildren = new SystemChildrenList(this, new QName(mx_internal, "noTopMostIndex"), new QName(mx_internal, "topMostIndex")); }; _popUpChildren.addChild(preloader); rslURLList = []; rslSizes = []; rsls = info()["rsls"]; i = 0; while (((rsls) && ((i < rsls.length)))) { rslURLList[i] = rsls[i].url; rslSizes[i] = rsls[i].size; i++; }; usePreloader = true; if (info()["usePreloader"] != undefined){ usePreloader = info()["usePreloader"]; }; preloaderDisplayClass = (info()["preloader"] as Class); if (((usePreloader) && (!(preloaderDisplayClass)))){ preloaderDisplayClass = DownloadProgressBar; }; preloader.initialize(usePreloader, preloaderDisplayClass, preloaderBackgroundColor, preloaderBackgroundAlpha, preloaderBackgroundImage, preloaderBackgroundSize, (isStageRoot) ? stage.stageWidth : loaderInfo.width, (isStageRoot) ? stage.stageHeight : loaderInfo.height, rslURLList, rslSizes); } private function appCreationCompleteHandler(event:FlexEvent):void{ var obj:DisplayObjectContainer; if (((!(topLevel)) && (parent))){ obj = parent.parent; while (obj) { if ((obj is IInvalidating)){ IInvalidating(obj).invalidateSize(); IInvalidating(obj).invalidateDisplayList(); return; }; obj = obj.parent; }; }; } public function get measuredHeight():Number{ return ((topLevelWindow) ? topLevelWindow.getExplicitOrMeasuredHeight() : loaderInfo.height); } mx_internal function regenerateStyleCache(recursive:Boolean):void{ var foundTopLevelWindow:Boolean; var n:int; var i:int; var child:IStyleClient; foundTopLevelWindow = false; n = rawChildren.numChildren; i = 0; while (i < n) { child = (rawChildren.getChildAt(i) as IStyleClient); if (child){ child.regenerateStyleCache(recursive); }; if (isTopLevelWindow(DisplayObject(child))){ foundTopLevelWindow = true; }; n = rawChildren.numChildren; i++; }; if (((!(foundTopLevelWindow)) && ((topLevelWindow is IStyleClient)))){ IStyleClient(topLevelWindow).regenerateStyleCache(recursive); }; } public function get topLevelSystemManager():ISystemManager{ if (topLevel){ return (this); }; return (_topLevelSystemManager); } private function nextFrameTimerHandler(event:TimerEvent):void{ if ((currentFrame + 1) <= framesLoaded){ nextFrame(); nextFrameTimer.removeEventListener(TimerEvent.TIMER, nextFrameTimerHandler); nextFrameTimer.reset(); }; } public function get preloaderBackgroundColor():uint{ var value:*; value = info()["backgroundColor"]; if (value == undefined){ return (4294967295); }; return (uint(value)); } mx_internal function childRemoved(child:DisplayObject):void{ if ((child is IUIComponent)){ IUIComponent(child).parentChanged(null); }; } override public function get numChildren():int{ return ((noTopMostIndex - applicationIndex)); } mx_internal function get noTopMostIndex():int{ return (_noTopMostIndex); } mx_internal function rawChildren_addChildAt(child:DisplayObject, index:int):DisplayObject{ addingChild(child); super.addChildAt(child, index); childAdded(child); return (child); } public function get numModalWindows():int{ return (_numModalWindows); } private function initializeTopLevelWindow(event:Event):void{ var app:IUIComponent; var obj:DisplayObjectContainer; initialized = true; if (!parent){ return; }; if (!topLevel){ obj = parent.parent; if (!obj){ return; }; while (obj) { if ((obj is IUIComponent)){ _topLevelSystemManager = IUIComponent(obj).systemManager; break; }; obj = obj.parent; }; }; addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler, true); if (((topLevel) && (stage))){ stage.addEventListener(Event.RESIZE, Stage_resizeHandler, false, 0, true); }; app = (topLevelWindow = IUIComponent(create())); document = app; if (document){ IEventDispatcher(app).addEventListener(FlexEvent.CREATION_COMPLETE, appCreationCompleteHandler); if (((topLevel) && (stage))){ LoaderConfig._url = loaderInfo.url; LoaderConfig._parameters = loaderInfo.parameters; _width = stage.stageWidth; _height = stage.stageHeight; IFlexDisplayObject(app).setActualSize(stage.stageWidth, stage.stageHeight); } else { IFlexDisplayObject(app).setActualSize(loaderInfo.width, loaderInfo.height); }; preloader.registerApplication(app); addingChild(DisplayObject(app)); childAdded(DisplayObject(app)); } else { document = this; }; } override public function get width():Number{ return (_width); } public function isTopLevelWindow(object:DisplayObject):Boolean{ return ((((object is IUIComponent)) && ((IUIComponent(object) == topLevelWindow)))); } public function move(x:Number, y:Number):void{ } public function set explicitWidth(value:Number):void{ _explicitWidth = value; } private function preloader_initProgressHandler(event:Event):void{ preloader.removeEventListener(FlexEvent.INIT_PROGRESS, preloader_initProgressHandler); deferredNextFrame(); } public function get explicitWidth():Number{ return (_explicitWidth); } public static function getSWFRoot(object:Object):DisplayObject{ var className:String; var p:*; var sm:SystemManager; var domain:ApplicationDomain; var cls:Class; var object = object; className = getQualifiedClassName(object); for (p in allSystemManagers) { sm = (p as SystemManager); domain = sm.loaderInfo.applicationDomain; cls = Class(domain.getDefinition(className)); if ((object is cls)){ return (sm); }; //unresolved jump var _slot1 = e; }; return (null); } mx_internal static function registerInitCallback(initFunction:Function):void{ var sm:SystemManager; if (((!(allSystemManagers)) || (!(lastSystemManager)))){ return; }; sm = lastSystemManager; if (sm.doneExecutingInitCallbacks){ initFunction(sm); } else { sm.initCallbackFunctions.push(initFunction); }; } } }//package mx.managers
Section 136
//SystemManagerGlobals (mx.managers.SystemManagerGlobals) package mx.managers { public class SystemManagerGlobals { public static var topLevelSystemManagers:Array = []; public static var bootstrapLoaderInfoURL:String; public function SystemManagerGlobals(){ super(); } } }//package mx.managers
Section 137
//SystemRawChildrenList (mx.managers.SystemRawChildrenList) package mx.managers { import mx.core.*; import flash.display.*; import flash.geom.*; public class SystemRawChildrenList implements IChildList { private var owner:SystemManager; mx_internal static const VERSION:String = "2.0.1.0"; public function SystemRawChildrenList(owner:SystemManager){ super(); this.owner = owner; } public function getChildByName(name:String):DisplayObject{ return (owner.mx_internal::rawChildren_getChildByName(name)); } public function removeChildAt(index:int):DisplayObject{ return (owner.mx_internal::rawChildren_removeChildAt(index)); } public function getChildIndex(child:DisplayObject):int{ return (owner.mx_internal::rawChildren_getChildIndex(child)); } public function addChildAt(child:DisplayObject, index:int):DisplayObject{ return (owner.mx_internal::rawChildren_addChildAt(child, index)); } public function getObjectsUnderPoint(point:Point):Array{ return (owner.mx_internal::rawChildren_getObjectsUnderPoint(point)); } public function setChildIndex(child:DisplayObject, newIndex:int):void{ var _local3 = owner; _local3.mx_internal::rawChildren_setChildIndex(child, newIndex); } public function get numChildren():int{ return (owner.mx_internal::$numChildren); } public function contains(child:DisplayObject):Boolean{ return (owner.mx_internal::rawChildren_contains(child)); } public function removeChild(child:DisplayObject):DisplayObject{ return (owner.mx_internal::rawChildren_removeChild(child)); } public function getChildAt(index:int):DisplayObject{ return (owner.mx_internal::rawChildren_getChildAt(index)); } public function addChild(child:DisplayObject):DisplayObject{ return (owner.mx_internal::rawChildren_addChild(child)); } } }//package mx.managers
Section 138
//ToolTipManager (mx.managers.ToolTipManager) package mx.managers { import flash.events.*; import mx.core.*; import flash.display.*; import mx.effects.*; public class ToolTipManager extends EventDispatcher { mx_internal static const VERSION:String = "2.0.1.0"; private static var impl:IToolTipManager = (Singleton.getInstance("mx.managers::IToolTipManager") as IToolTipManager); private static var implClassDependency:ToolTipManagerImpl; public function ToolTipManager(){ super(); } public static function get enabled():Boolean{ return (impl.enabled); } public static function set enabled(value:Boolean):void{ impl.enabled = value; } mx_internal static function registerToolTip(target:DisplayObject, toolTip:String):void{ impl.registerToolTip(target, toolTip); } public static function set hideDelay(value:Number):void{ impl.hideDelay = value; } public static function set showDelay(value:Number):void{ impl.showDelay = value; } public static function get showDelay():Number{ return (impl.showDelay); } public static function createToolTip(text:String, x:Number, y:Number, errorTipBorderStyle:String=null, context:IUIComponent=null):IToolTip{ return (impl.createToolTip(text, x, y, errorTipBorderStyle, context)); } public static function destroyToolTip(toolTip:IToolTip):void{ return (impl.destroyToolTip(toolTip)); } public static function get scrubDelay():Number{ return (impl.scrubDelay); } public static function get toolTipClass():Class{ return (impl.toolTipClass); } mx_internal static function registerErrorString(target:DisplayObject, errorString:String):void{ impl.registerErrorString(target, errorString); } mx_internal static function sizeTip(toolTip:IToolTip):void{ impl.sizeTip(toolTip); } public static function set currentTarget(value:DisplayObject):void{ impl.currentTarget = value; } public static function set showEffect(value:Effect):void{ impl.showEffect = value; } public static function get hideDelay():Number{ return (impl.hideDelay); } public static function set hideEffect(value:Effect):void{ impl.hideEffect = value; } public static function set scrubDelay(value:Number):void{ impl.scrubDelay = value; } public static function get currentToolTip():IToolTip{ return (impl.currentToolTip); } public static function set currentToolTip(value:IToolTip):void{ impl.currentToolTip = value; } public static function get showEffect():Effect{ return (impl.showEffect); } public static function get currentTarget():DisplayObject{ return (impl.currentTarget); } public static function get hideEffect():Effect{ return (impl.hideEffect); } public static function set toolTipClass(value:Class):void{ impl.toolTipClass = value; } } }//package mx.managers
Section 139
//ToolTipManagerImpl (mx.managers.ToolTipManagerImpl) package mx.managers { import flash.events.*; import mx.core.*; import flash.display.*; import flash.utils.*; import flash.geom.*; import mx.styles.*; import mx.events.*; import mx.effects.*; import mx.validators.*; import mx.controls.*; public class ToolTipManagerImpl extends EventDispatcher implements IToolTipManager { private var _enabled:Boolean;// = true private var _showDelay:Number;// = 500 private var _hideEffect:Effect; private var hideTimer:Timer; private var _toolTipClass:Class; private var _scrubDelay:Number;// = 100 private var showTimer:Timer; private var _currentToolTip:IToolTip; private var currentText:String; private var scrubTimer:Timer; private var previousTarget:DisplayObject; private var _currentTarget:DisplayObject; private var _showEffect:Effect; private var initialized:Boolean;// = false private var _hideDelay:Number;// = 10000 private var isError:Boolean; mx_internal static const VERSION:String = "2.0.1.0"; private static var instance:IToolTipManager; public function ToolTipManagerImpl(){ initialized = false; _enabled = true; _hideDelay = 10000; _scrubDelay = 100; _showDelay = 500; _toolTipClass = ToolTip; super(); if (instance){ throw (new Error("Instance already exists.")); }; } private function toolTipMouseOverHandler(event:MouseEvent):void{ checkIfTargetChanged(DisplayObject(event.target)); } private function showTimer_timerHandler(event:TimerEvent):void{ if (currentTarget){ createTip(); initializeTip(); positionTip(); showTip(); }; } private function systemManager_mouseDownHandler(event:MouseEvent):void{ reset(); } public function set showDelay(value:Number):void{ _showDelay = value; } private function hideEffectEnded():void{ var event:ToolTipEvent; reset(); if (previousTarget){ event = new ToolTipEvent(ToolTipEvent.TOOL_TIP_END); event.toolTip = currentToolTip; previousTarget.dispatchEvent(event); }; } public function set scrubDelay(value:Number):void{ _scrubDelay = value; } public function get currentToolTip():IToolTip{ return (_currentToolTip); } private function toolTipMouseOutHandler(event:MouseEvent):void{ checkIfTargetChanged(event.relatedObject); } public function get enabled():Boolean{ return (_enabled); } public function createToolTip(text:String, x:Number, y:Number, errorTipBorderStyle:String=null, context:IUIComponent=null):IToolTip{ var toolTip:ToolTip; var sm:ISystemManager; toolTip = new ToolTip(); sm = (context) ? context.systemManager : Application.application.systemManager; sm.toolTipChildren.addChild(toolTip); if (errorTipBorderStyle){ toolTip.setStyle("styleName", "errorTip"); toolTip.setStyle("borderStyle", errorTipBorderStyle); }; toolTip.text = text; sizeTip(toolTip); toolTip.move(x, y); return ((toolTip as IToolTip)); } private function reset():void{ var sm:ISystemManager; showTimer.reset(); hideTimer.reset(); if (currentToolTip){ if (((showEffect) || (hideEffect))){ currentToolTip.removeEventListener(EffectEvent.EFFECT_END, effectEndHandler); }; EffectManager.endEffectsForTarget(currentToolTip); sm = getSystemManager(previousTarget); sm.toolTipChildren.removeChild(DisplayObject(currentToolTip)); currentToolTip = null; scrubTimer.delay = scrubDelay; scrubTimer.reset(); if (scrubDelay > 0){ scrubTimer.delay = scrubDelay; scrubTimer.start(); }; }; } public function set currentToolTip(value:IToolTip):void{ _currentToolTip = value; } private function showTip():void{ var event:ToolTipEvent; var sm:ISystemManager; event = new ToolTipEvent(ToolTipEvent.TOOL_TIP_SHOW); event.toolTip = currentToolTip; currentTarget.dispatchEvent(event); if (isError){ currentTarget.addEventListener("change", changeHandler); } else { sm = getSystemManager(currentTarget); sm.addEventListener(MouseEvent.MOUSE_DOWN, systemManager_mouseDownHandler); }; currentToolTip.visible = true; if (!showEffect){ showEffectEnded(); }; } private function effectEndHandler(event:EffectEvent):void{ if (event.effectInstance.effect == showEffect){ showEffectEnded(); } else { if (event.effectInstance.effect == hideEffect){ hideEffectEnded(); }; }; } public function get hideDelay():Number{ return (_hideDelay); } public function get toolTipClass():Class{ return (_toolTipClass); } public function get currentTarget():DisplayObject{ return (_currentTarget); } public function get hideEffect():Effect{ return (_hideEffect); } private function showEffectEnded():void{ var event:ToolTipEvent; if (hideDelay == 0){ hideTip(); } else { if (hideDelay < Infinity){ hideTimer.delay = hideDelay; hideTimer.start(); }; }; if (currentTarget){ event = new ToolTipEvent(ToolTipEvent.TOOL_TIP_SHOWN); event.toolTip = currentToolTip; currentTarget.dispatchEvent(event); }; } public function set enabled(value:Boolean):void{ _enabled = value; } private function errorTipMouseOverHandler(event:MouseEvent):void{ checkIfTargetChanged(DisplayObject(event.target)); } public function get scrubDelay():Number{ return (_scrubDelay); } public function get showDelay():Number{ return (_showDelay); } public function registerErrorString(target:DisplayObject, errorString:String):void{ var oldErrorString:String; oldErrorString = IValidatorListener(target).errorString; if (((!(oldErrorString)) && (errorString))){ target.addEventListener(MouseEvent.MOUSE_OVER, errorTipMouseOverHandler); target.addEventListener(MouseEvent.MOUSE_OUT, errorTipMouseOutHandler); } else { if (((oldErrorString) && (!(errorString)))){ target.removeEventListener(MouseEvent.MOUSE_OVER, errorTipMouseOverHandler); target.removeEventListener(MouseEvent.MOUSE_OUT, errorTipMouseOutHandler); }; }; } private function initialize():void{ if (!showTimer){ showTimer = new Timer(0, 1); showTimer.addEventListener(TimerEvent.TIMER, showTimer_timerHandler); }; if (!hideTimer){ hideTimer = new Timer(0, 1); hideTimer.addEventListener(TimerEvent.TIMER, hideTimer_timerHandler); }; if (!scrubTimer){ scrubTimer = new Timer(0, 1); }; initialized = true; } public function destroyToolTip(toolTip:IToolTip):void{ var sm:ISystemManager; sm = toolTip.systemManager; sm.toolTipChildren.removeChild(DisplayObject(toolTip)); } private function checkIfTargetChanged(displayObject:DisplayObject):void{ if (!enabled){ return; }; findTarget(displayObject); if (currentTarget != previousTarget){ targetChanged(); previousTarget = currentTarget; }; } private function changeHandler(event:Event):void{ reset(); } public function set toolTipClass(value:Class):void{ _toolTipClass = value; } private function getGlobalBounds(obj:DisplayObject):Rectangle{ var upperLeft:Point; upperLeft = new Point(0, 0); upperLeft = obj.localToGlobal(upperLeft); return (new Rectangle(upperLeft.x, upperLeft.y, obj.width, obj.height)); } private function positionTip():void{ var x:Number; var y:Number; var screenWidth:Number; var screenHeight:Number; var targetGlobalBounds:Rectangle; var pos:Point; var ctt:IToolTip; var newWidth:Number; var oldWidth:Number; var toolTipWidth:Number; var toolTipHeight:Number; screenWidth = currentToolTip.screen.width; screenHeight = currentToolTip.screen.height; if (isError){ targetGlobalBounds = getGlobalBounds(currentTarget); x = (targetGlobalBounds.right + 4); y = (targetGlobalBounds.top - 1); if ((x + currentToolTip.width) > screenWidth){ newWidth = NaN; oldWidth = NaN; x = (targetGlobalBounds.left - 2); if (((x + currentToolTip.width) + 4) > screenWidth){ newWidth = ((screenWidth - x) - 4); oldWidth = Object(toolTipClass).maxWidth; Object(toolTipClass).maxWidth = newWidth; if ((currentToolTip is IStyleClient)){ IStyleClient(currentToolTip).setStyle("borderStyle", "errorTipAbove"); }; currentToolTip["text"] = currentToolTip["text"]; Object(toolTipClass).maxWidth = oldWidth; } else { if ((currentToolTip is IStyleClient)){ IStyleClient(currentToolTip).setStyle("borderStyle", "errorTipAbove"); }; currentToolTip["text"] = currentToolTip["text"]; }; if ((currentToolTip.height + 2) < targetGlobalBounds.top){ y = (targetGlobalBounds.top - (currentToolTip.height + 2)); } else { y = (targetGlobalBounds.bottom + 2); if (!isNaN(newWidth)){ Object(toolTipClass).maxWidth = newWidth; }; if ((currentToolTip is IStyleClient)){ IStyleClient(currentToolTip).setStyle("borderStyle", "errorTipBelow"); }; currentToolTip["text"] = currentToolTip["text"]; if (!isNaN(oldWidth)){ Object(toolTipClass).maxWidth = oldWidth; }; }; }; sizeTip(currentToolTip); pos = new Point(x, y); ctt = currentToolTip; pos = DisplayObject(ctt).root.globalToLocal(pos); x = pos.x; y = pos.y; } else { x = (Application.application.mouseX + 11); y = (Application.application.mouseY + 22); toolTipWidth = currentToolTip.width; if ((x + toolTipWidth) > screenWidth){ x = (screenWidth - toolTipWidth); }; toolTipHeight = currentToolTip.height; if ((y + toolTipHeight) > screenHeight){ y = (screenHeight - toolTipHeight); }; }; currentToolTip.move(x, y); } private function errorTipMouseOutHandler(event:MouseEvent):void{ checkIfTargetChanged(event.relatedObject); } private function findTarget(displayObject:DisplayObject):void{ while (displayObject) { if ((displayObject is IValidatorListener)){ currentText = IValidatorListener(displayObject).errorString; if (((!((currentText == null))) && (!((currentText == ""))))){ currentTarget = displayObject; isError = true; return; }; }; if ((displayObject is IToolTipManagerClient)){ currentText = IToolTipManagerClient(displayObject).toolTip; if (currentText != null){ currentTarget = displayObject; isError = false; return; }; }; displayObject = displayObject.parent; }; currentText = null; currentTarget = null; } public function registerToolTip(target:DisplayObject, toolTip:String):void{ var oldToolTip:String; if ((target is IToolTipManagerClient)){ oldToolTip = IToolTipManagerClient(target).toolTip; }; if (((!(oldToolTip)) && (toolTip))){ target.addEventListener(MouseEvent.MOUSE_OVER, toolTipMouseOverHandler); target.addEventListener(MouseEvent.MOUSE_OUT, toolTipMouseOutHandler); } else { if (((oldToolTip) && (!(toolTip)))){ target.removeEventListener(MouseEvent.MOUSE_OVER, toolTipMouseOverHandler); target.removeEventListener(MouseEvent.MOUSE_OUT, toolTipMouseOutHandler); }; }; } public function set hideDelay(value:Number):void{ _hideDelay = value; } private function getSystemManager(target:DisplayObject):ISystemManager{ return (((target is IUIComponent)) ? IUIComponent(target).systemManager : null); } public function set currentTarget(value:DisplayObject):void{ _currentTarget = value; } public function set showEffect(value:Effect):void{ _showEffect = value; } public function sizeTip(toolTip:IToolTip):void{ if ((toolTip is IInvalidating)){ IInvalidating(toolTip).validateNow(); }; toolTip.setActualSize(toolTip.getExplicitOrMeasuredWidth(), toolTip.getExplicitOrMeasuredHeight()); } public function set hideEffect(value:Effect):void{ _hideEffect = value; } private function hideTimer_timerHandler(event:TimerEvent):void{ hideTip(); } private function targetChanged():void{ var event:ToolTipEvent; if (!initialized){ initialize(); }; if (((previousTarget) && (currentToolTip))){ event = new ToolTipEvent(ToolTipEvent.TOOL_TIP_HIDE); event.toolTip = currentToolTip; previousTarget.dispatchEvent(event); }; reset(); if (currentTarget){ if (currentText == ""){ return; }; event = new ToolTipEvent(ToolTipEvent.TOOL_TIP_START); currentTarget.dispatchEvent(event); if ((((showDelay == 0)) || (scrubTimer.running))){ createTip(); initializeTip(); positionTip(); showTip(); } else { showTimer.delay = showDelay; showTimer.start(); }; }; } private function initializeTip():void{ if ((currentToolTip is ToolTip)){ ToolTip(currentToolTip).text = currentText; }; if (((isError) && ((currentToolTip is IStyleClient)))){ IStyleClient(currentToolTip).setStyle("styleName", "errorTip"); }; sizeTip(currentToolTip); if ((currentToolTip is IStyleClient)){ if (showEffect){ IStyleClient(currentToolTip).setStyle("showEffect", showEffect); }; if (hideEffect){ IStyleClient(currentToolTip).setStyle("hideEffect", hideEffect); }; }; if (((showEffect) || (hideEffect))){ currentToolTip.addEventListener(EffectEvent.EFFECT_END, effectEndHandler); }; } public function get showEffect():Effect{ return (_showEffect); } private function hideTip():void{ var event:ToolTipEvent; var sm:ISystemManager; if (previousTarget){ event = new ToolTipEvent(ToolTipEvent.TOOL_TIP_HIDE); event.toolTip = currentToolTip; previousTarget.dispatchEvent(event); }; if (currentToolTip){ currentToolTip.visible = false; }; if (isError){ if (currentTarget){ currentTarget.removeEventListener("change", changeHandler); }; } else { if (previousTarget){ sm = getSystemManager(previousTarget); sm.removeEventListener(MouseEvent.MOUSE_DOWN, systemManager_mouseDownHandler); }; }; if (!hideEffect){ hideEffectEnded(); }; } private function createTip():void{ var event:ToolTipEvent; var sm:ISystemManager; event = new ToolTipEvent(ToolTipEvent.TOOL_TIP_CREATE); currentTarget.dispatchEvent(event); if (event.toolTip){ currentToolTip = event.toolTip; } else { currentToolTip = new toolTipClass(); }; currentToolTip.visible = false; sm = getSystemManager(currentTarget); sm.toolTipChildren.addChild(DisplayObject(currentToolTip)); } public static function getInstance():IToolTipManager{ if (!instance){ instance = new (ToolTipManagerImpl); }; return (instance); } } }//package mx.managers
Section 140
//LoaderConfig (mx.messaging.config.LoaderConfig) package mx.messaging.config { import mx.core.*; public class LoaderConfig { mx_internal static const VERSION:String = "2.0.1.0"; mx_internal static var _url:String = null; mx_internal static var _parameters:Object; public function LoaderConfig(){ super(); } public static function get url():String{ return (_url); } public static function get parameters():Object{ return (_parameters); } } }//package mx.messaging.config
Section 141
//IModuleInfo (mx.modules.IModuleInfo) package mx.modules { import flash.events.*; import mx.core.*; import flash.system.*; public interface IModuleInfo extends IEventDispatcher { function get ready():Boolean; function get loaded():Boolean; function get error():Boolean; function get factory():IFlexModuleFactory; function release():void; function get data():Object; function load(_arg1:ApplicationDomain=null, _arg2:SecurityDomain=null):void; function get url():String; function set data(C:\dev\flex_201_ja\sdk\frameworks;mx\modules;IModuleInfo.as:Object):void; function get setup():Boolean; function publish(C:\dev\flex_201_ja\sdk\frameworks;mx\modules;IModuleInfo.as:IFlexModuleFactory):void; function unload():void; } }//package mx.modules
Section 142
//ModuleManager (mx.modules.ModuleManager) package mx.modules { import mx.core.*; public class ModuleManager { mx_internal static const VERSION:String = "2.0.1.0"; public function ModuleManager(){ super(); } public static function getModule(url:String):IModuleInfo{ return (getSingleton().getModule(url)); } private static function getSingleton():Object{ if (!ModuleManagerGlobals.managerSingleton){ ModuleManagerGlobals.managerSingleton = new ModuleManagerImpl(); }; return (ModuleManagerGlobals.managerSingleton); } public static function getAssociatedFactory(object:Object):IFlexModuleFactory{ return (getSingleton().getAssociatedFactory(object)); } } }//package mx.modules import flash.events.*; import mx.core.*; import flash.system.*; import flash.display.*; import flash.utils.*; import mx.events.*; import flash.net.*; class ModuleInfoProxy extends EventDispatcher implements IModuleInfo { private var _data:Object; private var info:ModuleInfo; private var referenced:Boolean;// = false private function ModuleInfoProxy(info:ModuleInfo){ referenced = false; super(); this.info = info; info.addEventListener(ModuleEvent.SETUP, moduleEventHandler); info.addEventListener(ModuleEvent.PROGRESS, moduleEventHandler); info.addEventListener(ModuleEvent.READY, moduleEventHandler); info.addEventListener(ModuleEvent.ERROR, moduleEventHandler); info.addEventListener(ModuleEvent.UNLOAD, moduleEventHandler); } public function get loaded():Boolean{ return (info.loaded); } public function get error():Boolean{ return (info.error); } public function set data(value:Object):void{ _data = value; } public function publish(factory:IFlexModuleFactory):void{ info.publish(factory); } public function get factory():IFlexModuleFactory{ return (info.factory); } public function release():void{ if (referenced){ info.removeReference(); referenced = false; }; } public function get ready():Boolean{ return (info.ready); } public function load(applicationDomain:ApplicationDomain=null, securityDomain:SecurityDomain=null):void{ var moduleEvent:ModuleEvent; info.resurrect(); if (!referenced){ info.addReference(); referenced = true; }; if (info.error){ dispatchEvent(new ModuleEvent(ModuleEvent.ERROR)); } else { if (info.loaded){ if (info.setup){ dispatchEvent(new ModuleEvent(ModuleEvent.SETUP)); if (info.ready){ moduleEvent = new ModuleEvent(ModuleEvent.PROGRESS); moduleEvent.bytesLoaded = info.size; moduleEvent.bytesTotal = info.size; dispatchEvent(moduleEvent); dispatchEvent(new ModuleEvent(ModuleEvent.READY)); }; }; } else { info.load(applicationDomain, securityDomain); }; }; } public function get data():Object{ return (_data); } private function moduleEventHandler(event:ModuleEvent):void{ dispatchEvent(event); } public function get url():String{ return (info.url); } public function get setup():Boolean{ return (info.setup); } public function unload():void{ info.unload(); info.removeEventListener(ModuleEvent.SETUP, moduleEventHandler); info.removeEventListener(ModuleEvent.PROGRESS, moduleEventHandler); info.removeEventListener(ModuleEvent.READY, moduleEventHandler); info.removeEventListener(ModuleEvent.ERROR, moduleEventHandler); info.removeEventListener(ModuleEvent.UNLOAD, moduleEventHandler); } } class ModuleManagerImpl extends EventDispatcher { private var moduleList:Object; private function ModuleManagerImpl(){ moduleList = {}; super(); } public function getModule(url:String):IModuleInfo{ var info:ModuleInfo; info = (moduleList[url] as _slot3); if (!info){ info = new ModuleInfo(url); moduleList[url] = info; }; return (new ModuleInfoProxy(info)); } public function getAssociatedFactory(object:Object):IFlexModuleFactory{ var className:String; var m:Object; var info:ModuleInfo; var domain:ApplicationDomain; var cls:Class; var object = object; className = getQualifiedClassName(object); for each (m in moduleList) { info = (m as _slot3); if (!info.ready){ } else { domain = info.applicationDomain; cls = Class(domain.getDefinition(className)); if ((object is cls)){ return (info.factory); }; //unresolved jump var _slot1 = error; }; }; return (null); } } class ModuleInfo extends EventDispatcher { private var _error:Boolean;// = false private var loader:Loader; private var _loaded:Boolean;// = false private var _ready:Boolean;// = false private var numReferences:int;// = 0 private var _url:String; private var factoryInfo:FactoryInfo; private var limbo:Dictionary; private var _setup:Boolean;// = false private function ModuleInfo(url:String){ numReferences = 0; _error = false; _loaded = false; _ready = false; _setup = false; super(); _url = url; } public function get loaded():Boolean{ return ((limbo) ? false : _loaded); } public function get error():Boolean{ return ((limbo) ? false : _error); } public function get factory():IFlexModuleFactory{ return ((((!(limbo)) && (factoryInfo))) ? factoryInfo.factory : null); } public function release():void{ if (((_ready) && (!(limbo)))){ limbo = new Dictionary(true); limbo[factoryInfo] = 1; factoryInfo = null; } else { unload(); }; } public function get size():int{ return ((((!(limbo)) && (factoryInfo))) ? factoryInfo.bytesTotal : 0); } public function publish(factory:IFlexModuleFactory):void{ if (factoryInfo){ return; }; if (_url.indexOf("published://") != 0){ return; }; factoryInfo = new FactoryInfo(); factoryInfo.factory = factory; _loaded = true; _setup = true; _ready = true; _error = false; dispatchEvent(new ModuleEvent(ModuleEvent.SETUP)); dispatchEvent(new ModuleEvent(ModuleEvent.PROGRESS)); dispatchEvent(new ModuleEvent(ModuleEvent.READY)); } public function initHandler(event:Event):void{ var moduleEvent:ModuleEvent; var event = event; factoryInfo = new FactoryInfo(); factoryInfo.factory = (loader.content as IFlexModuleFactory); //unresolved jump var _slot1 = error; if (!factoryInfo.factory){ moduleEvent = new ModuleEvent(ModuleEvent.ERROR, event.bubbles, event.cancelable); moduleEvent.bytesLoaded = 0; moduleEvent.bytesTotal = 0; moduleEvent.errorText = "SWF is not a loadable module"; dispatchEvent(moduleEvent); return; }; loader.content.addEventListener("ready", readyHandler); factoryInfo.applicationDomain = loader.contentLoaderInfo.applicationDomain; //unresolved jump var _slot1 = error; _setup = true; dispatchEvent(new ModuleEvent(ModuleEvent.SETUP)); } public function resurrect():void{ var f:Object; if (((!(factoryInfo)) && (limbo))){ for (f in limbo) { factoryInfo = (f as _slot4); break; }; limbo = null; }; if (!factoryInfo){ if (_loaded){ dispatchEvent(new ModuleEvent(ModuleEvent.UNLOAD)); }; loader = null; _loaded = false; _setup = false; _ready = false; _error = false; }; } public function errorHandler(event:ErrorEvent):void{ var moduleEvent:ModuleEvent; _error = true; moduleEvent = new ModuleEvent(ModuleEvent.ERROR, event.bubbles, event.cancelable); moduleEvent.bytesLoaded = 0; moduleEvent.bytesTotal = 0; moduleEvent.errorText = event.text; dispatchEvent(moduleEvent); } public function get ready():Boolean{ return ((limbo) ? false : _ready); } public function removeReference():void{ numReferences--; if (numReferences == 0){ release(); }; } public function addReference():void{ numReferences++; } public function get applicationDomain():ApplicationDomain{ return ((((!(limbo)) && (factoryInfo))) ? factoryInfo.applicationDomain : null); } public function readyHandler(event:Event):void{ _ready = true; factoryInfo.bytesTotal = loader.contentLoaderInfo.bytesTotal; clearLoader(); dispatchEvent(new ModuleEvent(ModuleEvent.READY)); } private function clearLoader():void{ if (loader){ if (loader.contentLoaderInfo){ loader.contentLoaderInfo.removeEventListener(Event.INIT, initHandler); loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, completeHandler); loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, progressHandler); loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler); loader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler); }; if (loader.content){ loader.content.removeEventListener("ready", readyHandler); }; //unresolved jump var _slot1 = error; if (_loaded){ loader.close(); //unresolved jump var _slot1 = error; }; loader.unload(); //unresolved jump var _slot1 = error; loader = null; }; } public function progressHandler(event:ProgressEvent):void{ var moduleEvent:ModuleEvent; moduleEvent = new ModuleEvent(ModuleEvent.PROGRESS, event.bubbles, event.cancelable); moduleEvent.bytesLoaded = event.bytesLoaded; moduleEvent.bytesTotal = event.bytesTotal; dispatchEvent(moduleEvent); } public function load(applicationDomain:ApplicationDomain=null, securityDomain:SecurityDomain=null):void{ var r:URLRequest; var c:LoaderContext; if (_loaded){ return; }; _loaded = true; limbo = null; if (_url.indexOf("published://") == 0){ return; }; r = new URLRequest(_url); c = new LoaderContext(); c.applicationDomain = (applicationDomain) ? applicationDomain : new ApplicationDomain(ApplicationDomain.currentDomain); c.securityDomain = securityDomain; if ((((securityDomain == null)) && ((Security.sandboxType == Security.REMOTE)))){ c.securityDomain = SecurityDomain.currentDomain; }; loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.INIT, initHandler); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler); loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler); loader.load(r, c); } public function completeHandler(event:Event):void{ var moduleEvent:ModuleEvent; moduleEvent = new ModuleEvent(ModuleEvent.PROGRESS, event.bubbles, event.cancelable); moduleEvent.bytesLoaded = loader.contentLoaderInfo.bytesLoaded; moduleEvent.bytesTotal = loader.contentLoaderInfo.bytesTotal; dispatchEvent(moduleEvent); } public function get url():String{ return (_url); } public function get setup():Boolean{ return ((limbo) ? false : _setup); } public function unload():void{ clearLoader(); if (_loaded){ dispatchEvent(new ModuleEvent(ModuleEvent.UNLOAD)); }; limbo = null; factoryInfo = null; _loaded = false; _setup = false; _ready = false; _error = false; } } class FactoryInfo { public var bytesTotal:int;// = 0 public var factory:IFlexModuleFactory; public var applicationDomain:ApplicationDomain; private function FactoryInfo(){ bytesTotal = 0; super(); } }
Section 143
//ModuleManagerGlobals (mx.modules.ModuleManagerGlobals) package mx.modules { public class ModuleManagerGlobals { public static var managerSingleton:Object = null; public function ModuleManagerGlobals(){ super(); } } }//package mx.modules
Section 144
//DownloadProgressBar (mx.preloaders.DownloadProgressBar) package mx.preloaders { import flash.events.*; import mx.core.*; import flash.system.*; import flash.display.*; import flash.utils.*; import flash.geom.*; import mx.events.*; import flash.text.*; import mx.graphics.*; import flash.net.*; public class DownloadProgressBar extends Sprite implements IPreloaderDisplay { private var _stageHeight:Number;// = 375 private var _percentRect:Rectangle; private var _percentObj:TextField; private var _backgroundSize:String;// = "" private var _showLabel:Boolean;// = true private var _value:Number;// = 0 private var _backgroundAlpha:Number;// = 1 private var _backgroundImage:Object; private var _backgroundColor:uint; protected var DOWNLOAD_PERCENTAGE:uint;// = 60 private var _labelObj:TextField; private var _barFrameSprite:Sprite; private var _maximum:Number;// = 0 private var _startTime:int; private var _preloader:Sprite; private var _displayTime:int; protected var MINIMUM_DISPLAY_TIME:uint;// = 0 private var _stageWidth:Number;// = 500 private var _downloadingLabel:String;// = "Loading" private var _showProgressBar:Boolean;// = true private var _yOffset:Number;// = 20 private var _initProgressCount:uint;// = 0 private var _barSprite:Sprite; private var _visible:Boolean;// = false private var _barRect:RoundedRectangle; private var _showingDisplay:Boolean;// = false private var _initProgressTotal:uint;// = 12 private var _startedInit:Boolean;// = false private var _labelRect:Rectangle; private var _showPercentage:Boolean;// = false private var _startedLoading:Boolean;// = false private var _displayStartCount:uint;// = 0 private var _borderRect:RoundedRectangle; private var _xOffset:Number;// = 20 private var _label:String;// = "" private var _barFrameRect:RoundedRectangle; mx_internal static const VERSION:String = "2.0.1.0"; private static var _initializingLabel:String = "Initializing"; public function DownloadProgressBar(){ MINIMUM_DISPLAY_TIME = 0; DOWNLOAD_PERCENTAGE = 60; _showProgressBar = true; _labelRect = labelRect; _percentRect = percentRect; _borderRect = borderRect; _barFrameRect = barFrameRect; _barRect = barRect; _xOffset = 20; _yOffset = 20; _maximum = 0; _value = 0; _startedLoading = false; _startedInit = false; _showingDisplay = false; _displayStartCount = 0; _initProgressCount = 0; _initProgressTotal = 12; _visible = false; _backgroundAlpha = 1; _backgroundSize = ""; _stageHeight = 375; _stageWidth = 500; _downloadingLabel = "Loading"; _label = ""; _showLabel = true; _showPercentage = false; super(); } private function calcScale():void{ var scale:Number; if ((((stageWidth < 160)) || ((stageHeight < 120)))){ scaleX = 1; scaleY = 1; } else { if ((((stageWidth < 240)) || ((stageHeight < 150)))){ createChildren(); scale = Math.min((stageWidth / 240), (stageHeight / 150)); scaleX = scale; scaleY = scale; } else { createChildren(); }; }; } protected function get labelFormat():TextFormat{ var tf:TextFormat; tf = new TextFormat(); tf.color = 0x333333; tf.font = "Verdana"; tf.size = 10; return (tf); } protected function rslCompleteHandler(event:RSLEvent):void{ label = ((("Loaded library " + event.rslIndex) + " of ") + event.rslTotal); } protected function set showLabel(value:Boolean):void{ _showLabel = value; draw(); } private function calcBackgroundSize():Number{ var percentage:Number; var index:int; percentage = NaN; if (backgroundSize){ index = backgroundSize.indexOf("%"); if (index != -1){ percentage = Number(backgroundSize.substr(0, index)); }; }; return (percentage); } protected function rslErrorHandler(event:RSLEvent):void{ _preloader.removeEventListener(ProgressEvent.PROGRESS, progressHandler); _preloader.removeEventListener(Event.COMPLETE, completeHandler); _preloader.removeEventListener(RSLEvent.RSL_PROGRESS, rslProgressHandler); _preloader.removeEventListener(RSLEvent.RSL_COMPLETE, rslCompleteHandler); _preloader.removeEventListener(RSLEvent.RSL_ERROR, rslErrorHandler); _preloader.removeEventListener(FlexEvent.INIT_PROGRESS, initProgressHandler); _preloader.removeEventListener(FlexEvent.INIT_COMPLETE, initCompleteHandler); if (!_showingDisplay){ show(); _showingDisplay = true; }; label = ((("RSL Error " + (event.rslIndex + 1)) + " of ") + event.rslTotal); } protected function get barFrameRect():RoundedRectangle{ return (new RoundedRectangle(14, 40, 154, 4)); } private function loader_ioErrorHandler(event:IOErrorEvent):void{ } protected function get borderRect():RoundedRectangle{ return (new RoundedRectangle(0, 0, 182, 60, 4)); } protected function showDisplayForDownloading(elapsedTime:int, event:ProgressEvent):Boolean{ return ((((elapsedTime > 700)) && ((event.bytesLoaded < (event.bytesTotal / 2))))); } private function timerHandler(event:Event=null):void{ dispatchEvent(new Event(Event.COMPLETE)); } protected function progressHandler(event:ProgressEvent):void{ var loaded:uint; var total:uint; var elapsedTime:int; loaded = event.bytesLoaded; total = event.bytesTotal; elapsedTime = (getTimer() - _startTime); if (((_showingDisplay) || (showDisplayForDownloading(elapsedTime, event)))){ if (!_startedLoading){ show(); label = downloadingLabel; _startedLoading = true; }; setProgress(event.bytesLoaded, event.bytesTotal); }; } public function get backgroundSize():String{ return (_backgroundSize); } override public function get visible():Boolean{ return (_visible); } protected function center(width:Number, height:Number):void{ _xOffset = Math.floor(((width - _borderRect.width) / 2)); _yOffset = Math.floor(((height - _borderRect.height) / 2)); } protected function get barRect():RoundedRectangle{ return (new RoundedRectangle(14, 39, 154, 6, 0)); } protected function rslProgressHandler(event:RSLEvent):void{ } public function set backgroundSize(value:String):void{ _backgroundSize = value; } private function initCompleteHandler(event:Event):void{ var elapsedTime:int; var timer:Timer; elapsedTime = (getTimer() - _displayTime); if (((_showingDisplay) && ((elapsedTime < MINIMUM_DISPLAY_TIME)))){ timer = new Timer((MINIMUM_DISPLAY_TIME - elapsedTime), 1); timer.addEventListener(TimerEvent.TIMER, timerHandler); timer.start(); } else { timerHandler(); }; } protected function get percentFormat():TextFormat{ var tf:TextFormat; tf = new TextFormat(); tf.align = "right"; tf.color = 0; tf.font = "Verdana"; tf.size = 10; return (tf); } private function calcY(base:Number):Number{ return ((base + _yOffset)); } protected function setProgress(completed:Number, total:Number):void{ if (((((((!(isNaN(completed))) && (!(isNaN(total))))) && ((completed >= 0)))) && ((total > 0)))){ _value = Number(completed); _maximum = Number(total); draw(); }; } protected function get downloadingLabel():String{ return (_downloadingLabel); } private function calcX(base:Number):Number{ return ((base + _xOffset)); } protected function showDisplayForInit(elapsedTime:int, count:int):Boolean{ return ((((elapsedTime > 300)) && ((count == 2)))); } private function drawProgressBar(percentage:Number):void{ var g:Graphics; var colors:Array; var ratios:Array; var matrix:Matrix; var barWidth:Number; var barWidthSplit:Number; var barHeight:Number; var barX:Number; var barY:Number; var barY2:Number; g = _barSprite.graphics; g.clear(); colors = [0xFFFFFF, 0xFFFFFF]; ratios = [0, 0xFF]; matrix = new Matrix(); barWidth = ((_barRect.width * percentage) / 100); barWidthSplit = (barWidth / 2); barHeight = (_barRect.height - 4); barX = calcX(_barRect.x); barY = (calcY(_barRect.y) + 2); matrix.createGradientBox(barWidthSplit, barHeight, 0, barX, barY); g.beginGradientFill(GradientType.LINEAR, colors, [0.39, 0.85], ratios, matrix); g.drawRect(barX, barY, barWidthSplit, barHeight); matrix.createGradientBox(barWidthSplit, barHeight, 0, (barX + barWidthSplit), barY); g.beginGradientFill(GradientType.LINEAR, colors, [0.85, 1], ratios, matrix); g.drawRect((barX + barWidthSplit), barY, barWidthSplit, barHeight); barWidthSplit = (barWidth / 3); barHeight = _barRect.height; barY = calcY(_barRect.y); barY2 = ((barY + barHeight) - 1); matrix.createGradientBox(barWidthSplit, barHeight, 0, barX, barY); g.beginGradientFill(GradientType.LINEAR, colors, [0.05, 0.15], ratios, matrix); g.drawRect(barX, barY, barWidthSplit, 1); g.drawRect(barX, barY2, barWidthSplit, 1); matrix.createGradientBox(barWidthSplit, barHeight, 0, (barX + barWidthSplit), barY); g.beginGradientFill(GradientType.LINEAR, colors, [0.15, 0.25], ratios, matrix); g.drawRect((barX + barWidthSplit), barY, barWidthSplit, 1); g.drawRect((barX + barWidthSplit), barY2, barWidthSplit, 1); matrix.createGradientBox(barWidthSplit, barHeight, 0, (barX + (barWidthSplit * 2)), barY); g.beginGradientFill(GradientType.LINEAR, colors, [0.25, 0.1], ratios, matrix); g.drawRect((barX + (barWidthSplit * 2)), barY, barWidthSplit, 1); g.drawRect((barX + (barWidthSplit * 2)), barY2, barWidthSplit, 1); barWidthSplit = (barWidth / 3); barHeight = _barRect.height; barY = (calcY(_barRect.y) + 1); barY2 = ((calcY(_barRect.y) + barHeight) - 2); matrix.createGradientBox(barWidthSplit, barHeight, 0, barX, barY); g.beginGradientFill(GradientType.LINEAR, colors, [0.15, 0.3], ratios, matrix); g.drawRect(barX, barY, barWidthSplit, 1); g.drawRect(barX, barY2, barWidthSplit, 1); matrix.createGradientBox(barWidthSplit, barHeight, 0, (barX + barWidthSplit), barY); g.beginGradientFill(GradientType.LINEAR, colors, [0.3, 0.4], ratios, matrix); g.drawRect((barX + barWidthSplit), barY, barWidthSplit, 1); g.drawRect((barX + barWidthSplit), barY2, barWidthSplit, 1); matrix.createGradientBox(barWidthSplit, barHeight, 0, (barX + (barWidthSplit * 2)), barY); g.beginGradientFill(GradientType.LINEAR, colors, [0.4, 0.25], ratios, matrix); g.drawRect((barX + (barWidthSplit * 2)), barY, barWidthSplit, 1); g.drawRect((barX + (barWidthSplit * 2)), barY2, barWidthSplit, 1); } public function get backgroundImage():Object{ return (_backgroundImage); } public function set stageWidth(value:Number):void{ _stageWidth = value; } public function get backgroundAlpha():Number{ if (!isNaN(_backgroundAlpha)){ return (_backgroundAlpha); }; return (1); } public function set preloader(value:Sprite):void{ _preloader = value; value.addEventListener(ProgressEvent.PROGRESS, progressHandler); value.addEventListener(Event.COMPLETE, completeHandler); value.addEventListener(RSLEvent.RSL_PROGRESS, rslProgressHandler); value.addEventListener(RSLEvent.RSL_COMPLETE, rslCompleteHandler); value.addEventListener(RSLEvent.RSL_ERROR, rslErrorHandler); value.addEventListener(FlexEvent.INIT_PROGRESS, initProgressHandler); value.addEventListener(FlexEvent.INIT_COMPLETE, initCompleteHandler); } public function get backgroundColor():uint{ return (_backgroundColor); } protected function set showPercentage(value:Boolean):void{ _showPercentage = value; draw(); } override public function set visible(value:Boolean):void{ if (((!(_visible)) && (value))){ show(); } else { if (((_visible) && (!(value)))){ hide(); }; }; _visible = value; } protected function get labelRect():Rectangle{ return (new Rectangle(14, 17, 100, 16)); } private function show():void{ _showingDisplay = true; calcScale(); draw(); _displayTime = getTimer(); } protected function createChildren():void{ var g:Graphics; var labelObj:TextField; var percentObj:TextField; var frame_g:Graphics; var matrix:Matrix; var ds:RectangularDropShadow; g = graphics; if (backgroundImage != null){ loadBackgroundImage(backgroundImage); }; _barFrameSprite = new Sprite(); _barSprite = new Sprite(); addChild(_barFrameSprite); addChild(_barSprite); g.beginFill(0xCCCCCC, 0.4); g.drawRoundRect(calcX(_borderRect.x), calcY(_borderRect.y), _borderRect.width, _borderRect.height, (_borderRect.cornerRadius * 2), (_borderRect.cornerRadius * 2)); g.drawRoundRect(calcX((_borderRect.x + 1)), calcY((_borderRect.y + 1)), (_borderRect.width - 2), (_borderRect.height - 2), (_borderRect.cornerRadius - (1 * 2)), (_borderRect.cornerRadius - (1 * 2))); g.endFill(); g.beginFill(0xCCCCCC, 0.4); g.drawRoundRect(calcX((_borderRect.x + 1)), calcY((_borderRect.y + 1)), (_borderRect.width - 2), (_borderRect.height - 2), (_borderRect.cornerRadius - (1 * 2)), (_borderRect.cornerRadius - (1 * 2))); g.endFill(); frame_g = _barFrameSprite.graphics; matrix = new Matrix(); matrix.createGradientBox(_barFrameRect.width, _barFrameRect.height, (Math.PI / 2), calcX(_barFrameRect.x), calcY(_barFrameRect.y)); frame_g.beginGradientFill(GradientType.LINEAR, [6054502, 11909306], [1, 1], [0, 0xFF], matrix); frame_g.drawRoundRect(calcX(_barFrameRect.x), calcY(_barFrameRect.y), _barFrameRect.width, _barFrameRect.height, (_barFrameRect.cornerRadius * 2), (_barFrameRect.cornerRadius * 2)); frame_g.drawRoundRect(calcX((_barFrameRect.x + 1)), calcY((_barFrameRect.y + 1)), (_barFrameRect.width - 2), (_barFrameRect.height - 2), (_barFrameRect.cornerRadius * 2), (_barFrameRect.cornerRadius * 2)); frame_g.endFill(); _labelObj = new TextField(); _labelObj.x = calcX(_labelRect.x); _labelObj.y = calcY(_labelRect.y); _labelObj.width = _labelRect.width; _labelObj.height = _labelRect.height; _labelObj.selectable = false; _labelObj.defaultTextFormat = labelFormat; addChild(_labelObj); _percentObj = new TextField(); _percentObj.x = calcX(_percentRect.x); _percentObj.y = calcY(_percentRect.y); _percentObj.width = _percentRect.width; _percentObj.height = _percentRect.height; _percentObj.selectable = false; _percentObj.defaultTextFormat = percentFormat; addChild(_percentObj); ds = new RectangularDropShadow(); ds.color = 0; ds.angle = 90; ds.alpha = 0.6; ds.distance = 2; ds.tlRadius = (ds.trRadius = (ds.blRadius = (ds.brRadius = _borderRect.cornerRadius))); ds.drawShadow(g, calcX(_borderRect.x), calcY(_borderRect.y), _borderRect.width, _borderRect.height); g.lineStyle(1, 0xFFFFFF, 0.3); g.moveTo((calcX(_borderRect.x) + _borderRect.cornerRadius), calcY(_borderRect.y)); g.lineTo(((calcX(_borderRect.x) - _borderRect.cornerRadius) + _borderRect.width), calcY(_borderRect.y)); } private function loadBackgroundImage(classOrString:Object):void{ var cls:Class; var newStyleObj:DisplayObject; var loader:Loader; var loaderContext:LoaderContext; var classOrString = classOrString; if (((classOrString) && ((classOrString as Class)))){ cls = Class(classOrString); initBackgroundImage(new (cls)); } else { if (((classOrString) && ((classOrString is String)))){ cls = Class(getDefinitionByName(String(classOrString))); //unresolved jump var _slot1 = e; if (cls){ newStyleObj = new (cls); initBackgroundImage(newStyleObj); } else { loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_completeHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loader_ioErrorHandler); loaderContext = new LoaderContext(); loaderContext.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain); loader.load(new URLRequest(String(classOrString)), loaderContext); }; }; }; } private function hide():void{ } private function draw():void{ var percentage:Number; if (_startedLoading){ if (!_startedInit){ percentage = Math.round(((getPercentLoaded(_value, _maximum) * DOWNLOAD_PERCENTAGE) / 100)); } else { percentage = Math.round((((getPercentLoaded(_value, _maximum) * (100 - DOWNLOAD_PERCENTAGE)) / 100) + DOWNLOAD_PERCENTAGE)); }; } else { percentage = getPercentLoaded(_value, _maximum); }; if (_labelObj){ _labelObj.text = _label; }; if (_percentObj){ if (!_showPercentage){ _percentObj.visible = false; _percentObj.text = ""; } else { _percentObj.text = (String(percentage) + "%"); }; }; if (((_barSprite) && (_barFrameSprite))){ if (!_showProgressBar){ _barSprite.visible = false; _barFrameSprite.visible = false; } else { drawProgressBar(percentage); }; }; } protected function initProgressHandler(event:Event):void{ var elapsedTime:int; var loaded:Number; elapsedTime = (getTimer() - _startTime); _initProgressCount++; if (((!(_showingDisplay)) && (showDisplayForInit(elapsedTime, _initProgressCount)))){ _displayStartCount = _initProgressCount; show(); } else { if (_showingDisplay){ if (!_startedInit){ _startedInit = true; label = initializingLabel; }; loaded = ((100 * _initProgressCount) / (_initProgressTotal - _displayStartCount)); setProgress(loaded, 100); }; }; } protected function get label():String{ return (_label); } protected function getPercentLoaded(loaded:Number, total:Number):Number{ var perc:Number; if ((((((((loaded == 0)) || ((total == 0)))) || (isNaN(total)))) || (isNaN(loaded)))){ return (0); }; perc = ((100 * loaded) / total); if (((isNaN(perc)) || ((perc <= 0)))){ return (0); }; if (perc > 99){ return (99); }; return (Math.round(perc)); } protected function set downloadingLabel(value:String):void{ _downloadingLabel = value; } public function get stageWidth():Number{ return (_stageWidth); } public function set stageHeight(value:Number):void{ _stageHeight = value; } protected function get showPercentage():Boolean{ return (_showPercentage); } public function initialize():void{ _startTime = getTimer(); center(stageWidth, stageHeight); } private function initBackgroundImage(image:DisplayObject):void{ var backgroundImageWidth:Number; var backgroundImageHeight:Number; var percentage:Number; var offsetX:Number; var offsetY:Number; var sX:Number; var sY:Number; var scale:Number; addChildAt(image, 0); backgroundImageWidth = image.width; backgroundImageHeight = image.height; percentage = calcBackgroundSize(); if (isNaN(percentage)){ sX = 1; sY = 1; } else { scale = (percentage * 0.01); sX = ((scale * stageWidth) / backgroundImageWidth); sY = ((scale * stageHeight) / backgroundImageHeight); }; image.scaleX = sX; image.scaleY = sY; offsetX = Math.round((0.5 * (stageWidth - (backgroundImageWidth * sX)))); offsetY = Math.round((0.5 * (stageHeight - (backgroundImageHeight * sY)))); image.x = offsetX; image.y = offsetY; if (!isNaN(backgroundAlpha)){ image.alpha = backgroundAlpha; }; } public function set backgroundImage(value:Object):void{ _backgroundImage = value; } public function set backgroundAlpha(value:Number):void{ _backgroundAlpha = value; } public function set backgroundColor(value:uint):void{ _backgroundColor = value; } private function loader_completeHandler(event:Event):void{ var target:DisplayObject; target = DisplayObject(LoaderInfo(event.target).loader); initBackgroundImage(target); } public function get stageHeight():Number{ return (_stageHeight); } protected function get percentRect():Rectangle{ return (new Rectangle(108, 4, 34, 16)); } protected function completeHandler(event:Event):void{ } protected function set label(value:String):void{ if (!(value is Function)){ _label = value; }; draw(); } protected function get showLabel():Boolean{ return (_showLabel); } public static function get initializingLabel():String{ return (_initializingLabel); } public static function set initializingLabel(value:String):void{ _initializingLabel = value; } } }//package mx.preloaders
Section 145
//IPreloaderDisplay (mx.preloaders.IPreloaderDisplay) package mx.preloaders { import flash.events.*; import flash.display.*; public interface IPreloaderDisplay extends IEventDispatcher { function get stageHeight():Number; function set backgroundAlpha(C:\dev\flex_201_ja\sdk\frameworks;mx\preloaders;IPreloaderDisplay.as:Number):void; function get stageWidth():Number; function set backgroundColor(C:\dev\flex_201_ja\sdk\frameworks;mx\preloaders;IPreloaderDisplay.as:uint):void; function set preloader(C:\dev\flex_201_ja\sdk\frameworks;mx\preloaders;IPreloaderDisplay.as:Sprite):void; function get backgroundAlpha():Number; function get backgroundColor():uint; function get backgroundSize():String; function set stageWidth(C:\dev\flex_201_ja\sdk\frameworks;mx\preloaders;IPreloaderDisplay.as:Number):void; function set stageHeight(C:\dev\flex_201_ja\sdk\frameworks;mx\preloaders;IPreloaderDisplay.as:Number):void; function set backgroundImage(C:\dev\flex_201_ja\sdk\frameworks;mx\preloaders;IPreloaderDisplay.as:Object):void; function get backgroundImage():Object; function set backgroundSize(C:\dev\flex_201_ja\sdk\frameworks;mx\preloaders;IPreloaderDisplay.as:String):void; function initialize():void; } }//package mx.preloaders
Section 146
//Preloader (mx.preloaders.Preloader) package mx.preloaders { import flash.events.*; import mx.core.*; import flash.system.*; import flash.display.*; import flash.utils.*; import mx.events.*; import flash.net.*; public class Preloader extends Sprite { private var showDisplay:Boolean; private var timer:Timer; private var rslIndex:int;// = 0 private var rslDone:Boolean;// = false private var rslLibs:Array; private var displayClass:IPreloaderDisplay;// = null mx_internal static const VERSION:String = "2.0.1.0"; public function Preloader(){ displayClass = null; rslIndex = 0; rslDone = false; super(); } mx_internal function rslCompleteHandler(event:Event, rsl:RSLNode):void{ var rslEvent:RSLEvent; rslEvent = new RSLEvent(RSLEvent.RSL_COMPLETE); rslEvent.bytesLoaded = rsl.total; rslEvent.bytesTotal = rsl.total; rslEvent.rslIndex = rsl.index; rslEvent.rslTotal = rslLibs.length; rslEvent.url = rsl.url; dispatchEvent(rslEvent); loadRSL(++rslIndex); } private function appProgressHandler(event:Event):void{ dispatchEvent(new FlexEvent(FlexEvent.INIT_PROGRESS)); } mx_internal function rslErrorHandler(event:ErrorEvent, rsl:RSLNode):void{ var rslEvent:RSLEvent; rslEvent = new RSLEvent(RSLEvent.RSL_ERROR); rslEvent.bytesLoaded = 0; rslEvent.bytesTotal = 0; rslEvent.rslIndex = rsl.index; rslEvent.rslTotal = rslLibs.length; rslEvent.url = rsl.url; rslEvent.errorText = event.text; dispatchEvent(rslEvent); } private function displayClassCompleteHandler(event:Event):void{ dispatchEvent(new FlexEvent(FlexEvent.PRELOADER_DONE)); } private function timerHandler(event:TimerEvent):void{ var bytes:Object; var loaded:int; var total:int; if (!root){ return; }; bytes = getByteValues(); loaded = bytes.loaded; total = bytes.total; dispatchEvent(new ProgressEvent(ProgressEvent.PROGRESS, false, false, loaded, total)); if (((rslDone) && ((((((((loaded >= total)) && ((total > 0)))) || ((((total == 0)) && ((loaded > 0)))))) || ((((((root is MovieClip)) && ((MovieClip(root).totalFrames > 2)))) && ((MovieClip(root).framesLoaded >= 2)))))))){ timer.removeEventListener(TimerEvent.TIMER, timerHandler); timer.reset(); dispatchEvent(new Event(Event.COMPLETE)); dispatchEvent(new FlexEvent(FlexEvent.INIT_PROGRESS)); }; } private function getByteValues():Object{ var li:LoaderInfo; var loaded:int; var total:int; var n:int; var i:int; li = root.loaderInfo; loaded = li.bytesLoaded; total = li.bytesTotal; n = (rslLibs) ? rslLibs.length : 0; i = 0; while (i < n) { loaded = (loaded + rslLibs[i].loaded); total = (total + rslLibs[i].total); i++; }; return ({loaded:loaded, total:total}); } private function ioErrorHandler(event:IOErrorEvent):void{ } public function initialize(showDisplay:Boolean, displayClassName:Class, backgroundColor:uint, backgroundAlpha:Number, backgroundImage:Object, backgroundSize:String, displayWidth:Number, displayHeight:Number, libs:Array=null, sizes:Array=null):void{ var n:int; var i:int; var req:URLRequest; var size:int; var node:RSLNode; root.loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); if (((libs) && ((libs.length > 0)))){ rslLibs = []; n = libs.length; i = 0; while (i < n) { req = new URLRequest(libs[i]); size = 0; if (((sizes) && ((sizes.length == libs.length)))){ size = sizes[i]; }; node = new RSLNode(req, i, size, this); rslLibs.push(node); i++; }; loadRSL(0); } else { rslDone = true; }; this.showDisplay = showDisplay; timer = new Timer(10); timer.addEventListener(TimerEvent.TIMER, timerHandler); timer.start(); if (showDisplay){ displayClass = new (displayClassName); displayClass.addEventListener(Event.COMPLETE, displayClassCompleteHandler); addChild(DisplayObject(displayClass)); displayClass.backgroundColor = backgroundColor; displayClass.backgroundAlpha = backgroundAlpha; displayClass.backgroundImage = backgroundImage; displayClass.backgroundSize = backgroundSize; displayClass.stageWidth = displayWidth; displayClass.stageHeight = displayHeight; displayClass.initialize(); displayClass.preloader = this; }; } private function appCreationCompleteHandler(event:FlexEvent):void{ dispatchAppEndEvent(); } mx_internal function rslProgressHandler(event:ProgressEvent, rsl:RSLNode):void{ var rslEvent:RSLEvent; rslEvent = new RSLEvent(RSLEvent.RSL_PROGRESS); rslEvent.bytesLoaded = event.bytesLoaded; rslEvent.bytesTotal = event.bytesTotal; rslEvent.rslIndex = rsl.index; rslEvent.rslTotal = rslLibs.length; rslEvent.url = rsl.url; dispatchEvent(rslEvent); } private function loadRSL(index:int):void{ var rslNode:RSLNode; var loader:Loader; var loaderContext:LoaderContext; if (index < rslLibs.length){ rslNode = rslLibs[index]; loader = new Loader(); loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, rslNode.progressHandler); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, rslNode.completeHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, rslNode.errorHandler); loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, rslNode.errorHandler); loaderContext = new LoaderContext(); loaderContext.applicationDomain = ApplicationDomain.currentDomain; loader.load(rslNode.url, loaderContext); } else { rslDone = true; }; } public function registerApplication(app:IEventDispatcher):void{ app.addEventListener("validatePropertiesComplete", appProgressHandler); app.addEventListener("validateSizeComplete", appProgressHandler); app.addEventListener("validateDisplayListComplete", appProgressHandler); app.addEventListener(FlexEvent.CREATION_COMPLETE, appCreationCompleteHandler); } private function dispatchAppEndEvent(event:Object=null):void{ dispatchEvent(new FlexEvent(FlexEvent.INIT_COMPLETE)); if (!showDisplay){ displayClassCompleteHandler(null); }; } } }//package mx.preloaders import flash.events.*; import mx.core.*; import flash.net.*; class RSLNode { public var completed:Boolean;// = false public var loaded:uint;// = 0 public var total:uint;// = 0 public var index:int; public var errorText:String; public var url:URLRequest; public var owner:Preloader; private function RSLNode(url:URLRequest, index:int, total:int, owner:Preloader){ total = 0; loaded = 0; completed = false; super(); this.url = url; this.index = index; this.total = total; this.owner = owner; } public function errorHandler(event:ErrorEvent):void{ errorText = event.text; completed = true; loaded = 0; total = 0; var _local2 = owner; _local2.mx_internal::rslErrorHandler(event, this); } public function progressHandler(event:ProgressEvent):void{ loaded = event.bytesLoaded; total = event.bytesTotal; var _local2 = owner; _local2.mx_internal::rslProgressHandler(event, this); } public function completeHandler(event:Event):void{ completed = true; var _local2 = owner; _local2.mx_internal::rslCompleteHandler(event, this); } }
Section 147
//ResourceBundle (mx.resources.ResourceBundle) package mx.resources { import mx.core.*; import flash.system.*; import mx.utils.*; public class ResourceBundle { private var content:Object; private var bundleName:String; mx_internal static const VERSION:String = "2.0.1.0"; public function ResourceBundle(){ super(); } protected function getContent():Object{ return (null); } public function getStringArray(key:String):Array{ var array:Array; var n:int; var i:int; array = getObject(key).split(","); n = array.length; i = 0; while (i < n) { array[i] = StringUtil.trim(array[i]); i++; }; return (array); } public function getString(key:String):String{ return (String(getObject(key))); } private function initialize(name:String):void{ bundleName = name; content = getContent(); if (!content){ throw (new Error(("No content found in resource bundle " + bundleName))); }; } public function getObject(key:String):Object{ var value:Object; value = content[key]; if (!value){ throw (new Error(((("Key " + key) + " was not found in resource bundle ") + bundleName))); }; return (value); } public function getBoolean(key:String, defaultValue:Boolean=true):Boolean{ var temp:String; temp = getObject(key).toLowerCase(); if (temp == "false"){ return (false); }; if (temp == "true"){ return (true); }; return (defaultValue); } public function getNumber(key:String):Number{ return (Number(getObject(key))); } private static function getDefinitionByName(name:String, domain:ApplicationDomain):Object{ var definition:Object; if (domain.hasDefinition(name)){ definition = domain.getDefinition(name); }; return (definition); } public static function getResourceBundle(baseName:String, currentDomain:ApplicationDomain=null):ResourceBundle{ var bundleClass:Class; var bundleObj:Object; var bundle:ResourceBundle; if (currentDomain == null){ currentDomain = ApplicationDomain.currentDomain; }; bundleClass = Class(getDefinitionByName((baseName + "_properties"), currentDomain)); if (!bundleClass){ bundleClass = Class(getDefinitionByName(String(baseName), currentDomain)); }; if (bundleClass){ bundleObj = new (bundleClass); if ((bundleObj is _slot1)){ bundle = ResourceBundle(bundleObj); bundle.initialize(String(baseName)); return (bundle); }; }; throw (new Error(("Could not find resource bundle " + baseName))); } } }//package mx.resources
Section 148
//IResponder (mx.rpc.IResponder) package mx.rpc { public interface IResponder { function fault(:Object):void; function result(:Object):void; } }//package mx.rpc
Section 149
//HaloBorder (mx.skins.halo.HaloBorder) package mx.skins.halo { import mx.core.*; import flash.display.*; import mx.styles.*; import mx.graphics.*; import mx.skins.*; import mx.utils.*; public class HaloBorder extends RectangularBorder { private var _borderMetrics:EdgeMetrics; private var dropShadow:RectangularDropShadow; mx_internal static const VERSION:String = "2.0.1.0"; private static var BORDER_WIDTHS:Object = {none:0, solid:1, inset:2, outset:2, alert:3, dropdown:2, menuBorder:1, comboNonEdit:2}; public function HaloBorder(){ super(); BORDER_WIDTHS["default"] = 3; } override public function get borderMetrics():EdgeMetrics{ var borderThickness:Number; var borderStyle:String; var borderSides:String; if (_borderMetrics){ return (_borderMetrics); }; borderStyle = getStyle("borderStyle"); if ((((borderStyle == "default")) || ((borderStyle == "alert")))){ _borderMetrics = new EdgeMetrics(0, 0, 0, 0); } else { if ((((borderStyle == "controlBar")) || ((borderStyle == "applicationControlBar")))){ _borderMetrics = new EdgeMetrics(1, 1, 1, 1); } else { if (borderStyle == "solid"){ borderThickness = getStyle("borderThickness"); if (isNaN(borderThickness)){ borderThickness = 0; }; _borderMetrics = new EdgeMetrics(borderThickness, borderThickness, borderThickness, borderThickness); borderSides = getStyle("borderSides"); if (borderSides != "left top right bottom"){ if (borderSides.indexOf("left") == -1){ _borderMetrics.left = 0; }; if (borderSides.indexOf("top") == -1){ _borderMetrics.top = 0; }; if (borderSides.indexOf("right") == -1){ _borderMetrics.right = 0; }; if (borderSides.indexOf("bottom") == -1){ _borderMetrics.bottom = 0; }; }; } else { borderThickness = BORDER_WIDTHS[borderStyle]; if (isNaN(borderThickness)){ borderThickness = 0; }; _borderMetrics = new EdgeMetrics(borderThickness, borderThickness, borderThickness, borderThickness); }; }; }; return (_borderMetrics); } private function drawDropShadow(x:Number, y:Number, width:Number, height:Number, tlRadius:Number, trRadius:Number, brRadius:Number, blRadius:Number):void{ var distance:Number; var direction:String; var angle:Number; var docked:Boolean; if ((((((((getStyle("dropShadowEnabled") == false)) || ((getStyle("dropShadowEnabled") == "false")))) || ((width == 0)))) || ((height == 0)))){ return; }; distance = getStyle("shadowDistance"); direction = getStyle("shadowDirection"); if (getStyle("borderStyle") == "applicationControlBar"){ docked = getStyle("docked"); angle = (docked) ? 90 : getDropShadowAngle(distance, direction); distance = Math.abs(distance); } else { angle = getDropShadowAngle(distance, direction); distance = (Math.abs(distance) + 2); }; if (!dropShadow){ dropShadow = new RectangularDropShadow(); }; dropShadow.distance = distance; dropShadow.angle = angle; dropShadow.color = getStyle("dropShadowColor"); dropShadow.alpha = 0.4; dropShadow.tlRadius = tlRadius; dropShadow.trRadius = trRadius; dropShadow.blRadius = blRadius; dropShadow.brRadius = brRadius; dropShadow.drawShadow(graphics, x, y, width, height); } private function draw3dBorder(c1:Number, c2:Number, c3:Number, c4:Number, c5:Number, c6:Number):void{ var w:Number; var h:Number; var g:Graphics; w = width; h = height; drawDropShadow(0, 0, width, height, 0, 0, 0, 0); g = graphics; g.beginFill(c1); g.drawRect(0, 0, w, h); g.drawRect(1, 0, (w - 2), h); g.endFill(); g.beginFill(c2); g.drawRect(1, 0, (w - 2), 1); g.endFill(); g.beginFill(c3); g.drawRect(1, (h - 1), (w - 2), 1); g.endFill(); g.beginFill(c4); g.drawRect(1, 1, (w - 2), 1); g.endFill(); g.beginFill(c5); g.drawRect(1, (h - 2), (w - 2), 1); g.endFill(); g.beginFill(c6); g.drawRect(1, 2, (w - 2), (h - 4)); g.drawRect(2, 2, (w - 4), (h - 4)); g.endFill(); } private function getBackgroundColor():Object{ var p:IUIComponent; var color:Object; p = (parent as IUIComponent); if (((p) && (!(p.enabled)))){ color = getStyle("backgroundDisabledColor"); if (color){ return (color); }; }; return (getStyle("backgroundColor")); } override public function styleChanged(styleProp:String):void{ if ((((((((((styleProp == null)) || ((styleProp == "styleName")))) || ((styleProp == "borderStyle")))) || ((styleProp == "borderThickness")))) || ((styleProp == "borderSides")))){ _borderMetrics = null; }; invalidateDisplayList(); } private function getDropShadowAngle(distance:Number, direction:String):Number{ if (direction == "left"){ return (((distance >= 0)) ? 135 : 225); } else { if (direction == "right"){ return (((distance >= 0)) ? 45 : 315); //unresolved jump }; }; return (!NULL!); } override protected function updateDisplayList(w:Number, h:Number):void{ var borderStyle:String; var backgroundColor:Object; var highlightAlphas:Array; var backgroundAlpha:Number; var backgroundAlphaName:String; var backgroundHole:Object; var borderCapColor:uint; var borderColor:uint; var borderSides:String; var borderThickness:Number; var buttonColor:uint; var docked:Boolean; var dropdownBorderColor:uint; var fillColors:Array; var footerColors:Array; var highlightColor:uint; var shadowCapColor:uint; var shadowColor:uint; var themeColor:uint; var translucent:Boolean; var radius:Number; var radiusObj:Object; var bRoundedCorners:Boolean; var hole:Object; var borderColorDrk1:Number; var borderColorDrk2:Number; var borderColorLt1:Number; var borderInnerColor:Object; var g:Graphics; var contentAlpha:Number; var br:Number; var parentContainer:Container; var vm:EdgeMetrics; var showChrome:Boolean; var borderAlpha:Number; var fillAlphas:Array; var backgroundColorNum:uint; var bHasAllSides:Boolean; var holeRadius:Number; var nd:Number; var alpha:Number; var bm:EdgeMetrics; var bottom:Number; var bottomRadius:Number; if (((isNaN(w)) || (isNaN(h)))){ return; }; super.updateDisplayList(w, h); borderStyle = getStyle("borderStyle"); backgroundColor = getBackgroundColor(); highlightAlphas = getStyle("highlightAlphas"); backgroundAlphaName = "backgroundAlpha"; radius = 0; radiusObj = null; bRoundedCorners = false; g = graphics; g.clear(); if (borderStyle){ switch (borderStyle){ case "none": break; case "inset": borderColor = getStyle("borderColor"); borderColorDrk1 = ColorUtil.adjustBrightness2(borderColor, -40); borderColorDrk2 = ColorUtil.adjustBrightness2(borderColor, 25); borderColorLt1 = ColorUtil.adjustBrightness2(borderColor, 40); borderInnerColor = backgroundColor; if ((((borderInnerColor === null)) || ((borderInnerColor === "")))){ borderInnerColor = borderColor; }; draw3dBorder(borderColorDrk2, borderColorDrk1, borderColorLt1, Number(borderInnerColor), Number(borderInnerColor), Number(borderInnerColor)); break; case "outset": borderColor = getStyle("borderColor"); borderColorDrk1 = ColorUtil.adjustBrightness2(borderColor, -40); borderColorDrk2 = ColorUtil.adjustBrightness2(borderColor, -25); borderColorLt1 = ColorUtil.adjustBrightness2(borderColor, 40); borderInnerColor = backgroundColor; if ((((borderInnerColor === null)) || ((borderInnerColor === "")))){ borderInnerColor = borderColor; }; draw3dBorder(borderColorDrk2, borderColorLt1, borderColorDrk1, Number(borderInnerColor), Number(borderInnerColor), Number(borderInnerColor)); break; case "alert": case "default": contentAlpha = getStyle("backgroundAlpha"); backgroundAlpha = getStyle("borderAlpha"); backgroundAlphaName = "borderAlpha"; radius = getStyle("cornerRadius"); bRoundedCorners = (getStyle("roundedBottomCorners").toString().toLowerCase() == "true"); br = (bRoundedCorners) ? radius : 0; drawDropShadow(0, 0, w, h, radius, radius, br, br); if (!bRoundedCorners){ radiusObj = {}; }; parentContainer = (parent as Container); if (parentContainer){ vm = parentContainer.viewMetrics; backgroundHole = {x:vm.left, y:vm.top, w:Math.max(0, ((w - vm.left) - vm.right)), h:Math.max(0, ((h - vm.top) - vm.bottom)), r:0}; if ((((backgroundHole.w > 0)) && ((backgroundHole.h > 0)))){ if (contentAlpha != backgroundAlpha){ drawDropShadow(backgroundHole.x, backgroundHole.y, backgroundHole.w, backgroundHole.h, 0, 0, 0, 0); }; g.beginFill(Number(backgroundColor), contentAlpha); g.drawRect(backgroundHole.x, backgroundHole.y, backgroundHole.w, backgroundHole.h); g.endFill(); }; }; backgroundColor = getStyle("borderColor"); break; case "dropdown": dropdownBorderColor = getStyle("dropdownBorderColor"); drawDropShadow(0, 0, w, h, 4, 0, 0, 4); drawRoundRect(0, 0, w, h, {tl:4, tr:0, br:0, bl:4}, 5068126, 1); drawRoundRect(0, 0, w, h, {tl:4, tr:0, br:0, bl:4}, [0xFFFFFF, 0xFFFFFF], [0.7, 0], verticalGradientMatrix(0, 0, w, h)); drawRoundRect(1, 1, (w - 1), (h - 2), {tl:3, tr:0, br:0, bl:3}, 0xFFFFFF, 1); drawRoundRect(1, 2, (w - 1), (h - 3), {tl:3, tr:0, br:0, bl:3}, [0xEEEEEE, 0xFFFFFF], 1, verticalGradientMatrix(0, 0, (w - 1), (h - 3))); if (!isNaN(dropdownBorderColor)){ drawRoundRect(0, 0, (w + 1), h, {tl:4, tr:0, br:0, bl:4}, dropdownBorderColor, 0.5); drawRoundRect(1, 1, (w - 1), (h - 2), {tl:3, tr:0, br:0, bl:3}, 0xFFFFFF, 1); drawRoundRect(1, 2, (w - 1), (h - 3), {tl:3, tr:0, br:0, bl:3}, [0xEEEEEE, 0xFFFFFF], 1, verticalGradientMatrix(0, 0, (w - 1), (h - 3))); }; backgroundColor = null; break; case "menuBorder": borderColor = getStyle("borderColor"); drawRoundRect(0, 0, w, h, 0, borderColor, 1); drawDropShadow(1, 1, (w - 2), (h - 2), 0, 0, 0, 0); break; case "comboNonEdit": break; case "controlBar": if ((((w == 0)) || ((h == 0)))){ backgroundColor = null; break; }; footerColors = getStyle("footerColors"); showChrome = !((footerColors == null)); borderAlpha = getStyle("borderAlpha"); if (showChrome){ g.lineStyle(0, ((footerColors.length > 0)) ? footerColors[1] : footerColors[0], borderAlpha); g.moveTo(0, 0); g.lineTo(w, 0); g.lineStyle(0, 0, 0); if (((((parent) && (parent.parent))) && ((parent.parent is IStyleClient)))){ radius = IStyleClient(parent.parent).getStyle("cornerRadius"); borderAlpha = IStyleClient(parent.parent).getStyle("borderAlpha"); }; if (isNaN(radius)){ radius = 0; }; if (IStyleClient(parent.parent).getStyle("roundedBottomCorners").toString().toLowerCase() != "true"){ radius = 0; }; drawRoundRect(0, 1, w, (h - 1), {tl:0, tr:0, bl:radius, br:radius}, footerColors, borderAlpha, verticalGradientMatrix(0, 0, w, h)); if ((((footerColors.length > 1)) && (!((footerColors[0] == footerColors[1]))))){ drawRoundRect(0, 1, w, (h - 1), {tl:0, tr:0, bl:radius, br:radius}, [0xFFFFFF, 0xFFFFFF], highlightAlphas, verticalGradientMatrix(0, 0, w, h)); drawRoundRect(1, 2, (w - 2), (h - 3), {tl:0, tr:0, bl:(radius - 1), br:(radius - 1)}, footerColors, borderAlpha, verticalGradientMatrix(0, 0, w, h)); }; }; backgroundColor = null; break; case "applicationControlBar": fillColors = getStyle("fillColors"); backgroundAlpha = getStyle("backgroundAlpha"); highlightAlphas = getStyle("highlightAlphas"); fillAlphas = getStyle("fillAlphas"); docked = getStyle("docked"); backgroundColorNum = uint(backgroundColor); radius = getStyle("cornerRadius"); if (!radius){ radius = 0; }; drawDropShadow(0, 1, w, (h - 1), radius, radius, radius, radius); if (backgroundColor){ drawRoundRect(0, 1, w, (h - 1), radius, backgroundColorNum, backgroundAlpha, verticalGradientMatrix(0, 0, w, h)); }; drawRoundRect(0, 1, w, (h - 1), radius, fillColors, fillAlphas, verticalGradientMatrix(0, 0, w, h)); drawRoundRect(0, 1, w, ((h / 2) - 1), {tl:radius, tr:radius, bl:0, br:0}, [0xFFFFFF, 0xFFFFFF], highlightAlphas, verticalGradientMatrix(0, 0, w, ((h / 2) - 1))); drawRoundRect(0, 1, w, (h - 1), {tl:radius, tr:radius, bl:0, br:0}, 0xFFFFFF, 0.3, null, GradientType.LINEAR, null, {x:0, y:2, w:w, h:(h - 2), r:{tl:radius, tr:radius, bl:0, br:0}}); backgroundColor = null; break; default: borderColor = getStyle("borderColor"); borderThickness = getStyle("borderThickness"); borderSides = getStyle("borderSides"); bHasAllSides = true; radius = getStyle("cornerRadius"); bRoundedCorners = (getStyle("roundedBottomCorners").toString().toLowerCase() == "true"); holeRadius = Math.max((radius - borderThickness), 0); hole = {x:borderThickness, y:borderThickness, w:(w - (borderThickness * 2)), h:(h - (borderThickness * 2)), r:holeRadius}; if (!bRoundedCorners){ radiusObj = {tl:radius, tr:radius, bl:0, br:0}; hole.r = {tl:holeRadius, tr:holeRadius, bl:0, br:0}; }; if (borderSides != "left top right bottom"){ hole.r = {tl:holeRadius, tr:holeRadius, bl:(bRoundedCorners) ? holeRadius : 0, br:(bRoundedCorners) ? holeRadius : 0}; radiusObj = {tl:radius, tr:radius, bl:(bRoundedCorners) ? radius : 0, br:(bRoundedCorners) ? radius : 0}; borderSides = borderSides.toLowerCase(); if (borderSides.indexOf("left") == -1){ hole.x = 0; hole.w = (hole.w + borderThickness); hole.r.tl = 0; hole.r.bl = 0; radiusObj.tl = 0; radiusObj.bl = 0; bHasAllSides = false; }; if (borderSides.indexOf("top") == -1){ hole.y = 0; hole.h = (hole.h + borderThickness); hole.r.tl = 0; hole.r.tr = 0; radiusObj.tl = 0; radiusObj.tr = 0; bHasAllSides = false; }; if (borderSides.indexOf("right") == -1){ hole.w = (hole.w + borderThickness); hole.r.tr = 0; hole.r.br = 0; radiusObj.tr = 0; radiusObj.br = 0; bHasAllSides = false; }; if (borderSides.indexOf("bottom") == -1){ hole.h = (hole.h + borderThickness); hole.r.bl = 0; hole.r.br = 0; radiusObj.bl = 0; radiusObj.br = 0; bHasAllSides = false; }; }; if ((((radius == 0)) && (bHasAllSides))){ drawDropShadow(0, 0, w, h, 0, 0, 0, 0); g.beginFill(borderColor); g.drawRect(0, 0, w, h); g.drawRect(borderThickness, borderThickness, (w - (2 * borderThickness)), (h - (2 * borderThickness))); g.endFill(); } else { if (radiusObj){ drawDropShadow(0, 0, w, h, radiusObj.tl, radiusObj.tr, radiusObj.br, radiusObj.bl); drawRoundRect(0, 0, w, h, radiusObj, borderColor, 1, null, null, null, hole); radiusObj.tl = Math.max((radius - borderThickness), 0); radiusObj.tr = Math.max((radius - borderThickness), 0); radiusObj.bl = (bRoundedCorners) ? Math.max((radius - borderThickness), 0) : 0; radiusObj.br = (bRoundedCorners) ? Math.max((radius - borderThickness), 0) : 0; } else { drawDropShadow(0, 0, w, h, radius, radius, radius, radius); drawRoundRect(0, 0, w, h, radius, borderColor, 1, null, null, null, hole); radius = Math.max((getStyle("cornerRadius") - borderThickness), 0); }; }; }; }; if (((((((!((backgroundColor === null))) && (!((backgroundColor === ""))))) || (getStyle("mouseShield")))) || (getStyle("mouseShieldChildren")))){ nd = Number(backgroundColor); alpha = 1; bm = borderMetrics; if (((((isNaN(nd)) || ((backgroundColor === "")))) || ((backgroundColor === null)))){ alpha = 0; nd = 0xFFFFFF; } else { alpha = getStyle(backgroundAlphaName); }; if (((!((radius == 0))) || (backgroundHole))){ bottom = bm.bottom; if (radiusObj){ bottomRadius = (bRoundedCorners) ? radius : 0; radiusObj = {tl:radius, tr:radius, bl:bottomRadius, br:bottomRadius}; drawRoundRect(bm.left, bm.top, (width - (bm.left + bm.right)), (height - (bm.top + bottom)), radiusObj, nd, alpha, null, GradientType.LINEAR, null, backgroundHole); } else { drawRoundRect(bm.left, bm.top, (width - (bm.left + bm.right)), (height - (bm.top + bottom)), radius, nd, alpha, null, GradientType.LINEAR, null, backgroundHole); }; } else { g.beginFill(nd, alpha); g.drawRect(bm.left, bm.top, ((w - bm.right) - bm.left), ((h - bm.bottom) - bm.top)); g.endFill(); }; }; } } }//package mx.skins.halo
Section 150
//HaloFocusRect (mx.skins.halo.HaloFocusRect) package mx.skins.halo { import mx.core.*; import flash.display.*; import mx.styles.*; import mx.skins.*; import mx.utils.*; public class HaloFocusRect extends ProgrammaticSkin implements IStyleClient { private var _focusColor:Number; mx_internal static const VERSION:String = "2.0.1.0"; public function HaloFocusRect(){ super(); } public function get styleDeclaration():CSSStyleDeclaration{ return (CSSStyleDeclaration(styleName)); } public function set styleDeclaration(value:CSSStyleDeclaration):void{ } public function notifyStyleChangeInChildren(styleProp:String, recursive:Boolean):void{ } public function regenerateStyleCache(recursive:Boolean):void{ } public function get className():String{ return ("HaloFocusRect"); } public function clearStyle(styleProp:String):void{ if (styleProp == "focusColor"){ _focusColor = NaN; }; } public function setStyle(styleProp:String, newValue):void{ if (styleProp == "focusColor"){ _focusColor = newValue; }; } public function set nonInheritingStyles(value:Object):void{ } public function set inheritingStyles(value:Object):void{ } public function get nonInheritingStyles():Object{ return (styleName.nonInheritingStyles); } public function get inheritingStyles():Object{ return (styleName.inheritingStyles); } public function registerEffects(effects:Array):void{ } public function getClassStyleDeclarations():Array{ return ([]); } override protected function updateDisplayList(w:Number, h:Number):void{ var focusBlendMode:String; var focusAlpha:Number; var focusColor:Number; var cornerRadius:Number; var focusThickness:Number; var focusRoundedCorners:String; var themeColor:Number; var rectColor:Number; var g:Graphics; var tl:Number; var bl:Number; var tr:Number; var br:Number; var nr:Number; var ellipseSize:Number; super.updateDisplayList(w, h); focusBlendMode = getStyle("focusBlendMode"); focusAlpha = getStyle("focusAlpha"); focusColor = getStyle("focusColor"); cornerRadius = getStyle("cornerRadius"); focusThickness = getStyle("focusThickness"); focusRoundedCorners = getStyle("focusRoundedCorners"); themeColor = getStyle("themeColor"); rectColor = focusColor; if (!rectColor){ rectColor = themeColor; }; g = graphics; g.clear(); blendMode = focusBlendMode; if (((!((focusRoundedCorners == "tl tr bl br"))) && ((cornerRadius > 0)))){ tl = 0; bl = 0; tr = 0; br = 0; nr = (cornerRadius + focusThickness); if (focusRoundedCorners.indexOf("tl") >= 0){ tl = nr; }; if (focusRoundedCorners.indexOf("tr") >= 0){ tr = nr; }; if (focusRoundedCorners.indexOf("bl") >= 0){ bl = nr; }; if (focusRoundedCorners.indexOf("br") >= 0){ br = nr; }; g.beginFill(rectColor, focusAlpha); GraphicsUtil.drawRoundRectComplex(g, 0, 0, w, h, tl, tr, bl, br); tl = (tl) ? cornerRadius : 0; tr = (tr) ? cornerRadius : 0; bl = (bl) ? cornerRadius : 0; br = (br) ? cornerRadius : 0; GraphicsUtil.drawRoundRectComplex(g, focusThickness, focusThickness, (w - (2 * focusThickness)), (h - (2 * focusThickness)), tl, tr, bl, br); g.endFill(); nr = (cornerRadius + (focusThickness / 2)); tl = (tl) ? nr : 0; tr = (tr) ? nr : 0; bl = (bl) ? nr : 0; br = (br) ? nr : 0; g.beginFill(rectColor, focusAlpha); GraphicsUtil.drawRoundRectComplex(g, (focusThickness / 2), (focusThickness / 2), (w - focusThickness), (h - focusThickness), tl, tr, bl, br); tl = (tl) ? cornerRadius : 0; tr = (tr) ? cornerRadius : 0; bl = (bl) ? cornerRadius : 0; br = (br) ? cornerRadius : 0; GraphicsUtil.drawRoundRectComplex(g, focusThickness, focusThickness, (w - (2 * focusThickness)), (h - (2 * focusThickness)), tl, tr, bl, br); g.endFill(); } else { g.beginFill(rectColor, focusAlpha); ellipseSize = (((cornerRadius > 0)) ? (cornerRadius + focusThickness) : 0 * 2); g.drawRoundRect(0, 0, w, h, ellipseSize, ellipseSize); ellipseSize = (cornerRadius * 2); g.drawRoundRect(focusThickness, focusThickness, (w - (2 * focusThickness)), (h - (2 * focusThickness)), ellipseSize, ellipseSize); g.endFill(); g.beginFill(rectColor, focusAlpha); ellipseSize = (((cornerRadius > 0)) ? (cornerRadius + (focusThickness / 2)) : 0 * 2); g.drawRoundRect((focusThickness / 2), (focusThickness / 2), (w - focusThickness), (h - focusThickness), ellipseSize, ellipseSize); ellipseSize = (cornerRadius * 2); g.drawRoundRect(focusThickness, focusThickness, (w - (2 * focusThickness)), (h - (2 * focusThickness)), ellipseSize, ellipseSize); g.endFill(); }; } override public function getStyle(styleProp:String){ return (((styleProp == "focusColor")) ? _focusColor : super.getStyle(styleProp)); } } }//package mx.skins.halo
Section 151
//Border (mx.skins.Border) package mx.skins { import mx.core.*; public class Border extends ProgrammaticSkin { mx_internal static const VERSION:String = "2.0.1.0"; public function Border(){ super(); } public function get borderMetrics():EdgeMetrics{ return (EdgeMetrics.EMPTY); } } }//package mx.skins
Section 152
//ProgrammaticSkin (mx.skins.ProgrammaticSkin) package mx.skins { import mx.core.*; import flash.display.*; import flash.geom.*; import mx.styles.*; import mx.managers.*; import mx.utils.*; public class ProgrammaticSkin extends FlexShape implements IFlexDisplayObject, IInvalidating, ILayoutManagerClient, ISimpleStyleClient { private var _initialized:Boolean;// = false private var invalidateDisplayListFlag:Boolean;// = false private var _height:Number; private var _styleName:IStyleClient; private var _processedDescriptors:Boolean;// = false private var _updateCompletePendingFlag:Boolean;// = true private var _width:Number; private var _nestLevel:int;// = 0 mx_internal static const VERSION:String = "2.0.1.0"; private static var tempMatrix:Matrix = new Matrix(); public function ProgrammaticSkin(){ invalidateDisplayListFlag = false; _initialized = false; _nestLevel = 0; _processedDescriptors = false; _updateCompletePendingFlag = true; super(); _width = measuredWidth; _height = measuredHeight; } protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ } public function invalidateSize():void{ } public function getStyle(styleProp:String){ return (_styleName.getStyle(styleProp)); } public function get nestLevel():int{ return (_nestLevel); } public function set nestLevel(value:int):void{ _nestLevel = value; invalidateDisplayList(); } override public function get height():Number{ return (_height); } public function get updateCompletePendingFlag():Boolean{ return (_updateCompletePendingFlag); } protected function verticalGradientMatrix(x:Number, y:Number, width:Number, height:Number):Matrix{ return (rotatedGradientMatrix(x, y, width, height, 90)); } public function validateSize(recursive:Boolean=false):void{ } public function invalidateDisplayList():void{ if (((!(invalidateDisplayListFlag)) && ((nestLevel > 0)))){ invalidateDisplayListFlag = true; UIComponentGlobals.layoutManager.invalidateDisplayList(this); }; } public function set updateCompletePendingFlag(value:Boolean):void{ _updateCompletePendingFlag = value; } override public function set height(value:Number):void{ _height = value; invalidateDisplayList(); } protected function horizontalGradientMatrix(x:Number, y:Number, width:Number, height:Number):Matrix{ return (rotatedGradientMatrix(x, y, width, height, 0)); } public function set processedDescriptors(value:Boolean):void{ _processedDescriptors = value; } override public function set width(value:Number):void{ _width = value; invalidateDisplayList(); } public function validateDisplayList():void{ invalidateDisplayListFlag = false; updateDisplayList(width, height); } public function get measuredWidth():Number{ return (0); } public function set initialized(value:Boolean):void{ _initialized = value; } protected function drawRoundRect(x:Number, y:Number, width:Number, height:Number, cornerRadius:Object=null, color:Object=null, alpha:Object=null, gradientMatrix:Matrix=null, gradientType:String="linear", gradientRatios:Array=null, hole:Object=null):void{ var g:Graphics; var ellipseSize:Number; var alphas:Array; var holeR:Object; g = graphics; if ((((width == 0)) || ((height == 0)))){ return; }; if (color !== null){ if ((color is uint)){ g.beginFill(uint(color), Number(alpha)); } else { if ((color is Array)){ alphas = ((alpha is Array)) ? (alpha as Array) : [alpha, alpha]; if (!gradientRatios){ gradientRatios = [0, 0xFF]; }; g.beginGradientFill(gradientType, (color as Array), alphas, gradientRatios, gradientMatrix); }; }; }; if (!cornerRadius){ g.drawRect(x, y, width, height); } else { if ((cornerRadius is Number)){ ellipseSize = (Number(cornerRadius) * 2); g.drawRoundRect(x, y, width, height, ellipseSize, ellipseSize); } else { GraphicsUtil.drawRoundRectComplex(g, x, y, width, height, cornerRadius.tl, cornerRadius.tr, cornerRadius.bl, cornerRadius.br); }; }; if (hole){ holeR = hole.r; if ((holeR is Number)){ ellipseSize = (Number(holeR) * 2); g.drawRoundRect(hole.x, hole.y, hole.w, hole.h, ellipseSize, ellipseSize); } else { GraphicsUtil.drawRoundRectComplex(g, hole.x, hole.y, hole.w, hole.h, holeR.tl, holeR.tr, holeR.bl, holeR.br); }; }; if (color !== null){ g.endFill(); }; } public function get measuredHeight():Number{ return (0); } public function get processedDescriptors():Boolean{ return (_processedDescriptors); } public function set styleName(value:Object):void{ if (_styleName != value){ _styleName = (value as IStyleClient); invalidateDisplayList(); }; } public function setActualSize(newWidth:Number, newHeight:Number):void{ var changed:Boolean; changed = false; if (_width != newWidth){ _width = newWidth; changed = true; }; if (_height != newHeight){ _height = newHeight; changed = true; }; if (changed){ invalidateDisplayList(); }; } override public function get width():Number{ return (_width); } public function styleChanged(styleProp:String):void{ invalidateDisplayList(); } public function invalidateProperties():void{ } public function move(x:Number, y:Number):void{ this.x = x; this.y = y; } public function get initialized():Boolean{ return (_initialized); } protected function rotatedGradientMatrix(x:Number, y:Number, width:Number, height:Number, rotation:Number):Matrix{ tempMatrix.createGradientBox(width, height, ((rotation * Math.PI) / 180), x, y); return (tempMatrix); } public function get styleName():Object{ return (_styleName); } public function validateProperties():void{ } public function validateNow():void{ if (invalidateDisplayListFlag){ validateDisplayList(); }; } } }//package mx.skins
Section 153
//RectangularBorder (mx.skins.RectangularBorder) package mx.skins { import flash.events.*; import mx.core.*; import mx.resources.*; import flash.system.*; import flash.display.*; import flash.utils.*; import flash.geom.*; import mx.styles.*; import flash.net.*; import mx.utils.*; public class RectangularBorder extends Border { private var backgroundImageWidth:Number; private var backgroundImageStyle:Object; mx_internal var loader:Loader; private var backgroundMask:Shape; private var backgroundImageHeight:Number; private var _backgroundImageRect:Rectangle; private var backgroundImage:DisplayObject; mx_internal static const VERSION:String = "2.0.1.0"; private static var resourceNotLoaded:String; private static var packageResources:ResourceBundle = ResourceBundle.getResourceBundle("skins", ApplicationDomain.currentDomain); public function RectangularBorder(){ super(); addEventListener(Event.REMOVED, removedHandler); } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ var newStyle:Object; var cls:Class; var imgParent:DisplayObjectContainer; var childrenList:IChildList; var newStyleObj:DisplayObject; var loaderContext:LoaderContext; var unscaledWidth = unscaledWidth; var unscaledHeight = unscaledHeight; if (!parent){ return; }; newStyle = getStyle("backgroundImage"); if (newStyle != backgroundImageStyle){ backgroundImageStyle = newStyle; if (backgroundImage){ imgParent = backgroundImage.parent; childrenList = ((imgParent is Container)) ? Container(imgParent).rawChildren : IChildList(imgParent); childrenList.removeChild(backgroundImage); }; backgroundImage = null; if (((newStyle) && ((newStyle as Class)))){ cls = Class(newStyle); initBackgroundImage(new (cls)); } else { if (((newStyle) && ((newStyle is String)))){ cls = Class(getDefinitionByName(String(newStyle))); //unresolved jump var _slot1 = e; if (cls){ newStyleObj = new (cls); initBackgroundImage(newStyleObj); } else { loader = new FlexLoader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeEventHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorEventHandler); loader.contentLoaderInfo.addEventListener(ErrorEvent.ERROR, errorEventHandler); loaderContext = new LoaderContext(); loaderContext.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain); loader.load(new URLRequest(String(newStyle)), loaderContext); }; } else { if (newStyle){ throw (new Error(StringUtil.substitute(resourceNotLoaded, newStyle))); }; }; }; }; if (backgroundImage){ adjustBackgroundImage(); }; } private function completeEventHandler(event:Event):void{ var target:DisplayObject; if (!parent){ return; }; target = DisplayObject(LoaderInfo(event.target).loader); initBackgroundImage(target); adjustBackgroundImage(); dispatchEvent(event.clone()); } mx_internal function get backgroundImageRect():Rectangle{ return (_backgroundImageRect); } private function getBackgroundSize():Number{ var percentage:Number; var backgroundSize:Object; var index:int; percentage = NaN; backgroundSize = getStyle("backgroundSize"); if (((backgroundSize) && ((backgroundSize is String)))){ index = backgroundSize.indexOf("%"); if (index != -1){ percentage = Number(backgroundSize.substr(0, index)); }; }; return (percentage); } mx_internal function adjustBackgroundImage():void{ var p:DisplayObject; var bm:EdgeMetrics; var scrollableBk:Boolean; var percentage:Number; var offsetX:Number; var offsetY:Number; var maskWidth:Number; var maskHeight:Number; var sW:Number; var sH:Number; var sX:Number; var sY:Number; var scale:Number; var g:Graphics; p = parent; bm = ((p is Container)) ? Container(p).viewMetrics : borderMetrics; scrollableBk = !((getStyle("backgroundAttachment") == "fixed")); if (_backgroundImageRect){ sW = _backgroundImageRect.width; sH = _backgroundImageRect.height; } else { sW = ((width - bm.left) - bm.right); sH = ((height - bm.top) - bm.bottom); }; percentage = getBackgroundSize(); if (isNaN(percentage)){ sX = 1; sY = 1; } else { scale = (percentage * 0.01); sX = ((scale * sW) / backgroundImageWidth); sY = ((scale * sH) / backgroundImageHeight); }; backgroundImage.scaleX = sX; backgroundImage.scaleY = sY; offsetX = Math.round((0.5 * (sW - (backgroundImageWidth * sX)))); offsetY = Math.round((0.5 * (sH - (backgroundImageHeight * sY)))); backgroundImage.x = bm.left; backgroundImage.y = bm.top; backgroundMask.x = bm.left; backgroundMask.y = bm.top; if (((scrollableBk) && ((p is Container)))){ offsetX = (offsetX - Container(p).horizontalScrollPosition); offsetY = (offsetY - Container(p).verticalScrollPosition); }; backgroundImage.alpha = getStyle("backgroundAlpha"); backgroundImage.x = (backgroundImage.x + offsetX); backgroundImage.y = (backgroundImage.y + offsetY); maskWidth = ((width - bm.left) - bm.right); maskHeight = ((height - bm.top) - bm.bottom); if (((!((backgroundMask.width == maskWidth))) || (!((backgroundMask.height == maskHeight))))){ g = backgroundMask.graphics; g.clear(); g.beginFill(0xFFFFFF); g.drawRect(0, 0, maskWidth, maskHeight); g.endFill(); }; } private function errorEventHandler(event:Event):void{ } private function initBackgroundImage(image:DisplayObject):void{ var childrenList:IChildList; var myIndex:int; backgroundImage = image; if ((image is Loader)){ backgroundImageWidth = Loader(image).contentLoaderInfo.width; backgroundImageHeight = Loader(image).contentLoaderInfo.height; } else { backgroundImageWidth = backgroundImage.width; backgroundImageHeight = backgroundImage.height; if ((image is ISimpleStyleClient)){ ISimpleStyleClient(image).styleName = styleName; }; }; childrenList = ((parent is Container)) ? Container(parent).rawChildren : IChildList(parent); backgroundMask = new FlexShape(); backgroundMask.name = "backgroundMask"; backgroundMask.x = 0; backgroundMask.y = 0; childrenList.addChild(backgroundMask); myIndex = childrenList.getChildIndex(this); childrenList.addChildAt(backgroundImage, (myIndex + 1)); backgroundImage.mask = backgroundMask; } mx_internal function set backgroundImageRect(value:Rectangle):void{ _backgroundImageRect = value; invalidateDisplayList(); } mx_internal function get hasBackgroundImage():Boolean{ return (!((backgroundImage == null))); } private function removedHandler(event:Event):void{ var childrenList:IChildList; childrenList = ((parent is Container)) ? Container(parent).rawChildren : IChildList(parent); if (backgroundImage){ childrenList.removeChild(backgroundImage); backgroundImage = null; }; if (backgroundMask){ childrenList.removeChild(backgroundMask); backgroundMask = null; }; } private static function loadResources():void{ resourceNotLoaded = packageResources.getString("notLoaded"); } loadResources(); } }//package mx.skins
Section 154
//IOverride (mx.states.IOverride) package mx.states { import mx.core.*; public interface IOverride { function initialize():void; function remove(:UIComponent):void; function apply(:UIComponent):void; } }//package mx.states
Section 155
//State (mx.states.State) package mx.states { import flash.events.*; import mx.core.*; import mx.events.*; public class State extends EventDispatcher { public var name:String; private var initialized:Boolean;// = false public var overrides:Array; public var basedOn:String; mx_internal static const VERSION:String = "2.0.1.0"; public function State(){ initialized = false; overrides = []; super(); } mx_internal function initialize():void{ var i:int; if (!initialized){ initialized = true; i = 0; while (i < overrides.length) { IOverride(overrides[i]).initialize(); i++; }; }; } mx_internal function dispatchExitState():void{ dispatchEvent(new FlexEvent(FlexEvent.EXIT_STATE)); } mx_internal function dispatchEnterState():void{ dispatchEvent(new FlexEvent(FlexEvent.ENTER_STATE)); } } }//package mx.states
Section 156
//Transition (mx.states.Transition) package mx.states { import mx.core.*; import mx.effects.*; public class Transition { public var effect:Effect; public var toState:String;// = "*" public var fromState:String;// = "*" mx_internal static const VERSION:String = "2.0.1.0"; public function Transition(){ fromState = "*"; toState = "*"; super(); } } }//package mx.states
Section 157
//CSSStyleDeclaration (mx.styles.CSSStyleDeclaration) package mx.styles { import flash.events.*; import mx.core.*; import flash.display.*; import flash.utils.*; import mx.managers.*; public class CSSStyleDeclaration extends EventDispatcher { mx_internal var effects:Array; public var defaultFactory:Function; public var factory:Function; protected var overrides:Object; private var clones:Dictionary; mx_internal var selectorRefCount:int;// = 0 mx_internal static const VERSION:String = "2.0.1.0"; private static const NOT_A_COLOR:uint = 4294967295; private static var styleManager:IStyleManager = (Singleton.getInstance("mx.styles::IStyleManager") as IStyleManager); public function CSSStyleDeclaration(selector:String=null){ clones = new Dictionary(true); selectorRefCount = 0; super(); if (selector){ StyleManager.setStyleDeclaration(selector, this, false); }; } mx_internal function addStyleToProtoChain(chain:Object, target:DisplayObject):Object{ var nodeAddedToChain:Boolean; var p:String; var emptyObjectFactory:Function; var chain = chain; var target = target; nodeAddedToChain = false; if (defaultFactory != null){ defaultFactory.prototype = chain; chain = new defaultFactory(); nodeAddedToChain = true; }; if (factory != null){ factory.prototype = chain; chain = new factory(); nodeAddedToChain = true; }; if (overrides){ if ((((defaultFactory == null)) && ((factory == null)))){ emptyObjectFactory = function ():void{ }; emptyObjectFactory.prototype = chain; chain = new (emptyObjectFactory); nodeAddedToChain = true; }; for (p in overrides) { if (overrides[p] === undefined){ delete chain[p]; } else { chain[p] = overrides[p]; }; }; }; if (nodeAddedToChain){ clones[chain] = 1; }; return (chain); } public function getStyle(styleProp:String){ var o:*; var v:*; if (overrides){ if ((((styleProp in overrides)) && ((overrides[styleProp] === undefined)))){ return (undefined); }; v = overrides[styleProp]; if (v !== undefined){ return (v); }; }; if (factory != null){ factory.prototype = {}; o = new factory(); v = o[styleProp]; if (v !== undefined){ return (v); }; }; if (defaultFactory != null){ defaultFactory.prototype = {}; o = new defaultFactory(); v = o[styleProp]; if (v !== undefined){ return (v); }; }; return (undefined); } mx_internal function createProtoChainRoot():Object{ var root:Object; root = {}; if (defaultFactory != null){ defaultFactory.prototype = root; root = new defaultFactory(); }; if (factory != null){ factory.prototype = root; root = new factory(); }; clones[root] = 1; return (root); } public function clearStyle(styleProp:String):void{ setStyle(styleProp, undefined); } public function setStyle(styleProp:String, newValue):void{ var oldValue:Object; var regenerate:Boolean; var sms:Array; var n:int; var i:int; var sm:Object; oldValue = getStyle(styleProp); regenerate = false; if ((((((((((selectorRefCount > 0)) && ((factory == null)))) && ((defaultFactory == null)))) && (!(overrides)))) && (!((oldValue === newValue))))){ regenerate = true; }; if (newValue !== undefined){ setStyle(styleProp, newValue); } else { if (newValue == oldValue){ return; }; setStyle(styleProp, newValue); }; sms = SystemManagerGlobals.topLevelSystemManagers; n = sms.length; if (regenerate){ i = 0; while (i < n) { sm = sms[i]; sm.regenerateStyleCache(true); i++; }; }; i = 0; while (i < n) { sm = sms[i]; sm.notifyStyleChangeInChildren(styleProp, true); i++; }; } private function clearStyleAttr(styleProp:String):void{ var clone:*; if (!overrides){ overrides = {}; }; overrides[styleProp] = undefined; for (clone in clones) { delete clone[styleProp]; }; } mx_internal function clearOverride(styleProp:String):void{ if (((overrides) && (overrides[styleProp]))){ delete overrides[styleProp]; }; } mx_internal function setStyle(styleProp:String, value):void{ var o:Object; var clone:*; var colorNumber:Number; if (value === undefined){ clearStyleAttr(styleProp); return; }; if ((value is String)){ colorNumber = StyleManager.getColorName(value); if (colorNumber != NOT_A_COLOR){ value = colorNumber; }; }; if (defaultFactory != null){ o = new defaultFactory(); if (o[styleProp] !== value){ if (!overrides){ overrides = {}; }; overrides[styleProp] = value; } else { if (overrides){ delete overrides[styleProp]; }; }; }; if (factory != null){ o = new factory(); if (o[styleProp] !== value){ if (!overrides){ overrides = {}; }; overrides[styleProp] = value; } else { if (overrides){ delete overrides[styleProp]; }; }; }; if ((((defaultFactory == null)) && ((factory == null)))){ if (!overrides){ overrides = {}; }; overrides[styleProp] = value; }; for (clone in clones) { clone[styleProp] = value; }; } } }//package mx.styles
Section 158
//ISimpleStyleClient (mx.styles.ISimpleStyleClient) package mx.styles { public interface ISimpleStyleClient { function styleChanged(C:\dev\flex_201_ja\sdk\frameworks;mx\styles;ISimpleStyleClient.as:String):void; function set styleName(C:\dev\flex_201_ja\sdk\frameworks;mx\styles;ISimpleStyleClient.as:Object):void; function get styleName():Object; } }//package mx.styles
Section 159
//IStyleClient (mx.styles.IStyleClient) package mx.styles { public interface IStyleClient extends ISimpleStyleClient { function regenerateStyleCache(mx.styles:IStyleClient/mx.styles:IStyleClient:className/get:Boolean):void; function clearStyle(mx.styles:IStyleClient/mx.styles:IStyleClient:className/get:String):void; function getClassStyleDeclarations():Array; function get styleDeclaration():CSSStyleDeclaration; function get className():String; function notifyStyleChangeInChildren(_arg1:String, _arg2:Boolean):void; function set nonInheritingStyles(mx.styles:IStyleClient/mx.styles:IStyleClient:className/get:Object):void; function get inheritingStyles():Object; function set inheritingStyles(mx.styles:IStyleClient/mx.styles:IStyleClient:className/get:Object):void; function get nonInheritingStyles():Object; function set styleDeclaration(mx.styles:IStyleClient/mx.styles:IStyleClient:className/get:CSSStyleDeclaration):void; function getStyle(*:String); function setStyle(_arg1:String, _arg2):void; function registerEffects(mx.styles:IStyleClient/mx.styles:IStyleClient:className/get:Array):void; } }//package mx.styles
Section 160
//IStyleManager (mx.styles.IStyleManager) package mx.styles { import flash.events.*; public interface IStyleManager { function isParentSizeInvalidatingStyle(mx.styles:IStyleManager/mx.styles:IStyleManager:getStyleDeclaration:String):Boolean; function registerParentDisplayListInvalidatingStyle(selector:String):void; function set stylesRoot(selector:Object):void; function get inheritingStyles():Object; function styleDeclarationsChanged():void; function unloadStyleDeclarations(_arg1:String, _arg2:Boolean=true):void; function isParentDisplayListInvalidatingStyle(mx.styles:IStyleManager/mx.styles:IStyleManager:getStyleDeclaration:String):Boolean; function registerInheritingStyle(selector:String):void; function get typeSelectorCache():Object; function setStyleDeclaration(_arg1:String, _arg2:CSSStyleDeclaration, _arg3:Boolean):void; function loadStyleDeclarations(_arg1:String, _arg2:Boolean=true, _arg3:Boolean=false):IEventDispatcher; function isSizeInvalidatingStyle(mx.styles:IStyleManager/mx.styles:IStyleManager:getStyleDeclaration:String):Boolean; function getColorName(mx.styles:Object):uint; function isValidStyleValue(mx.styles:IStyleManager/mx.styles:IStyleManager:getStyleDeclaration):Boolean; function getColorNames(selector:Array):void; function isColorName(mx.styles:IStyleManager/mx.styles:IStyleManager:getStyleDeclaration:String):Boolean; function isInheritingStyle(mx.styles:IStyleManager/mx.styles:IStyleManager:getStyleDeclaration:String):Boolean; function set inheritingStyles(selector:Object):void; function get stylesRoot():Object; function initProtoChainRoots():void; function set typeSelectorCache(selector:Object):void; function registerParentSizeInvalidatingStyle(selector:String):void; function registerColorName(_arg1:String, _arg2:uint):void; function registerSizeInvalidatingStyle(selector:String):void; function clearStyleDeclaration(_arg1:String, _arg2:Boolean):void; function isInheritingTextFormatStyle(mx.styles:IStyleManager/mx.styles:IStyleManager:getStyleDeclaration:String):Boolean; function getStyleDeclaration(:String):CSSStyleDeclaration; } }//package mx.styles
Section 161
//IStyleModule (mx.styles.IStyleModule) package mx.styles { public interface IStyleModule { function unload():void; } }//package mx.styles
Section 162
//StyleManager (mx.styles.StyleManager) package mx.styles { import flash.events.*; import mx.core.*; public class StyleManager { mx_internal static const VERSION:String = "2.0.1.0"; public static const NOT_A_COLOR:uint = 4294967295; private static var impl:IStyleManager = (Singleton.getInstance("mx.styles::IStyleManager") as IStyleManager); private static var implClassDependency:StyleManagerImpl; public function StyleManager(){ super(); } public static function isParentSizeInvalidatingStyle(styleName:String):Boolean{ return (impl.isParentSizeInvalidatingStyle(styleName)); } public static function registerInheritingStyle(styleName:String):void{ impl.registerInheritingStyle(styleName); } mx_internal static function set stylesRoot(value:Object):void{ impl.stylesRoot = value; } mx_internal static function get inheritingStyles():Object{ return (impl.inheritingStyles); } mx_internal static function styleDeclarationsChanged():void{ impl.styleDeclarationsChanged(); } public static function setStyleDeclaration(selector:String, styleDeclaration:CSSStyleDeclaration, update:Boolean):void{ impl.setStyleDeclaration(selector, styleDeclaration, update); } public static function registerParentDisplayListInvalidatingStyle(styleName:String):void{ impl.registerParentDisplayListInvalidatingStyle(styleName); } public static function isSizeInvalidatingStyle(styleName:String):Boolean{ return (impl.isSizeInvalidatingStyle(styleName)); } mx_internal static function get typeSelectorCache():Object{ return (impl.typeSelectorCache); } mx_internal static function set inheritingStyles(value:Object):void{ impl.inheritingStyles = value; } public static function isColorName(colorName:String):Boolean{ return (impl.isColorName(colorName)); } public static function isParentDisplayListInvalidatingStyle(styleName:String):Boolean{ return (impl.isParentDisplayListInvalidatingStyle(styleName)); } public static function getColorName(colorName:Object):uint{ return (impl.getColorName(colorName)); } mx_internal static function set typeSelectorCache(value:Object):void{ impl.typeSelectorCache = value; } public static function unloadStyleDeclarations(url:String, update:Boolean=true):void{ impl.unloadStyleDeclarations(url, update); } public static function getColorNames(colors:Array):void{ impl.getColorNames(colors); } public static function loadStyleDeclarations(url:String, update:Boolean=true, trustContent:Boolean=false):IEventDispatcher{ return (impl.loadStyleDeclarations(url, update, trustContent)); } public static function isValidStyleValue(value):Boolean{ return (impl.isValidStyleValue(value)); } mx_internal static function get stylesRoot():Object{ return (impl.stylesRoot); } public static function isInheritingStyle(styleName:String):Boolean{ return (impl.isInheritingStyle(styleName)); } mx_internal static function initProtoChainRoots():void{ impl.initProtoChainRoots(); } public static function registerParentSizeInvalidatingStyle(styleName:String):void{ impl.registerParentSizeInvalidatingStyle(styleName); } public static function registerSizeInvalidatingStyle(styleName:String):void{ impl.registerSizeInvalidatingStyle(styleName); } public static function clearStyleDeclaration(selector:String, update:Boolean):void{ impl.clearStyleDeclaration(selector, update); } public static function registerColorName(colorName:String, colorValue:uint):void{ impl.registerColorName(colorName, colorValue); } public static function isInheritingTextFormatStyle(styleName:String):Boolean{ return (impl.isInheritingTextFormatStyle(styleName)); } public static function getStyleDeclaration(selector:String):CSSStyleDeclaration{ return (impl.getStyleDeclaration(selector)); } } }//package mx.styles
Section 163
//StyleManagerImpl (mx.styles.StyleManagerImpl) package mx.styles { import flash.events.*; import mx.core.*; import mx.resources.*; import flash.system.*; import flash.utils.*; import mx.modules.*; import mx.events.*; import mx.managers.*; import mx.utils.*; public class StyleManagerImpl implements IStyleManager { private var resourceUnableToLoad:String;// = null private var _stylesRoot:Object; private var styleModules:Object; private var packageResources:ResourceBundle; private var _inheritingStyles:Object; private var _typeSelectorCache:Object; private var selectors:Object; mx_internal static const VERSION:String = "2.0.1.0"; private static var parentSizeInvalidatingStyles:Object = {bottom:true, horizontalCenter:true, left:true, right:true, top:true, verticalCenter:true}; private static var colorNames:Object = {transparent:"transparent", black:0, blue:0xFF, green:0x8000, gray:0x808080, silver:0xC0C0C0, lime:0xFF00, olive:0x808000, white:0xFFFFFF, yellow:0xFFFF00, maroon:0x800000, navy:128, red:0xFF0000, purple:0x800080, teal:0x8080, fuchsia:0xFF00FF, aqua:0xFFFF, magenta:0xFF00FF, cyan:0xFFFF, halogreen:8453965, haloblue:40447, haloorange:0xFFB600, halosilver:11455193}; private static var inheritingTextFormatStyles:Object = {align:true, bold:true, color:true, font:true, indent:true, italic:true, size:true}; private static var instance:IStyleManager; private static var parentDisplayListInvalidatingStyles:Object = {bottom:true, horizontalCenter:true, left:true, right:true, top:true, verticalCenter:true}; private static var sizeInvalidatingStyles:Object = {borderStyle:true, borderThickness:true, fontAntiAliasType:true, fontFamily:true, fontGridFitType:true, fontSharpness:true, fontSize:true, fontStyle:true, fontThickness:true, fontWeight:true, headerHeight:true, horizontalAlign:true, horizontalGap:true, kerning:true, leading:true, letterSpacing:true, paddingBottom:true, paddingLeft:true, paddingRight:true, paddingTop:true, strokeWidth:true, tabHeight:true, tabWidth:true, verticalAlign:true, verticalGap:true}; public function StyleManagerImpl(){ packageResources = ResourceBundle.getResourceBundle("styles", ApplicationDomain.currentDomain); resourceUnableToLoad = null; selectors = {}; styleModules = {}; _inheritingStyles = {}; _typeSelectorCache = {}; super(); } public function setStyleDeclaration(selector:String, styleDeclaration:CSSStyleDeclaration, update:Boolean):void{ styleDeclaration.selectorRefCount++; selectors[selector] = styleDeclaration; typeSelectorCache = new Object(); if (update){ styleDeclarationsChanged(); }; } public function registerSizeInvalidatingStyle(styleName:String):void{ sizeInvalidatingStyles[styleName] = true; } public function isColorName(colorName:String):Boolean{ return (!((colorNames[colorName.toLowerCase()] === undefined))); } public function registerParentDisplayListInvalidatingStyle(styleName:String):void{ parentDisplayListInvalidatingStyles[styleName] = true; } public function set inheritingStyles(value:Object):void{ _inheritingStyles = value; } public function getColorNames(colors:Array):void{ var n:int; var i:int; var colorNumber:uint; if (!colors){ return; }; n = colors.length; i = 0; while (i < n) { if (((!((colors[i] == null))) && (isNaN(colors[i])))){ colorNumber = getColorName(colors[i]); if (colorNumber != StyleManager.NOT_A_COLOR){ colors[i] = colorNumber; }; }; i++; }; } public function isInheritingTextFormatStyle(styleName:String):Boolean{ return ((inheritingTextFormatStyles[styleName] == true)); } public function set typeSelectorCache(value:Object):void{ _typeSelectorCache = value; } public function registerParentSizeInvalidatingStyle(styleName:String):void{ parentSizeInvalidatingStyles[styleName] = true; } public function registerColorName(colorName:String, colorValue:uint):void{ colorNames[colorName.toLowerCase()] = colorValue; } public function isParentSizeInvalidatingStyle(styleName:String):Boolean{ return ((parentSizeInvalidatingStyles[styleName] == true)); } public function get inheritingStyles():Object{ return (_inheritingStyles); } public function isParentDisplayListInvalidatingStyle(styleName:String):Boolean{ return ((parentDisplayListInvalidatingStyles[styleName] == true)); } public function isSizeInvalidatingStyle(styleName:String):Boolean{ return ((sizeInvalidatingStyles[styleName] == true)); } public function set stylesRoot(value:Object):void{ _stylesRoot = value; } public function styleDeclarationsChanged():void{ var sms:Array; var n:int; var i:int; var sm:SystemManager; sms = SystemManagerGlobals.topLevelSystemManagers; n = sms.length; i = 0; while (i < n) { sm = SystemManager(sms[i]); sm.regenerateStyleCache(true); sm.notifyStyleChangeInChildren(null, true); i++; }; } public function isValidStyleValue(value):Boolean{ return (!((value === undefined))); } public function loadStyleDeclarations(url:String, update:Boolean=true, trustContent:Boolean=false):IEventDispatcher{ var module:IModuleInfo; var readyHandler:Function; var styleEventDispatcher:StyleEventDispatcher; var errorHandler:Function; var timer:Timer; var timerHandler:Function; var url = url; var update = update; var trustContent = trustContent; module = ModuleManager.getModule(url); readyHandler = function (moduleEvent:ModuleEvent):void{ var styleModule:IStyleModule; styleModule = IStyleModule(moduleEvent.module.factory.create()); styleModules[moduleEvent.module.url].styleModule = styleModule; if (update){ styleDeclarationsChanged(); }; }; module.addEventListener(ModuleEvent.READY, readyHandler, false, 0, true); styleEventDispatcher = new StyleEventDispatcher(module); errorHandler = function (moduleEvent:ModuleEvent):void{ var errorText:String; var styleEvent:StyleEvent; if (resourceUnableToLoad == null){ loadResources(); }; errorText = StringUtil.substitute(resourceUnableToLoad, moduleEvent.errorText, url); if (styleEventDispatcher.willTrigger(StyleEvent.ERROR)){ styleEvent = new StyleEvent(StyleEvent.ERROR, moduleEvent.bubbles, moduleEvent.cancelable); styleEvent.bytesLoaded = 0; styleEvent.bytesTotal = 0; styleEvent.errorText = errorText; styleEventDispatcher.dispatchEvent(styleEvent); } else { throw (new Error(errorText)); }; }; module.addEventListener(ModuleEvent.ERROR, errorHandler, false, 0, true); styleModules[url] = new StyleModuleInfo(module, readyHandler, errorHandler); timer = new Timer(0); timerHandler = function (event:TimerEvent):void{ timer.removeEventListener(TimerEvent.TIMER, timerHandler); timer.stop(); if (trustContent){ module.load(ApplicationDomain.currentDomain, SecurityDomain.currentDomain); } else { module.load(); }; }; timer.addEventListener(TimerEvent.TIMER, timerHandler, false, 0, true); timer.start(); return (styleEventDispatcher); } public function registerInheritingStyle(styleName:String):void{ inheritingStyles[styleName] = true; } public function unloadStyleDeclarations(url:String, update:Boolean=true):void{ var styleModuleInfo:StyleModuleInfo; var module:IModuleInfo; styleModuleInfo = styleModules[url]; if (styleModuleInfo){ styleModuleInfo.styleModule.unload(); module = styleModuleInfo.module; module.unload(); module.removeEventListener(ModuleEvent.READY, styleModuleInfo.readyHandler); module.removeEventListener(ModuleEvent.ERROR, styleModuleInfo.errorHandler); styleModules[url] = null; }; if (update){ styleDeclarationsChanged(); }; } private function loadResources():void{ resourceUnableToLoad = packageResources.getString("unableToLoad"); } public function isInheritingStyle(styleName:String):Boolean{ return ((inheritingStyles[styleName] == true)); } public function get typeSelectorCache():Object{ return (_typeSelectorCache); } public function get stylesRoot():Object{ return (_stylesRoot); } public function getColorName(colorName:Object):uint{ var n:Number; var c:*; if ((colorName is String)){ if (colorName.charAt(0) == "#"){ n = Number(("0x" + colorName.slice(1))); return ((isNaN(n)) ? StyleManager.NOT_A_COLOR : uint(n)); }; if ((((colorName.charAt(1) == "x")) && ((colorName.charAt(0) == "0")))){ n = Number(colorName); return ((isNaN(n)) ? StyleManager.NOT_A_COLOR : uint(n)); }; c = colorNames[colorName.toLowerCase()]; if (c === undefined){ return (StyleManager.NOT_A_COLOR); }; return (uint(c)); }; return (uint(colorName)); } public function initProtoChainRoots():void{ if (!stylesRoot){ stylesRoot = selectors["global"].addStyleToProtoChain({}, null); }; } public function clearStyleDeclaration(selector:String, update:Boolean):void{ var styleDeclaration:CSSStyleDeclaration; styleDeclaration = getStyleDeclaration(selector); if (((styleDeclaration) && ((styleDeclaration.selectorRefCount > 0)))){ styleDeclaration.selectorRefCount--; }; delete selectors[selector]; if (update){ styleDeclarationsChanged(); }; } public function getStyleDeclaration(selector:String):CSSStyleDeclaration{ var index:int; if (selector.charAt(0) != "."){ index = selector.lastIndexOf("."); if (index != -1){ selector = selector.substr((index + 1)); }; }; return (selectors[selector]); } public static function getInstance():IStyleManager{ if (!instance){ instance = new (StyleManagerImpl); }; return (instance); } } }//package mx.styles import flash.events.*; import mx.modules.*; import mx.events.*; class StyleEventDispatcher extends EventDispatcher { private function StyleEventDispatcher(moduleInfo:IModuleInfo){ super(); moduleInfo.addEventListener(ModuleEvent.ERROR, moduleInfo_errorHandler, false, 0, true); moduleInfo.addEventListener(ModuleEvent.PROGRESS, moduleInfo_progressHandler, false, 0, true); moduleInfo.addEventListener(ModuleEvent.READY, moduleInfo_readyHandler, false, 0, true); } private function moduleInfo_readyHandler(event:ModuleEvent):void{ var styleEvent:StyleEvent; styleEvent = new StyleEvent(StyleEvent.COMPLETE); dispatchEvent(styleEvent); } private function moduleInfo_errorHandler(event:ModuleEvent):void{ var styleEvent:StyleEvent; styleEvent = new StyleEvent(StyleEvent.ERROR, event.bubbles, event.cancelable); styleEvent.bytesLoaded = event.bytesLoaded; styleEvent.bytesTotal = event.bytesTotal; styleEvent.errorText = event.errorText; dispatchEvent(styleEvent); } private function moduleInfo_progressHandler(event:ModuleEvent):void{ var styleEvent:StyleEvent; styleEvent = new StyleEvent(StyleEvent.PROGRESS, event.bubbles, event.cancelable); styleEvent.bytesLoaded = event.bytesLoaded; styleEvent.bytesTotal = event.bytesTotal; dispatchEvent(styleEvent); } } class StyleModuleInfo { public var errorHandler:Function; public var module:IModuleInfo; public var styleModule:IStyleModule; public var readyHandler:Function; private function StyleModuleInfo(module:IModuleInfo, readyHandler:Function, errorHandler:Function){ super(); this.module = module; this.readyHandler = readyHandler; this.errorHandler = errorHandler; } }
Section 164
//StyleProtoChain (mx.styles.StyleProtoChain) package mx.styles { import mx.core.*; import flash.display.*; public class StyleProtoChain { mx_internal static const VERSION:String = "2.0.1.0"; public function StyleProtoChain(){ super(); } public static function initProtoChainForUIComponentStyleName(obj:IStyleClient):void{ var styleName:IStyleClient; var nonInheritChain:Object; var inheritChain:Object; var typeSelectors:Array; var n:int; var i:int; var typeSelector:CSSStyleDeclaration; styleName = IStyleClient(obj.styleName); nonInheritChain = styleName.nonInheritingStyles; if (((!(nonInheritChain)) || ((nonInheritChain == UIComponent.STYLE_UNINITIALIZED)))){ nonInheritChain = StyleManager.stylesRoot; if (nonInheritChain.effects){ obj.registerEffects(nonInheritChain.effects); }; }; inheritChain = styleName.inheritingStyles; if (((!(inheritChain)) || ((inheritChain == UIComponent.STYLE_UNINITIALIZED)))){ inheritChain = StyleManager.stylesRoot; }; typeSelectors = obj.getClassStyleDeclarations(); n = typeSelectors.length; i = 0; while (i < n) { typeSelector = typeSelectors[i]; inheritChain = typeSelector.addStyleToProtoChain(inheritChain, DisplayObject(obj)); inheritChain = addProperties(inheritChain, styleName, true); nonInheritChain = typeSelector.addStyleToProtoChain(nonInheritChain, DisplayObject(obj)); nonInheritChain = addProperties(nonInheritChain, styleName, false); if (typeSelector.effects){ obj.registerEffects(typeSelector.effects); }; i++; }; obj.inheritingStyles = (obj.styleDeclaration) ? obj.styleDeclaration.addStyleToProtoChain(inheritChain, DisplayObject(obj)) : inheritChain; obj.nonInheritingStyles = (obj.styleDeclaration) ? obj.styleDeclaration.addStyleToProtoChain(nonInheritChain, DisplayObject(obj)) : nonInheritChain; } private static function addProperties(chain:Object, obj:IStyleClient, bInheriting:Boolean):Object{ var typeSelectors:Array; var n:int; var i:int; var styleName:Object; var typeSelector:CSSStyleDeclaration; var classSelector:CSSStyleDeclaration; typeSelectors = obj.getClassStyleDeclarations(); n = typeSelectors.length; i = 0; while (i < n) { typeSelector = typeSelectors[i]; chain = typeSelector.addStyleToProtoChain(chain, DisplayObject(obj)); if (typeSelector.effects){ obj.registerEffects(typeSelector.effects); }; i++; }; styleName = obj.styleName; if (styleName){ if (typeof(styleName) == "object"){ if ((styleName is CSSStyleDeclaration)){ classSelector = CSSStyleDeclaration(styleName); } else { chain = addProperties(chain, IStyleClient(styleName), bInheriting); }; } else { classSelector = StyleManager.getStyleDeclaration(("." + styleName)); }; if (classSelector){ chain = classSelector.addStyleToProtoChain(chain, DisplayObject(obj)); if (classSelector.effects){ obj.registerEffects(classSelector.effects); }; }; }; if (obj.styleDeclaration){ chain = obj.styleDeclaration.addStyleToProtoChain(chain, DisplayObject(obj)); }; return (chain); } public static function initTextField(obj:UITextField):void{ var styleName:Object; var classSelector:CSSStyleDeclaration; var inheritChain:Object; var nonInheritChain:Object; styleName = obj.styleName; if (styleName){ if (typeof(styleName) == "object"){ if ((styleName is CSSStyleDeclaration)){ classSelector = CSSStyleDeclaration(styleName); } else { obj.inheritingStyles = IStyleClient(styleName).inheritingStyles; obj.nonInheritingStyles = IStyleClient(styleName).nonInheritingStyles; return; }; } else { classSelector = StyleManager.getStyleDeclaration(("." + styleName)); }; }; inheritChain = IStyleClient(obj.parent).inheritingStyles; nonInheritChain = StyleManager.stylesRoot; if (!inheritChain){ inheritChain = StyleManager.stylesRoot; }; if (classSelector){ inheritChain = classSelector.addStyleToProtoChain(inheritChain, obj); nonInheritChain = classSelector.addStyleToProtoChain(nonInheritChain, obj); }; obj.inheritingStyles = inheritChain; obj.nonInheritingStyles = nonInheritChain; } } }//package mx.styles
Section 165
//ColorUtil (mx.utils.ColorUtil) package mx.utils { import mx.core.*; public class ColorUtil { mx_internal static const VERSION:String = "2.0.1.0"; public function ColorUtil(){ super(); } public static function adjustBrightness2(rgb:uint, brite:Number):uint{ var r:Number; var g:Number; var b:Number; if (brite == 0){ return (rgb); }; if (brite < 0){ brite = ((100 + brite) / 100); r = (((rgb >> 16) & 0xFF) * brite); g = (((rgb >> 8) & 0xFF) * brite); b = ((rgb & 0xFF) * brite); } else { brite = (brite / 100); r = ((rgb >> 16) & 0xFF); g = ((rgb >> 8) & 0xFF); b = (rgb & 0xFF); r = (r + ((0xFF - r) * brite)); g = (g + ((0xFF - g) * brite)); b = (b + ((0xFF - b) * brite)); r = Math.min(r, 0xFF); g = Math.min(g, 0xFF); b = Math.min(b, 0xFF); }; return ((((r << 16) | (g << 8)) | b)); } public static function rgbMultiply(rgb1:uint, rgb2:uint):uint{ var r1:Number; var g1:Number; var b1:Number; var r2:Number; var g2:Number; var b2:Number; r1 = ((rgb1 >> 16) & 0xFF); g1 = ((rgb1 >> 8) & 0xFF); b1 = (rgb1 & 0xFF); r2 = ((rgb2 >> 16) & 0xFF); g2 = ((rgb2 >> 8) & 0xFF); b2 = (rgb2 & 0xFF); return ((((((r1 * r2) / 0xFF) << 16) | (((g1 * g2) / 0xFF) << 8)) | ((b1 * b2) / 0xFF))); } public static function adjustBrightness(rgb:uint, brite:Number):uint{ var r:Number; var g:Number; var b:Number; r = Math.max(Math.min((((rgb >> 16) & 0xFF) + brite), 0xFF), 0); g = Math.max(Math.min((((rgb >> 8) & 0xFF) + brite), 0xFF), 0); b = Math.max(Math.min(((rgb & 0xFF) + brite), 0xFF), 0); return ((((r << 16) | (g << 8)) | b)); } } }//package mx.utils
Section 166
//GraphicsUtil (mx.utils.GraphicsUtil) package mx.utils { import mx.core.*; import flash.display.*; public class GraphicsUtil { mx_internal static const VERSION:String = "2.0.1.0"; public function GraphicsUtil(){ super(); } public static function drawRoundRectComplex(graphics:Graphics, x:Number, y:Number, width:Number, height:Number, topLeftRadius:Number, topRightRadius:Number, bottomLeftRadius:Number, bottomRightRadius:Number):void{ var xw:Number; var yh:Number; var minSize:Number; var a:Number; var s:Number; xw = (x + width); yh = (y + height); minSize = ((width < height)) ? (width * 2) : (height * 2); topLeftRadius = ((topLeftRadius < minSize)) ? topLeftRadius : minSize; topRightRadius = ((topRightRadius < minSize)) ? topRightRadius : minSize; bottomLeftRadius = ((bottomLeftRadius < minSize)) ? bottomLeftRadius : minSize; bottomRightRadius = ((bottomRightRadius < minSize)) ? bottomRightRadius : minSize; a = (bottomRightRadius * 0.292893218813453); s = (bottomRightRadius * 0.585786437626905); graphics.moveTo(xw, (yh - bottomRightRadius)); graphics.curveTo(xw, (yh - s), (xw - a), (yh - a)); graphics.curveTo((xw - s), yh, (xw - bottomRightRadius), yh); a = (bottomLeftRadius * 0.292893218813453); s = (bottomLeftRadius * 0.585786437626905); graphics.lineTo((x + bottomLeftRadius), yh); graphics.curveTo((x + s), yh, (x + a), (yh - a)); graphics.curveTo(x, (yh - s), x, (yh - bottomLeftRadius)); a = (topLeftRadius * 0.292893218813453); s = (topLeftRadius * 0.585786437626905); graphics.lineTo(x, (y + topLeftRadius)); graphics.curveTo(x, (y + s), (x + a), (y + a)); graphics.curveTo((x + s), y, (x + topLeftRadius), y); a = (topRightRadius * 0.292893218813453); s = (topRightRadius * 0.585786437626905); graphics.lineTo((xw - topRightRadius), y); graphics.curveTo((xw - s), y, (xw - a), (y + a)); graphics.curveTo(xw, (y + s), xw, (y + topRightRadius)); graphics.lineTo(xw, (yh - bottomRightRadius)); } } }//package mx.utils
Section 167
//NameUtil (mx.utils.NameUtil) package mx.utils { import mx.core.*; import flash.display.*; import flash.utils.*; public class NameUtil { mx_internal static const VERSION:String = "2.0.1.0"; private static var counter:int = 0; public function NameUtil(){ super(); } public static function displayObjectToString(displayObject:DisplayObject):String{ var result:String; var o:DisplayObject; var s:String; var indices:Array; o = displayObject; while (o != null) { if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){ break; }; s = o.name; if ((o is IRepeaterClient)){ indices = IRepeaterClient(o).instanceIndices; if (indices){ s = (s + (("[" + indices.join("][")) + "]")); }; }; result = ((result == null)) ? s : ((s + ".") + result); o = o.parent; }; return (result); } public static function createUniqueName(object:Object):String{ var name:String; var index:int; var charCode:int; if (!object){ return (null); }; name = getQualifiedClassName(object); index = name.indexOf("::"); if (index != -1){ name = name.substr((index + 2)); }; charCode = name.charCodeAt((name.length - 1)); if ((((charCode >= 48)) && ((charCode <= 57)))){ name = (name + "_"); }; return ((name + counter++)); } } }//package mx.utils
Section 168
//StringUtil (mx.utils.StringUtil) package mx.utils { import mx.core.*; public class StringUtil { mx_internal static const VERSION:String = "2.0.1.0"; public function StringUtil(){ super(); } public static function trim(str:String):String{ var startIndex:int; var endIndex:int; startIndex = 0; while (isWhitespace(str.charAt(startIndex))) { startIndex++; }; endIndex = (str.length - 1); while (isWhitespace(str.charAt(endIndex))) { endIndex--; }; if (endIndex >= startIndex){ return (str.slice(startIndex, (endIndex + 1))); }; return (""); } public static function isWhitespace(character:String):Boolean{ switch (character){ case " ": case "\t": case "\r": case "\n": case "\f": return (true); default: return (false); }; } public static function substitute(str:String, ... _args):String{ var len:uint; var args:Array; var i:int; len = _args.length; if ((((len == 1)) && ((_args[0] is Array)))){ args = (_args[0] as Array); len = args.length; } else { args = _args; }; i = 0; while (i < len) { str = str.replace(new RegExp((("\\{" + i) + "\\}"), "g"), args[i]); i++; }; return (str); } public static function trimArrayElements(value:String, delimiter:String):String{ var items:Array; var len:int; var i:int; if (((!((value == ""))) && (!((value == null))))){ items = value.split(delimiter); len = items.length; i = 0; while (i < len) { items[i] = StringUtil.trim(items[i]); i++; }; if (len > 0){ value = items.join(delimiter); }; }; return (value); } } }//package mx.utils
Section 169
//IValidatorListener (mx.validators.IValidatorListener) package mx.validators { import mx.events.*; public interface IValidatorListener { function set errorString(C:\dev\flex_201_ja\sdk\frameworks;mx\validators;IValidatorListener.as:String):void; function get validationSubField():String; function validationResultHandler(C:\dev\flex_201_ja\sdk\frameworks;mx\validators;IValidatorListener.as:ValidationResultEvent):void; function set validationSubField(C:\dev\flex_201_ja\sdk\frameworks;mx\validators;IValidatorListener.as:String):void; function get errorString():String; } }//package mx.validators
Section 170
//ValidationResult (mx.validators.ValidationResult) package mx.validators { import mx.core.*; public class ValidationResult { public var errorCode:String; public var errorMessage:String; public var subField:String; public var isError:Boolean; mx_internal static const VERSION:String = "2.0.1.0"; public function ValidationResult(isError:Boolean, subField:String="", errorCode:String="", errorMessage:String=""){ super(); this.isError = isError; this.subField = subField; this.errorMessage = errorMessage; this.errorCode = errorCode; } } }//package mx.validators
Section 171
//Camera3D (org.papervision3d.cameras.Camera3D) package org.papervision3d.cameras { import org.papervision3d.objects.*; import org.papervision3d.core.proto.*; import org.papervision3d.core.*; public class Camera3D extends CameraObject3D { public var goto:Number3D; public var target:DisplayObject3D; public function Camera3D(target:DisplayObject3D=null, zoom:Number=2, focus:Number=100, initObject:Object=null){ super(zoom, focus, initObject); this.target = ((target) || (DisplayObject3D.ZERO)); this.goto = new Number3D(this.x, this.y, this.z); } override public function transformView(transform:Matrix3D=null):void{ this.lookAt(this.target); super.transformView(); } public function hover(type:Number, mouseX:Number, mouseY:Number):void{ var target:DisplayObject3D; var goto:Number3D; var camSpeed:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; target = this.target; goto = this.goto; camSpeed = 8; switch (type){ case 0: _local7 = (goto.x - target.x); _local8 = (goto.z - target.z); _local9 = Math.atan2(_local8, _local7); _local10 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8))); _local11 = (0.5 * mouseX); _local12 = (_local10 * Math.cos((_local9 - _local11))); _local13 = (_local10 * Math.sin((_local9 - _local11))); _local14 = (goto.y - (300 * mouseY)); this.x = (this.x - ((this.x - _local12) / camSpeed)); this.y = (this.y - ((this.y - _local14) / camSpeed)); this.z = (this.z - ((this.z - _local13) / camSpeed)); break; case 1: this.x = (this.x - ((this.x - (1000 * mouseX)) / camSpeed)); this.y = (this.y - ((this.y - (1000 * mouseY)) / camSpeed)); break; }; } } }//package org.papervision3d.cameras
Section 172
//DefaultTriangleCuller (org.papervision3d.core.culling.DefaultTriangleCuller) package org.papervision3d.core.culling { import org.papervision3d.objects.*; import org.papervision3d.core.proto.*; import org.papervision3d.core.geom.*; public class DefaultTriangleCuller implements ITriangleCuller { private static var y2:Number; private static var y1:Number; private static var y0:Number; private static var x0:Number; private static var x1:Number; private static var x2:Number; public function DefaultTriangleCuller(){ super(); } public function testFace(displayObject3D:DisplayObject3D, faceInstance:Face3DInstance, vertex0:Vertex2D, vertex1:Vertex2D, vertex2:Vertex2D):Boolean{ var material:MaterialObject3D; if (((((vertex0.visible) && (vertex1.visible))) && (vertex2.visible))){ material = (faceInstance.face.material) ? faceInstance.face.material : displayObject3D.material; if (material.invisible){ return (false); }; x0 = vertex0.x; y0 = vertex0.y; x1 = vertex1.x; y1 = vertex1.y; x2 = vertex2.x; y2 = vertex2.y; if (material.oneSide){ if (material.opposite){ if ((((x2 - x0) * (y1 - y0)) - ((y2 - y0) * (x1 - x0))) > 0){ return (false); }; } else { if ((((x2 - x0) * (y1 - y0)) - ((y2 - y0) * (x1 - x0))) < 0){ return (false); }; }; }; return (true); }; return (false); } } }//package org.papervision3d.core.culling
Section 173
//ITriangleCuller (org.papervision3d.core.culling.ITriangleCuller) package org.papervision3d.core.culling { import org.papervision3d.objects.*; import org.papervision3d.core.geom.*; public interface ITriangleCuller { function testFace(_arg1:DisplayObject3D, _arg2:Face3DInstance, _arg3:Vertex2D, _arg4:Vertex2D, _arg5:Vertex2D):Boolean; } }//package org.papervision3d.core.culling
Section 174
//IFaceDrawer (org.papervision3d.core.draw.IFaceDrawer) package org.papervision3d.core.draw { import flash.display.*; import org.papervision3d.objects.*; import org.papervision3d.core.geom.*; public interface IFaceDrawer { function drawFace3D(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Graphics, _arg4:Vertex2D, _arg5:Vertex2D, _arg6:Vertex2D):int; } }//package org.papervision3d.core.draw
Section 175
//Face3D (org.papervision3d.core.geom.Face3D) package org.papervision3d.core.geom { import flash.display.*; import org.papervision3d.objects.*; import org.papervision3d.core.proto.*; import org.papervision3d.core.*; public class Face3D { public var vertices:Array; public var face3DInstance:Face3DInstance; public var id:Number; public var uv:Array; public var material:MaterialObject3D; private var renderMat:MaterialObject3D; public var faceNormal:Number3D; public var screenZ:Number; public var _materialName:String; public var visible:Boolean; public var v0:Vertex3D; public var v1:Vertex3D; public var v2:Vertex3D; private static var _totalFaces:Number = 0; public function Face3D(vertices:Array, material:MaterialObject3D=null, uv:Array=null){ super(); this.vertices = vertices; v0 = vertices[0]; v1 = vertices[1]; v2 = vertices[2]; this.material = material; this.uv = uv; this.id = _totalFaces++; face3DInstance = new Face3DInstance(this); createNormal(); } protected function createNormal():void{ var vn0:Number3D; var vn1:Number3D; var vn2:Number3D; var vt1:Number3D; var vt2:Number3D; vn0 = v0.toNumber3D(); vn1 = v1.toNumber3D(); vn2 = v2.toNumber3D(); vt1 = Number3D.sub(vn1, vn0); vt2 = Number3D.sub(vn2, vn0); faceNormal = Number3D.cross(vt2, vt1); faceNormal.normalize(); } public function render(instance:DisplayObject3D, container:Sprite):Number{ renderMat = (material) ? material : instance.material; return (renderMat.drawFace3D(instance, this, container.graphics, v0.vertex2DInstance, v1.vertex2DInstance, v2.vertex2DInstance)); } } }//package org.papervision3d.core.geom
Section 176
//Face3DInstance (org.papervision3d.core.geom.Face3DInstance) package org.papervision3d.core.geom { import flash.display.*; import org.papervision3d.objects.*; import org.papervision3d.core.*; public class Face3DInstance { public var container:Sprite; public var faceNormal:Number3D; public var screenZ:Number; public var visible:Boolean;// = false public var instance:DisplayObject3D; public var face:Face3D; public function Face3DInstance(face:Face3D, instance:DisplayObject3D=null){ visible = false; super(); this.face = face; this.instance = instance; faceNormal = new Number3D(); } } }//package org.papervision3d.core.geom
Section 177
//Mesh3D (org.papervision3d.core.geom.Mesh3D) package org.papervision3d.core.geom { import flash.utils.*; import org.papervision3d.objects.*; import org.papervision3d.core.proto.*; import org.papervision3d.core.*; import org.papervision3d.core.culling.*; public class Mesh3D extends Vertices3D { public function Mesh3D(material:MaterialObject3D, vertices:Array, faces:Array, name:String=null, initObject:Object=null){ super(vertices, name, initObject); this.geometry.faces = ((faces) || (new Array())); this.material = ((material) || (MaterialObject3D.DEFAULT)); } override public function project(parent:DisplayObject3D, camera:CameraObject3D, sorted:Array=null):Number{ var faces:Array; var screenZs:Number; var visibleFaces:Number; var triCuller:ITriangleCuller; var vertex0:Vertex2D; var vertex1:Vertex2D; var vertex2:Vertex2D; var iFace:Face3DInstance; var face:Face3D; var mat:MaterialObject3D; super.project(parent, camera, sorted); if (!sorted){ sorted = this._sorted; }; faces = this.geometry.faces; screenZs = 0; visibleFaces = 0; triCuller = scene.triangleCuller; for each (face in faces) { mat = (face.material) ? face.material : material; iFace = face.face3DInstance; iFace.instance = this; vertex0 = face.v0.vertex2DInstance; vertex1 = face.v1.vertex2DInstance; vertex2 = face.v2.vertex2DInstance; if ((iFace.visible = triCuller.testFace(this, iFace, vertex0, vertex1, vertex2))){ if (mat.needsFaceNormals){ face.faceNormal.copyTo(iFace.faceNormal); Matrix3D.multiplyVector3x3(this.view, iFace.faceNormal); }; if (mat.needsVertexNormals){ face.v0.normal.copyTo(face.v0.vertex2DInstance.normal); Matrix3D.multiplyVector3x3(this.view, face.v0.vertex2DInstance.normal); face.v1.normal.copyTo(face.v1.vertex2DInstance.normal); Matrix3D.multiplyVector3x3(this.view, face.v1.vertex2DInstance.normal); face.v2.normal.copyTo(face.v2.vertex2DInstance.normal); Matrix3D.multiplyVector3x3(this.view, face.v2.vertex2DInstance.normal); }; switch (meshSort){ case DisplayObject3D.MESH_SORT_CENTER: screenZs = (screenZs + (iFace.screenZ = (((vertex0.z + vertex1.z) + vertex2.z) * 0.333))); break; case DisplayObject3D.MESH_SORT_FAR: screenZs = (screenZs + (iFace.screenZ = Math.max(vertex0.z, vertex1.z, vertex2.z))); break; case DisplayObject3D.MESH_SORT_CLOSE: screenZs = (screenZs + (iFace.screenZ = Math.min(vertex0.z, vertex1.z, vertex2.z))); break; }; visibleFaces++; sorted.push(iFace); } else { scene.stats.culledTriangles++; }; }; return ((this.screenZ = (screenZs / visibleFaces))); } public function mergeVertices():void{ var uniqueDic:Dictionary; var uniqueList:Array; var v:Vertex3D; var f:Face3D; var vu:Vertex3D; uniqueDic = new Dictionary(); uniqueList = new Array(); for each (v in this.geometry.vertices) { for each (vu in uniqueDic) { if ((((((v.x == vu.x)) && ((v.y == vu.y)))) && ((v.z == vu.z)))){ uniqueDic[v] = vu; break; }; }; if (!uniqueDic[v]){ uniqueDic[v] = v; uniqueList.push(v); }; }; this.geometry.vertices = uniqueList; for each (f in this.geometry.faces) { f.v0 = uniqueDic[f.v0]; f.v1 = uniqueDic[f.v1]; f.v2 = uniqueDic[f.v2]; }; } public function projectTexture(u:String="x", v:String="y"):void{ var faces:Array; var bBox:Object; var minX:Number; var sizeX:Number; var minY:Number; var sizeY:Number; var objectMaterial:MaterialObject3D; var i:String; var myFace:Face3D; var myVertices:Array; var a:Vertex3D; var b:Vertex3D; var c:Vertex3D; var uvA:NumberUV; var uvB:NumberUV; var uvC:NumberUV; faces = this.geometry.faces; bBox = this.boundingBox(); minX = bBox.min[u]; sizeX = bBox.size[u]; minY = bBox.min[v]; sizeY = bBox.size[v]; objectMaterial = this.material; for (i in faces) { myFace = faces[Number(i)]; myVertices = myFace.vertices; a = myVertices[0]; b = myVertices[1]; c = myVertices[2]; uvA = new NumberUV(((a[u] - minX) / sizeX), ((a[v] - minY) / sizeY)); uvB = new NumberUV(((b[u] - minX) / sizeX), ((b[v] - minY) / sizeY)); uvC = new NumberUV(((c[u] - minX) / sizeX), ((c[v] - minY) / sizeY)); myFace.uv = [uvA, uvB, uvC]; }; } } }//package org.papervision3d.core.geom
Section 178
//Vertex2D (org.papervision3d.core.geom.Vertex2D) package org.papervision3d.core.geom { import org.papervision3d.core.*; public class Vertex2D { public var visible:Boolean; public var normal:Number3D; public var extra:Object; public var x:Number; public var y:Number; public var z:Number; public function Vertex2D(x:Number=0, y:Number=0, z:Number=0){ super(); this.x = x; this.y = y; this.z = z; this.visible = false; this.normal = new Number3D(); } public function clone():Vertex2D{ var clone:Vertex2D; clone = new Vertex2D(x, y, z); clone.visible = visible; clone.extra = extra; return (clone); } } }//package org.papervision3d.core.geom
Section 179
//Vertex3D (org.papervision3d.core.geom.Vertex3D) package org.papervision3d.core.geom { import flash.utils.*; import org.papervision3d.core.*; public class Vertex3D { public var vertex2DInstance:Vertex2D; public var connectedFaces:Dictionary; public var normal:Number3D; public var extra:Object; public var x:Number; public var y:Number; public var z:Number; public function Vertex3D(x:Number=0, y:Number=0, z:Number=0){ super(); this.x = x; this.y = y; this.z = z; this.vertex2DInstance = new Vertex2D(); this.normal = new Number3D(); this.connectedFaces = new Dictionary(); } public function calculateNormal():void{ var face:Face3D; normal = new Number3D(); for each (face in connectedFaces) { normal = Number3D.add(face.faceNormal, normal); }; normal.normalize(); } public function toNumber3D():Number3D{ return (new Number3D(x, y, z)); } public function clone():Vertex3D{ var clone:Vertex3D; clone = new Vertex3D(x, y, z); clone.extra = extra; clone.vertex2DInstance = vertex2DInstance.clone(); clone.normal = normal.clone(); return (clone); } } }//package org.papervision3d.core.geom
Section 180
//Vertices3D (org.papervision3d.core.geom.Vertices3D) package org.papervision3d.core.geom { import org.papervision3d.objects.*; import org.papervision3d.core.proto.*; import org.papervision3d.core.*; import org.papervision3d.scenes.*; public class Vertices3D extends DisplayObject3D { public function Vertices3D(vertices:Array, name:String=null, initObject:Object=null){ super(name, new GeometryObject3D(), initObject); this.geometry.vertices = ((vertices) || (new Array())); } override public function project(parent:DisplayObject3D, camera:CameraObject3D, sorted:Array=null):Number{ var view:Matrix3D; var m11:Number; var m12:Number; var m13:Number; var m21:Number; var m22:Number; var m23:Number; var m31:Number; var m32:Number; var m33:Number; var vx:Number; var vy:Number; var vz:Number; var s_x:Number; var s_y:Number; var s_z:Number; var vertex:Vertex3D; var screen:Vertex2D; var persp:Number; var vertices:Array; var i:int; var focus:Number; var fz:Number; super.project(parent, camera, sorted); view = this.view; m11 = view.n11; m12 = view.n12; m13 = view.n13; m21 = view.n21; m22 = view.n22; m23 = view.n23; m31 = view.n31; m32 = view.n32; m33 = view.n33; vertices = this.geometry.vertices; i = vertices.length; focus = camera.focus; fz = (focus * camera.zoom); while ((vertex = vertices[--i])) { vx = vertex.x; vy = vertex.y; vz = vertex.z; s_z = ((((vx * m31) + (vy * m32)) + (vz * m33)) + view.n34); screen = vertex.vertex2DInstance; if ((screen.visible = (s_z > 0))){ s_x = ((((vx * m11) + (vy * m12)) + (vz * m13)) + view.n14); s_y = ((((vx * m21) + (vy * m22)) + (vz * m23)) + view.n24); persp = (fz / (focus + s_z)); screen.x = (s_x * persp); screen.y = (s_y * persp); screen.z = s_z; }; }; return (0); } public function transformVertices(transformation:Matrix3D):void{ var m11:Number; var m12:Number; var m13:Number; var m21:Number; var m22:Number; var m23:Number; var m31:Number; var m32:Number; var m33:Number; var m14:Number; var m24:Number; var m34:Number; var vertices:Array; var i:int; var vertex:Vertex3D; var vx:Number; var vy:Number; var vz:Number; var tx:Number; var ty:Number; var tz:Number; m11 = transformation.n11; m12 = transformation.n12; m13 = transformation.n13; m21 = transformation.n21; m22 = transformation.n22; m23 = transformation.n23; m31 = transformation.n31; m32 = transformation.n32; m33 = transformation.n33; m14 = transformation.n14; m24 = transformation.n24; m34 = transformation.n34; vertices = this.geometry.vertices; i = vertices.length; while ((vertex = vertices[--i])) { vx = vertex.x; vy = vertex.y; vz = vertex.z; tx = ((((vx * m11) + (vy * m12)) + (vz * m13)) + m14); ty = ((((vx * m21) + (vy * m22)) + (vz * m23)) + m24); tz = ((((vx * m31) + (vy * m32)) + (vz * m33)) + m34); vertex.x = tx; vertex.y = ty; vertex.z = tz; }; } public function boundingBox():Object{ var vertices:Object; var bBox:Object; var i:String; var v:Vertex3D; vertices = this.geometry.vertices; bBox = new Object(); bBox.min = new Number3D(); bBox.max = new Number3D(); bBox.size = new Number3D(); for (i in vertices) { v = vertices[Number(i)]; bBox.min.x = ((bBox.min.x)==undefined) ? v.x : Math.min(v.x, bBox.min.x); bBox.max.x = ((bBox.max.x)==undefined) ? v.x : Math.max(v.x, bBox.max.x); bBox.min.y = ((bBox.min.y)==undefined) ? v.y : Math.min(v.y, bBox.min.y); bBox.max.y = ((bBox.max.y)==undefined) ? v.y : Math.max(v.y, bBox.max.y); bBox.min.z = ((bBox.min.z)==undefined) ? v.z : Math.min(v.z, bBox.min.z); bBox.max.z = ((bBox.max.z)==undefined) ? v.z : Math.max(v.z, bBox.max.z); }; bBox.size.x = (bBox.max.x - bBox.min.x); bBox.size.y = (bBox.max.y - bBox.min.y); bBox.size.z = (bBox.max.z - bBox.min.z); return (bBox); } } }//package org.papervision3d.core.geom
Section 181
//CameraObject3D (org.papervision3d.core.proto.CameraObject3D) package org.papervision3d.core.proto { import org.papervision3d.objects.*; import org.papervision3d.core.*; public class CameraObject3D extends DisplayObject3D { public var sort:Boolean; public var zoom:Number; public var focus:Number; private static var _flipY:Matrix3D = Matrix3D.scaleMatrix(1, -1, 1); public static var DEFAULT_POS:Number3D = new Number3D(0, 0, -1000); public function CameraObject3D(zoom:Number=3, focus:Number=500, initObject:Object=null){ super(); this.x = (initObject) ? ((initObject.x) || (DEFAULT_POS.x)) : DEFAULT_POS.x; this.y = (initObject) ? ((initObject.y) || (DEFAULT_POS.y)) : DEFAULT_POS.y; this.z = (initObject) ? ((initObject.z) || (DEFAULT_POS.z)) : DEFAULT_POS.z; this.zoom = zoom; this.focus = focus; this.sort = (initObject) ? !((initObject.sort == false)) : true; } public function transformView(transform:Matrix3D=null):void{ this.view = Matrix3D.inverse(Matrix3D.multiply(((transform) || (this.transform)), _flipY)); } public function pan(angle:Number):void{ super.yaw(angle); } public function tilt(angle:Number):void{ super.pitch(angle); } } }//package org.papervision3d.core.proto
Section 182
//DisplayObjectContainer3D (org.papervision3d.core.proto.DisplayObjectContainer3D) package org.papervision3d.core.proto { import flash.events.*; import flash.utils.*; import org.papervision3d.materials.*; import org.papervision3d.objects.*; import org.papervision3d.*; public class DisplayObjectContainer3D extends EventDispatcher { protected var _children:Dictionary; public var root:DisplayObjectContainer3D; private var _childrenTotal:int; protected var _childrenByName:Object; public function DisplayObjectContainer3D():void{ super(); this._children = new Dictionary(false); this._childrenByName = new Dictionary(true); this._childrenTotal = 0; } public function getChildByName(name:String):DisplayObject3D{ return (this._childrenByName[name]); } public function addCollada(filename:String, materials:MaterialsList=null, scale:Number=1):void{ Papervision3D.log("The addCollada() method has been deprecated. Use addChildren( new Collada( filename ) )"); } public function removeChildByName(name:String):DisplayObject3D{ return (removeChild(getChildByName(name))); } public function get numChildren():int{ return (this._childrenTotal); } override public function toString():String{ return (childrenList()); } public function addChildren(parent:DisplayObject3D):DisplayObjectContainer3D{ var child:DisplayObject3D; for each (child in parent.children) { parent.removeChild(child); this.addChild(child); }; return (this); } public function removeChild(child:DisplayObject3D):DisplayObject3D{ if (child){ delete this._childrenByName[this._children[child]]; delete this._children[child]; child.parent = null; child.root = null; return (child); }; return (null); } public function addChild(child:DisplayObject3D, name:String=null):DisplayObject3D{ name = ((((name) || (child.name))) || (String(child.id))); this._children[child] = name; this._childrenByName[name] = child; this._childrenTotal++; child.parent = this; child.root = this.root; return (child); } public function childrenList():String{ var list:String; var name:String; list = ""; for (name in this._children) { list = (list + (name + "\n")); }; return (list); } public function get children():Object{ return (this._childrenByName); } } }//package org.papervision3d.core.proto
Section 183
//GeometryObject3D (org.papervision3d.core.proto.GeometryObject3D) package org.papervision3d.core.proto { import flash.events.*; import flash.utils.*; import org.papervision3d.materials.*; import org.papervision3d.core.*; import org.papervision3d.core.geom.*; import org.papervision3d.scenes.*; public class GeometryObject3D extends EventDispatcher { protected var _boundingSphere2:Number; protected var _boundingSphereDirty:Boolean;// = true public var _ready:Boolean;// = false protected var _material:MaterialObject3D; public var faces:Array; public var vertices:Array; public function GeometryObject3D(initObject:Object=null):void{ _ready = false; _boundingSphereDirty = true; super(); } public function transformVertices(transformation:Matrix3D):void{ } public function get boundingSphere2():Number{ if (_boundingSphereDirty){ return (getBoundingSphere2()); }; return (_boundingSphere2); } public function getBoundingSphere2():Number{ var max:Number; var d:Number; var v:Vertex3D; max = 0; for each (v in this.vertices) { d = (((v.x * v.x) + (v.y * v.y)) + (v.z * v.z)); max = ((d)>max) ? d : max; }; this._boundingSphereDirty = false; return ((_boundingSphere2 = max)); } private function createVertexNormals():void{ var tempVertices:Dictionary; var face:Face3D; var vertex3D:Vertex3D; tempVertices = new Dictionary(true); for each (face in faces) { face.v0.connectedFaces[face] = face; face.v1.connectedFaces[face] = face; face.v2.connectedFaces[face] = face; tempVertices[face.v0] = face.v0; tempVertices[face.v1] = face.v1; tempVertices[face.v2] = face.v2; }; for each (vertex3D in tempVertices) { vertex3D.calculateNormal(); }; } public function transformUV(material:MaterialObject3D):void{ var i:String; if (material.bitmap){ for (i in this.faces) { faces[i].transformUV(material); }; }; } public function set ready(b:Boolean):void{ if (b){ createVertexNormals(); }; _ready = b; } public function get ready():Boolean{ return (_ready); } } }//package org.papervision3d.core.proto
Section 184
//MaterialObject3D (org.papervision3d.core.proto.MaterialObject3D) package org.papervision3d.core.proto { import flash.events.*; import flash.display.*; import org.papervision3d.materials.*; import org.papervision3d.objects.*; import org.papervision3d.core.geom.*; import org.papervision3d.core.draw.*; public class MaterialObject3D extends EventDispatcher implements IFaceDrawer { public var widthOffset:Number;// = 0 public var name:String; public var scene:SceneObject3D; public var needsVertexNormals:Boolean;// = false public var heightOffset:Number;// = 0 public var fillAlpha:Number;// = 0 public var fillColor:Number; public var id:Number; public var invisible:Boolean;// = false public var smooth:Boolean;// = false public var bitmap:BitmapData; public var lineColor:Number; public var lineAlpha:Number;// = 0 public var oneSide:Boolean;// = true public var lineThickness:Number;// = 1 public var opposite:Boolean;// = false public var maxU:Number; public var maxV:Number; public var tiled:Boolean;// = false public var needsFaceNormals:Boolean;// = false public static var DEFAULT_COLOR:int = 0; public static var DEBUG_COLOR:int = 0xFF00FF; private static var _totalMaterialObjects:Number = 0; public function MaterialObject3D(){ smooth = false; tiled = false; lineColor = DEFAULT_COLOR; lineAlpha = 0; lineThickness = 1; fillColor = DEFAULT_COLOR; fillAlpha = 0; oneSide = true; invisible = false; opposite = false; needsFaceNormals = false; needsVertexNormals = false; widthOffset = 0; heightOffset = 0; super(); this.id = _totalMaterialObjects++; } public function get doubleSided():Boolean{ return (!(this.oneSide)); } public function drawFace3D(instance:DisplayObject3D, face3D:Face3D, graphics:Graphics, v0:Vertex2D, v1:Vertex2D, v2:Vertex2D):int{ return (0); } public function set doubleSided(double:Boolean):void{ this.oneSide = !(double); } public function updateBitmap():void{ } override public function toString():String{ return (((((("[MaterialObject3D] bitmap:" + this.bitmap) + " lineColor:") + this.lineColor) + " fillColor:") + fillColor)); } public function copy(material:MaterialObject3D):void{ this.bitmap = material.bitmap; this.smooth = material.smooth; this.lineColor = material.lineColor; this.lineAlpha = material.lineAlpha; this.fillColor = material.fillColor; this.fillAlpha = material.fillAlpha; this.needsFaceNormals = material.needsFaceNormals; this.needsVertexNormals = material.needsVertexNormals; this.oneSide = material.oneSide; this.opposite = material.opposite; this.invisible = material.invisible; this.scene = material.scene; this.name = material.name; this.maxU = material.maxU; this.maxV = material.maxV; } public function clone():MaterialObject3D{ var cloned:MaterialObject3D; cloned = new MaterialObject3D(); cloned.copy(this); return (cloned); } public static function get DEFAULT():MaterialObject3D{ var defMaterial:MaterialObject3D; defMaterial = new WireframeMaterial(); defMaterial.lineColor = (0xFFFFFF * Math.random()); defMaterial.lineAlpha = 1; defMaterial.fillColor = DEFAULT_COLOR; defMaterial.fillAlpha = 1; defMaterial.doubleSided = false; return (defMaterial); } public static function get DEBUG():MaterialObject3D{ var defMaterial:MaterialObject3D; defMaterial = new (MaterialObject3D); defMaterial.lineColor = (0xFFFFFF * Math.random()); defMaterial.lineAlpha = 1; defMaterial.fillColor = DEBUG_COLOR; defMaterial.fillAlpha = 0.37; defMaterial.doubleSided = true; return (defMaterial); } } }//package org.papervision3d.core.proto
Section 185
//SceneObject3D (org.papervision3d.core.proto.SceneObject3D) package org.papervision3d.core.proto { import flash.display.*; import flash.utils.*; import org.papervision3d.materials.*; import org.papervision3d.objects.*; import org.papervision3d.core.culling.*; import org.papervision3d.core.stat.*; import org.papervision3d.*; public class SceneObject3D extends DisplayObjectContainer3D { public var container:Sprite; public var triangleCuller:ITriangleCuller; private var geometries:Dictionary; public var objects:Array; public var stats:RenderStatistics; public var materials:MaterialsList; public function SceneObject3D(container:Sprite){ triangleCuller = new DefaultTriangleCuller(); super(); if (container){ this.container = container; } else { Papervision3D.log("Scene3D: container argument required."); }; this.objects = new Array(); this.materials = new MaterialsList(); Papervision3D.log((((((Papervision3D.NAME + " ") + Papervision3D.VERSION) + " (") + Papervision3D.DATE) + ")\n")); this.stats = new RenderStatistics(); this.stats.points = 0; this.stats.polys = 0; this.stats.triangles = 0; this.stats.performance = 0; this.stats.rendered = 0; this.root = this; } override public function addChild(child:DisplayObject3D, name:String=null):DisplayObject3D{ var newChild:DisplayObject3D; newChild = super.addChild(child, name); child.scene = this; this.objects.push(newChild); return (newChild); } public function renderCamera(camera:CameraObject3D):void{ var objects:Array; var p:DisplayObject3D; var i:Number; stats.clear(); stats.performance = getTimer(); MovieMaterial.updateAnimatedBitmaps(); if (camera){ camera.transformView(); objects = this.objects; i = objects.length; while ((p = objects[--i])) { if (p.visible){ p.project(camera, camera); }; }; }; if (camera.sort){ this.objects.sortOn("screenZ", Array.NUMERIC); }; renderObjects(camera.sort); } protected function renderObjects(sort:Boolean):void{ } override public function removeChild(child:DisplayObject3D):DisplayObject3D{ var i:int; super.removeChild(child); i = 0; while (i < this.objects.length) { if (this.objects[i] === child){ this.objects.splice(i, 1); return (child); }; i++; }; return (child); } } }//package org.papervision3d.core.proto
Section 186
//RenderStatistics (org.papervision3d.core.stat.RenderStatistics) package org.papervision3d.core.stat { public class RenderStatistics { public var points:int;// = 0 public var polys:int;// = 0 public var triangles:int;// = 0 public var pixels:Number; public var performance:int;// = 0 public var rendered:int;// = 0 public var culledTriangles:int;// = 0 public var particles:Number; public function RenderStatistics(){ performance = 0; points = 0; polys = 0; rendered = 0; triangles = 0; culledTriangles = 0; super(); } public function clear():void{ performance = 0; points = 0; polys = 0; rendered = 0; triangles = 0; pixels = 0; particles = 0; culledTriangles = 0; } public function toString():String{ return (new String(((((((((("Performance:" + performance) + ", Points:") + points) + " Polys:") + polys) + " Rendered:") + rendered) + " Culled:") + culledTriangles))); } } }//package org.papervision3d.core.stat
Section 187
//Matrix3D (org.papervision3d.core.Matrix3D) package org.papervision3d.core { public class Matrix3D { public var n31:Number; public var n32:Number; public var n11:Number; public var n13:Number; public var n14:Number; public var n33:Number; public var n12:Number; public var n21:Number; public var n22:Number; public var n23:Number; public var n24:Number; public var n34:Number; private static var toDEGREES:Number = 57.2957795130823; private static var toRADIANS:Number = 0.0174532925199433; public function Matrix3D(args:Array=null){ super(); if (((!(args)) || ((args.length < 12)))){ n11 = (n22 = (n33 = 1)); n12 = (n13 = (n14 = (n21 = (n23 = (n24 = (n31 = (n32 = (n34 = 0)))))))); } else { n11 = args[0]; n12 = args[1]; n13 = args[2]; n14 = args[3]; n21 = args[4]; n22 = args[5]; n23 = args[6]; n24 = args[7]; n31 = args[8]; n32 = args[9]; n33 = args[10]; n34 = args[11]; }; } public function calculateMultiply3x3(a:Matrix3D, b:Matrix3D):void{ var a11:Number; var b11:Number; var a21:Number; var b21:Number; var a31:Number; var b31:Number; var a12:Number; var b12:Number; var a22:Number; var b22:Number; var a32:Number; var b32:Number; var a13:Number; var b13:Number; var a23:Number; var b23:Number; var a33:Number; var b33:Number; a11 = a.n11; b11 = b.n11; a21 = a.n21; b21 = b.n21; a31 = a.n31; b31 = b.n31; a12 = a.n12; b12 = b.n12; a22 = a.n22; b22 = b.n22; a32 = a.n32; b32 = b.n32; a13 = a.n13; b13 = b.n13; a23 = a.n23; b23 = b.n23; a33 = a.n33; b33 = b.n33; this.n11 = (((a11 * b11) + (a12 * b21)) + (a13 * b31)); this.n12 = (((a11 * b12) + (a12 * b22)) + (a13 * b32)); this.n13 = (((a11 * b13) + (a12 * b23)) + (a13 * b33)); this.n21 = (((a21 * b11) + (a22 * b21)) + (a23 * b31)); this.n22 = (((a21 * b12) + (a22 * b22)) + (a23 * b32)); this.n23 = (((a21 * b13) + (a22 * b23)) + (a23 * b33)); this.n31 = (((a31 * b11) + (a32 * b21)) + (a33 * b31)); this.n32 = (((a31 * b12) + (a32 * b22)) + (a33 * b32)); this.n33 = (((a31 * b13) + (a32 * b23)) + (a33 * b33)); } public function get trace():Number{ return ((((this.n11 + this.n22) + this.n33) + 1)); } public function get det():Number{ return ((((((this.n11 * this.n22) - (this.n21 * this.n12)) * this.n33) - (((this.n11 * this.n32) - (this.n31 * this.n12)) * this.n23)) + (((this.n21 * this.n32) - (this.n31 * this.n22)) * this.n13))); } public function copy3x3(m:Matrix3D):Matrix3D{ this.n11 = m.n11; this.n12 = m.n12; this.n13 = m.n13; this.n21 = m.n21; this.n22 = m.n22; this.n23 = m.n23; this.n31 = m.n31; this.n32 = m.n32; this.n33 = m.n33; return (this); } public function calculateAdd(a:Matrix3D, b:Matrix3D):void{ this.n11 = (a.n11 + b.n11); this.n12 = (a.n12 + b.n12); this.n13 = (a.n13 + b.n13); this.n14 = (a.n14 + b.n14); this.n21 = (a.n21 + b.n21); this.n22 = (a.n22 + b.n22); this.n23 = (a.n23 + b.n23); this.n24 = (a.n24 + b.n24); this.n31 = (a.n31 + b.n31); this.n32 = (a.n32 + b.n32); this.n33 = (a.n33 + b.n33); this.n34 = (a.n34 + b.n34); } public function calculateMultiply(a:Matrix3D, b:Matrix3D):void{ var a11:Number; var b11:Number; var a21:Number; var b21:Number; var a31:Number; var b31:Number; var a12:Number; var b12:Number; var a22:Number; var b22:Number; var a32:Number; var b32:Number; var a13:Number; var b13:Number; var a23:Number; var b23:Number; var a33:Number; var b33:Number; var a14:Number; var b14:Number; var a24:Number; var b24:Number; var a34:Number; var b34:Number; a11 = a.n11; b11 = b.n11; a21 = a.n21; b21 = b.n21; a31 = a.n31; b31 = b.n31; a12 = a.n12; b12 = b.n12; a22 = a.n22; b22 = b.n22; a32 = a.n32; b32 = b.n32; a13 = a.n13; b13 = b.n13; a23 = a.n23; b23 = b.n23; a33 = a.n33; b33 = b.n33; a14 = a.n14; b14 = b.n14; a24 = a.n24; b24 = b.n24; a34 = a.n34; b34 = b.n34; this.n11 = (((a11 * b11) + (a12 * b21)) + (a13 * b31)); this.n12 = (((a11 * b12) + (a12 * b22)) + (a13 * b32)); this.n13 = (((a11 * b13) + (a12 * b23)) + (a13 * b33)); this.n14 = ((((a11 * b14) + (a12 * b24)) + (a13 * b34)) + a14); this.n21 = (((a21 * b11) + (a22 * b21)) + (a23 * b31)); this.n22 = (((a21 * b12) + (a22 * b22)) + (a23 * b32)); this.n23 = (((a21 * b13) + (a22 * b23)) + (a23 * b33)); this.n24 = ((((a21 * b14) + (a22 * b24)) + (a23 * b34)) + a24); this.n31 = (((a31 * b11) + (a32 * b21)) + (a33 * b31)); this.n32 = (((a31 * b12) + (a32 * b22)) + (a33 * b32)); this.n33 = (((a31 * b13) + (a32 * b23)) + (a33 * b33)); this.n34 = ((((a31 * b14) + (a32 * b24)) + (a33 * b34)) + a34); } public function toString():String{ var s:String; s = ""; s = (s + ((((((((int((n11 * 1000)) / 1000) + "\t\t") + (int((n12 * 1000)) / 1000)) + "\t\t") + (int((n13 * 1000)) / 1000)) + "\t\t") + (int((n14 * 1000)) / 1000)) + "\n")); s = (s + ((((((((int((n21 * 1000)) / 1000) + "\t\t") + (int((n22 * 1000)) / 1000)) + "\t\t") + (int((n23 * 1000)) / 1000)) + "\t\t") + (int((n24 * 1000)) / 1000)) + "\n")); s = (s + ((((((((int((n31 * 1000)) / 1000) + "\t\t") + (int((n32 * 1000)) / 1000)) + "\t\t") + (int((n33 * 1000)) / 1000)) + "\t\t") + (int((n34 * 1000)) / 1000)) + "\n")); return (s); } public function copy(m:Matrix3D):Matrix3D{ this.n11 = m.n11; this.n12 = m.n12; this.n13 = m.n13; this.n14 = m.n14; this.n21 = m.n21; this.n22 = m.n22; this.n23 = m.n23; this.n24 = m.n24; this.n31 = m.n31; this.n32 = m.n32; this.n33 = m.n33; this.n34 = m.n34; return (this); } public function calculateInverse(m:Matrix3D):void{ var d:Number; var m11:Number; var m21:Number; var m31:Number; var m12:Number; var m22:Number; var m32:Number; var m13:Number; var m23:Number; var m33:Number; var m14:Number; var m24:Number; var m34:Number; d = m.det; if (Math.abs(d) > 0.001){ d = (1 / d); m11 = m.n11; m21 = m.n21; m31 = m.n31; m12 = m.n12; m22 = m.n22; m32 = m.n32; m13 = m.n13; m23 = m.n23; m33 = m.n33; m14 = m.n14; m24 = m.n24; m34 = m.n34; this.n11 = (d * ((m22 * m33) - (m32 * m23))); this.n12 = (-(d) * ((m12 * m33) - (m32 * m13))); this.n13 = (d * ((m12 * m23) - (m22 * m13))); this.n14 = (-(d) * (((m12 * ((m23 * m34) - (m33 * m24))) - (m22 * ((m13 * m34) - (m33 * m14)))) + (m32 * ((m13 * m24) - (m23 * m14))))); this.n21 = (-(d) * ((m21 * m33) - (m31 * m23))); this.n22 = (d * ((m11 * m33) - (m31 * m13))); this.n23 = (-(d) * ((m11 * m23) - (m21 * m13))); this.n24 = (d * (((m11 * ((m23 * m34) - (m33 * m24))) - (m21 * ((m13 * m34) - (m33 * m14)))) + (m31 * ((m13 * m24) - (m23 * m14))))); this.n31 = (d * ((m21 * m32) - (m31 * m22))); this.n32 = (-(d) * ((m11 * m32) - (m31 * m12))); this.n33 = (d * ((m11 * m22) - (m21 * m12))); this.n34 = (-(d) * (((m11 * ((m22 * m34) - (m32 * m24))) - (m21 * ((m12 * m34) - (m32 * m14)))) + (m31 * ((m12 * m24) - (m22 * m14))))); }; } public static function rotationMatrixWithReference(axis:Number3D, rad:Number, ref:Number3D):Matrix3D{ var m:Matrix3D; m = Matrix3D.translationMatrix(ref.x, -(ref.y), ref.z); m.calculateMultiply(m, Matrix3D.rotationMatrix(axis.x, axis.y, axis.z, rad)); m.calculateMultiply(m, Matrix3D.translationMatrix(-(ref.x), ref.y, -(ref.z))); return (m); } public static function multiplyVector3x3(m:Matrix3D, v:Number3D):void{ var vx:Number; var vy:Number; var vz:Number; vx = v.x; vy = v.y; vz = v.z; v.x = (((vx * m.n11) + (vy * m.n12)) + (vz * m.n13)); v.y = (((vx * m.n21) + (vy * m.n22)) + (vz * m.n23)); v.z = (((vx * m.n31) + (vy * m.n32)) + (vz * m.n33)); } public static function multiply3x3(a:Matrix3D, b:Matrix3D):Matrix3D{ var m:Matrix3D; m = new (Matrix3D); m.calculateMultiply3x3(a, b); return (m); } public static function normalizeQuaternion(q:Object):Object{ var mag:Number; mag = magnitudeQuaternion(q); q.x = (q.x / mag); q.y = (q.y / mag); q.z = (q.z / mag); q.w = (q.w / mag); return (q); } public static function multiplyVector(m:Matrix3D, v:Number3D):void{ var vx:Number; var vy:Number; var vz:Number; vx = v.x; vy = v.y; vz = v.z; v.x = ((((vx * m.n11) + (vy * m.n12)) + (vz * m.n13)) + m.n14); v.y = ((((vx * m.n21) + (vy * m.n22)) + (vz * m.n23)) + m.n24); v.z = ((((vx * m.n31) + (vy * m.n32)) + (vz * m.n33)) + m.n34); } public static function axis2quaternion(x:Number, y:Number, z:Number, angle:Number):Object{ var sin:Number; var cos:Number; var q:Object; sin = Math.sin((angle / 2)); cos = Math.cos((angle / 2)); q = new Object(); q.x = (x * sin); q.y = (y * sin); q.z = (z * sin); q.w = cos; return (normalizeQuaternion(q)); } public static function translationMatrix(x:Number, y:Number, z:Number):Matrix3D{ var m:Matrix3D; m = IDENTITY; m.n14 = x; m.n24 = y; m.n34 = z; return (m); } public static function magnitudeQuaternion(q:Object):Number{ return (Math.sqrt(((((q.w * q.w) + (q.x * q.x)) + (q.y * q.y)) + (q.z * q.z)))); } public static function euler2quaternion(ax:Number, ay:Number, az:Number):Object{ var fSinPitch:Number; var fCosPitch:Number; var fSinYaw:Number; var fCosYaw:Number; var fSinRoll:Number; var fCosRoll:Number; var fCosPitchCosYaw:Number; var fSinPitchSinYaw:Number; var q:Object; fSinPitch = Math.sin((ax * 0.5)); fCosPitch = Math.cos((ax * 0.5)); fSinYaw = Math.sin((ay * 0.5)); fCosYaw = Math.cos((ay * 0.5)); fSinRoll = Math.sin((az * 0.5)); fCosRoll = Math.cos((az * 0.5)); fCosPitchCosYaw = (fCosPitch * fCosYaw); fSinPitchSinYaw = (fSinPitch * fSinYaw); q = new Object(); q.x = ((fSinRoll * fCosPitchCosYaw) - (fCosRoll * fSinPitchSinYaw)); q.y = (((fCosRoll * fSinPitch) * fCosYaw) + ((fSinRoll * fCosPitch) * fSinYaw)); q.z = (((fCosRoll * fCosPitch) * fSinYaw) - ((fSinRoll * fSinPitch) * fCosYaw)); q.w = ((fCosRoll * fCosPitchCosYaw) + (fSinRoll * fSinPitchSinYaw)); return (q); } public static function rotationX(rad:Number):Matrix3D{ var m:Matrix3D; var c:Number; var s:Number; m = IDENTITY; c = Math.cos(rad); s = Math.sin(rad); m.n22 = c; m.n23 = -(s); m.n32 = s; m.n33 = c; return (m); } public static function rotationY(rad:Number):Matrix3D{ var m:Matrix3D; var c:Number; var s:Number; m = IDENTITY; c = Math.cos(rad); s = Math.sin(rad); m.n11 = c; m.n13 = -(s); m.n31 = s; m.n33 = c; return (m); } public static function rotationZ(rad:Number):Matrix3D{ var m:Matrix3D; var c:Number; var s:Number; m = IDENTITY; c = Math.cos(rad); s = Math.sin(rad); m.n11 = c; m.n12 = -(s); m.n21 = s; m.n22 = c; return (m); } public static function clone(m:Matrix3D):Matrix3D{ return (new Matrix3D([m.n11, m.n12, m.n13, m.n14, m.n21, m.n22, m.n23, m.n24, m.n31, m.n32, m.n33, m.n34])); } public static function rotationMatrix(x:Number, y:Number, z:Number, rad:Number):Matrix3D{ var m:Matrix3D; var nCos:Number; var nSin:Number; var scos:Number; var sxy:Number; var syz:Number; var sxz:Number; var sz:Number; var sy:Number; var sx:Number; m = IDENTITY; nCos = Math.cos(rad); nSin = Math.sin(rad); scos = (1 - nCos); sxy = ((x * y) * scos); syz = ((y * z) * scos); sxz = ((x * z) * scos); sz = (nSin * z); sy = (nSin * y); sx = (nSin * x); m.n11 = (nCos + ((x * x) * scos)); m.n12 = (-(sz) + sxy); m.n13 = (sy + sxz); m.n21 = (sz + sxy); m.n22 = (nCos + ((y * y) * scos)); m.n23 = (-(sx) + syz); m.n31 = (-(sy) + sxz); m.n32 = (sx + syz); m.n33 = (nCos + ((z * z) * scos)); return (m); } public static function add(a:Matrix3D, b:Matrix3D):Matrix3D{ var m:Matrix3D; m = new (Matrix3D); m.calculateAdd(a, b); return (m); } public static function rotateAxis(m:Matrix3D, v:Number3D):void{ var vx:Number; var vy:Number; var vz:Number; vx = v.x; vy = v.y; vz = v.z; v.x = (((vx * m.n11) + (vy * m.n12)) + (vz * m.n13)); v.y = (((vx * m.n21) + (vy * m.n22)) + (vz * m.n23)); v.z = (((vx * m.n31) + (vy * m.n32)) + (vz * m.n33)); v.normalize(); } public static function multiply(a:Matrix3D, b:Matrix3D):Matrix3D{ var m:Matrix3D; m = new (Matrix3D); m.calculateMultiply(a, b); return (m); } public static function multiplyQuaternion(a:Object, b:Object):Object{ var ax:Number; var ay:Number; var az:Number; var aw:Number; var bx:Number; var by:Number; var bz:Number; var bw:Number; var q:Object; ax = a.x; ay = a.y; az = a.z; aw = a.w; bx = b.x; by = b.y; bz = b.z; bw = b.w; q = new Object(); q.x = ((((aw * bx) + (ax * bw)) + (ay * bz)) - (az * by)); q.y = ((((aw * by) + (ay * bw)) + (az * bx)) - (ax * bz)); q.z = ((((aw * bz) + (az * bw)) + (ax * by)) - (ay * bx)); q.w = ((((aw * bw) - (ax * bx)) - (ay * by)) - (az * bz)); return (q); } public static function euler2matrix(deg:Number3D):Matrix3D{ var m:Matrix3D; var ax:Number; var ay:Number; var az:Number; var a:Number; var b:Number; var c:Number; var d:Number; var e:Number; var f:Number; var ad:Number; var bd:Number; m = IDENTITY; ax = (deg.x * toRADIANS); ay = (deg.y * toRADIANS); az = (deg.z * toRADIANS); a = Math.cos(ax); b = Math.sin(ax); c = Math.cos(ay); d = Math.sin(ay); e = Math.cos(az); f = Math.sin(az); ad = (a * d); bd = (b * d); m.n11 = (c * e); m.n12 = (-(c) * f); m.n13 = d; m.n21 = ((bd * e) + (a * f)); m.n22 = ((-(bd) * f) + (a * e)); m.n23 = (-(b) * c); m.n31 = ((-(ad) * e) + (b * f)); m.n32 = ((ad * f) + (b * e)); m.n33 = (a * c); return (m); } public static function scaleMatrix(x:Number, y:Number, z:Number):Matrix3D{ var m:Matrix3D; m = IDENTITY; m.n11 = x; m.n22 = y; m.n33 = z; return (m); } public static function quaternion2matrix(x:Number, y:Number, z:Number, w:Number):Matrix3D{ var xx:Number; var xy:Number; var xz:Number; var xw:Number; var yy:Number; var yz:Number; var yw:Number; var zz:Number; var zw:Number; var m:Matrix3D; xx = (x * x); xy = (x * y); xz = (x * z); xw = (x * w); yy = (y * y); yz = (y * z); yw = (y * w); zz = (z * z); zw = (z * w); m = IDENTITY; m.n11 = (1 - (2 * (yy + zz))); m.n12 = (2 * (xy - zw)); m.n13 = (2 * (xz + yw)); m.n21 = (2 * (xy + zw)); m.n22 = (1 - (2 * (xx + zz))); m.n23 = (2 * (yz - xw)); m.n31 = (2 * (xz - yw)); m.n32 = (2 * (yz + xw)); m.n33 = (1 - (2 * (xx + yy))); return (m); } public static function inverse(m:Matrix3D):Matrix3D{ var inv:Matrix3D; inv = new (Matrix3D); inv.calculateInverse(m); return (inv); } public static function matrix2euler(t:Matrix3D):Number3D{ var rot:Number3D; var i:Number3D; var j:Number3D; var k:Number3D; var m:Matrix3D; var rx:Matrix3D; var n:Matrix3D; var cy:Number; rot = new Number3D(); i = new Number3D(t.n11, t.n21, t.n31); j = new Number3D(t.n12, t.n22, t.n32); k = new Number3D(t.n13, t.n23, t.n33); i.normalize(); j.normalize(); k.normalize(); m = new Matrix3D([i.x, j.x, k.x, 0, i.y, j.y, k.y, 0, i.z, j.z, k.z, 0]); rot.x = Math.atan2(m.n23, m.n33); rx = Matrix3D.rotationX(-(rot.x)); n = Matrix3D.multiply(rx, m); cy = Math.sqrt(((n.n11 * n.n11) + (n.n21 * n.n21))); rot.y = Math.atan2(-(n.n31), cy); rot.z = Math.atan2(-(n.n12), n.n11); if (rot.x == Math.PI){ if (rot.y > 0){ rot.y = (rot.y - Math.PI); } else { rot.y = (rot.y + Math.PI); }; rot.x = 0; rot.z = (rot.z + Math.PI); }; rot.x = (rot.x * toDEGREES); rot.y = (rot.y * toDEGREES); rot.z = (rot.z * toDEGREES); return (rot); } public static function get IDENTITY():Matrix3D{ return (new Matrix3D([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0])); } } }//package org.papervision3d.core
Section 188
//Number3D (org.papervision3d.core.Number3D) package org.papervision3d.core { public class Number3D { public var x:Number; public var y:Number; public var z:Number; public function Number3D(x:Number=0, y:Number=0, z:Number=0){ super(); this.x = x; this.y = y; this.z = z; } public function toString():String{ return (((((("x:" + x) + " y:") + y) + " z:") + z)); } public function normalize():void{ var mod:Number; mod = this.modulo; if (((!((mod == 0))) && (!((mod == 1))))){ this.x = (this.x / mod); this.y = (this.y / mod); this.z = (this.z / mod); }; } public function get modulo():Number{ return (Math.sqrt((((this.x * this.x) + (this.y * this.y)) + (this.z * this.z)))); } public function copyTo(n:Number3D):void{ n.x = x; n.y = y; n.z = z; } public function clone():Number3D{ return (new Number3D(this.x, this.y, this.z)); } public static function sub(v:Number3D, w:Number3D):Number3D{ return (new Number3D((v.x - w.x), (v.y - w.y), (v.z - w.z))); } public static function add(v:Number3D, w:Number3D):Number3D{ return (new Number3D((v.x + w.x), (v.y + w.y), (v.z + w.z))); } public static function cross(v:Number3D, w:Number3D):Number3D{ return (new Number3D(((w.y * v.z) - (w.z * v.y)), ((w.z * v.x) - (w.x * v.z)), ((w.x * v.y) - (w.y * v.x)))); } public static function get ZERO():Number3D{ return (new Number3D(0, 0, 0)); } public static function dot(v:Number3D, w:Number3D):Number{ return ((((v.x * w.x) + (v.y * w.y)) + (w.z * v.z))); } } }//package org.papervision3d.core
Section 189
//NumberUV (org.papervision3d.core.NumberUV) package org.papervision3d.core { public class NumberUV { public var u:Number; public var v:Number; public function NumberUV(u:Number=0, v:Number=0){ super(); this.u = u; this.v = v; } public function toString():String{ return (((("u:" + u) + " v:") + v)); } public function clone():NumberUV{ return (new NumberUV(this.u, this.v)); } public static function get ZERO():NumberUV{ return (new NumberUV(0, 0)); } } }//package org.papervision3d.core
Section 190
//InteractiveScene3DEvent (org.papervision3d.events.InteractiveScene3DEvent) package org.papervision3d.events { import flash.events.*; import flash.display.*; import org.papervision3d.objects.*; import org.papervision3d.core.geom.*; import org.papervision3d.utils.*; public class InteractiveScene3DEvent extends Event { public var sprite:Sprite;// = null public var interactiveContainerData:InteractiveContainerData;// = null public var displayObject3D:DisplayObject3D;// = null public var face3d:Face3D;// = null public static const OBJECT_ADDED:String = "objectAdded"; public static const OBJECT_PRESS:String = "mousePress"; public static const OBJECT_RELEASE:String = "mouseRelease"; public static const OBJECT_CLICK:String = "mouseClick"; public static const OBJECT_RELEASE_OUTSIDE:String = "mouseReleaseOutside"; public static const OBJECT_OUT:String = "mouseOut"; public static const OBJECT_MOVE:String = "mouseMove"; public static const OBJECT_OVER:String = "mouseOver"; public function InteractiveScene3DEvent(type:String, container3d:DisplayObject3D=null, sprite:Sprite=null, face3d:Face3D=null, interactiveContainerData:InteractiveContainerData=null, bubbles:Boolean=false, cancelable:Boolean=false){ displayObject3D = null; sprite = null; face3d = null; interactiveContainerData = null; super(type, bubbles, cancelable); this.displayObject3D = container3d; this.sprite = sprite; this.face3d = face3d; this.interactiveContainerData = interactiveContainerData; } } }//package org.papervision3d.events
Section 191
//BitmapMaterial (org.papervision3d.materials.BitmapMaterial) package org.papervision3d.materials { import flash.display.*; import flash.utils.*; import org.papervision3d.objects.*; import org.papervision3d.core.proto.*; import org.papervision3d.core.geom.*; import flash.geom.*; import org.papervision3d.core.draw.*; import org.papervision3d.*; public class BitmapMaterial extends MaterialObject3D implements IFaceDrawer { public var uvMatrices:Dictionary; protected var _texture:Object; public static var AUTO_MIP_MAPPING:Boolean = false; protected static var _localMatrix:Matrix = new Matrix(); public static var MIP_MAP_DEPTH:Number = 8; protected static var _triMatrix:Matrix = new Matrix(); public function BitmapMaterial(asset:BitmapData=null){ uvMatrices = new Dictionary(); super(); if (asset){ texture = asset; }; } override public function drawFace3D(instance:DisplayObject3D, face3D:Face3D, graphics:Graphics, v0:Vertex2D, v1:Vertex2D, v2:Vertex2D):int{ var map:Matrix; var x0:Number; var y0:Number; var x1:Number; var y1:Number; var x2:Number; var y2:Number; if (lineAlpha){ graphics.lineStyle(0, lineColor, lineAlpha); }; if (bitmap){ map = ((uvMatrices[face3D]) || (transformUV(face3D, instance))); x0 = v0.x; y0 = v0.y; x1 = v1.x; y1 = v1.y; x2 = v2.x; y2 = v2.y; _triMatrix.a = (x1 - x0); _triMatrix.b = (y1 - y0); _triMatrix.c = (x2 - x0); _triMatrix.d = (y2 - y0); _triMatrix.tx = x0; _triMatrix.ty = y0; _localMatrix.a = map.a; _localMatrix.b = map.b; _localMatrix.c = map.c; _localMatrix.d = map.d; _localMatrix.tx = map.tx; _localMatrix.ty = map.ty; _localMatrix.concat(_triMatrix); graphics.beginBitmapFill(bitmap, _localMatrix, tiled, smooth); }; graphics.moveTo(x0, y0); graphics.lineTo(x1, y1); graphics.lineTo(x2, y2); graphics.lineTo(x0, y0); if (bitmap){ graphics.endFill(); }; if (lineAlpha){ graphics.lineStyle(); }; return (1); } public function resetMapping():void{ uvMatrices = new Dictionary(); } public function transformUV(face3D:Face3D, instance:DisplayObject3D=null):Matrix{ var uv:Array; var w:Number; var h:Number; var u0:Number; var v0:Number; var u1:Number; var v1:Number; var u2:Number; var v2:Number; var at:Number; var bt:Number; var ct:Number; var dt:Number; var m:Matrix; var mapping:Matrix; if (!face3D.uv){ Papervision3D.log("MaterialObject3D: transformUV() uv not found!"); } else { if (bitmap){ uv = face3D.uv; w = (bitmap.width * maxU); h = (bitmap.height * maxV); u0 = (w * uv[0].u); v0 = (h * (1 - uv[0].v)); u1 = (w * uv[1].u); v1 = (h * (1 - uv[1].v)); u2 = (w * uv[2].u); v2 = (h * (1 - uv[2].v)); if ((((((u0 == u1)) && ((v0 == v1)))) || ((((u0 == u2)) && ((v0 == v2)))))){ u0 = (u0 - ((u0)>0.05) ? 0.05 : -0.05); v0 = (v0 - ((v0)>0.07) ? 0.07 : -0.07); }; if ((((u2 == u1)) && ((v2 == v1)))){ u2 = (u2 - ((u2)>0.05) ? 0.04 : -0.04); v2 = (v2 - ((v2)>0.06) ? 0.06 : -0.06); }; at = (u1 - u0); bt = (v1 - v0); ct = (u2 - u0); dt = (v2 - v0); m = new Matrix(at, bt, ct, dt, u0, v0); m.invert(); mapping = ((uvMatrices[face3D]) || ((uvMatrices[face3D] = m.clone()))); mapping.a = m.a; mapping.b = m.b; mapping.c = m.c; mapping.d = m.d; mapping.tx = m.tx; mapping.ty = m.ty; } else { Papervision3D.log("MaterialObject3D: transformUV() material.bitmap not found!"); }; }; return (mapping); } public function get texture():Object{ return (this._texture); } protected function correctBitmap(bitmap:BitmapData):BitmapData{ var okBitmap:BitmapData; var levels:Number; var bWidth:Number; var bHeight:Number; var width:Number; var height:Number; var ok:Boolean; levels = (1 << MIP_MAP_DEPTH); bWidth = (bitmap.width / levels); bWidth = ((bWidth == uint(bWidth))) ? bWidth : (uint(bWidth) + 1); bHeight = (bitmap.height / levels); bHeight = ((bHeight == uint(bHeight))) ? bHeight : (uint(bHeight) + 1); width = (levels * bWidth); height = (levels * bHeight); ok = true; if (width > 2880){ width = bitmap.width; ok = false; }; if (height > 2880){ height = bitmap.height; ok = false; }; if (!ok){ Papervision3D.log((("Material " + this.name) + ": Texture too big for mip mapping. Resizing recommended for better performance and quality.")); }; if (((bitmap) && (((!(((bitmap.width % levels) == 0))) || (!(((bitmap.height % levels) == 0))))))){ okBitmap = new BitmapData(width, height, bitmap.transparent, 0); widthOffset = bitmap.width; heightOffset = bitmap.height; this.maxU = (bitmap.width / width); this.maxV = (bitmap.height / height); okBitmap.draw(bitmap); extendBitmapEdges(okBitmap, bitmap.width, bitmap.height); } else { this.maxU = (this.maxV = 1); okBitmap = bitmap; }; return (okBitmap); } public function set texture(asset:Object):void{ if ((asset is BitmapData) == false){ Papervision3D.log("Error: BitmapMaterial.texture requires a BitmapData object for the texture"); return; }; bitmap = createBitmap(BitmapData(asset)); _texture = asset; } protected function createBitmap(asset:BitmapData):BitmapData{ resetMapping(); if (AUTO_MIP_MAPPING){ return (correctBitmap(asset)); }; this.maxU = (this.maxV = 1); return (asset); } override public function toString():String{ return (((((("Texture:" + this.texture) + " lineColor:") + this.lineColor) + " lineAlpha:") + this.lineAlpha)); } override public function copy(material:MaterialObject3D):void{ super.copy(material); this.maxU = material.maxU; this.maxV = material.maxV; } protected function extendBitmapEdges(bmp:BitmapData, originalWidth:Number, originalHeight:Number):void{ var srcRect:Rectangle; var dstPoint:Point; var i:int; srcRect = new Rectangle(); dstPoint = new Point(); if (bmp.width > originalWidth){ srcRect.x = (originalWidth - 1); srcRect.y = 0; srcRect.width = 1; srcRect.height = originalHeight; dstPoint.y = 0; i = originalWidth; while (i < bmp.width) { dstPoint.x = i; bmp.copyPixels(bmp, srcRect, dstPoint); i++; }; }; if (bmp.height > originalHeight){ srcRect.x = 0; srcRect.y = (originalHeight - 1); srcRect.width = bmp.width; srcRect.height = 1; dstPoint.x = 0; i = originalHeight; while (i < bmp.height) { dstPoint.y = i; bmp.copyPixels(bmp, srcRect, dstPoint); i++; }; }; } override public function clone():MaterialObject3D{ var cloned:MaterialObject3D; cloned = super.clone(); cloned.maxU = this.maxU; cloned.maxV = this.maxV; return (cloned); } } }//package org.papervision3d.materials
Section 192
//InteractiveMovieMaterial (org.papervision3d.materials.InteractiveMovieMaterial) package org.papervision3d.materials { import flash.display.*; import org.papervision3d.objects.*; import org.papervision3d.core.geom.*; public class InteractiveMovieMaterial extends MovieMaterial { public function InteractiveMovieMaterial(movieAsset:Sprite, transparent:Boolean=false, animated:Boolean=false){ super(movieAsset, transparent, animated); } override public function drawFace3D(instance:DisplayObject3D, face3D:Face3D, graphics:Graphics, v0:Vertex2D, v1:Vertex2D, v2:Vertex2D):int{ var result:int; result = super.drawFace3D(instance, face3D, graphics, v0, v1, v2); if (((!((instance.interactiveSceneManager == null))) && (result))){ instance.interactiveSceneManager.drawFace(instance, face3D, v0.x, v1.x, v2.x, v0.y, v1.y, v2.y); }; return (result); } } }//package org.papervision3d.materials
Section 193
//MaterialsList (org.papervision3d.materials.MaterialsList) package org.papervision3d.materials { import flash.utils.*; import org.papervision3d.core.proto.*; public class MaterialsList { public var materialsByName:Dictionary; protected var _materials:Dictionary; private var _materialsTotal:int; public function MaterialsList(materials=null):void{ var i:String; var name:String; super(); this.materialsByName = new Dictionary(true); this._materials = new Dictionary(false); this._materialsTotal = 0; if (materials){ if ((materials is Array)){ for (i in materials) { this.addMaterial(materials[i]); }; } else { if ((materials is Object)){ for (name in materials) { this.addMaterial(materials[name], name); }; }; }; }; } public function get numMaterials():int{ return (this._materialsTotal); } public function addMaterial(material:MaterialObject3D, name:String=null):MaterialObject3D{ name = ((((name) || (material.name))) || (String(material.id))); this._materials[material] = name; this.materialsByName[name] = material; this._materialsTotal++; return (material); } public function removeMaterial(material:MaterialObject3D):MaterialObject3D{ delete this.materialsByName[this._materials[material]]; delete this._materials[material]; return (material); } public function toString():String{ var list:String; var m:MaterialObject3D; list = ""; for each (m in this.materialsByName) { list = (list + (this._materials[m] + "\n")); }; return (list); } public function removeMaterialByName(name:String):MaterialObject3D{ return (removeMaterial(getMaterialByName(name))); } public function clone():MaterialsList{ var cloned:MaterialsList; var m:MaterialObject3D; cloned = new MaterialsList(); for each (m in this.materialsByName) { cloned.addMaterial(m.clone(), this._materials[m]); }; return (cloned); } public function getMaterialByName(name:String):MaterialObject3D{ return ((this.materialsByName[name]) ? this.materialsByName[name] : this.materialsByName["all"]); } } }//package org.papervision3d.materials
Section 194
//MovieMaterial (org.papervision3d.materials.MovieMaterial) package org.papervision3d.materials { import flash.display.*; import flash.utils.*; import flash.geom.*; import org.papervision3d.*; public class MovieMaterial extends BitmapMaterial { public var movieTransparent:Boolean; public var allowAutoResize:Boolean;// = true public var movie:DisplayObject; private static var animatedMaterials:Dictionary = new Dictionary(false); public function MovieMaterial(movieAsset:DisplayObject=null, transparent:Boolean=false, animated:Boolean=false){ allowAutoResize = true; super(); movieTransparent = transparent; this.animated = animated; if (movieAsset){ texture = movieAsset; }; } public function drawBitmap():void{ var mtx:Matrix; bitmap.fillRect(bitmap.rect, this.fillColor); mtx = new Matrix(); mtx.scale(movie.scaleX, movie.scaleY); bitmap.draw(movie, mtx, movie.transform.colorTransform); } override public function get texture():Object{ return (this._texture); } public function get animated():Boolean{ return (animatedMaterials[this]); } override public function set texture(asset:Object):void{ if ((asset is DisplayObject) == false){ Papervision3D.log("Error: MovieMaterial.texture requires a Sprite to be passed as the object"); return; }; bitmap = createBitmapFromSprite(DisplayObject(asset)); _texture = asset; } protected function createBitmapFromSprite(asset:DisplayObject):BitmapData{ movie = asset; initBitmap(movie); drawBitmap(); bitmap = super.createBitmap(bitmap); return (bitmap); } public function set animated(status:Boolean):void{ animatedMaterials[this] = status; } override public function updateBitmap():void{ var mWidth:int; var mHeight:int; mWidth = int(movie.width); mHeight = int(movie.height); if (((allowAutoResize) && (((!((mWidth == bitmap.width))) || (!((mHeight == bitmap.height))))))){ initBitmap(movie); }; drawBitmap(); } protected function initBitmap(asset:DisplayObject):void{ if (bitmap){ bitmap.dispose(); }; bitmap = new BitmapData(asset.width, asset.height, this.movieTransparent); } public static function updateAnimatedBitmaps():void{ var material:Object; for (material in animatedMaterials) { if (animatedMaterials[material]){ material.updateBitmap(); }; }; } } }//package org.papervision3d.materials
Section 195
//WireframeMaterial (org.papervision3d.materials.WireframeMaterial) package org.papervision3d.materials { import flash.display.*; import org.papervision3d.objects.*; import org.papervision3d.core.proto.*; import org.papervision3d.core.geom.*; import org.papervision3d.core.draw.*; public class WireframeMaterial extends MaterialObject3D implements IFaceDrawer { public function WireframeMaterial(color:Number=0xFF00FF, alpha:Number=100){ super(); this.lineColor = color; this.lineAlpha = alpha; this.doubleSided = false; } override public function drawFace3D(instance:DisplayObject3D, face3D:Face3D, graphics:Graphics, v0:Vertex2D, v1:Vertex2D, v2:Vertex2D):int{ var x0:Number; var y0:Number; var x1:Number; var y1:Number; var x2:Number; var y2:Number; x0 = v0.x; y0 = v0.y; x1 = v1.x; y1 = v1.y; x2 = v2.x; y2 = v2.y; if (lineAlpha){ graphics.lineStyle(0, lineColor, lineAlpha); graphics.moveTo(x0, y0); graphics.lineTo(x1, y1); graphics.lineTo(x2, y2); graphics.lineTo(x0, y0); graphics.lineStyle(); return (1); }; return (0); } override public function toString():String{ return (((("WireframeMaterial - color:" + this.lineColor) + " alpha:") + this.lineAlpha)); } } }//package org.papervision3d.materials
Section 196
//DisplayObject3D (org.papervision3d.objects.DisplayObject3D) package org.papervision3d.objects { import flash.display.*; import org.papervision3d.materials.*; import org.papervision3d.core.proto.*; import org.papervision3d.core.*; import org.papervision3d.core.geom.*; import com.blitzagency.xray.logger.*; import org.papervision3d.utils.*; import org.papervision3d.scenes.*; import org.papervision3d.*; public class DisplayObject3D extends DisplayObjectContainer3D { public var extra:Object; public var id:int; private var _rotationY:Number; private var _rotationZ:Number; private var _rotationX:Number; public var material:MaterialObject3D; public var meshSort:uint;// = 1 public var materials:MaterialsList; private var _scaleDirty:Boolean;// = false public var transform:Matrix3D; public var screenZ:Number; public var visible:Boolean; private var _scaleX:Number; private var _scaleY:Number; private var _scaleZ:Number; public var geometry:GeometryObject3D; public var interactiveSceneManager:InteractiveSceneManager; public var screen:Number3D; public var name:String; public var container:Sprite; public var world:Matrix3D; public var parent:DisplayObjectContainer3D; public var view:Matrix3D; protected var _scene:SceneObject3D;// = null public var faces:Array; protected var _transformDirty:Boolean;// = false private var _rotationDirty:Boolean;// = false protected var _sorted:Array; public static const MESH_SORT_CENTER:uint = 1; public static const MESH_SORT_CLOSE:uint = 3; public static const MESH_SORT_FAR:uint = 2; private static var LEFT:Number3D = new Number3D(-1, 0, 0); private static var _totalDisplayObjects:int = 0; private static var UP:Number3D = new Number3D(0, 1, 0); private static var BACKWARD:Number3D = new Number3D(0, 0, -1); private static var FORWARD:Number3D = new Number3D(0, 0, 1); private static var DOWN:Number3D = new Number3D(0, -1, 0); public static var faceLevelMode:Boolean; private static var toDEGREES:Number = 57.2957795130823; private static var toRADIANS:Number = 0.0174532925199433; private static var RIGHT:Number3D = new Number3D(1, 0, 0); public function DisplayObject3D(name:String=null, geometry:GeometryObject3D=null, initObject:Object=null):void{ var scaleDefault:Number; screen = new Number3D(); _scene = null; meshSort = MESH_SORT_CENTER; faces = new Array(); _transformDirty = false; _rotationDirty = false; _scaleDirty = false; super(); Papervision3D.log(("DisplayObject3D: " + name)); this.transform = Matrix3D.IDENTITY; this.world = Matrix3D.IDENTITY; this.view = Matrix3D.IDENTITY; this.x = (initObject) ? ((initObject.x) || (0)) : 0; this.y = (initObject) ? ((initObject.y) || (0)) : 0; this.z = (initObject) ? ((initObject.z) || (0)) : 0; rotationX = (initObject) ? ((initObject.rotationX) || (0)) : 0; rotationY = (initObject) ? ((initObject.rotationY) || (0)) : 0; rotationZ = (initObject) ? ((initObject.rotationZ) || (0)) : 0; scaleDefault = (Papervision3D.usePERCENT) ? 100 : 1; scaleX = (initObject) ? ((initObject.scaleX) || (scaleDefault)) : scaleDefault; scaleY = (initObject) ? ((initObject.scaleY) || (scaleDefault)) : scaleDefault; scaleZ = (initObject) ? ((initObject.scaleZ) || (scaleDefault)) : scaleDefault; if (((initObject) && (initObject.extra))){ this.extra = initObject.extra; }; if (((initObject) && (initObject.container))){ this.container = initObject.container; }; this.visible = true; this.id = _totalDisplayObjects++; this.name = ((name) || (String(this.id))); if (geometry){ addGeometry(geometry); }; } public function set z(value:Number):void{ this.transform.n34 = value; } override public function addChild(child:DisplayObject3D, name:String=null):DisplayObject3D{ child = super.addChild(child, name); if (child.scene == null){ child.scene = scene; }; return (child); } public function moveDown(distance:Number):void{ translate(distance, DOWN); } public function set scene(p_scene:SceneObject3D):void{ var child:DisplayObject3D; _scene = p_scene; for each (child in this._childrenByName) { if (child.scene == null){ child.scene = _scene; }; }; if ((_scene is InteractiveScene3D) == false){ return; }; interactiveSceneManager = InteractiveScene3D(_scene).interactiveSceneManager; } public function project(parent:DisplayObject3D, camera:CameraObject3D, sorted:Array=null):Number{ var screenZs:Number; var children:Number; var child:DisplayObject3D; if (this._transformDirty){ updateTransform(); }; this.view.calculateMultiply(parent.view, this.transform); this.world.calculateMultiply(parent.world, this.transform); calculateScreenCoords(camera); screenZs = 0; children = 0; if (!sorted){ sorted = new Array(); this._sorted = sorted; }; for each (child in this._childrenByName) { if (child.visible){ screenZs = (screenZs + child.project(this, camera, sorted)); children++; }; }; return ((this.screenZ = (screenZs / children))); } private function calculateScreenCoords(camera:CameraObject3D):void{ var persp:Number; persp = ((camera.focus * camera.zoom) / (camera.focus + view.n34)); screen.x = (view.n14 * persp); screen.y = (view.n24 * persp); screen.z = view.n34; } public function lookAt(targetObject:DisplayObject3D, upAxis:Number3D=null):void{ var position:Number3D; var target:Number3D; var zAxis:Number3D; var xAxis:Number3D; var yAxis:Number3D; var look:Matrix3D; var log:XrayLog; position = new Number3D(this.x, this.y, this.z); target = new Number3D(targetObject.x, targetObject.y, targetObject.z); zAxis = Number3D.sub(target, position); zAxis.normalize(); if (zAxis.modulo > 0.1){ xAxis = Number3D.cross(zAxis, ((upAxis) || (UP))); xAxis.normalize(); yAxis = Number3D.cross(zAxis, xAxis); yAxis.normalize(); look = this.transform; look.n11 = (xAxis.x * _scaleX); look.n21 = (xAxis.y * _scaleX); look.n31 = (xAxis.z * _scaleX); look.n12 = (-(yAxis.x) * _scaleY); look.n22 = (-(yAxis.y) * _scaleY); look.n32 = (-(yAxis.z) * _scaleY); look.n13 = (zAxis.x * _scaleZ); look.n23 = (zAxis.y * _scaleZ); look.n33 = (zAxis.z * _scaleZ); this._transformDirty = false; this._rotationDirty = true; } else { log = new XrayLog(); log.debug("lookAt Error"); }; } public function set rotationX(rot:Number):void{ this._rotationX = (Papervision3D.useDEGREES) ? (-(rot) * toRADIANS) : -(rot); this._transformDirty = true; } public function set rotationY(rot:Number):void{ this._rotationY = (Papervision3D.useDEGREES) ? (-(rot) * toRADIANS) : -(rot); this._transformDirty = true; } public function set rotationZ(rot:Number):void{ this._rotationZ = (Papervision3D.useDEGREES) ? (-(rot) * toRADIANS) : -(rot); this._transformDirty = true; } public function addGeometry(geometry:GeometryObject3D=null):void{ if (geometry){ this.geometry = geometry; }; } public function get sceneX():Number{ return (this.world.n14); } public function get scaleX():Number{ if (Papervision3D.usePERCENT){ return ((this._scaleX * 100)); }; return (this._scaleX); } public function get scaleY():Number{ if (Papervision3D.usePERCENT){ return ((this._scaleY * 100)); }; return (this._scaleY); } public function get scaleZ():Number{ if (Papervision3D.usePERCENT){ return ((this._scaleZ * 100)); }; return (this._scaleZ); } public function moveUp(distance:Number):void{ translate(distance, UP); } public function get sceneZ():Number{ return (this.world.n34); } public function distanceTo(obj:DisplayObject3D):Number{ var x:Number; var y:Number; var z:Number; x = (this.x - obj.x); y = (this.y - obj.y); z = (this.z - obj.z); return (Math.sqrt((((x * x) + (y * y)) + (z * z)))); } public function get scale():Number{ if ((((this._scaleX == this._scaleY)) && ((this._scaleX == this._scaleZ)))){ if (Papervision3D.usePERCENT){ return ((this._scaleX * 100)); }; return (this._scaleX); //unresolved jump }; return (NaN); } public function get sceneY():Number{ return (this.world.n24); } public function hitTestObject(obj:DisplayObject3D, multiplier:Number=1):Boolean{ var dx:Number; var dy:Number; var dz:Number; var d2:Number; var sA:Number; var sB:Number; dx = (this.x - obj.x); dy = (this.y - obj.y); dz = (this.z - obj.z); d2 = (((dx * dx) + (dy * dy)) + (dz * dz)); sA = (this.geometry) ? this.geometry.boundingSphere2 : 0; sB = (obj.geometry) ? obj.geometry.boundingSphere2 : 0; sA = (sA * multiplier); return (((sA + sB) > d2)); } public function translate(distance:Number, axis:Number3D):void{ var vector:Number3D; vector = axis.clone(); if (this._transformDirty){ updateTransform(); }; Matrix3D.rotateAxis(transform, vector); this.x = (this.x + (distance * vector.x)); this.y = (this.y + (distance * vector.y)); this.z = (this.z + (distance * vector.z)); } private function updateRotation():void{ var rot:Number3D; rot = Matrix3D.matrix2euler(this.transform); this._rotationX = (rot.x * toRADIANS); this._rotationY = (rot.y * toRADIANS); this._rotationZ = (rot.z * toRADIANS); this._rotationDirty = false; } public function pitch(angle:Number):void{ var vector:Number3D; var m:Matrix3D; angle = (Papervision3D.useDEGREES) ? (angle * toRADIANS) : angle; vector = RIGHT.clone(); if (this._transformDirty){ updateTransform(); }; Matrix3D.rotateAxis(transform, vector); m = Matrix3D.rotationMatrix(vector.x, vector.y, vector.z, angle); this.transform.calculateMultiply3x3(m, transform); this._rotationDirty = true; } public function yaw(angle:Number):void{ var vector:Number3D; var m:Matrix3D; angle = (Papervision3D.useDEGREES) ? (angle * toRADIANS) : angle; vector = UP.clone(); if (this._transformDirty){ updateTransform(); }; Matrix3D.rotateAxis(transform, vector); m = Matrix3D.rotationMatrix(vector.x, vector.y, vector.z, angle); this.transform.calculateMultiply3x3(m, transform); this._rotationDirty = true; } public function copyTransform(reference):void{ var trans:Matrix3D; var matrix:Matrix3D; trans = this.transform; matrix = ((reference is DisplayObject3D)) ? reference.transform : reference; trans.n11 = matrix.n11; trans.n12 = matrix.n12; trans.n13 = matrix.n13; trans.n14 = matrix.n14; trans.n21 = matrix.n21; trans.n22 = matrix.n22; trans.n23 = matrix.n23; trans.n24 = matrix.n24; trans.n31 = matrix.n31; trans.n32 = matrix.n32; trans.n33 = matrix.n33; trans.n34 = matrix.n34; this._transformDirty = false; this._rotationDirty = true; } public function get x():Number{ return (this.transform.n14); } public function get z():Number{ return (this.transform.n34); } override public function toString():String{ return (((((((this.name + ": x:") + Math.round(this.x)) + " y:") + Math.round(this.y)) + " z:") + Math.round(this.z))); } public function roll(angle:Number):void{ var vector:Number3D; var m:Matrix3D; angle = (Papervision3D.useDEGREES) ? (angle * toRADIANS) : angle; vector = FORWARD.clone(); if (this._transformDirty){ updateTransform(); }; Matrix3D.rotateAxis(transform, vector); m = Matrix3D.rotationMatrix(vector.x, vector.y, vector.z, angle); this.transform.calculateMultiply3x3(m, transform); this._rotationDirty = true; } public function getMaterialByName(name:String):MaterialObject3D{ var material:MaterialObject3D; var child:DisplayObject3D; material = this.materials.getMaterialByName(name); if (material){ return (material); }; for each (child in this._childrenByName) { material = child.getMaterialByName(name); if (material){ return (material); }; }; return (null); } public function moveLeft(distance:Number):void{ translate(distance, LEFT); } public function get scene():SceneObject3D{ return (_scene); } public function get y():Number{ return (this.transform.n24); } public function set scale(scale:Number):void{ if (Papervision3D.usePERCENT){ scale = (scale / 100); }; this._scaleX = (this._scaleY = (this._scaleZ = scale)); this._transformDirty = true; } public function render(scene:SceneObject3D):void{ var iFaces:Array; var container:Sprite; var rendered:Number; var iFace:Face3DInstance; var length:Number; var i:int; iFaces = this._sorted; iFaces.sortOn("screenZ", (Array.DESCENDING | Array.NUMERIC)); container = ((this.container) || (scene.container)); rendered = 0; length = iFaces.length; i = 0; while (i < length) { iFace = iFaces[i]; if (faceLevelMode){ if (!iFace.container){ iFace.container = new InteractiveSprite(this); scene.container.addChild(iFace.container); } else { iFace.container.graphics.clear(); }; if (iFace.visible){ rendered = (rendered + iFace.face.render(iFace.instance, iFace.container)); }; } else { if (iFace.visible){ rendered = (rendered + iFace.face.render(iFace.instance, container)); }; }; i++; }; scene.stats.rendered = (scene.stats.rendered + rendered); } public function get rotationY():Number{ if (this._rotationDirty){ updateRotation(); }; return ((Papervision3D.useDEGREES) ? (-(this._rotationY) * toDEGREES) : -(this._rotationY)); } public function get rotationZ():Number{ if (this._rotationDirty){ updateRotation(); }; return ((Papervision3D.useDEGREES) ? (-(this._rotationZ) * toDEGREES) : -(this._rotationZ)); } public function set scaleY(scale:Number):void{ if (Papervision3D.usePERCENT){ this._scaleY = (scale / 100); } else { this._scaleY = scale; }; this._transformDirty = true; } public function set scaleZ(scale:Number):void{ if (Papervision3D.usePERCENT){ this._scaleZ = (scale / 100); } else { this._scaleZ = scale; }; this._transformDirty = true; } public function get rotationX():Number{ if (this._rotationDirty){ updateRotation(); }; return ((Papervision3D.useDEGREES) ? (-(this._rotationX) * toDEGREES) : -(this._rotationX)); } public function set scaleX(scale:Number):void{ if (Papervision3D.usePERCENT){ this._scaleX = (scale / 100); } else { this._scaleX = scale; }; this._transformDirty = true; } protected function updateTransform():void{ var q:Object; var m:Matrix3D; var transform:Matrix3D; var scaleM:Matrix3D; q = Matrix3D.euler2quaternion(-(this._rotationY), -(this._rotationZ), this._rotationX); m = Matrix3D.quaternion2matrix(q.x, q.y, q.z, q.w); transform = this.transform; m.n14 = transform.n14; m.n24 = transform.n24; m.n34 = transform.n34; transform.copy(m); scaleM = Matrix3D.IDENTITY; scaleM.n11 = this._scaleX; scaleM.n22 = this._scaleY; scaleM.n33 = this._scaleZ; this.transform.calculateMultiply(transform, scaleM); this._transformDirty = false; } public function moveForward(distance:Number):void{ translate(distance, FORWARD); } public function copyPosition(reference):void{ var trans:Matrix3D; var matrix:Matrix3D; trans = this.transform; matrix = ((reference is DisplayObject3D)) ? reference.transform : reference; trans.n14 = matrix.n14; trans.n24 = matrix.n24; trans.n34 = matrix.n34; } public function hitTestPoint(x:Number, y:Number, z:Number):Boolean{ var dx:Number; var dy:Number; var dz:Number; var d2:Number; var sA:Number; dx = (this.x - x); dy = (this.y - y); dz = (this.z - z); d2 = (((x * x) + (y * y)) + (z * z)); sA = (this.geometry) ? this.geometry.boundingSphere2 : 0; return ((sA > d2)); } public function moveRight(distance:Number):void{ translate(distance, RIGHT); } public function moveBackward(distance:Number):void{ translate(distance, BACKWARD); } public function materialsList():String{ var list:String; var name:String; var child:DisplayObject3D; list = ""; for (name in this.materials) { list = (list + (name + "\n")); }; for each (child in this._childrenByName) { for (name in child.materials.materialsByName) { list = (list + (("+ " + name) + "\n")); }; }; return (list); } public function set x(value:Number):void{ this.transform.n14 = value; } public function set y(value:Number):void{ this.transform.n24 = value; } public static function get ZERO():DisplayObject3D{ return (new (DisplayObject3D)); } } }//package org.papervision3d.objects
Section 197
//InteractiveScene3D (org.papervision3d.scenes.InteractiveScene3D) package org.papervision3d.scenes { import flash.display.*; import org.papervision3d.core.proto.*; import org.papervision3d.utils.*; public class InteractiveScene3D extends MovieScene3D { public var interactiveSceneManager:InteractiveSceneManager; public function InteractiveScene3D(container:Sprite){ super(container); interactiveSceneManager = new InteractiveSceneManager(this); } override public function renderCamera(camera:CameraObject3D):void{ interactiveSceneManager.resetFaces(); super.renderCamera(camera); interactiveSceneManager.sortObjects(); } } }//package org.papervision3d.scenes
Section 198
//MovieScene3D (org.papervision3d.scenes.MovieScene3D) package org.papervision3d.scenes { import flash.display.*; import flash.utils.*; import org.papervision3d.objects.*; import org.papervision3d.core.proto.*; public class MovieScene3D extends Scene3D { private var spriteList:Dictionary; private var containerList:Array; public function MovieScene3D(container:Sprite){ super(container); this.containerList = new Array(); spriteList = new Dictionary(); } override public function addChild(child:DisplayObject3D, name:String=null):DisplayObject3D{ child = super.addChild(child, name); child.container = new Sprite(); container.addChild(child.container); this.containerList.push(child.container); spriteList[child] = child.container; return (child); } public function getSprite(child:DisplayObject3D):Sprite{ return (spriteList[child]); } override protected function renderObjects(sort:Boolean):void{ var objectsLength:Number; var gfx:Sprite; var containerList:Array; var i:Number; var p:DisplayObject3D; var objects:Array; var stats:Object; objectsLength = this.objects.length; containerList = this.containerList; i = 0; while ((gfx = containerList[i++])) { gfx.graphics.clear(); }; objects = this.objects; i = objects.length; if (sort){ while ((p = objects[--i])) { if (p.visible){ container.addChild(p.container); p.render(this); }; }; } else { while ((p = objects[--i])) { if (p.visible){ p.render(this); }; }; }; stats = this.stats; stats.performance = (getTimer() - stats.performance); } override public function removeChild(child:DisplayObject3D):DisplayObject3D{ var removed:DisplayObject3D; var i:int; removed = super.removeChild(child); i = 0; while (i < containerList.length) { if (removed.container == containerList[i]){ this.containerList.splice(i, 1); }; i++; }; container.removeChild(removed.container); delete spriteList[removed]; return (removed); } } }//package org.papervision3d.scenes
Section 199
//Scene3D (org.papervision3d.scenes.Scene3D) package org.papervision3d.scenes { import flash.display.*; import flash.utils.*; import org.papervision3d.objects.*; import org.papervision3d.core.proto.*; public class Scene3D extends SceneObject3D { public function Scene3D(container:Sprite){ super(container); } override protected function renderObjects(sort:Boolean):void{ var p:DisplayObject3D; var objects:Array; var i:Number; var stats:Object; this.container.graphics.clear(); objects = this.objects; i = objects.length; while ((p = objects[--i])) { if (p.visible){ p.render(this); }; }; stats = this.stats; stats.performance = (getTimer() - stats.performance); } } }//package org.papervision3d.scenes
Section 200
//IVirtualMouseEvent (org.papervision3d.utils.virtualmouse.IVirtualMouseEvent) package org.papervision3d.utils.virtualmouse { public interface IVirtualMouseEvent { } }//package org.papervision3d.utils.virtualmouse
Section 201
//VirtualMouse (org.papervision3d.utils.virtualmouse.VirtualMouse) package org.papervision3d.utils.virtualmouse { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.geom.*; import com.blitzagency.xray.logger.*; public class VirtualMouse extends EventDispatcher { private var _container:Sprite; private var lastDownTarget:DisplayObject; private var target:InteractiveObject; private var updateMouseDown:Boolean;// = false private var eventEvent:Class; private var _lastEvent:Event; private var mouseEventEvent:Class; private var location:Point; private var delta:int;// = 0 private var disabledEvents:Object; private var log:XrayLog; private var ignoredInstances:Dictionary; private var isLocked:Boolean;// = false private var lastWithinStage:Boolean;// = true private var lastLocation:Point; private var isDoubleClickEvent:Boolean;// = false private var lastMouseDown:Boolean;// = false private var altKey:Boolean;// = false private var _useNativeEvents:Boolean;// = false private var ctrlKey:Boolean;// = false private var shiftKey:Boolean;// = false private var _stage:Stage; public static const UPDATE:String = "update"; private static var _mouseIsDown:Boolean = false; public function VirtualMouse(stage:Stage=null, container:Sprite=null, startX:Number=0, startY:Number=0){ altKey = false; ctrlKey = false; shiftKey = false; delta = 0; isLocked = false; isDoubleClickEvent = false; disabledEvents = new Object(); ignoredInstances = new Dictionary(true); lastMouseDown = false; updateMouseDown = false; lastWithinStage = true; _useNativeEvents = false; eventEvent = VirtualMouseEvent; mouseEventEvent = VirtualMouseMouseEvent; log = new XrayLog(); super(); this.stage = stage; this.container = container; location = new Point(startX, startY); lastLocation = location.clone(); addEventListener(UPDATE, handleUpdate); update(); } public function get mouseIsDown():Boolean{ return (_mouseIsDown); } public function get stage():Stage{ return (_stage); } public function exitContainer():void{ var targetLocal:Point; targetLocal = target.globalToLocal(location); if (!disabledEvents[MouseEvent.MOUSE_OUT]){ _lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, targetLocal.x, targetLocal.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta); container.dispatchEvent(_lastEvent); dispatchEvent(_lastEvent); }; if (!disabledEvents[MouseEvent.ROLL_OUT]){ _lastEvent = new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, targetLocal.x, targetLocal.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta); container.dispatchEvent(_lastEvent); dispatchEvent(_lastEvent); }; if (target != container){ if (!disabledEvents[MouseEvent.MOUSE_OUT]){ _lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, targetLocal.x, targetLocal.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta); target.dispatchEvent(_lastEvent); dispatchEvent(_lastEvent); }; if (!disabledEvents[MouseEvent.ROLL_OUT]){ _lastEvent = new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, targetLocal.x, targetLocal.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta); target.dispatchEvent(_lastEvent); dispatchEvent(_lastEvent); }; }; target = _stage; } public function release():void{ updateMouseDown = true; _mouseIsDown = false; if (!isLocked){ update(); }; } public function click():void{ press(); release(); } public function get container():Sprite{ return (_container); } public function set container(value:Sprite):void{ _container = value; } public function get y():Number{ return (location.y); } public function set x(n:Number):void{ location.x = n; if (!isLocked){ update(); }; } public function disableEvent(type:String):void{ disabledEvents[type] = true; } public function get lastEvent():Event{ return (_lastEvent); } private function handleUpdate(event:Event):void{ var objectsUnderPoint:Array; var currentTarget:InteractiveObject; var currentParent:DisplayObject; var i:int; var targetLocal:Point; var currentTargetLocal:Point; var withinStage:Boolean; if (!container){ return; }; objectsUnderPoint = container.getObjectsUnderPoint(location); i = objectsUnderPoint.length; while (i--) { currentParent = objectsUnderPoint[i]; while (currentParent) { if (ignoredInstances[currentParent]){ currentTarget = null; break; }; if (((currentTarget) && ((currentParent is SimpleButton)))){ currentTarget = null; } else { if (((currentTarget) && (!(DisplayObjectContainer(currentParent).mouseChildren)))){ currentTarget = null; }; }; if (((((!(currentTarget)) && ((currentParent is InteractiveObject)))) && (InteractiveObject(currentParent).mouseEnabled))){ currentTarget = InteractiveObject(currentParent); }; currentParent = currentParent.parent; }; if (currentTarget){ break; }; }; if (!currentTarget){ currentTarget = _stage; log.debug("no new target found, using stage"); }; targetLocal = target.globalToLocal(location); currentTargetLocal = currentTarget.globalToLocal(location); if (((!((lastLocation.x == location.x))) || (!((lastLocation.y == location.y))))){ withinStage = false; if (stage){ withinStage = (((((((location.x >= 0)) && ((location.y >= 0)))) && ((location.x <= stage.stageWidth)))) && ((location.y <= stage.stageHeight))); }; if (((((!(withinStage)) && (lastWithinStage))) && (!(disabledEvents[Event.MOUSE_LEAVE])))){ _lastEvent = new eventEvent(Event.MOUSE_LEAVE, false, false); stage.dispatchEvent(_lastEvent); dispatchEvent(_lastEvent); }; if (((withinStage) && (!(disabledEvents[MouseEvent.MOUSE_MOVE])))){ _lastEvent = new mouseEventEvent(MouseEvent.MOUSE_MOVE, true, false, currentTargetLocal.x, currentTargetLocal.y, currentTarget, ctrlKey, altKey, shiftKey, _mouseIsDown, delta); currentTarget.dispatchEvent(_lastEvent); dispatchEvent(_lastEvent); }; lastWithinStage = withinStage; }; if (currentTarget != target){ if (!disabledEvents[MouseEvent.MOUSE_OUT]){ _lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, targetLocal.x, targetLocal.y, currentTarget, ctrlKey, altKey, shiftKey, _mouseIsDown, delta); target.dispatchEvent(_lastEvent); dispatchEvent(_lastEvent); }; if (!disabledEvents[MouseEvent.ROLL_OUT]){ _lastEvent = new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, targetLocal.x, targetLocal.y, currentTarget, ctrlKey, altKey, shiftKey, _mouseIsDown, delta); target.dispatchEvent(_lastEvent); dispatchEvent(_lastEvent); }; if (!disabledEvents[MouseEvent.MOUSE_OVER]){ _lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OVER, true, false, currentTargetLocal.x, currentTargetLocal.y, target, ctrlKey, altKey, shiftKey, _mouseIsDown, delta); currentTarget.dispatchEvent(_lastEvent); dispatchEvent(_lastEvent); }; if (!disabledEvents[MouseEvent.ROLL_OVER]){ _lastEvent = new mouseEventEvent(MouseEvent.ROLL_OVER, false, false, currentTargetLocal.x, currentTargetLocal.y, target, ctrlKey, altKey, shiftKey, _mouseIsDown, delta); currentTarget.dispatchEvent(_lastEvent); dispatchEvent(_lastEvent); }; }; if (updateMouseDown){ if (_mouseIsDown){ if (!disabledEvents[MouseEvent.MOUSE_DOWN]){ _lastEvent = new mouseEventEvent(MouseEvent.MOUSE_DOWN, true, false, currentTargetLocal.x, currentTargetLocal.y, currentTarget, ctrlKey, altKey, shiftKey, _mouseIsDown, delta); currentTarget.dispatchEvent(_lastEvent); dispatchEvent(_lastEvent); }; lastDownTarget = currentTarget; updateMouseDown = false; } else { if (!disabledEvents[MouseEvent.MOUSE_UP]){ _lastEvent = new mouseEventEvent(MouseEvent.MOUSE_UP, true, false, currentTargetLocal.x, currentTargetLocal.y, currentTarget, ctrlKey, altKey, shiftKey, _mouseIsDown, delta); currentTarget.dispatchEvent(_lastEvent); dispatchEvent(_lastEvent); }; if (((!(disabledEvents[MouseEvent.CLICK])) && ((currentTarget == lastDownTarget)))){ _lastEvent = new mouseEventEvent(MouseEvent.CLICK, true, false, currentTargetLocal.x, currentTargetLocal.y, currentTarget, ctrlKey, altKey, shiftKey, _mouseIsDown, delta); currentTarget.dispatchEvent(_lastEvent); dispatchEvent(_lastEvent); }; lastDownTarget = null; updateMouseDown = false; }; }; if (((((isDoubleClickEvent) && (!(disabledEvents[MouseEvent.DOUBLE_CLICK])))) && (currentTarget.doubleClickEnabled))){ _lastEvent = new mouseEventEvent(MouseEvent.DOUBLE_CLICK, true, false, currentTargetLocal.x, currentTargetLocal.y, currentTarget, ctrlKey, altKey, shiftKey, _mouseIsDown, delta); currentTarget.dispatchEvent(_lastEvent); dispatchEvent(_lastEvent); }; lastLocation = location.clone(); lastMouseDown = _mouseIsDown; target = currentTarget; } public function getLocation():Point{ return (location.clone()); } public function get x():Number{ return (location.x); } public function lock():void{ isLocked = true; } public function get useNativeEvents():Boolean{ return (_useNativeEvents); } public function setLocation(a, b=null):void{ var loc:Point; if ((a is Point)){ loc = Point(a); location.x = loc.x; location.y = loc.y; } else { location.x = Number(a); location.y = Number(b); }; if (!isLocked){ update(); }; } private function keyHandler(event:KeyboardEvent):void{ altKey = event.altKey; ctrlKey = event.ctrlKey; shiftKey = event.shiftKey; } public function unignore(instance:DisplayObject):void{ if ((instance in ignoredInstances)){ delete ignoredInstances[instance]; }; } public function doubleClick():void{ if (isLocked){ release(); } else { click(); press(); isDoubleClickEvent = true; release(); isDoubleClickEvent = false; }; } public function update():void{ dispatchEvent(new Event(UPDATE, false, false)); } public function ignore(instance:DisplayObject):void{ ignoredInstances[instance] = true; } public function unlock():void{ isLocked = false; update(); } public function enableEvent(type:String):void{ if ((type in disabledEvents)){ delete disabledEvents[type]; }; } public function press():void{ updateMouseDown = true; _mouseIsDown = true; if (!isLocked){ update(); }; } public function set useNativeEvents(b:Boolean):void{ if (b == _useNativeEvents){ return; }; _useNativeEvents = b; if (_useNativeEvents){ eventEvent = VirtualMouseEvent; mouseEventEvent = VirtualMouseMouseEvent; } else { eventEvent = Event; mouseEventEvent = MouseEvent; }; } public function set y(n:Number):void{ location.y = n; if (!isLocked){ update(); }; } public function set stage(s:Stage):void{ var hadStage:Boolean; if (_stage){ hadStage = true; _stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyHandler); _stage.removeEventListener(KeyboardEvent.KEY_UP, keyHandler); } else { hadStage = false; }; _stage = s; if (_stage){ _stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler); _stage.addEventListener(KeyboardEvent.KEY_UP, keyHandler); target = _stage; if (!hadStage){ update(); }; }; } } }//package org.papervision3d.utils.virtualmouse
Section 202
//VirtualMouseEvent (org.papervision3d.utils.virtualmouse.VirtualMouseEvent) package org.papervision3d.utils.virtualmouse { import flash.events.*; public class VirtualMouseEvent extends Event implements IVirtualMouseEvent { public function VirtualMouseEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false){ super(type, bubbles, cancelable); } } }//package org.papervision3d.utils.virtualmouse
Section 203
//VirtualMouseMouseEvent (org.papervision3d.utils.virtualmouse.VirtualMouseMouseEvent) package org.papervision3d.utils.virtualmouse { import flash.events.*; import flash.display.*; public class VirtualMouseMouseEvent extends MouseEvent implements IVirtualMouseEvent { public function VirtualMouseMouseEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, localX:Number=NaN, localY:Number=NaN, relatedObject:InteractiveObject=null, ctrlKey:Boolean=false, altKey:Boolean=false, shiftKey:Boolean=false, buttonDown:Boolean=false, delta:int=0){ super(type, bubbles, cancelable, localX, localY, relatedObject, ctrlKey, altKey, shiftKey, buttonDown, delta); } } }//package org.papervision3d.utils.virtualmouse
Section 204
//InteractiveContainerData (org.papervision3d.utils.InteractiveContainerData) package org.papervision3d.utils { import flash.events.*; import org.papervision3d.objects.*; import org.papervision3d.core.geom.*; public class InteractiveContainerData extends EventDispatcher { public var container:InteractiveSprite; public var displayObject3D:DisplayObject3D;// = null public var lineColor:Number; public var lineAlpha:Number; public var fillAlpha:Number; public var sort:Boolean;// = false public var isDrawn:Boolean;// = false public var color:Number; public var lineSize:Number; public var face3d:Face3D; public function InteractiveContainerData(container3d, p_color:Number=0, target:IEventDispatcher=null){ displayObject3D = null; isDrawn = false; sort = false; color = InteractiveSceneManager.DEFAULT_FILL_COLOR; fillAlpha = InteractiveSceneManager.DEFAULT_FILL_ALPHA; lineColor = InteractiveSceneManager.DEFAULT_LINE_COLOR; lineSize = InteractiveSceneManager.DEFAULT_LINE_SIZE; lineAlpha = InteractiveSceneManager.DEFAULT_LINE_ALPHA; super(target); displayObject3D = (((container3d is DisplayObject3D) == true)) ? container3d : null; face3d = (((container3d is Face3D) == true)) ? container3d : null; if (displayObject3D != null){ this.container = new InteractiveSprite(container3d); }; if (face3d != null){ if (face3d.face3DInstance.container != null){ this.container = InteractiveSprite(face3d.face3DInstance.container); } else { this.container = new InteractiveSprite(); }; }; color = p_color; container.alpha = InteractiveSceneManager.DEFAULT_SPRITE_ALPHA; container.interactiveContainerData = this; } public function get screenZ():Number{ return (((displayObject3D)!=null) ? displayObject3D.screenZ : face3d.screenZ); } } }//package org.papervision3d.utils
Section 205
//InteractiveSceneManager (org.papervision3d.utils.InteractiveSceneManager) package org.papervision3d.utils { import flash.events.*; import flash.display.*; import flash.utils.*; import org.papervision3d.materials.*; import org.papervision3d.objects.*; import org.papervision3d.core.proto.*; import org.papervision3d.core.geom.*; import flash.geom.*; import com.blitzagency.xray.logger.*; import org.papervision3d.utils.virtualmouse.*; import org.papervision3d.events.*; public class InteractiveSceneManager extends EventDispatcher { public var container:Sprite; public var scene:SceneObject3D; protected var allowDraw:Boolean;// = true protected var log:XrayLog; private var _mouseInteractionMode:Boolean;// = false public var faceDictionary:Dictionary; public var mouse3D:Mouse3D; public var virtualMouse:VirtualMouse; public var faceLevelMode:Boolean;// = false public var debug:Boolean;// = false protected var evaluateClick:Boolean;// = false public var buttonMode:Boolean;// = false public var containerDictionary:Dictionary; public static var DEFAULT_FILL_ALPHA:Number = 1; public static var DEFAULT_SPRITE_ALPHA:Number = 1; public static var DEFAULT_FILL_COLOR:Number = 0xFFFFFF; public static var DEFAULT_LINE_SIZE:Number = 1; public static var DEFAULT_LINE_ALPHA:Number = 1; public static var DEFAULT_LINE_COLOR:Number = -1; public static var MOUSE_IS_DOWN:Boolean = false; public static var SHOW_DRAWN_FACES:Boolean = false; public function InteractiveSceneManager(p_scene:SceneObject3D):void{ buttonMode = false; faceLevelMode = false; _mouseInteractionMode = false; faceDictionary = new Dictionary(); containerDictionary = new Dictionary(); container = new InteractiveSprite(); mouse3D = new Mouse3D(); virtualMouse = new VirtualMouse(); debug = false; allowDraw = true; evaluateClick = false; log = new XrayLog(); super(); container.addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage); scene = p_scene; scene.container.parent.addChild(container); container.x = scene.container.x; container.y = scene.container.y; enableMouse = false; } protected function handleStageMouseMove(e:MouseEvent):void{ allowDraw = true; } public function sortObjects():void{ var sort:Array; var item:InteractiveContainerData; var i:uint; var distance:Number; sort = []; for each (item in faceDictionary) { if (!item.sort){ } else { distance = ((item.face3d == null)) ? item.screenZ : item.face3d.face3DInstance.screenZ; sort.push({container:item.container, distance:distance}); }; }; sort.sortOn("distance", (Array.DESCENDING | Array.NUMERIC)); i = 0; while (i < sort.length) { container.addChild(sort[i].container); i++; }; if (mouseInteractionMode){ allowDraw = false; }; } public function setInteractivityDefaults():void{ SHOW_DRAWN_FACES = false; DEFAULT_SPRITE_ALPHA = 1; DEFAULT_FILL_ALPHA = 1; BitmapMaterial.AUTO_MIP_MAPPING = false; DisplayObject3D.faceLevelMode = false; buttonMode = true; faceLevelMode = true; mouseInteractionMode = false; } public function addInteractiveObject(container3d:Object):void{ var icd:InteractiveContainerData; var icdContainer:InteractiveSprite; if (faceDictionary[container3d] == null){ icd = (faceDictionary[container3d] = new InteractiveContainerData(container3d)); containerDictionary[icd.container] = container3d; icdContainer = icd.container; icdContainer.addEventListener(MouseEvent.MOUSE_DOWN, handleMousePress); icdContainer.addEventListener(MouseEvent.MOUSE_UP, handleMouseRelease); icdContainer.addEventListener(MouseEvent.CLICK, handleMouseClick); icdContainer.addEventListener(MouseEvent.MOUSE_OVER, handleMouseOver); icdContainer.addEventListener(MouseEvent.MOUSE_OUT, handleMouseOut); icdContainer.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove); icdContainer.buttonMode = buttonMode; if (((!(SHOW_DRAWN_FACES)) && (!(DisplayObject3D.faceLevelMode)))){ icdContainer.blendMode = BlendMode.ERASE; }; virtualMouse.ignore(icdContainer); dispatchEvent(new InteractiveScene3DEvent(InteractiveScene3DEvent.OBJECT_ADDED, null, icdContainer)); if (debug){ log.debug("addDisplayObject id", container3d.id, container3d.name, DEFAULT_SPRITE_ALPHA); }; }; } public function resetFaces():void{ var item:InteractiveContainerData; for each (item in faceDictionary) { item.container.graphics.clear(); item.sort = item.isDrawn; item.isDrawn = false; }; resizeStage(); } public function resizeStage():void{ container.x = scene.container.x; container.y = scene.container.y; } protected function handleMouseClick(e:MouseEvent):void{ dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_CLICK, Sprite(e.currentTarget)); } protected function handleMouseOut(e:MouseEvent):void{ var face3d:Face3D; var p:Object; var mat:InteractiveMovieMaterial; var rect:Rectangle; var contains:Boolean; var e = e; if (((VirtualMouse) && (((faceLevelMode) || (DisplayObject3D.faceLevelMode))))){ face3d = containerDictionary[e.currentTarget]; p = InteractiveUtils.getMapCoordAtPoint(face3d, container.mouseX, container.mouseY); mat = InteractiveMovieMaterial(face3d.face3DInstance.instance.material); rect = new Rectangle(0, 0, mat.movie.width, mat.movie.height); contains = rect.contains(p.x, p.y); if (!contains){ virtualMouse.exitContainer(); }; //unresolved jump var _slot1 = err; log.error("material type is not Interactive. If you're using a Collada object, you may have to reassign the material to the object after the collada scene is loaded", _slot1.message); }; dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_OUT, Sprite(e.currentTarget)); } public function drawFace(container3d:DisplayObject3D, face3d:Face3D, x0:Number, x1:Number, x2:Number, y0:Number, y1:Number, y2:Number):void{ var container:Object; var drawingContainer:InteractiveContainerData; var iContainer:InteractiveSprite; var graphics:Graphics; container = container3d; if (((faceLevelMode) || (DisplayObject3D.faceLevelMode))){ container = face3d; }; if (faceDictionary[container] == null){ addInteractiveObject(container); }; if (((allowDraw) && (!(DisplayObject3D.faceLevelMode)))){ drawingContainer = faceDictionary[container]; iContainer = drawingContainer.container; graphics = iContainer.graphics; iContainer.x0 = x0; iContainer.x1 = x1; iContainer.x2 = x2; iContainer.y0 = y0; iContainer.y1 = y1; iContainer.y2 = y2; graphics.beginFill(drawingContainer.color, drawingContainer.fillAlpha); if (((!((drawingContainer.lineColor == -1))) && (SHOW_DRAWN_FACES))){ graphics.lineStyle(drawingContainer.lineSize, drawingContainer.lineColor, drawingContainer.lineAlpha); }; graphics.moveTo(x0, y0); graphics.lineTo(x1, y1); graphics.lineTo(x2, y2); graphics.endFill(); drawingContainer.isDrawn = true; }; } public function set enableMouse(value:Boolean):void{ Mouse3D.enabled = value; } protected function dispatchObjectEvent(event:String, currentTarget:Sprite):void{ var face3d:Face3D; var face3dContainer:InteractiveContainerData; if (debug){ log.debug(event, DisplayObject3D(containerDictionary[currentTarget]).name); }; if ((containerDictionary[currentTarget] is DisplayObject3D)){ containerDictionary[currentTarget].dispatchEvent(new InteractiveScene3DEvent(event, containerDictionary[currentTarget], InteractiveSprite(currentTarget))); dispatchEvent(new InteractiveScene3DEvent(event, containerDictionary[currentTarget], InteractiveSprite(currentTarget), null, null)); } else { if ((containerDictionary[currentTarget] is Face3D)){ face3d = containerDictionary[currentTarget]; face3dContainer = faceDictionary[face3d]; dispatchEvent(new InteractiveScene3DEvent(event, null, InteractiveSprite(currentTarget), face3d, face3dContainer)); }; }; } protected function handleMouseMove(e:MouseEvent):void{ var point:Object; var face3d:Face3D; var mat:MovieMaterial; var e = e; if (((VirtualMouse) && (((faceLevelMode) || (DisplayObject3D.faceLevelMode))))){ face3d = containerDictionary[e.currentTarget]; point = InteractiveUtils.getMapCoordAtPoint(face3d, container.mouseX, container.mouseY); mat = (face3d.face3DInstance.instance.material as MovieMaterial); virtualMouse.container = (mat.movie as Sprite); if (virtualMouse.container){ virtualMouse.setLocation(point.x, point.y); }; //unresolved jump var _slot1 = err; log.error("material type is not Inter active. If you're using a Collada object, you may have to reassign the material to the object after the collada scene is loaded", _slot1.message); }; dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_MOVE, Sprite(e.currentTarget)); if (((Mouse3D.enabled) && (((faceLevelMode) || (DisplayObject3D.faceLevelMode))))){ mouse3D.updatePosition(Face3D(containerDictionary[e.currentTarget]), (e.currentTarget as Sprite)); }; } protected function handleMouseOver(e:MouseEvent):void{ var eventType:String; eventType = (((!(evaluateClick)) || (!(mouseInteractionMode)))) ? InteractiveScene3DEvent.OBJECT_OVER : InteractiveScene3DEvent.OBJECT_CLICK; evaluateClick = false; if (((virtualMouse) && ((eventType == InteractiveScene3DEvent.OBJECT_CLICK)))){ virtualMouse.click(); }; dispatchObjectEvent(eventType, Sprite(e.currentTarget)); } public function set mouseInteractionMode(value:Boolean):void{ _mouseInteractionMode = value; allowDraw = !(value); if (value){ container.stage.addEventListener(MouseEvent.MOUSE_MOVE, handleStageMouseMove); }; if (!value){ container.stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleStageMouseMove); }; } public function get enableMouse():Boolean{ return (Mouse3D.enabled); } protected function handleMousePress(e:MouseEvent):void{ MOUSE_IS_DOWN = true; if (virtualMouse){ virtualMouse.press(); }; dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_PRESS, Sprite(e.currentTarget)); } protected function handleReleaseOutside(e:MouseEvent):void{ if (debug){ log.debug("releaseOutside"); }; dispatchEvent(new InteractiveScene3DEvent(InteractiveScene3DEvent.OBJECT_RELEASE_OUTSIDE)); MOUSE_IS_DOWN = false; evaluateClick = true; allowDraw = true; } public function get mouseInteractionMode():Boolean{ return (_mouseInteractionMode); } protected function handleAddedToStage(e:Event):void{ container.stage.addEventListener(Event.RESIZE, handleResize); container.stage.addEventListener(MouseEvent.MOUSE_UP, handleReleaseOutside); virtualMouse.stage = container.stage; } protected function handleMouseRelease(e:MouseEvent):void{ MOUSE_IS_DOWN = false; if (virtualMouse){ virtualMouse.release(); }; dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_RELEASE, Sprite(e.currentTarget)); } protected function handleResize(e:Event):void{ resizeStage(); } } }//package org.papervision3d.utils
Section 206
//InteractiveSprite (org.papervision3d.utils.InteractiveSprite) package org.papervision3d.utils { import flash.display.*; import org.papervision3d.objects.*; public class InteractiveSprite extends Sprite { public var interactiveContainerData:InteractiveContainerData;// = null public var x1:Number; public var x2:Number; public var x0:Number; public var y0:Number; public var y2:Number; public var obj:DisplayObject3D;// = null public var y1:Number; public function InteractiveSprite(obj:DisplayObject3D=null):void{ obj = null; interactiveContainerData = null; super(); this.obj = obj; } } }//package org.papervision3d.utils
Section 207
//InteractiveUtils (org.papervision3d.utils.InteractiveUtils) package org.papervision3d.utils { import flash.display.*; import org.papervision3d.materials.*; import org.papervision3d.objects.*; import org.papervision3d.core.proto.*; import org.papervision3d.core.geom.*; public class InteractiveUtils { public function InteractiveUtils(){ super(); } public static function getMapCoordAtPointDO3D(displayObject:DisplayObject3D, x:Number, y:Number):Object{ var face:Face3D; face = displayObject.geometry.faces[0]; return (getMapCoordAtPoint(face, x, y)); } public static function UVatPoint(face3d:Face3D, x:Number, y:Number):Object{ var v0:Vertex3D; var v1:Vertex3D; var v2:Vertex3D; var v0Dx:Number; var v0Dy:Number; var v1Dx:Number; var v1Dy:Number; var v2Dx:Number; var v2Dy:Number; var v0_x:Number; var v0_y:Number; var v1_x:Number; var v1_y:Number; var v2_x:Number; var v2_y:Number; var dot00:Number; var dot01:Number; var dot02:Number; var dot11:Number; var dot12:Number; var invDenom:Number; var u:Number; var v:Number; v0 = face3d.v0; v1 = face3d.v1; v2 = face3d.v2; v0Dx = v0.vertex2DInstance.x; v0Dy = v0.vertex2DInstance.y; v1Dx = v1.vertex2DInstance.x; v1Dy = v1.vertex2DInstance.y; v2Dx = v2.vertex2DInstance.x; v2Dy = v2.vertex2DInstance.y; v0_x = (v2Dx - v0Dx); v0_y = (v2Dy - v0Dy); v1_x = (v1Dx - v0Dx); v1_y = (v1Dy - v0Dy); v2_x = (x - v0Dx); v2_y = (y - v0Dy); dot00 = ((v0_x * v0_x) + (v0_y * v0_y)); dot01 = ((v0_x * v1_x) + (v0_y * v1_y)); dot02 = ((v0_x * v2_x) + (v0_y * v2_y)); dot11 = ((v1_x * v1_x) + (v1_y * v1_y)); dot12 = ((v1_x * v2_x) + (v1_y * v2_y)); invDenom = (1 / ((dot00 * dot11) - (dot01 * dot01))); u = (((dot11 * dot02) - (dot01 * dot12)) * invDenom); v = (((dot00 * dot12) - (dot01 * dot02)) * invDenom); return ({u:u, v:v}); } public static function getMapCoordAtPoint(face3d:Face3D, x:Number, y:Number):Object{ var uv:Array; var rUV:Object; var u:Number; var v:Number; var u0:Number; var u1:Number; var u2:Number; var v0:Number; var v1:Number; var v2:Number; var v_x:Number; var v_y:Number; var material:MaterialObject3D; var bitmap:BitmapData; var width:Number; var height:Number; uv = face3d.uv; rUV = UVatPoint(face3d, x, y); u = rUV.u; v = rUV.v; u0 = uv[0].u; u1 = uv[1].u; u2 = uv[2].u; v0 = uv[0].v; v1 = uv[1].v; v2 = uv[2].v; v_x = ((((u1 - u0) * v) + ((u2 - u0) * u)) + u0); v_y = ((((v1 - v0) * v) + ((v2 - v0) * u)) + v0); material = face3d.face3DInstance.instance.material; bitmap = material.bitmap; width = 1; height = 1; if (bitmap){ width = (BitmapMaterial.AUTO_MIP_MAPPING) ? material.widthOffset : bitmap.width; height = (BitmapMaterial.AUTO_MIP_MAPPING) ? material.heightOffset : bitmap.height; }; return ({x:(v_x * width), y:(height - (v_y * height))}); } public static function getCoordAtPoint(face3d:Face3D, x:Number, y:Number):Vertex3D{ var rUV:Object; var v0x:Number; var v0y:Number; var v0z:Number; var v1x:Number; var v1y:Number; var v1z:Number; var v2x:Number; var v2y:Number; var v2z:Number; var u:Number; var v:Number; var rX:Number; var rY:Number; var rZ:Number; rUV = UVatPoint(face3d, x, y); v0x = face3d.v0.x; v0y = face3d.v0.y; v0z = face3d.v0.z; v1x = face3d.v1.x; v1y = face3d.v1.y; v1z = face3d.v1.z; v2x = face3d.v2.x; v2y = face3d.v2.y; v2z = face3d.v2.z; u = rUV.u; v = rUV.v; rX = ((v0x + ((v1x - v0x) * v)) + ((v2x - v0x) * u)); rY = ((v0y + ((v1y - v0y) * v)) + ((v2y - v0y) * u)); rZ = ((v0z + ((v1z - v0z) * v)) + ((v2z - v0z) * u)); return (new Vertex3D(rX, rY, rZ)); } } }//package org.papervision3d.utils
Section 208
//Mouse3D (org.papervision3d.utils.Mouse3D) package org.papervision3d.utils { import flash.display.*; import org.papervision3d.objects.*; import org.papervision3d.core.*; import org.papervision3d.core.geom.*; public class Mouse3D extends DisplayObject3D { public static var enabled:Boolean = true; private static var UP:Number3D = new Number3D(0, 1, 0); public function Mouse3D(initObject:Object=null):void{ super(); } public function updatePosition(face3d:Face3D, container:Sprite):void{ var position:Number3D; var target:Number3D; var zAxis:Number3D; var m:Matrix3D; var v:Matrix3D; var mx:Number; var my:Number; var xAxis:Number3D; var yAxis:Number3D; var look:Matrix3D; position = new Number3D(0, 0, 0); target = new Number3D(face3d.faceNormal.x, face3d.faceNormal.y, face3d.faceNormal.z); zAxis = Number3D.sub(target, position); zAxis.normalize(); if (zAxis.modulo > 0.1){ xAxis = Number3D.cross(zAxis, UP); xAxis.normalize(); yAxis = Number3D.cross(zAxis, xAxis); yAxis.normalize(); look = this.transform; look.n11 = xAxis.x; look.n21 = xAxis.y; look.n31 = xAxis.z; look.n12 = -(yAxis.x); look.n22 = -(yAxis.y); look.n32 = -(yAxis.z); look.n13 = zAxis.x; look.n23 = zAxis.y; look.n33 = zAxis.z; }; m = Matrix3D.IDENTITY; this.transform = Matrix3D.multiply(face3d.face3DInstance.instance.world, look); v = Matrix3D.IDENTITY; mx = container.mouseX; my = container.mouseY; v.n14 = InteractiveUtils.getCoordAtPoint(face3d, mx, my).x; v.n24 = InteractiveUtils.getCoordAtPoint(face3d, mx, my).y; v.n34 = InteractiveUtils.getCoordAtPoint(face3d, mx, my).z; m.calculateMultiply(face3d.face3DInstance.instance.world, v); x = m.n14; y = m.n24; z = m.n34; } } }//package org.papervision3d.utils
Section 209
//Papervision3D (org.papervision3d.Papervision3D) package org.papervision3d { public class Papervision3D { public static var useDEGREES:Boolean = true; public static var VERBOSE:Boolean = true; public static var AUTHOR:String = "(c) 2006-2007 Copyright by Carlos Ulloa | papervision3d.org | carlos@papervision3d.org"; public static var DATE:String = "20.08.07"; public static var NAME:String = "Papervision3D"; public static var VERSION:String = "Beta 1.7"; public static var usePERCENT:Boolean = false; public function Papervision3D(){ super(); } public static function log(message:String):void{ if (Papervision3D.VERBOSE){ trace(message); }; } } }//package org.papervision3d
Section 210
//_activeButtonStyleStyle (_activeButtonStyleStyle) package { import mx.core.*; import mx.styles.*; public class _activeButtonStyleStyle { public static function init(_activeButtonStyleStyle:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = _activeButtonStyleStyle; style = StyleManager.getStyleDeclaration(".activeButtonStyle"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".activeButtonStyle", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ }; }; } } }//package
Section 211
//_activeTabStyleStyle (_activeTabStyleStyle) package { import mx.core.*; import mx.styles.*; public class _activeTabStyleStyle { public static function init(:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = ; style = StyleManager.getStyleDeclaration(".activeTabStyle"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".activeTabStyle", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.fontWeight = "bold"; }; }; } } }//package
Section 212
//_alertButtonStyleStyle (_alertButtonStyleStyle) package { import mx.core.*; import mx.styles.*; public class _alertButtonStyleStyle { public static function init(:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = ; style = StyleManager.getStyleDeclaration(".alertButtonStyle"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".alertButtonStyle", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.color = 734012; }; }; } } }//package
Section 213
//_comboDropDownStyle (_comboDropDownStyle) package { import mx.core.*; import mx.styles.*; public class _comboDropDownStyle { public static function init(normal:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = normal; style = StyleManager.getStyleDeclaration(".comboDropDown"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".comboDropDown", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.shadowDirection = "center"; this.fontWeight = "normal"; this.dropShadowEnabled = true; this.backgroundColor = 0xFFFFFF; this.shadowDistance = 1; this.cornerRadius = 0; this.borderThickness = 0; }; }; } } }//package
Section 214
//_dataGridStylesStyle (_dataGridStylesStyle) package { import mx.core.*; import mx.styles.*; public class _dataGridStylesStyle { public static function init(:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = ; style = StyleManager.getStyleDeclaration(".dataGridStyles"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".dataGridStyles", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.fontWeight = "bold"; }; }; } } }//package
Section 215
//_dateFieldPopupStyle (_dateFieldPopupStyle) package { import mx.core.*; import mx.styles.*; public class _dateFieldPopupStyle { public static function init(_dateFieldPopupStyle.as$3:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = _dateFieldPopupStyle.as$3; style = StyleManager.getStyleDeclaration(".dateFieldPopup"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".dateFieldPopup", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.dropShadowEnabled = true; this.backgroundColor = 0xFFFFFF; this.borderThickness = 0; }; }; } } }//package
Section 216
//_errorTipStyle (_errorTipStyle) package { import mx.core.*; import mx.styles.*; public class _errorTipStyle { public static function init(borderColor:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = borderColor; style = StyleManager.getStyleDeclaration(".errorTip"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".errorTip", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.fontWeight = "bold"; this.borderStyle = "errorTipRight"; this.paddingTop = 4; this.borderColor = 13510953; this.color = 0xFFFFFF; this.fontSize = 9; this.shadowColor = 0; this.paddingLeft = 4; this.paddingBottom = 4; this.paddingRight = 4; }; }; } } }//package
Section 217
//_globalStyle (_globalStyle) package { import mx.core.*; import mx.styles.*; import mx.skins.halo.*; public class _globalStyle { public static function init(useRollOver:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = useRollOver; style = StyleManager.getStyleDeclaration("global"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration("global", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.fillColor = 0xFFFFFF; this.kerning = false; this.textRollOverColor = 2831164; this.horizontalAlign = "left"; this.shadowCapColor = 14015965; this.backgroundAlpha = 1; this.filled = true; this.roundedBottomCorners = true; this.fontThickness = 0; this.focusBlendMode = "normal"; this.fillColors = [0xFFFFFF, 0xCCCCCC, 0xFFFFFF, 0xEEEEEE]; this.horizontalGap = 8; this.borderCapColor = 9542041; this.buttonColor = 7305079; this.indentation = 17; this.selectionDisabledColor = 0xDDDDDD; this.closeDuration = 250; this.embedFonts = false; this.paddingTop = 0; this.letterSpacing = 0; this.focusAlpha = 0.4; this.bevel = true; this.fontSize = 10; this.shadowColor = 0xEEEEEE; this.borderAlpha = 1; this.paddingLeft = 0; this.fontWeight = "normal"; this.indicatorGap = 14; this.focusSkin = HaloFocusRect; this.dropShadowEnabled = false; this.leading = 2; this.borderSkin = HaloBorder; this.fontSharpness = 0; this.modalTransparencyDuration = 100; this.borderThickness = 1; this.backgroundSize = "auto"; this.borderStyle = "inset"; this.borderColor = 12040892; this.fontAntiAliasType = "advanced"; this.errorColor = 0xFF0000; this.shadowDistance = 2; this.horizontalGridLineColor = 0xF7F7F7; this.stroked = false; this.cornerRadius = 0; this.modalTransparencyColor = 0xDDDDDD; this.verticalAlign = "top"; this.textIndent = 0; this.fillAlphas = [0.6, 0.4, 0.75, 0.65]; this.verticalGridLineColor = 14015965; this.themeColor = 40447; this.shadowDirection = "center"; this.modalTransparency = 0.5; this.repeatInterval = 35; this.openDuration = 250; this.textAlign = "left"; this.fontFamily = "Verdana"; this.textSelectedColor = 2831164; this.paddingBottom = 0; this.strokeWidth = 1; this.fontGridFitType = "pixel"; this.horizontalGridLines = false; this.useRollOver = true; this.verticalGridLines = true; this.repeatDelay = 500; this.fontStyle = "normal"; this.dropShadowColor = 0; this.focusThickness = 2; this.verticalGap = 6; this.disabledColor = 11187123; this.paddingRight = 0; this.focusRoundedCorners = "tl tr bl br"; this.borderSides = "left top right bottom"; this.modalTransparencyBlur = 3; this.color = 734012; this.selectionDuration = 250; this.highlightAlphas = [0.3, 0]; }; }; } } }//package
Section 218
//_headerDateTextStyle (_headerDateTextStyle) package { import mx.core.*; import mx.styles.*; public class _headerDateTextStyle { public static function init(bold:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = bold; style = StyleManager.getStyleDeclaration(".headerDateText"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".headerDateText", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.fontWeight = "bold"; this.textAlign = "center"; }; }; } } }//package
Section 219
//_headerDragProxyStyleStyle (_headerDragProxyStyleStyle) package { import mx.core.*; import mx.styles.*; public class _headerDragProxyStyleStyle { public static function init(:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = ; style = StyleManager.getStyleDeclaration(".headerDragProxyStyle"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".headerDragProxyStyle", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.fontWeight = "bold"; }; }; } } }//package
Section 220
//_opaquePanelStyle (_opaquePanelStyle) package { import mx.core.*; import mx.styles.*; public class _opaquePanelStyle { public static function init(Object:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = Object; style = StyleManager.getStyleDeclaration(".opaquePanel"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".opaquePanel", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.borderColor = 0xFFFFFF; this.backgroundColor = 0xFFFFFF; this.headerColors = [0xE7E7E7, 0xD9D9D9]; this.footerColors = [0xE7E7E7, 0xC7C7C7]; this.borderAlpha = 1; }; }; } } }//package
Section 221
//_plainStyle (_plainStyle) package { import mx.core.*; import mx.styles.*; public class _plainStyle { public static function init(backgroundImage:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = backgroundImage; style = StyleManager.getStyleDeclaration(".plain"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".plain", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.paddingTop = 0; this.backgroundColor = 0xFFFFFF; this.backgroundImage = ""; this.horizontalAlign = "left"; this.paddingLeft = 0; this.paddingBottom = 0; this.paddingRight = 0; }; }; } } }//package
Section 222
//_richTextEditorTextAreaStyleStyle (_richTextEditorTextAreaStyleStyle) package { import mx.core.*; import mx.styles.*; public class _richTextEditorTextAreaStyleStyle { public static function init(_richTextEditorTextAreaStyleStyle:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = _richTextEditorTextAreaStyleStyle; style = StyleManager.getStyleDeclaration(".richTextEditorTextAreaStyle"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".richTextEditorTextAreaStyle", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ }; }; } } }//package
Section 223
//_textAreaHScrollBarStyleStyle (_textAreaHScrollBarStyleStyle) package { import mx.core.*; import mx.styles.*; public class _textAreaHScrollBarStyleStyle { public static function init(_textAreaHScrollBarStyleStyle:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = _textAreaHScrollBarStyleStyle; style = StyleManager.getStyleDeclaration(".textAreaHScrollBarStyle"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".textAreaHScrollBarStyle", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ }; }; } } }//package
Section 224
//_textAreaVScrollBarStyleStyle (_textAreaVScrollBarStyleStyle) package { import mx.core.*; import mx.styles.*; public class _textAreaVScrollBarStyleStyle { public static function init(_textAreaVScrollBarStyleStyle:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = _textAreaVScrollBarStyleStyle; style = StyleManager.getStyleDeclaration(".textAreaVScrollBarStyle"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".textAreaVScrollBarStyle", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ }; }; } } }//package
Section 225
//_todayStyleStyle (_todayStyleStyle) package { import mx.core.*; import mx.styles.*; public class _todayStyleStyle { public static function init(color:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = color; style = StyleManager.getStyleDeclaration(".todayStyle"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".todayStyle", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.color = 0xFFFFFF; this.textAlign = "center"; }; }; } } }//package
Section 226
//_weekDayStyleStyle (_weekDayStyleStyle) package { import mx.core.*; import mx.styles.*; public class _weekDayStyleStyle { public static function init(bold:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = bold; style = StyleManager.getStyleDeclaration(".weekDayStyle"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".weekDayStyle", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.fontWeight = "bold"; this.textAlign = "center"; }; }; } } }//package
Section 227
//_windowStatusStyle (_windowStatusStyle) package { import mx.core.*; import mx.styles.*; public class _windowStatusStyle { public static function init(:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = ; style = StyleManager.getStyleDeclaration(".windowStatus"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".windowStatus", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.color = 0x666666; }; }; } } }//package
Section 228
//_windowStylesStyle (_windowStylesStyle) package { import mx.core.*; import mx.styles.*; public class _windowStylesStyle { public static function init(:IFlexModuleFactory):void{ var style:CSSStyleDeclaration; var fbs = ; style = StyleManager.getStyleDeclaration(".windowStyles"); if (!style){ style = new CSSStyleDeclaration(); StyleManager.setStyleDeclaration(".windowStyles", style, false); }; if (style.defaultFactory == null){ style.defaultFactory = function ():void{ this.fontWeight = "bold"; }; }; } } }//package
Section 229
//core_properties (core_properties) package { import mx.resources.*; public class core_properties extends ResourceBundle { override protected function getContent():Object{ var _local1:Object; _local1 = {}; _local1["multipleChildSets_ClassAndInstance"] = "Multiple sets of visual children have been specified for this component (component definition and component instance)."; _local1["multipleChildSets_ClassAndSubclass"] = "Multiple sets of visual children have been specified for this component (base component definition and derived component definition)."; _local1["notExecuting"] = "Repeater is not executing."; _local1["truncationIndicator"] = "..."; _local1["stateUndefined"] = "Undefined state '{0}'."; _local1["scrollDirection"] = "Unknown scroll direction '{0}'."; _local1["viewSource"] = "View Source"; return (_local1); } } }//package
Section 230
//effects_properties (effects_properties) package { import mx.resources.*; public class effects_properties extends ResourceBundle { override protected function getContent():Object{ var _local1:Object; _local1 = {}; _local1["incorrectTrigger"] = "The Zoom effect can not be triggered by a moveEffect trigger."; _local1["incorrectSource"] = "Source property must be a Class or String."; return (_local1); } } }//package
Section 231
//main (main) package { import flash.events.*; import mx.core.*; import flash.display.*; import flash.utils.*; import org.papervision3d.materials.*; import org.papervision3d.core.*; import org.papervision3d.cameras.*; import d3s.net.papervision3d.objects.*; import org.papervision3d.scenes.*; public class main extends Sprite { public const beatms:int = 458; public const bpm:Number = 131; public const barms:int = 1832; private var camera:Camera3D; public var asset_marine_md2:Class; public var asset_marine_red_png:Class; private var marineSkin:BitmapMaterial; public var asset_track_clip:Class; private var marineModel:Md2; private var container:Sprite; private var scene:Scene3D; private var currentScene:int; private var bgm:MovieClipLoaderAsset; private var time:int; private static var cameraTimeline:Array = new Array(new Array(1, new Number3D(-300, 150, 0)), new Array(1, new Number3D(0, 150, 400)), new Array(1, new Number3D(300, 300, 300)), new Array(1, new Number3D(300, 300, -300))); public function main(){ var ba:BitmapAsset; var md2:ByteArray; asset_marine_md2 = main_asset_marine_md2; asset_marine_red_png = main_asset_marine_red_png; asset_track_clip = main_asset_track_clip; super(); container = new Sprite(); container.x = 400; container.y = 300; addChild(container); scene = new Scene3D(container); camera = new Camera3D(); camera.target.y = 200; camera.zoom = 10; currentScene = 0; ba = new asset_marine_red_png(); marineSkin = new BitmapMaterial(ba.bitmapData); md2 = (new asset_marine_md2() as ByteArray); marineModel = new Md2(marineSkin, md2); marineModel.fps = ((bpm / 60) * 4); marineModel.scale = 5; marineModel.rotationX = 90; marineModel.loop(68, 72); scene.addChild(marineModel, "marine"); bgm = (new asset_track_clip() as MovieClipLoaderAsset); addEventListener(Event.ENTER_FRAME, updateView); } public function updateView(event:Event):void{ var ntime:int; var sceneCamera:Number3D; graphics.clear(); ntime = (getTimer() % barms); if (ntime < time){ currentScene = ((currentScene + 1) % cameraTimeline.length); }; time = ntime; sceneCamera = cameraTimeline[currentScene][1]; camera.x = sceneCamera.x; camera.y = sceneCamera.y; camera.z = sceneCamera.z; scene.renderCamera(camera); if (marineModel.keyframe == 68){ graphics.beginFill(0xFF0000); graphics.drawRect(0, 0, 10, 10); graphics.endFill(); }; if ((getTimer() % beatms) < 100){ graphics.beginFill(0xFF00); graphics.drawRect(10, 0, 10, 10); graphics.endFill(); }; if ((getTimer() % barms) < 100){ graphics.beginFill(0xFF); graphics.drawRect(20, 0, 10, 10); graphics.endFill(); }; } } }//package
Section 232
//main_asset_marine_md2 (main_asset_marine_md2) package { import mx.core.*; public class main_asset_marine_md2 extends ByteArrayAsset { } }//package
Section 233
//main_asset_marine_red_png (main_asset_marine_red_png) package { import mx.core.*; public class main_asset_marine_red_png extends BitmapAsset { } }//package
Section 234
//main_asset_track_clip (main_asset_track_clip) package { import mx.core.*; import flash.utils.*; public class main_asset_track_clip extends MovieClipLoaderAsset { public var dataClass:Class; private static var bytes:ByteArray = null; public function main_asset_track_clip(){ dataClass = main_asset_track_clip_dataClass; super(); initialWidth = (11000 / 20); initialHeight = (8000 / 20); } override public function get movieClipData():ByteArray{ if (bytes == null){ bytes = ByteArray(new dataClass()); }; return (bytes); } } }//package
Section 235
//main_asset_track_clip_dataClass (main_asset_track_clip_dataClass) package { import mx.core.*; public class main_asset_track_clip_dataClass extends ByteArrayAsset { } }//package
Section 236
//preldr (preldr) package { import flash.events.*; import flash.display.*; import flash.utils.*; public class preldr extends MovieClip { private var swfHeight:int;// = 600 private var swfWidth:int;// = 800 public function preldr(){ swfWidth = 800; swfHeight = 600; super(); stop(); addEventListener(Event.ENTER_FRAME, onEnterFrame); } public function init():void{ var cls:Class; var obj:Object; cls = Class(getDefinitionByName("main")); obj = new (cls); stage.quality = StageQuality.LOW; addChild((obj as DisplayObject)); } public function onEnterFrame(event:Event):void{ var p:Number; graphics.clear(); if (framesLoaded == totalFrames){ removeEventListener(Event.ENTER_FRAME, onEnterFrame); nextFrame(); init(); } else { p = (root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal); graphics.beginFill(0xFFFFFF); graphics.drawRect((swfWidth / 4), ((swfHeight / 2) - 10), ((swfWidth / 2) * p), 20); graphics.endFill(); }; } } }//package
Section 237
//skins_properties (skins_properties) package { import mx.resources.*; public class skins_properties extends ResourceBundle { override protected function getContent():Object{ var _local1:Object; _local1 = {}; _local1["notLoaded"] = "Unable to load '{0}'."; return (_local1); } } }//package
Section 238
//styles_properties (styles_properties) package { import mx.resources.*; public class styles_properties extends ResourceBundle { override protected function getContent():Object{ var _local1:Object; _local1 = {}; _local1["unableToLoad"] = "Unable to load style({0}): {1}."; return (_local1); } } }//package

Library Items

Symbol 1 MovieClip {main_asset_track_clip}
Symbol 2 BinaryData {main_asset_marine_md2}
Symbol 3 Bitmap {main_asset_marine_red_png}
Symbol 4 BinaryData {main_asset_track_clip_dataClass}

Special Tags

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

Labels

"preldr"Frame 1
"main"Frame 2




http://swfchan.com/16/78790/info.shtml
Created: 3/4 -2019 11:24:28 Last modified: 3/4 -2019 11:24:28 Server time: 22/12 -2024 05:42:37