Вопрос: Нужен слайдер, как у Газпрома?

Лучший ответ:
Там не так уж много кода:
Скрытый текст﻿package org.noregret.log {
    import flash.events.*;
    import flash.display.*;
    import flash.system.*;
    import flash.text.*;
    import org.noregret.utils.*;
    import flash.utils.*;
    import flash.external.*;
    import flash.ui.*;

    public class LogPanel extends Sprite {

        public static const INSTANCE:LogPanel = new (LogPanel)();
;
        public static const TYPE_ERROR:String = "errorMessage";
        private static const DEFAULT_SHORTCUT:Array = [Keyboard.CONTROL, Keyboard.SHIFT, Keyboard.SPACE];
        private static const COPY_EVENT:String = "copyToClipboard";
        public static const TYPE_PLAIN:String = "plainMessage";
        public static const TYPE_NOTIFY:String = "notifyMessage";
        public static const TYPE_WARNING:String = "warningMessage";

        public static var COLOR_WARNING:uint = 0x990099;
        private static var line_count:uint;
        public static var enableTraceInform:Boolean = false;
        public static var enableTraceErrors:Boolean = false;
        private static var charHash:Object = {};
        private static var keyCodeHash:Object;
        public static var COLOR_DEFAULT:uint = COLOR_PLAIN;
        private static var currentKey:uint;
        public static var COLOR_PLAIN:uint = 0x333333;
        private static var openKey:uint;
        public static var enableTraceAll:Boolean = false;
        public static var enabled:Boolean = true;
        public static var COLOR_NOTIFY:uint = 153;
        private static var messageList:Array;
        public static var FONT:String = "_typewriter";
        public static var maxMessages:Number = 100;
        public static var enableTraceNotify:Boolean = false;
        public static var COLOR_ERROR:uint = 0xFF0000;
        public static var shortcutString:String;
        private static var ERROR_SINGLTONE:Number = 0;
        public static var enableTraceWarnings:Boolean = false;
        private static var KEY_COPY:Number = "c".charCodeAt(0);

        private var logTextField:TextField;

        public function LogPanel(){
            super();
            if (INSTANCE){
                throw (new Error((getQualifiedClassName(this) + " is a Singletone!"), ERROR_SINGLTONE));
            };
            logTextField = makeTextField(500, 500);
            logTextField.addEventListener(TextEvent.LINK, onLinkTrigger);
            addChild(logTextField);
            messageList = new Array();
            addEventListener(Event.ADDED_TO_STAGE, onAddToStage);
            visible = false;
            setShortcut(DEFAULT_SHORTCUT);
        }
        public static function setShortcut(... _args):String{
            var code:uint;
            var keyCount:int;
            var key:String;
            var char:String;
            var validateFlag:Boolean;
            var keyNameList:Array;
            var i:int;
            keyCodeHash = {};
            charHash = {};
            if ((_args[0] is Array)){
                var list:Array = _args[0];
            };
            keyCount = 0;
            key = "";
            char = "";
            validateFlag = false;
            keyNameList = [];
            i = 0;
            for (;(((i < _args.length)) && ((keyCount < 4)));i++) {
                char = null;
                if ((_args[i] is String)){
                    char = (_args[i] as String).toLowerCase().substr(0, 1);
                    if (!char.length){
                        continue;
                    };
                    code = char.charCodeAt(0);
                } else {
                    code = uint(_args[i]);
                };
                validateFlag = (((((code > 32)) && ((code <= 160)))) || (KeyboardHelper.isSpecialKey(code)));
                if (((((((isNaN(code)) || (!(validateFlag)))) || (!((keyCodeHash[code] == null))))) || (!((charHash[char] == null))))){
                } else {
                    if (char){
                        charHash[code] = keyCount;
                    } else {
                        keyCodeHash[code] = keyCount;
                    };
                    keyNameList.push(KeyboardHelper.getKeyName(code));
                    keyCount++;
                    key = (key + "1");
                };
            };
            if (keyCount){
                openKey = parseInt(key, 2);
            } else {
                return (setShortcut(DEFAULT_SHORTCUT));
            };
            currentKey = 0;
            shortcutString = keyNameList.join("+");
            return (shortcutString);
        }
        public static function warn(message:Object, sender=null):void{
            if (((enableTraceWarnings) || (enableTraceAll))){
                trace((("*** LogPanel.warn(" + arguments) + ")"));
            };
            add(addSender(message, sender), LogPanel.TYPE_WARNING);
        }
        public static function show():void{
            INSTANCE.visible = true;
            INSTANCE.buildDebugPanel();
            if (INSTANCE.stage){
                INSTANCE.stage.addChild(INSTANCE);
            };
        }
        public static function error(message:Object, sender=null):void{
            if (((enableTraceErrors) || (enableTraceAll))){
                trace((("*** LogPanel.error(" + arguments) + ")"));
            };
            add(addSender(message, sender), LogPanel.TYPE_ERROR);
        }
        private static function add(message:String, type:String):void{
            var str:String;
            if (!enabled){
                return;
            };
            line_count++;
            str = (("<span class='count'>" + StringUtils.trimAndFormat(line_count, 3, 0)) + "</span>: ");
            str = (str + (((("<span class='" + type) + "'>") + message) + "</span>"));
            str = (str + (("<span class='time'> (" + getTimer()) + " msec)</span>"));
            messageList.push(str);
            while (messageList.length > LogPanel.maxMessages) {
                messageList.shift();
            };
            if (INSTANCE.visible){
                INSTANCE.buildDebugPanel();
            };
        }
        private static function addSender(message, sender=null):String{
            var msg:String;
            msg = String(message);
            msg = msg.split(">").join(">");
            msg = msg.split("<").join("<");
            if (sender){
                return ((((("<span class='sender'>" + getQualifiedClassName(sender)) + "</span>: <span class='item'>") + msg) + "</span>"));
            };
            return (msg);
        }
        public static function hide():void{
            INSTANCE.visible = false;
        }
        public static function notify(message:Object, sender=null):void{
            if (((enableTraceNotify) || (enableTraceAll))){
                trace((("*** LogPanel.notify(" + arguments) + ")"));
            };
            add(addSender(message, sender), LogPanel.TYPE_NOTIFY);
        }
        public static function clear():void{
            messageList = new Array();
            line_count = 0;
            INSTANCE.logTextField.htmlText = getHeaders();
        }
        private static function getHeaders():String{
            var html:String;
            html = "";
            html = (html + "<p class='headers'>");
            html = (html + (("<p class='shortcut'>shortcut = " + shortcutString) + "</p>"));
            html = (html + (("<p class='copy'><a href='event:" + COPY_EVENT) + "'>copy to clipboard</a></p>"));
            html = (html + "<p class='break'></p>");
            html = (html + (((("<p class='player'>Player: <b>" + Capabilities.version) + "</b> ") + Capabilities.playerType) + "</p>"));
            html = (html + (("<p class='os'>OS: <b>" + Capabilities.os) + "</b>, "));
            html = (html + (((("resolution: <b>" + Capabilities.screenResolutionX) + "×") + Capabilities.screenResolutionY) + "</b></p>"));
            html = (html + (("<p class='externalinterface'>ExternalInterface: <b>" + ((ExternalInterface.available) ? "IS" : "IS NOT")) + "</b> available</p>"));
            html = (html + "<p class='break'></p>");
            html = (html + "</p>");
            return (html);
        }
        public static function notifyIncomingParameters():void{
            var message:String;
            var params:Object;
            var name:String;
            message = "Incoming parameters: [";
            if (INSTANCE.stage){
                params = INSTANCE.root.loaderInfo.parameters;
                for (name in params) {
                    message = (message + ((("\n  " + name) + "=") + params[name]));
                };
                message = (message + "\n]");
            } else {
                message = (message + "not accessible]");
            };
            notify(message);
        }
        public static function inform(message, sender=null):void{
            if (((enableTraceInform) || (enableTraceAll))){
                trace((("LogPanel.inform(" + arguments) + ")"));
            };
            add(addSender(message, sender), LogPanel.TYPE_PLAIN);
        }

        private function onKeyUpHandler(event:KeyboardEvent):void{
            var position:Number;
            if (!enabled){
                return;
            };
            position = getKeyPosition(event);
            if (isNaN(position)){
                return;
            };
            currentKey = (currentKey & (0xFFFFFFFF ^ (1 << position)));
        }
        private function onKeyDownHandler(event:KeyboardEvent):void{
            var position:Number;
            if (!enabled){
                return;
            };
            position = getKeyPosition(event);
            if (isNaN(position)){
                return;
            };
            currentKey = (currentKey | (1 << position));
            if (currentKey == openKey){
                if (visible){
                    hide();
                } else {
                    show();
                };
            };
        }
        private function makeTextField(w:uint, h:uint):TextField{
            var TF:TextField;
            TF = new TextField();
            TF.border = true;
            TF.width = w;
            TF.height = h;
            TF.background = true;
            TF.multiline = true;
            TF.wordWrap = true;
            TF.backgroundColor = 0xFFFFFF;
            TF.styleSheet = new StyleSheet();
            TF.styleSheet.setStyle("p", {
                fontFamily:FONT,
                letterSpacing:0,
                marginLeft:5
            });
            TF.styleSheet.setStyle("a", {textDecoration:"underline"});
            TF.styleSheet.setStyle("a:hover", {
                textDecoration:"underline",
                color:"#CC0000"
            });
            TF.styleSheet.setStyle(".count", {
                color:"#999999",
                fontSize:10
            });
            TF.styleSheet.setStyle(".time", {
                color:"#559955",
                fontSize:10
            });
            TF.styleSheet.setStyle(".copy", {
                color:"#000066",
                fontSize:11,
                fontWeight:"bold"
            });
            TF.styleSheet.setStyle(".shortcut", {color:"#000000"});
            TF.styleSheet.setStyle(".headers", {
                color:"#666600",
                fontSize:11
            });
            TF.styleSheet.setStyle(".messages", {
                color:("#" + StringUtils.addLeadingZeros(COLOR_DEFAULT.toString(16), 6)),
                fontSize:12
            });
            TF.styleSheet.setStyle(".break", {fontSize:8});
            TF.styleSheet.setStyle(("." + TYPE_PLAIN), {color:("#" + StringUtils.addLeadingZeros(COLOR_PLAIN.toString(16), 6))});
            TF.styleSheet.setStyle(("." + TYPE_ERROR), {
                color:("#" + StringUtils.addLeadingZeros(COLOR_ERROR.toString(16), 6)),
                fontWeight:"bold"
            });
            TF.styleSheet.setStyle(("." + TYPE_WARNING), {
                color:("#" + StringUtils.addLeadingZeros(COLOR_WARNING.toString(16), 6)),
                fontStyle:"italic"
            });
            TF.styleSheet.setStyle(("." + TYPE_NOTIFY), {color:("#" + StringUtils.addLeadingZeros(COLOR_NOTIFY.toString(16), 6))});
            return (TF);
        }
        private function onResize(event:Event=null):void{
            if (((INSTANCE.stage) && (INSTANCE.visible))){
                logTextField.height = (INSTANCE.stage.stageHeight - 1);
                logTextField.width = (INSTANCE.stage.stageWidth / 2);
            };
        }
        private function getKeyPosition(event:KeyboardEvent):Number{
            if (isNaN(charHash[event.charCode])){
                return (keyCodeHash[event.keyCode]);
            };
            return (charHash[event.charCode]);
        }
        private function buildDebugPanel():void{
            var html:String;
            if (INSTANCE.stage == null){
                return;
            };
            html = getHeaders();
            html = (html + (("<p class=\"messages\">" + messageList.join("<br/>")) + "</p>"));
            logTextField.htmlText = html;
            logTextField.scrollV = logTextField.maxScrollV;
            onResize();
        }
        private function onAddToStage(event:Event):void{
            INSTANCE.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler);
            INSTANCE.stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUpHandler);
            INSTANCE.stage.addEventListener(KeyboardEvent.KEY_DOWN, onCopyKey);
            INSTANCE.stage.addEventListener(Event.RESIZE, onResize);
            logTextField.height = INSTANCE.stage.stageHeight;
            onResize();
        }
        private function copyToClipboard():void{
            buildDebugPanel();
            System.setClipboard(logTextField.text);
        }
        private function onCopyKey(event:KeyboardEvent):void{
            if (!enabled){
                return;
            };
            if (((event.ctrlKey) && ((event.charCode == KEY_COPY)))){
                copyToClipboard();
            };
        }
        private function onLinkTrigger(event:TextEvent):void{
            switch (event.text){
                case COPY_EVENT:
                    copyToClipboard();
                    break;
            };
            copyToClipboard();
        }

    }
}//package org.noregret.log 
﻿package org.noregret.utils {

    public final class StringUtils {

        private static var CACHE_ZEROS:String = "0000000000000000000000000000000";

        public function StringUtils(){
            super();
        }
        public static function roundAndFormat(value:Number, intLength:Number, floatLength:Number, fractionDelimiter:String="."):String{
            var decimalRange:Number;
            if (((!(isNaN(floatLength))) && ((floatLength > 0)))){
                decimalRange = Math.pow(10, floatLength);
                value = (Math.round((value * decimalRange)) / decimalRange);
            };
            return (trimAndFormat(value, intLength, floatLength, fractionDelimiter));
        }
        public static function floorAndFormat(value:Number, intLength:Number, floatLength:Number, fractionDelimiter:String="."):String{
            return (trimAndFormat(value, intLength, floatLength, fractionDelimiter));
        }
        public static function trimAndFormat(value:Number, intLength:Number, floatLength:Number, fractionDelimiter:String="."):String{
            var decimalRange:Number;
            var result:String;
            var heap:Array;
            var str:String;
            if (((isNaN(intLength)) || ((intLength < 0)))){
                str = String(int(value));
                intLength = str.length;
                if (str.charAt(0) == "-"){
                    intLength--;
                };
            };
            if (((isNaN(floatLength)) || ((floatLength < 0)))){
                floatLength = 0;
            };
            decimalRange = Math.pow(10, floatLength);
            result = String((Math.floor((value * decimalRange)) / decimalRange));
            heap = result.split(".");
            if ((((heap.length < 2)) && ((floatLength > 0)))){
                heap.push("");
            };
            heap[0] = StringUtils.addLeadingZeros(heap[0], intLength);
            if (heap.length > 1){
                heap[1] = StringUtils.addTrailingZeros(heap[1], floatLength);
            };
            return (heap.join(fractionDelimiter));
        }
        private static function getZeros(len:Number):String{
            var count:Number;
            var i:Number;
            if (CACHE_ZEROS.length >= len){
                return (CACHE_ZEROS);
            };
            count = CACHE_ZEROS.length;
            i = 0;
            while (i < (len - count)) {
                CACHE_ZEROS = (CACHE_ZEROS + "0");
                i++;
            };
            return (CACHE_ZEROS);
        }
        public static function addLeadingZeros(value:Object, len:Number):String{
            var str:String;
            var isNegative:Boolean;
            var strLength:Number;
            var lead:String;
            var result:String;
            str = String(value);
            isNegative = (str.charAt(0) == "-");
            strLength = (str.length - ((isNegative) ? 1 : 0));
            if (((isNaN(len)) || ((strLength >= len)))){
                return (str);
            };
            lead = getZeros(len);
            result = lead.substr(0, (len - strLength));
            if (isNegative){
                return ((("-" + result) + str.substr(1)));
            };
            return ((result + str));
        }
        public static function ceilAndFormat(value:Number, intLength:Number, floatLength:Number, fractionDelimiter:String="."):String{
            var decimalRange:Number;
            if (((!(isNaN(floatLength))) && ((floatLength > 0)))){
                decimalRange = Math.pow(10, floatLength);
                value = (Math.ceil((value * decimalRange)) / decimalRange);
            };
            return (trimAndFormat(value, intLength, floatLength, fractionDelimiter));
        }
        public static function addTrailingZeros(value:String, len:Number):String{
            var trail:String;
            if (((isNaN(len)) || ((value.length >= len)))){
                return (value);
            };
            trail = getZeros(len);
            return ((value + trail.substr(0, (len - value.length))));
        }

    }
}//package org.noregret.utils 
﻿package org.noregret.utils {
    import flash.ui.*;

    public class KeyboardHelper {

        private static const ARROW_HASH:Object = {};
        private static const F_HASH:Object = {};
        private static const NUMPAD_HASH:Object = {};
        private static const CONTROL_HASH:Object = {};
        private static const NAVIGATION_HASH:Object = {};
        private static const KNOWN_LIST:Array = [ARROW_HASH, NUMPAD_HASH, F_HASH, NAVIGATION_HASH, CONTROL_HASH];
        private static const KNOWN_KEYS_HASH:Object = {};

        private static var i:int = 0;
        private static var j:String;

        public function KeyboardHelper(){
            super();
            trace("KeyboardHelper.KeyboardHelper(): Class is static! You don't need any instances.");
        }
        public static function getKeyName(keyCode:uint, charCode:uint=0):String{
            if (KNOWN_KEYS_HASH[keyCode]){
                return (KNOWN_KEYS_HASH[keyCode]);
            };
            if (keyCode < 32){
                return ((((("key " + keyCode) + "(0x") + StringUtils.addLeadingZeros(keyCode.toString(16).toUpperCase(), 2)) + ")"));
            };
            if (keyCode > 160){
                return (String.fromCharCode(((charCode) || (keyCode))));
            };
            return (String.fromCharCode(keyCode));
        }
        public static function isSpecialKey(keyCode:uint):Boolean{
            return (Boolean(KNOWN_KEYS_HASH[keyCode]));
        }
        public static function isNumpad(keyCode:uint):Boolean{
            return (Boolean(NUMPAD_HASH[keyCode]));
        }
        public static function isF(keyCode:uint):Boolean{
            return (Boolean(F_HASH[keyCode]));
        }
        public static function isNavigation(keyCode:uint):Boolean{
            return (Boolean(NAVIGATION_HASH[keyCode]));
        }
        public static function isArrow(keyCode:uint):Boolean{
            return (Boolean(ARROW_HASH[keyCode]));
        }

        ARROW_HASH[Keyboard.UP] = "arrow up";
        ARROW_HASH[Keyboard.DOWN] = "arrow down";
        ARROW_HASH[Keyboard.LEFT] = "arrow left";
        ARROW_HASH[Keyboard.RIGHT] = "arrow right";
        NUMPAD_HASH[Keyboard.NUMPAD_0] = "numpad 0";
        NUMPAD_HASH[Keyboard.NUMPAD_1] = "numpad 1";
        NUMPAD_HASH[Keyboard.NUMPAD_2] = "numpad 2";
        NUMPAD_HASH[Keyboard.NUMPAD_3] = "numpad 3";
        NUMPAD_HASH[Keyboard.NUMPAD_4] = "numpad 4";
        NUMPAD_HASH[Keyboard.NUMPAD_5] = "numpad 5";
        NUMPAD_HASH[Keyboard.NUMPAD_6] = "numpad 6";
        NUMPAD_HASH[Keyboard.NUMPAD_7] = "numpad 7";
        NUMPAD_HASH[Keyboard.NUMPAD_8] = "numpad 8";
        NUMPAD_HASH[Keyboard.NUMPAD_9] = "numpad 9";
        NUMPAD_HASH[Keyboard.NUMPAD_ADD] = "numpad add";
        NUMPAD_HASH[Keyboard.NUMPAD_MULTIPLY] = "numpad multiply";
        NUMPAD_HASH[Keyboard.NUMPAD_DIVIDE] = "numpad divide";
        NUMPAD_HASH[Keyboard.NUMPAD_SUBTRACT] = "numpad subtract";
        NUMPAD_HASH[Keyboard.NUMPAD_ENTER] = "numpad enter";
        NUMPAD_HASH[Keyboard.NUMPAD_DECIMAL] = "numpad decimal";
        F_HASH[Keyboard.F1] = "f1";
        F_HASH[Keyboard.F2] = "f2";
        F_HASH[Keyboard.F3] = "f3";
        F_HASH[Keyboard.F4] = "f4";
        F_HASH[Keyboard.F5] = "f5";
        F_HASH[Keyboard.F6] = "f6";
        F_HASH[Keyboard.F7] = "f7";
        F_HASH[Keyboard.F8] = "f8";
        F_HASH[Keyboard.F9] = "f9";
        F_HASH[Keyboard.F10] = "f10";
        F_HASH[Keyboard.F11] = "f11";
        F_HASH[Keyboard.F12] = "f12";
        F_HASH[Keyboard.F13] = "f13";
        F_HASH[Keyboard.F14] = "f14";
        F_HASH[Keyboard.F15] = "f15";
        NAVIGATION_HASH[Keyboard.PAGE_DOWN] = "page down";
        NAVIGATION_HASH[Keyboard.PAGE_UP] = "page up";
        NAVIGATION_HASH[Keyboard.HOME] = "home";
        NAVIGATION_HASH[Keyboard.END] = "end";
        NAVIGATION_HASH[Keyboard.INSERT] = "insert";
        NAVIGATION_HASH[Keyboard.DELETE] = "delete";
        CONTROL_HASH[Keyboard.CONTROL] = "control";
        CONTROL_HASH[Keyboard.SHIFT] = "shift";
        CONTROL_HASH[Keyboard.CAPS_LOCK] = "caps lock";
        CONTROL_HASH[144] = "num lock";
        while (i < KNOWN_LIST.length) {
            for (j in KNOWN_LIST[i]) {
                KNOWN_KEYS_HASH[j] = KNOWN_LIST[i][j];
            };
            i++;
        };
        KNOWN_KEYS_HASH[Keyboard.SPACE] = "space";
        KNOWN_KEYS_HASH[160] = "non-breaking space";
        KNOWN_KEYS_HASH[Keyboard.ENTER] = "enter";
        KNOWN_KEYS_HASH[Keyboard.BACKSPACE] = "backspace";
    }
}//package org.noregret.utils 
﻿package ru.isky.external {
    import flash.events.*;
    import flash.net.*;

    public class ExternalConnector extends EventDispatcher {

        private var connectionClient:Object;
        private var connector:LocalConnection;

        public function ExternalConnector(){
            super();
        }
        private function onMessageRecieve(message:Array):void{
            var methodName:String;
            var parameters:Array;
            methodName = message[0];
            parameters = message[1];
            dispatchEvent(new ExternalConnectorEvent(ExternalConnectorEvent.ON_MESSAGE, methodName, parameters));
        }
        public function connect(connectionID:String):void{
            var connectionID:* = connectionID;
            connectionClient = new Object();
            connectionClient[SWFConnector.METHOD_NAME] = onMessageRecieve;
            connector = new LocalConnection();
            connector.client = connectionClient;
            try {
                connector.connect(connectionID);
            } catch(error:ArgumentError) {
                throw (new Error("Данное соединение занято"));
            };
        }

    }
}//package ru.isky.external 
﻿package ru.isky.external {
    import flash.display.*;
    import flash.net.*;

    public class SWFConnector extends Sprite {

        public static const METHOD_NAME:String = "onCallbackHandler";

        public function SWFConnector(){
            var commands:* = null;
            var commandList:* = null;
            var commandXML:* = null;
            var paramslist:* = null;
            var parameters:* = null;
            var i:* = NaN;
            var k:* = NaN;
            super();
            commands = root.loaderInfo.parameters["xml_commands"];
            if ((((commands == null)) || ((commands.length == 0)))){
                throw (new Error("Variable xml_commands must contain commands"));
            };
            try {
                commandList = new XMLList(commands);
            } catch(error:Error) {
                throw (new Error(("Content in xml_commands variable is not valid XML:" + commands)));
            };
            i = 0;
            while (i < commandList.length()) {
                commandXML = commandList[i];
                parameters = [];
                paramslist = commandXML..param;
                k = 0;
                while (k < paramslist.length()) {
                    parameters[k] = paramslist[k];
                    k = (k + 1);
                };
                executeCommand(commandXML, parameters);
                i = (i + 1);
            };
        }
        private function executeCommand(commandXML:XML, parameters:Array):void{
            var connector:LocalConnection;
            var connection_id:String;
            var method_name:String;
            connector = new LocalConnection();
            connection_id = commandXML.attribute("targetConnectionID");
            method_name = commandXML.attribute("methodName");
            connector.send(connection_id, METHOD_NAME, [method_name, parameters]);
        }

    }
}//package ru.isky.external 
﻿package ru.isky.external {
    import flash.events.*;

    public class ExternalConnectorEvent extends Event {

        public static const ON_CONNECTION_BUSY:String = "onConnectionBusy";
        public static const ON_MESSAGE:String = "onMessageRecieved";

        public var parameters:Array;
        public var methodName:String;

        public function ExternalConnectorEvent(type:String, _methodName:String=null, _parameters:Array=null, bubbles:Boolean=false, cancelable:Boolean=false){
            super(type, bubbles, cancelable);
            methodName = _methodName;
            parameters = _parameters;
        }
    }
}//package ru.isky.external 
﻿package ru.isky.multiloader {
    import flash.events.*;

    public class DataLoaderEvent extends Event {

        public static const ON_ERROR:String = "onError";
        public static const ON_COMPLETE:String = "onComplete";
        public static const ON_PROGRESS:String = "onProgress";

        public var error:String;
        public var id:uint;

        public function DataLoaderEvent(type:String, _id:uint, _error:String=null, bubbles:Boolean=false, cancelable:Boolean=false){
            super(type, bubbles, cancelable);
            id = _id;
            error = _error;
        }
        override public function toString():String{
            return (((((("id:" + id) + ", error:") + error) + " ") + super.toString()));
        }

    }
}//package ru.isky.multiloader 
﻿package ru.isky.multiloader {
    import flash.events.*;

    public class MultiloaderEvent extends Event {

        public static const ON_ITEM_LOADED:String = "onItemLoaded";
        public static const ON_ERROR:String = "onError";
        public static const ON_COMPLETE:String = "onComplete";
        public static const ON_PROGRESS:String = "onProgress";
        public static const ON_START:String = "onStart";

        public var progress:Number;
        public var itemID:Number;
        public var error:String;

        public function MultiloaderEvent(type:String, _itemID:Number=NaN, _error:String=null, _progress:Number=NaN, bubbles:Boolean=false, cancelable:Boolean=false){
            super(type, bubbles, cancelable);
            itemID = _itemID;
            error = _error;
            progress = _progress;
        }
    }
}//package ru.isky.multiloader 
﻿package ru.isky.multiloader {
    import flash.events.*;

    public class CustomLoader extends EventDispatcher {

        private var started:Boolean;
        protected var loader:Multiloader;

        public function CustomLoader(){
            super();
        }
        protected function onMyItemLoaded(item:Object, parameters:Array=null):void{
        }
        protected function refreshLoader():void{
            removeLoader();
            createLoader();
        }
        protected function onItemLoadError(event:MultiloaderEvent):void{
            throw (new Error(event.error));
        }
        protected function onItemLoaded(event:MultiloaderEvent):void{
            onMyItemLoaded(loader.getContentById(event.itemID), loader.getParametersById(event.itemID));
        }
        protected function createLoader():void{
            loader = new Multiloader();
            loader.addEventListener(MultiloaderEvent.ON_ITEM_LOADED, onItemLoaded);
            loader.addEventListener(MultiloaderEvent.ON_START, onStartLoading);
            loader.addEventListener(MultiloaderEvent.ON_PROGRESS, onLoadProgress);
            loader.addEventListener(MultiloaderEvent.ON_COMPLETE, onLoadComplete);
            loader.addEventListener(MultiloaderEvent.ON_ERROR, onItemLoadError);
        }
        protected function onLoadProgress(event:MultiloaderEvent):void{
        }
        protected function removeLoader():void{
            if (loader){
                loader.removeEventListener(MultiloaderEvent.ON_ITEM_LOADED, onItemLoaded);
                loader.removeEventListener(MultiloaderEvent.ON_PROGRESS, onLoadProgress);
                loader.removeEventListener(MultiloaderEvent.ON_COMPLETE, onLoadComplete);
                loader.removeEventListener(MultiloaderEvent.ON_ERROR, onItemLoadError);
                loader.clear();
                loader = null;
                started = false;
            };
        }
        private function onStartLoading(event:MultiloaderEvent):void{
            if (started){
                throw (new Error("After second loading use CustomLoader.refreshLoader()"));
            };
            started = true;
        }
        public function destroy():void{
            removeLoader();
        }
        protected function onLoadComplete(event:MultiloaderEvent):void{
        }

    }
}//package ru.isky.multiloader 
﻿package ru.isky.multiloader {
    import flash.events.*;
    import flash.system.*;
    import flash.net.*;
    import ru.isky.utils.*;
    import flash.utils.*;

    public class Multiloader extends EventDispatcher {

        private static const STATUS_IDLE:String = "idle";
        public static const DATA_TEXT:String = "TEXT";
        public static const DATA_BITMAP:String = "BITMAP";
        private static const STATUS_BUSY:String = "busy";
        private static const DATA_TYPES:Object = {};
        public static const DATA_SOUND:String = "SOUND";
        public static const DATA_FLASH:String = "FLASH";
        public static const DATA_BINARY:String = "BINARY";

        private var loaded:Number = 0;
        private var _added:uint;
        private var start_time:Number;
        private var load_time:Number;
        public var progress:Number = 0;
        private var loaders:Array;
        private var nextid:uint = 0;
        public var dataList:Array;
        private var defaultLoaderContext:LoaderContext;
        private var waitFramesBetweenLoadings:Number = 0;
        private var waitId:uint;
        private var status:String;

        public function Multiloader(loaderContext:LoaderContext=null){
            nextid = 0;
            loaded = 0;
            progress = 0;
            waitFramesBetweenLoadings = 0;
            super();
            if (loaderContext == null){
                defaultLoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
            } else {
                defaultLoaderContext = loaderContext;
            };
            loaders = new Array();
            dataList = new Array();
            clear();
        }
        private function onItemError(event:DataLoaderEvent):void{
            if (!hasEventListener(MultiloaderEvent.ON_ERROR)){
                throw (new Error(event.error));
            };
            dispatchEvent(new MultiloaderEvent(MultiloaderEvent.ON_ERROR, event.id, event.error));
        }
        public function get added():Number{
            return (_added);
        }
        public function add(dataType:String, url:String, parameters:Array=null):Number{
            if (url == "null"){
                throw (new Error("url is null"));
            };
            return (addItem(dataType, new URLRequest(url), parameters));
        }
        private function loadNextItem():void{
            var dataLoader:DataLoader;
            dataLoader = loaders[loaded];
            trace("dataLoader", dataLoader);
            dataLoader.addEventListener(DataLoaderEvent.ON_COMPLETE, onItemLoaded);
            dataLoader.addEventListener(DataLoaderEvent.ON_ERROR, onItemError);
            dataLoader.addEventListener(DataLoaderEvent.ON_PROGRESS, onItemProgress);
            dataLoader.load();
        }
        public function getContentById(id:Number):Object{
            return ((dataList[id] as DataHolder).content);
        }
        private function onItemLoaded(event:DataLoaderEvent):void{
            loaded++;
            dispatchEvent(new MultiloaderEvent(MultiloaderEvent.ON_ITEM_LOADED, event.id));
            if ((((loaded == loaders.length)) && (!((loaded == 0))))){
                load_time = (getTimer() - start_time);
                dispatchEvent(new MultiloaderEvent(MultiloaderEvent.ON_COMPLETE));
            } else {
                if (status != STATUS_IDLE){
                    waitId = EnterFrameUtils.setTimeout(loadNextItem, waitFramesBetweenLoadings);
                };
            };
        }
        public function getParametersById(id:Number):Array{
            return ((dataList[id] as DataHolder).parameters);
        }
        public function get loadTime():Number{
            return (load_time);
        }
        private function addItem(dataType:String, request:URLRequest, parameters:Array=null):Number{
            if (status != STATUS_IDLE){
                throw (new Error("add() method must be called before start() method"));
            };
            if (!DATA_TYPES[dataType]){
                throw (new Error(("unknown dataType:" + dataType)));
            };
            _added++;
            loaders[nextid] = new DataLoader(nextid, dataType, request, parameters);
            dataList[nextid] = (loaders[nextid] as DataLoader).dataholder;
            nextid++;
            return ((nextid - 1));
        }
        public function clear():void{
            var dataLoader:DataLoader;
            var i:Number;
            EnterFrameUtils.clearTimeout(waitId);
            waitFramesBetweenLoadings = 0;
            i = 0;
            while (i < loaders.length) {
                dataLoader = loaders[i];
                dataLoader.removeEventListener(DataLoaderEvent.ON_COMPLETE, onItemLoaded);
                dataLoader.removeEventListener(DataLoaderEvent.ON_ERROR, onItemError);
                dataLoader.removeEventListener(DataLoaderEvent.ON_PROGRESS, onItemProgress);
                dataLoader.destroy();
                dataLoader = null;
                i++;
            };
            _added = 0;
            progress = NaN;
            start_time = 0;
            load_time = 0;
            loaded = 0;
            loaders = [];
            dataList = [];
            nextid = 0;
            status = STATUS_IDLE;
        }
        public function getDataHolderById(id:Number):DataHolder{
            return (dataList[id]);
        }
        private function onItemProgress(event:DataLoaderEvent):void{
            var newProgress:Number;
            var dataloader:DataLoader;
            var i:Number;
            newProgress = 0;
            i = 0;
            while (i < loaders.length) {
                dataloader = loaders[i];
                if (dataloader.dataholder.bytesTotal > 0){
                    newProgress = (newProgress + (((1 / loaders.length) * (1 / dataloader.dataholder.bytesTotal)) * dataloader.dataholder.bytesLoaded));
                };
                i++;
            };
            if (newProgress >= 1){
                newProgress = 1;
            };
            if (newProgress != progress){
                progress = newProgress;
                dispatchEvent(new MultiloaderEvent(MultiloaderEvent.ON_PROGRESS, NaN, null, progress));
            };
        }
        public function start(framesTimeoutBetweenLoadings:Number=1):void{
            trace("loader start");
            waitFramesBetweenLoadings = framesTimeoutBetweenLoadings;
            if (status == STATUS_IDLE){
                if (loaders.length == 0){
                    throw (new Error("Use add() method before start()"));
                };
                loadNextItem();
                status = STATUS_BUSY;
                start_time = getTimer();
                dispatchEvent(new MultiloaderEvent(MultiloaderEvent.ON_START));
            } else {
                throw (new Error("Multiloader уже был запущен"));
            };
        }
        public function close():void{
            var dataLoader:DataLoader;
            var i:Number;
            i = 0;
            while (i < loaders.length) {
                dataLoader = loaders[i];
                dataLoader.close();
                i++;
            };
        }

        DATA_TYPES[DATA_TEXT] = true;
        DATA_TYPES[DATA_BITMAP] = true;
        DATA_TYPES[DATA_FLASH] = true;
        DATA_TYPES[DATA_BINARY] = true;
        DATA_TYPES[DATA_SOUND] = true;
    }
}//package ru.isky.multiloader 
﻿package ru.isky.multiloader {
    import flash.display.*;
    import flash.net.*;
    import flash.media.*;

    public class DataHolder {

        private var _loaderInfo:Object;
        private var __datatype:String;
        public var loader:Object;
        private var __url:String;
        public var loadTime:Number;
        public var parameters:Array;
        private var __id:Number;

        public function DataHolder(_id:Number, _datatype:String, _url:String, _parameters:Array=null){
            super();
            __datatype = _datatype;
            __url = _url;
            __id = _id;
            parameters = _parameters;
        }
        public function get dataType():String{
            return (__datatype);
        }
        public function get bytesLoaded():Number{
            return (loaderInfo["bytesLoaded"]);
        }
        public function get bytesTotal():Number{
            return (loaderInfo["bytesTotal"]);
        }
        public function get id():Number{
            return (__id);
        }
        private function get loaderInfo():Object{
            if (_loaderInfo == null){
                if ((((__datatype == Multiloader.DATA_FLASH)) || ((__datatype == Multiloader.DATA_BITMAP)))){
                    _loaderInfo = (loader as Loader).contentLoaderInfo;
                };
                if ((((__datatype == Multiloader.DATA_TEXT)) || ((__datatype == Multiloader.DATA_BINARY)))){
                    _loaderInfo = loader;
                };
                if (__datatype == Multiloader.DATA_SOUND){
                    _loaderInfo = loader;
                };
            };
            return (_loaderInfo);
        }
        public function get url():String{
            return (__url);
        }
        public function get content():Object{
            var data:Object;
            if ((((__datatype == Multiloader.DATA_BITMAP)) || ((__datatype == Multiloader.DATA_FLASH)))){
                data = (loader as Loader).content;
            };
            if ((((__datatype == Multiloader.DATA_TEXT)) || ((__datatype == Multiloader.DATA_BINARY)))){
                data = (loader as URLLoader).data;
            };
            if (__datatype == Multiloader.DATA_SOUND){
                data = (loader as Sound);
            };
            return (data);
        }
        public function destroy():void{
            _loaderInfo = null;
            loader = null;
            parameters = null;
        }

    }
}//package ru.isky.multiloader 
﻿package ru.isky.multiloader {
    import flash.events.*;
    import flash.display.*;
    import flash.net.*;
    import flash.utils.*;
    import flash.media.*;

    public class DataLoader extends EventDispatcher {

        private var startTime:uint;
        public var dataholder:DataHolder;
        private var dispatcher:IEventDispatcher;
        private var request:URLRequest;

        public function DataLoader(_id:Number, _dataType:String, _request:URLRequest, _parameters:Array=null){
            super();
            dataholder = new DataHolder(_id, _dataType, _request.url, _parameters);
            request = _request;
            if ((((dataholder.dataType == Multiloader.DATA_FLASH)) || ((dataholder.dataType == Multiloader.DATA_BITMAP)))){
                dataholder.loader = new Loader();
                dispatcher = (dataholder.loader as Loader).contentLoaderInfo;
            };
            if ((((dataholder.dataType == Multiloader.DATA_TEXT)) || ((dataholder.dataType == Multiloader.DATA_BINARY)))){
                dataholder.loader = new URLLoader();
                if (dataholder.dataType == Multiloader.DATA_BINARY){
                    (dataholder.loader as URLLoader).dataFormat = URLLoaderDataFormat.BINARY;
                };
                dispatcher = (dataholder.loader as URLLoader);
            };
            if (dataholder.dataType == Multiloader.DATA_SOUND){
                dataholder.loader = new Sound();
                dispatcher = (dataholder.loader as Sound);
            };
        }
        public function destroy():void{
            close();
            dataholder.destroy();
            dataholder = null;
            request = null;
        }
        private function onErrorHandler(event:IOErrorEvent):void{
            dispatchEvent(new DataLoaderEvent(DataLoaderEvent.ON_ERROR, dataholder.id, event.toString()));
        }
        public function load():void{
            startTime = getTimer();
            dispatcher.addEventListener(Event.COMPLETE, onCompleteHandler);
            dispatcher.addEventListener(IOErrorEvent.IO_ERROR, onErrorHandler);
            dispatcher.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
            try {
                var _local2 = dataholder.loader;
                _local2["load"](request);
            } catch(loader_error:Error) {
                onError(loader_error);
            };
        }
        private function onError(error:Error):void{
            dispatchEvent(new DataLoaderEvent(DataLoaderEvent.ON_ERROR, dataholder.id, error.toString()));
        }
        private function onCompleteHandler(event:Event):void{
            dataholder.loadTime = (getTimer() - startTime);
            dispatcher.removeEventListener(Event.COMPLETE, onCompleteHandler);
            dispatcher.removeEventListener(IOErrorEvent.IO_ERROR, onErrorHandler);
            dispatcher.removeEventListener(ProgressEvent.PROGRESS, onProgressHandler);
            dispatchEvent(new DataLoaderEvent(DataLoaderEvent.ON_COMPLETE, dataholder.id));
        }
        public function close():void{
            try {
                var _local2 = dataholder.loader;
                _local2["close"]();
            } catch(error:Error) {
                onError(error);
            };
        }
        private function onProgressHandler(event:ProgressEvent):void{
            dispatchEvent(new DataLoaderEvent(DataLoaderEvent.ON_PROGRESS, dataholder.id));
        }
        public function unload():void{
            if ((((dataholder.dataType == Multiloader.DATA_BITMAP)) || ((dataholder.dataType == Multiloader.DATA_FLASH)))){
                try {
                    (dataholder.loader as Loader).unload();
                } catch(error:Error) {
                    onError(error);
                };
            };
            dataholder.loader = null;
        }

    }
}//package ru.isky.multiloader 
﻿package ru.isky.geom.d2 {
    import flash.geom.*;

    public class Point2DTools {

        public function Point2DTools(){
            super();
        }
        public static function displace(src:Point, displaceX:Number=0, displaceY:Number=0):Point{
            return (new Point((src.x + displaceX), (src.y + displaceY)));
        }
        public static function distance(_P1:Point, _P2:Point):Number{
            var distance:Number;
            var katetA:Number;
            var katetB:Number;
            katetA = Math.abs((_P1.x - _P2.x));
            katetB = Math.abs((_P1.y - _P2.y));
            if (katetA == 0){
                distance = Math.abs((_P1.y - _P2.y));
            } else {
                if (katetB == 0){
                    distance = Math.abs((_P1.x - _P2.x));
                } else {
                    distance = Math.sqrt(((katetA * katetA) + (katetB * katetB)));
                };
            };
            return (distance);
        }
        public static function rotateAt(targetPoint:Point, centerPoint:Point, angle_rad:Number):Point{
            var radius:Number;
            var currentAngle:Number;
            var newAngle:Number;
            var endX:Number;
            var endY:Number;
            radius = distance(targetPoint, centerPoint);
            currentAngle = (Math.atan2((targetPoint.x - centerPoint.x), (targetPoint.y - centerPoint.y)) * -1);
            newAngle = (currentAngle + angle_rad);
            endX = ((Math.cos(newAngle) * radius) + centerPoint.x);
            endY = ((Math.sin(newAngle) * radius) + centerPoint.y);
            return (new Point(endX, endY));
        }

    }
}//package ru.isky.geom.d2 
﻿package ru.isky.math {
    import flash.geom.*;

    public class RectangleUtils {

        public static const SIT_TYPE_INSIDE:String = "inside";
        public static const SIT_TYPE_OUTSIDE:String = "outside";

        public function RectangleUtils(){
            super();
        }
        public static function sitRectangle(rectangle0:Rectangle, rectangle1:Rectangle, type:String="inside"):Rectangle{
            var w_prop:Number;
            var h_prop:Number;
            var prop0:Number;
            rectangle0 = rectangle0.clone();
            w_prop = (rectangle0.width / rectangle1.width);
            h_prop = (rectangle1.height / rectangle1.height);
            prop0 = (rectangle0.width / rectangle0.height);
            if ((((w_prop > h_prop)) && ((type == SIT_TYPE_INSIDE)))){
                rectangle0.width = rectangle1.width;
                rectangle0.height = (rectangle0.width / prop0);
            } else {
                rectangle0.height = rectangle1.height;
                rectangle0.width = (rectangle0.height * prop0);
            };
            return (rectangle0);
        }

    }
}//package ru.isky.math 
﻿package ru.isky.gazprom.gallery {
    import flash.events.*;
    import flash.display.*;

    public class GalleryLoaderEvent extends Event {

        public static const ON_COMPLETE:String = "ON_COMPLETE";
        public static const ON_CONFIG_LOADED:String = "ON_CONFIG_LOADED";
        public static const ON_DEFAULT_IMAGE_LOADED:String = "ON_DEFAULT_IMAGE_LOADED";
        public static const ON_ALL_IMAGES_LOAD_PROGRESS:String = "ON_ALL_IMAGES_LOAD_PROGRESS";

        public var allImagesProgress:Number;
        public var defaultImage:Bitmap;

        public function GalleryLoaderEvent(type:String, _defaultImage:Bitmap=null, _allImagesProgress:Number=0, bubbles:Boolean=false, cancelable:Boolean=false){
            super(type, bubbles, cancelable);
            defaultImage = _defaultImage;
            allImagesProgress = _allImagesProgress;
        }
    }
}//package ru.isky.gazprom.gallery 
﻿package ru.isky.gazprom.gallery {
    import flash.events.*;
    import caurina.transitions.*;
    import flash.geom.*;
    import flash.display.*;
    import flash.text.*;
    import ru.isky.utils.*;

    public class Preloader extends Sprite {

        private var cellsAmount:Number;
        private var image:Bitmap;
        private var randomCells:Array;
        private var lastVisibleAmount:Number = 0;
        public var tf:TextField;
        private var container:Sprite;
        private var previousCell:Sprite;

        public function Preloader(defaultImage:Bitmap){
            lastVisibleAmount = 0;
            randomCells = [];
            super();
            image = defaultImage;
            container = new Sprite();
            addChild(container);
            tf = new TextField();
            tf.autoSize = TextFieldAutoSize.LEFT;
        }
        public function updateProgress(value:Number):void{
            var visibleAmount:Number;
            tf.text = (Math.round((value * 100)) + "%");
            visibleAmount = Math.round((value * cellsAmount));
            if (lastVisibleAmount != visibleAmount){
                lastVisibleAmount = visibleAmount;
                trace(lastVisibleAmount);
                showPartImage(lastVisibleAmount);
            };
        }
        private function showPartImage(amount:Number):void{
            var j:Number;
            var i:Number;
            var cell:Sprite;
            j = 0;
            while (j < amount) {
                i = 0;
                while (i < cellsAmount) {
                    cell = (container.getChildAt(i) as Sprite);
                    if (i == randomCells[j]){
                        if (cell.alpha != 1){
                            if (Tweener.isTweening(cell) != true){
                                Tweener.addTween(cell, {
                                    alpha:1,
                                    time:0.5
                                });
                            };
                        };
                    };
                    i++;
                };
                j++;
            };
        }
        public function buildMatrix(amount:Number):void{
            var arr:Array;
            var w_images:Number;
            var h_images:Number;
            var matrixItemWidth:int;
            var matrixItemHeight:int;
            var i:Number;
            var k:Number;
            var j:Number;
            var bitmapData:BitmapData;
            var bmp:Bitmap;
            var spr:Sprite;
            arr = ImagesRectangle.getRectangleSidesQuantity(amount);
            w_images = arr[0];
            trace(w_images);
            h_images = arr[1];
            trace(h_images);
            cellsAmount = (w_images * h_images);
            matrixItemWidth = (image.width / w_images);
            matrixItemHeight = (image.height / h_images);
            i = 0;
            while (i < h_images) {
                j = 0;
                while (j < w_images) {
                    bitmapData = new BitmapData(matrixItemWidth, matrixItemHeight, false);
                    bitmapData.copyPixels(image.bitmapData, new Rectangle((j * matrixItemWidth), (i * matrixItemHeight), matrixItemWidth, matrixItemHeight), new Point());
                    bmp = new Bitmap(bitmapData);
                    bmp.x = (j * matrixItemWidth);
                    bmp.y = (i * matrixItemHeight);
                    spr = new Sprite();
                    spr.addChild(bmp);
                    spr.alpha = 0;
                    spr.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);
                    container.addChild(spr);
                    j++;
                };
                i++;
            };
            k = 0;
            while (k < cellsAmount) {
                randomCells.push(k);
                k++;
            };
            ArrayUtils.shuffle(randomCells);
            trace(randomCells);
        }
        private function onMouseOverHandler(event:MouseEvent):void{
            var cell:Sprite;
            trace("mouseOver");
            cell = (event.target as Sprite);
            if (cell.alpha <= 0.5){
                Tweener.addTween(cell, {
                    alpha:0.6,
                    time:2
                });
            } else {
                if (cell.alpha != 1){
                    Tweener.addTween(cell, {
                        alpha:0,
                        time:2
                    });
                };
            };
            previousCell = cell;
        }

    }
}//package ru.isky.gazprom.gallery 
﻿package ru.isky.gazprom.gallery {

    public class ImagesStorage extends DataStorage {

        public var data:Array;

        public function ImagesStorage(){
            super();
            data = [];
        }
        override public function addData(_data:Object, href:String):void{
            super.addData(_data, href);
            data.push(_data);
        }

    }
}//package ru.isky.gazprom.gallery 
﻿package ru.isky.gazprom.gallery {

    public interface IClonableDisplayObject {

        function set x(_arg1:Number):void;
        function set y(_arg1:Number):void;
        function get width():Number;
        function get height():Number;
        function get x():Number;
        function get y():Number;
        function clone():IClonableDisplayObject;

    }
}//package ru.isky.gazprom.gallery 
﻿package ru.isky.gazprom.gallery {
    import flash.display.*;

    public class CloneGrid extends Sprite {

        private var item:IClonableDisplayObject;
        private var item_width:Number;
        private var item_height:Number;
        public var rows:Array;

        public function CloneGrid(item:IClonableDisplayObject, item_width:Number=NaN, item_height:Number=NaN){
            super();
            rows = [];
            this.item_width = ((item_width) || (item.width));
            this.item_height = ((item_height) || (item.height));
            this.item = item;
        }
        public function addBottomRow():void{
            addRow();
        }
        public function addRightColumn():void{
            addColumn();
        }
        private function removeArray(objects:Array=null):void{
            var target:IClonableDisplayObject;
            var i:Number;
            if (!objects){
                return;
            };
            i = 0;
            while (i < objects.length) {
                target = objects[i];
                removeChild((target as DisplayObject));
                target = null;
                i++;
            };
            objects = null;
        }
        private function addColumn(left:Boolean=false):void{
            var newItem:IClonableDisplayObject;
            var row:Array;
            var i:Number;
            if (rows.length == 0){
                rows.push([getItemCopy()]);
                return;
            };
            i = 0;
            while (i < rows.length) {
                row = rows[i];
                newItem = getItemCopy();
                if (left){
                    newItem.x = (row[0].x - item_width);
                    newItem.y = row[0].y;
                    row.unshift(newItem);
                } else {
                    newItem.x = (row[(row.length - 1)].x + item_width);
                    newItem.y = row[0].y;
                    row.push(newItem);
                };
                i++;
            };
        }
        public function removeRightColumn():void{
            removeColumn();
        }
        public function addTopRow():void{
            addRow(true);
        }
        private function addRow(top:Boolean=false):void{
            var row:Array;
            var newRow:Array;
            var newItem:IClonableDisplayObject;
            var i:Number;
            if (rows.length == 0){
                rows.push([getItemCopy()]);
                return;
            };
            row = rows[0];
            newRow = [];
            i = 0;
            while (i < row.length) {
                newItem = getItemCopy();
                if (top){
                    row = rows[0];
                    newItem.x = row[i].x;
                    newItem.y = (row[0].y - item_height);
                } else {
                    row = rows[(rows.length - 1)];
                    newItem.x = row[i].x;
                    newItem.y = (row[(row.length - 1)].y + item_height);
                };
                newRow.push(newItem);
                i++;
            };
            if (top){
                rows.unshift(newRow);
            } else {
                rows.push(newRow);
            };
        }
        public function removeBottomRow():void{
            removeRow();
        }
        private function removeRow(top:Boolean=false):void{
            if (!rows.length){
                return;
            };
            if (top){
                removeArray(rows.shift());
            } else {
                removeArray(rows.pop());
            };
        }
        public function addLeftColumn():void{
            addColumn(true);
        }
        private function getItemCopy():IClonableDisplayObject{
            return ((addChild((item.clone() as DisplayObject)) as IClonableDisplayObject));
        }
        public function removeLeftColumn():void{
            removeColumn(true);
        }
        public function removeTopRow():void{
            removeRow(true);
        }
        private function removeColumn(left:Boolean=false):void{
            var itemIndex:int;
            var row:Array;
            var i:Number;
            if (!rows.length){
                return;
            };
            itemIndex = (rows[0].length - 1);
            if (left){
                itemIndex = 0;
            };
            i = 0;
            while (i < rows.length) {
                row = rows[i];
                if (left){
                    removeChild(row.shift());
                } else {
                    removeChild(row.pop());
                };
                i++;
            };
            if (row.length == 0){
                rows = [];
            };
        }

    }
}//package ru.isky.gazprom.gallery 
﻿package ru.isky.gazprom.gallery {

    public class DataStorage {

        private var _length:int = 0;
        protected var storage:Object;

        public function DataStorage(){
            _length = 0;
            super();
            storage = new Object();
        }
        public function getDataByHref(href:String):Object{
            return (storage[href]);
        }
        public function addData(data:Object, href:String):void{
            if (storage[href] == null){
                _length++;
            };
            storage[href] = data;
        }
        public function get length():int{
            return (_length);
        }

    }
}//package ru.isky.gazprom.gallery 
﻿package ru.isky.gazprom.gallery {
    import flash.events.*;

    public class ImagesLoaderEvent extends Event {

        public static const ON_COMPLETE:String = "onComplete";
        public static const ON_PROGRESS:String = "onProgress";

        public var progress:Number;

        public function ImagesLoaderEvent(type:String, _progress:Number, bubbles:Boolean=false, cancelable:Boolean=false){
            super(type, bubbles, cancelable);
            progress = _progress;
        }
    }
}//package ru.isky.gazprom.gallery 
﻿package ru.isky.gazprom.gallery {
    import flash.geom.*;
    import flash.display.*;
    import ru.isky.utils.*;

    public class Gallery extends WEBDocument {

        private var galleryLoader:GalleryLoader;
        private var map:Map;
        public var preloader:Preloader;
        private var defaultImage:Bitmap;

        public function Gallery(){
            var configHref:String;
            super();
            galleryLoader = new GalleryLoader();
            galleryLoader.addEventListener(GalleryLoaderEvent.ON_DEFAULT_IMAGE_LOADED, onDefaultImageLoaded);
            galleryLoader.addEventListener(GalleryLoaderEvent.ON_ALL_IMAGES_LOAD_PROGRESS, onImagesLoadProgress);
            galleryLoader.addEventListener(GalleryLoaderEvent.ON_COMPLETE, onImagesLoaded);
            configHref = ((root.loaderInfo.parameters["config_href"]) || ("config.xml"));
            galleryLoader.loadConfig(configHref);
        }
        private function onImagesLoaded(event:GalleryLoaderEvent):void{
            removeChild(preloader);
            defaultImage.visible = false;
            map = new Map(new ImagesRectangle(galleryLoader.storage), new Rectangle(0, 0, 710, 350));
            addChild(map);
            map.initExternal();
            map.addCallBacks();
            map.showAll();
        }
        private function onImagesLoadProgress(event:GalleryLoaderEvent):void{
            preloader.updateProgress(event.allImagesProgress);
        }
        private function onDefaultImageLoaded(event:GalleryLoaderEvent):void{
            defaultImage = event.defaultImage;
            preloader = new Preloader(defaultImage);
            preloader.x = (preloader.y = 0);
            addChild(preloader);
            preloader.buildMatrix(galleryLoader.imagesAmount);
            defaultImage.alpha = 0;
        }

    }
}//package ru.isky.gazprom.gallery 
﻿package ru.isky.gazprom.gallery {
    import flash.events.*;
    import caurina.transitions.*;
    import flash.geom.*;
    import ru.actionsmile.utils.*;
    import flash.display.*;
    import ru.isky.external.*;
    import ru.isky.geom.d2.*;
    import ru.isky.math.*;
    import org.noregret.log.*;
    import flash.utils.*;


Худший ответ:
Посмотрите здесь cube3x.com/demo/adipoli-jquery-image-hover-plugin/