Skip to content

Instantly share code, notes, and snippets.

@ZoczuS
Created May 22, 2014 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZoczuS/823db7a0db5bdd96a0d1 to your computer and use it in GitHub Desktop.
Save ZoczuS/823db7a0db5bdd96a0d1 to your computer and use it in GitHub Desktop.
/*
* Source code for kraski-universal-blogplayer.swf (C) Yandex
*
* Decompiled using flaczki - https://github.com/chung-leong/flaczki
*
*/
package ru.yandex.kraski.universalpainter.preloader
{
public class KraskiPreloader extends flash.display::Sprite implements {mx.preloaders}::IPreloaderDisplay
{
//========================= Variables
private var preloaderImage : Loader;
public var preloaderSWF : String;
private var prevFrame : uint;
//========================= Methods
public static function KraskiPreloader()
{
return;
}
public function KraskiPreloader()
{
super();
return;
}
private function handleComplete(arg0:flash.events::Event)
{
return;
}
public Getter function stageHeight() : Number
{
return 700;
}
public Getter function backgroundImage() : Object
{
return null;
}
public Getter function backgroundSize() : String
{
return null;
}
public Setter function stageHeight(arg0:Number)
{
return;
}
public Getter function backgroundColor() : uint
{
return 0;
}
public function initialize()
{
var loc0:* = stage.loaderInfo.url;
var loc1:* = "";
var loc2:* = loc0.indexOf("?");
loc0 = loc0.substr(0, loc2);
loc2 = loc0.lastIndexOf("/");
loc0 = loc0.substr(0, loc2);
loc1 = loc0 + "/" + this.preloaderSWF;
this.preloaderImage = new Loader();
addEventListener(Event.COMPLETE, this.loader_completeHandler);
preloaderImage.load(new URLRequest(loc1));
return;
}
public Setter function backgroundImage(arg0:Object)
{
return;
}
public Setter function backgroundSize(arg0:String)
{
return;
}
public Setter function backgroundAlpha(arg0:Number)
{
return;
}
private function enterFrameHandler(arg0:flash.events::Event)
{
if(this.prevFrame == MovieClip(this.preloaderImage.content).currentFrame)
{
removeEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
dispatchEvent(new Event(Event.COMPLETE));
}
this.prevFrame = MovieClip(this.preloaderImage.content).currentFrame;
return;
}
private function handleInitProgress(arg0:flash.events::Event)
{
return;
}
public Getter function backgroundAlpha() : Number
{
return 0;
}
public Getter function stageWidth() : Number
{
return 1000;
}
private function handleInitComplete(arg0:flash.events::Event)
{
this.startEnterFrame();
return;
}
public Setter function stageWidth(arg0:Number)
{
return;
}
private function handleProgress(arg0:flash.events::ProgressEvent)
{
var loc0:* = 0;
if(this.preloaderImage.content)
{
loc0 = Math.round(arg0.bytesLoaded / arg0.bytesTotal * 100);
gotoAndStop(loc0);
}
return;
}
private function startEnterFrame(arg0:flash.events::TimerEvent = null)
{
var loc0:* = null;
if(this.preloaderImage && this.preloaderImage.content)
{
this.prevFrame = MovieClip(this.preloaderImage.content).currentFrame;
play();
addEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
}
else
{
loc0 = new Timer(2000, 1);
loc0.addEventListener(TimerEvent.TIMER, this.startEnterFrame);
loc0.start();
}
return;
}
public Setter function backgroundColor(arg0:uint)
{
return;
}
public Setter function preloader(arg0:flash.display::Sprite)
{
arg0.addEventListener(ProgressEvent.PROGRESS, this.handleProgress);
arg0.addEventListener(Event.COMPLETE, this.handleComplete);
arg0.addEventListener(FlexEvent.INIT_PROGRESS, this.handleInitProgress);
arg0.addEventListener(FlexEvent.INIT_COMPLETE, this.handleInitComplete);
return;
}
private function loader_completeHandler(arg0:flash.events::Event)
{
addChild(this.preloaderImage);
stop();
return;
}
}
public class BlogPlayerPreloader extends ru.yandex.kraski.universalpainter.preloader::KraskiPreloader
{
//========================= Methods
public static function BlogPlayerPreloader()
{
return;
}
public function BlogPlayerPreloader()
{
super();
this.preloaderSWF = "blogPlayerPreloader.swf";
return;
}
public Getter function stageWidth() : Number
{
return 500;
}
public Getter function stageHeight() : Number
{
return 560;
}
}
}
package [Global]
{
public dynamic class blogPlayAgainButton_skin extends mx.flash::UIMovieClip
{
//========================= Methods
public static function blogPlayAgainButton_skin()
{
return;
}
public function blogPlayAgainButton_skin()
{
super();
return;
}
}
public dynamic class blogDownloadButton_skin extends mx.flash::UIMovieClip
{
//========================= Methods
public static function blogDownloadButton_skin()
{
return;
}
public function blogDownloadButton_skin()
{
super();
return;
}
}
public dynamic class blogPaintYourselfButton_skin extends mx.flash::UIMovieClip
{
//========================= Methods
public static function blogPaintYourselfButton_skin()
{
return;
}
public function blogPaintYourselfButton_skin()
{
super();
return;
}
}
public dynamic class blogPlayerStartButton_skin extends mx.flash::UIMovieClip
{
//========================= Methods
public static function blogPlayerStartButton_skin()
{
return;
}
public function blogPlayerStartButton_skin()
{
super();
return;
}
}
public dynamic class blogGetCodeButton_skin extends mx.flash::UIMovieClip
{
//========================= Methods
public static function blogGetCodeButton_skin()
{
return;
}
public function blogGetCodeButton_skin()
{
super();
return;
}
}
public class BlogPlayer extends mx.core::Application implements {mx.binding}::IBindingClient
{
//========================= Variables
private static var _watcherSetupUtil : IWatcherSetupUtil;
public static var _BlogPlayer_StylesInit_done : Boolean = False;
private var _1763239082paintCanvas : PaintCanvas;
private var _235964214traceTarget : TraceTarget;
private var _2056864585isDebug : Boolean = False;
private var card : Card;
private var _1354231074playAgainButton : HandCursorButton;
private var _1631133009preloaderAftertaste : BlogPlayerPreloaderAftertaste;
private var _model : Model;
private var _embed_css__2093910380 : Class;
private var _159077850downloadButton : HandCursorButton;
private var _1704619147getCodeButton : HandCursorButton;
private var currentVisualIndex : int;
public var _bindingsByDestination : Object;
private var _1435122461loggerWrapper : UIComponent;
private var _embed_css__2078891259 : Class;
private var _318184504preview : Canvas;
private var loadLibraryController : LoadLibraryController;
private var _416447130screenshot : Image;
private var _1613058925playerStartButton : HandCursorButton;
private var _1937158641paintYourselfButton : HandCursorButton;
private var customCursorManager : CustomCursorManager;
private var loadConfigController : LoadConfigController;
public var _BlogPlayer_HBox2 : HBox;
public var _watchers : Array;
private var _embed_css__1502235314 : Class;
private var _1554553085viewstack : ViewStack;
private var paintTypes : PaintType;
public var _bindingsBeginWithWord : Object;
private var _embed_css__162016752 : Class;
private var _embed_css__1017935931 : Class;
private var player : Player;
private var cardXML : XML;
public var _bindings : Array;
private var _documentDescriptor_ : UIComponentDescriptor;
//========================= Methods
public static function BlogPlayer()
{
this._BlogPlayer_StylesInit_done = false;
return;
}
public function BlogPlayer()
{
this._documentDescriptor_ = new UIComponentDescriptor({"type" : Application, "propertiesFactory" : function()
{
return {"width" : 500, "height" : 560, "childDescriptors" : [new UIComponentDescriptor({"type" : VBox, "stylesFactory" : function()
{
this.horizontalAlign = "center";
this.verticalGap = 6;
this.paddingTop = 12;
return;
}, "propertiesFactory" : function()
{
return {"width" : 500, "height" : 560, "styleName" : "PaintCanvasOuterContainerStyle", "childDescriptors" : [new UIComponentDescriptor({"type" : ViewStack, "id" : "viewstack", "propertiesFactory" : function()
{
return {"width" : 475, "height" : 475, "creationPolicy" : "all", "styleName" : "PaintCanvasInnerContainerStyle", "childDescriptors" : [new UIComponentDescriptor({"type" : Canvas, "id" : "preview", "propertiesFactory" : function()
{
return {"percentWidth" : 100, "percentHeight" : 100, "horizontalScrollPolicy" : "off", "verticalScrollPolicy" : "off", "childDescriptors" : [new UIComponentDescriptor({"type" : Image, "id" : "screenshot", "events" : {"complete" : "__screenshot_complete"}, "propertiesFactory" : function()
{
return {"x" : 0, "y" : 0};
}}), new UIComponentDescriptor({"type" : HandCursorButton, "id" : "playerStartButton", "events" : {"click" : "__playerStartButton_click"}, "stylesFactory" : function()
{
this.horizontalCenter = "0";
this.verticalCenter = "0";
return;
}, "propertiesFactory" : function()
{
return {"styleName" : "BlogPlayerStartButtonStyle", "visible" : false};
}})]};
}}), new UIComponentDescriptor({"type" : Canvas, "propertiesFactory" : function()
{
return {"percentWidth" : 100, "percentHeight" : 100, "horizontalScrollPolicy" : "off", "verticalScrollPolicy" : "off", "childDescriptors" : [new UIComponentDescriptor({"type" : PaintCanvas, "id" : "paintCanvas"})]};
}})]};
}}), new UIComponentDescriptor({"type" : HBox, "stylesFactory" : function()
{
this.horizontalAlign = "center";
this.verticalAlign = "middle";
return;
}, "propertiesFactory" : function()
{
return {"width" : 320, "height" : 60, "styleName" : "BlogControlsBoxStyle", "childDescriptors" : [new UIComponentDescriptor({"type" : HandCursorButton, "id" : "downloadButton", "events" : {"click" : "__downloadButton_click"}, "propertiesFactory" : function()
{
return {"styleName" : "DownloadButtonStyle", "enabled" : false};
}}), new UIComponentDescriptor({"type" : HandCursorButton, "id" : "paintYourselfButton", "events" : {"click" : "__paintYourselfButton_click"}, "propertiesFactory" : function()
{
return {"styleName" : "PaintYourselfButtonStyle", "enabled" : false};
}}), new UIComponentDescriptor({"type" : HandCursorButton, "id" : "getCodeButton", "events" : {"click" : "__getCodeButton_click"}, "propertiesFactory" : function()
{
return {"styleName" : "GetCodeButtonStyle", "enabled" : false};
}}), new UIComponentDescriptor({"type" : HandCursorButton, "id" : "playAgainButton", "events" : {"click" : "__playAgainButton_click"}, "propertiesFactory" : function()
{
return {"styleName" : "PlayAgainButtonStyle", "enabled" : false};
}})]};
}})]};
}}), new UIComponentDescriptor({"type" : BlogPlayerPreloaderAftertaste, "id" : "preloaderAftertaste", "propertiesFactory" : function()
{
return {"x" : 0, "y" : 0, "width" : 500, "height" : 560};
}}), new UIComponentDescriptor({"type" : HBox, "id" : "_BlogPlayer_HBox2", "stylesFactory" : function()
{
this.left = "0";
this.bottom = "0";
return;
}, "propertiesFactory" : function()
{
return {"childDescriptors" : [new UIComponentDescriptor({"type" : FpsMeter}), new UIComponentDescriptor({"type" : MemoryUsageMeter})]};
}}), new UIComponentDescriptor({"type" : UIComponent, "id" : "loggerWrapper", "propertiesFactory" : function()
{
return {"mouseEnabled" : false, "percentWidth" : 100, "percentHeight" : 100};
}})]};
}});
this.loadConfigController = LoadConfigController.instance;
this.loadLibraryController = LoadLibraryController.instance;
this._embed_css__1017935931 = BlogPlayer__embed_css__1017935931;
this._embed_css__1502235314 = BlogPlayer__embed_css__1502235314;
this._embed_css__162016752 = BlogPlayer__embed_css__162016752;
this._embed_css__2078891259 = BlogPlayer__embed_css__2078891259;
this._embed_css__2093910380 = BlogPlayer__embed_css__2093910380;
this._bindings = [];
this._watchers = [];
this._bindingsByDestination = {};
this._bindingsBeginWithWord = {};
super();
mx_internal._document = this;
if(this.styleDeclaration)
{
this.styleDeclaration = new CSSStyleDeclaration();
}
this.styleDeclaration.defaultFactory = ;
var loc1:* = this;
this.layout = "absolute";
this.width = 500;
this.height = 560;
this.horizontalScrollPolicy = "off";
this.verticalScrollPolicy = "off";
this._BlogPlayer_TraceTarget1_i();
this.addEventListener("applicationComplete", this.___BlogPlayer_Application1_applicationComplete);
return;
}
public static Setter function watcherSetupUtil(arg0:mx.binding::IWatcherSetupUtil)
{
*::_watcherSetupUtil._watcherSetupUtil = ;
return;
}
public function __playAgainButton_click(arg0:flash.events::MouseEvent)
{
this.playAgain();
return;
}
private function loadLibraryClipartsXML()
{
this.loadLibraryController.data = ;
loadLibraryController.addEventListener(ModelEvent.LIBRARY_LOAD_COMPLETE, this.library_loadCompleteHandler);
loadLibraryController.load();
return;
}
public Setter function viewstack(arg0:mx.containers::ViewStack)
{
var loc0:* = this._1554553085viewstack;
if(loc0 !== arg0)
{
this._1554553085viewstack = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "viewstack", loc0, arg0));
}
return;
}
private function _BlogPlayer_TraceTarget1_i() : mx.logging.targets::TraceTarget
{
var loc0:* = new TraceTarget();
this.traceTarget = loc0;
loc0.includeCategory = true;
loc0.includeLevel = true;
loc0.includeTime = true;
loc0.fieldSeparator = " -> ";
BindingManager.executeBindings(this, "traceTarget", this.traceTarget);
loc0.initialized(this, "traceTarget");
return loc0;
}
public function __screenshot_complete(arg0:flash.events::Event)
{
this.playerStartButton.visible = true;
return;
}
public Getter function downloadButton() : ru.yandex.kraski.universalpainter.view.comps::HandCursorButton
{
return this._159077850downloadButton;
}
private function playInitEffect()
{
preloaderAftertaste.gotoAndPlay(0);
addEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
return;
}
private function loadCard()
{
var loc0:* = ServiceLocator.loadCardForPlayService;
loc0.addEventListener(ResultEvent.RESULT, this.resultHandler);
loc0.addEventListener(FaultEvent.FAULT, this.faultHandler);
loc0.load(Config.instance.cardHash);
return;
}
public Getter function viewstack() : mx.containers::ViewStack
{
return this._1554553085viewstack;
}
private function enterFrameHandler(arg0:flash.events::Event)
{
if(this.preloaderAftertaste.totalFrames == this.preloaderAftertaste.currentFrame)
{
preloaderAftertaste.stop();
removeChild(this.preloaderAftertaste);
removeEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
}
return;
}
private function init()
{
this.isDebug = "false" == "true";
this.addVersionToContextMenu();
this.initCursorVisibility();
this.initCursorManager();
callLater(this.playInitEffect);
Log.addTarget(this.traceTarget);
var loc0:* = new Logger();
loc0.mouseEnabled = false;
loc0.target.filters = ;
Log.addTarget(loc0.target);
loggerWrapper.addChild(loc0);
if(parameters.mode == "local")
{
ServiceLocator.implementation = new FakeServiceLocatorImpl();
}
else
{
ServiceLocator.implementation = new WebServiceLocatorImpl();
}
this._model = new Model(this);
this.paintCanvas.model = ;
SmoothPaint.smoothingEnabled = false;
this.screenshot.source = 0;
return;
}
public Setter function paintYourselfButton(arg0:ru.yandex.kraski.universalpainter.view.comps::HandCursorButton)
{
var loc0:* = this._1937158641paintYourselfButton;
if(loc0 !== arg0)
{
this._1937158641paintYourselfButton = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "paintYourselfButton", loc0, arg0));
}
return;
}
public Setter function playerStartButton(arg0:ru.yandex.kraski.universalpainter.view.comps::HandCursorButton)
{
var loc0:* = this._1613058925playerStartButton;
if(loc0 !== arg0)
{
this._1613058925playerStartButton = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "playerStartButton", loc0, arg0));
}
return;
}
public Getter function model() : ru.yandex.kraski.universalpainter.data::Model
{
return this._model;
}
public Getter function paintYourselfButton() : ru.yandex.kraski.universalpainter.view.comps::HandCursorButton
{
return this._1937158641paintYourselfButton;
}
private function usedResources_loadCompleteHandler(arg0:ru.yandex.kraski.universalpainter.events::ModelEvent)
{
removeEventListener(ModelEvent.CLIPARTS_LOAD_COMPLETE, this.usedResources_loadCompleteHandler);
debug("Ready to show card");
this.card = Card.fromXML(this.model.clipartDescriptors, this.cardXML);
this.card.hash = Config.instance.cardHash;
this.cardXML = null;
CustomCursorManager.setCursorByName(CursorType.POINTER);
this.downloadButton.enabled = true;
this.paintYourselfButton.enabled = true;
this.getCodeButton.enabled = true;
this.player = new Player();
this.player.paintCanvas = paintCanvas;
this.player.card = ;
if(this.viewstack.selectedIndex == 0)
{
this.viewstack.selectedIndex = 1;
}
this.playCard();
return;
}
public function ___BlogPlayer_Application1_applicationComplete(arg0:mx.events::FlexEvent)
{
this.init();
return;
}
private function initCursorVisibility()
{
var loc0:* = new Rectangle(1, 1, width - 1, height - 1);
if(loc0.containsPoint(new Point(mouseX, mouseY)))
{
CustomCursorManager.setCursorByName(CursorType.POINTER);
}
else
{
addEventListener(MouseEvent.ROLL_OVER, this.app_rollOverHandler);
}
return;
}
public Getter function traceTarget() : mx.logging.targets::TraceTarget
{
return this._235964214traceTarget;
}
private function initCursorManager()
{
this.customCursorManager = new CustomCursorManager();
this.customCursorManager.stage = stage;
return;
}
public Getter function isDebug() : Boolean
{
return this._2056864585isDebug;
}
public Getter function preloaderAftertaste() : BlogPlayerPreloaderAftertaste
{
return this._1631133009preloaderAftertaste;
}
public Getter function paintCanvas() : ru.yandex.kraski.universalpainter.view::PaintCanvas
{
return this._1763239082paintCanvas;
}
private function loadBackgroundsXml()
{
var loc0:* = BackgroundsLoadingController.instance;
loc0.model = ;
loc0.register();
loc0.addEventListener(ModelEvent.BACKGROUNDS_LOAD_COMPLETE, this.backgrounds_completeHandler);
loc0.load();
return;
}
public function __getCodeButton_click(arg0:flash.events::MouseEvent)
{
this.gotoCardPlayerPage();
return;
}
private function playCard()
{
this.playAgainButton.enabled = false;
player.play();
player.addEventListener(PlayerEvent.PLAY_FINISNED, this.playFinishedHandler);
return;
}
public function getUsedPhotoframePictures(arg0:XML) : Array
{
result = null;
photoframeNode = null;
pictureNode = null;
cardXML = arg0;
result = [];
var loc2:* = 0;
var loc3:* = cardXML.visual;
var loc1:* = new XMLList("");
for(loc2 in loc3)
{
var loc4:* = loc3.__getNextEnumerablePropertyValue();
var loc5:* = loc3.__getNextEnumerablePropertyValue();
if(type == "Photoframe")
{
loc1.loc4 = 0;
}
}
photoframeNode = loc1;
loc1 = 0;
loc4 = 0;
loc5 = photoframeNode.photos.visual;
loc3 = new XMLList("");
for(loc4 in loc5)
{
var loc6:* = loc5.__getNextEnumerablePropertyValue();
var loc7:* = loc5.__getNextEnumerablePropertyValue();
if(type == "PhotoframePicture")
{
loc3.loc6 = 0;
}
}
loc2 = loc3;
for(loc1 in loc2)
{
pictureNode = loc2.__getNextEnumerablePropertyValue();
push(parseInt(pictureNode.pictureIndex));
}
return result;
}
private function resultHandler(arg0:mx.rpc.events::ResultEvent)
{
this.removeLoadCardServiceListeners(ILoadCardService(arg0.target));
this.cardXML = (arg0.result) as XML;
this.restoreCard(this.cardXML);
return;
}
public Setter function traceTarget(arg0:mx.logging.targets::TraceTarget)
{
var loc0:* = this._235964214traceTarget;
if(loc0 !== arg0)
{
this._235964214traceTarget = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "traceTarget", loc0, arg0));
}
return;
}
public Getter function getCodeButton() : ru.yandex.kraski.universalpainter.view.comps::HandCursorButton
{
return this._1704619147getCodeButton;
}
public function __paintYourselfButton_click(arg0:flash.events::MouseEvent)
{
this.gotoServiceMainPage();
return;
}
private function getUsedClipartVOs(arg0:XML) : Array
{
clipartNode = null;
clipartVO = null;
cardXML = arg0;
result = [];
var loc1:* = 0;
var loc4:* = 0;
var loc5:* = cardXML.visual;
var loc3:* = new XMLList("");
for(loc4 in loc5)
{
var loc6:* = loc5.__getNextEnumerablePropertyValue();
var loc7:* = loc5.__getNextEnumerablePropertyValue();
if(type == "Clipart")
{
loc3.loc6 = 0;
}
}
var loc2:* = loc3;
for(loc1 in loc2)
{
clipartNode = loc2.__getNextEnumerablePropertyValue();
clipartVO = getClipartVOByClassName(clipartNode.resource.symbol);
if(clipartVO)
{
push(clipartVO);
}
}
return result;
}
private function addVersionToContextMenu()
{
var loc0:* = new ContextMenuManager();
loc0.addVersionToContextMenu(Model.blogPlayerAppName);
return;
}
public Getter function screenshot() : mx.controls::Image
{
return this._416447130screenshot;
}
private function gotoCardPlayerPage()
{
var loc0:* = new URLRequest(URLsBuilder.getCardPlayerPage(Config.instance.cardHash));
navigateToURL(loc0, "_blank");
return;
}
private function library_loadCompleteHandler(arg0:ru.yandex.kraski.universalpainter.events::ModelEvent)
{
this.loadBackgroundsXml();
return;
}
public function getUsedPictures(arg0:XML) : Array
{
pictureNode = null;
cardXML = arg0;
result = [];
var loc1:* = 0;
var loc4:* = 0;
var loc5:* = cardXML.visual;
var loc3:* = new XMLList("");
for(loc4 in loc5)
{
var loc6:* = loc5.__getNextEnumerablePropertyValue();
var loc7:* = loc5.__getNextEnumerablePropertyValue();
if(type == "Picture")
{
loc3.loc6 = 0;
}
}
var loc2:* = loc3;
for(loc1 in loc2)
{
pictureNode = loc2.__getNextEnumerablePropertyValue();
push(parseInt(pictureNode.pictureIndex));
}
return result;
}
private function playAgain()
{
if(this.player)
{
player.stop();
}
this.playCard();
return;
}
private function config_loadCompleteHandler(arg0:ru.yandex.kraski.universalpainter.events::ModelEvent)
{
this.loadLibraryClipartsXML();
return;
}
public function initialize()
{
target = null;
watcherSetupUtilClass = null;
var loc1:* = setDocumentDescriptor;
bindings = this._BlogPlayer_bindingsSetup();
watchers = [];
target = this;
if(this._watcherSetupUtil == null)
{
watcherSetupUtilClass = getDefinitionByName("_BlogPlayerWatcherSetupUtil");
loc1 = watcherSetupUtilClass;
}
_watcherSetupUtil.setup(this, function()
{
return target.loc0;
}, bindings, watchers);
i = 0;
while(i < bindings.length)
{
execute();
i = i + 1;
}
this._bindings = 0;
this._watchers = 0;
this.initialize();
return;
}
public Getter function playerStartButton() : ru.yandex.kraski.universalpainter.view.comps::HandCursorButton
{
return this._1613058925playerStartButton;
}
private function loadPhotoframes()
{
var loc0:* = PhotoframesLoadingController.instance;
loc0.model = ;
loc0.register();
loc0.addEventListener(ModelEvent.PHOTOFRAMES_LOAD_COMPLETE, this.photoframes_completeHandler);
loc0.load();
return;
}
private function backgrounds_completeHandler(arg0:ru.yandex.kraski.universalpainter.events::ModelEvent)
{
removeEventListener(ModelEvent.BACKGROUNDS_LOAD_COMPLETE, this.backgrounds_completeHandler);
this.loadPhotoframes();
return;
}
public Setter function preview(arg0:mx.containers::Canvas)
{
var loc0:* = this._318184504preview;
if(loc0 !== arg0)
{
this._318184504preview = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "preview", loc0, arg0));
}
return;
}
public Setter function isDebug(arg0:Boolean)
{
var loc0:* = this._2056864585isDebug;
if(loc0 !== arg0)
{
this._2056864585isDebug = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "isDebug", loc0, arg0));
}
return;
}
public Setter function preloaderAftertaste(arg0:BlogPlayerPreloaderAftertaste)
{
var loc0:* = this._1631133009preloaderAftertaste;
if(loc0 !== arg0)
{
this._1631133009preloaderAftertaste = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "preloaderAftertaste", loc0, arg0));
}
return;
}
private function playFinishedHandler(arg0:ru.yandex.kraski.universalpainter.events::PlayerEvent)
{
player.removeEventListener(PlayerEvent.PLAY_FINISNED, this.playFinishedHandler);
this.playAgainButton.enabled = true;
return;
}
public Setter function paintCanvas(arg0:ru.yandex.kraski.universalpainter.view::PaintCanvas)
{
var loc0:* = this._1763239082paintCanvas;
if(loc0 !== arg0)
{
this._1763239082paintCanvas = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "paintCanvas", loc0, arg0));
}
return;
}
public function _BlogPlayer_StylesInit()
{
style = null;
effects = null;
if(mx_internal._BlogPlayer_StylesInit_done)
{
return;
}
mx_internal._BlogPlayer_StylesInit_done = true;
style = StyleManager.getStyleDeclaration(".GetCodeButtonStyle");
if(style)
{
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".GetCodeButtonStyle", style, false);
}
if(style.factory == null)
{
style.factory = ;
}
style = StyleManager.getStyleDeclaration(".BlogControlsBoxStyle");
if(style)
{
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".BlogControlsBoxStyle", style, false);
}
if(style.factory == null)
{
style.factory = ;
}
style = StyleManager.getStyleDeclaration(".PaintCanvasInnerContainerStyle");
if(style)
{
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".PaintCanvasInnerContainerStyle", style, false);
}
if(style.factory == null)
{
style.factory = ;
}
style = StyleManager.getStyleDeclaration(".PaintCanvasOuterContainerStyle");
if(style)
{
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".PaintCanvasOuterContainerStyle", style, false);
}
if(style.factory == null)
{
style.factory = ;
}
style = StyleManager.getStyleDeclaration("Application");
if(style)
{
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration("Application", style, false);
}
if(style.factory == null)
{
style.factory = ;
}
style = StyleManager.getStyleDeclaration(".PlayAgainButtonStyle");
if(style)
{
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".PlayAgainButtonStyle", style, false);
}
if(style.factory == null)
{
style.factory = ;
}
style = StyleManager.getStyleDeclaration(".DownloadButtonStyle");
if(style)
{
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".DownloadButtonStyle", style, false);
}
if(style.factory == null)
{
style.factory = ;
}
style = StyleManager.getStyleDeclaration(".PaintYourselfButtonStyle");
if(style)
{
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".PaintYourselfButtonStyle", style, false);
}
if(style.factory == null)
{
style.factory = ;
}
style = StyleManager.getStyleDeclaration(".BlogPlayerStartButtonStyle");
if(style)
{
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".BlogPlayerStartButtonStyle", style, false);
}
if(style.factory == null)
{
style.factory = ;
}
var loc1:* = StyleManager;
return;
}
public Setter function downloadButton(arg0:ru.yandex.kraski.universalpainter.view.comps::HandCursorButton)
{
var loc0:* = this._159077850downloadButton;
if(loc0 !== arg0)
{
this._159077850downloadButton = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "downloadButton", loc0, arg0));
}
return;
}
public Setter function playAgainButton(arg0:ru.yandex.kraski.universalpainter.view.comps::HandCursorButton)
{
var loc0:* = this._1354231074playAgainButton;
if(loc0 !== arg0)
{
this._1354231074playAgainButton = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "playAgainButton", loc0, arg0));
}
return;
}
private function restoreCard(arg0:XML)
{
var loc0:* = ResourceManager.instance;
loc0.model = ;
var loc1:* = this.getUsedClipartVOs(arg0);
var loc2:* = 0;
while(loc2 < loc1.length)
{
loc0.queueClipart(loc1[loc2]);
loc2++;
}
var loc3:* = this.getUsedPictures(arg0);
var loc4:* = 0;
while(loc4 < loc3.length)
{
loc0.queuePicture(loc3[loc4]);
loc4++;
}
var loc5:* = this.getBackgroundVO(arg0);
if(this.getBackgroundVO(arg0))
{
loc0.queueClipart(loc5);
}
var loc6:* = this.getPhotoframeVO(arg0);
if(this.getPhotoframeVO(arg0))
{
loc0.queueClipart(loc6);
}
var loc7:* = this.getUsedPhotoframePictures(arg0);
var loc8:* = 0;
while(loc8 < loc7.length)
{
loc0.queuePicture(loc7[loc8]);
loc8++;
}
loc0.addEventListener(ModelEvent.CLIPARTS_LOAD_COMPLETE, this.usedResources_loadCompleteHandler);
loc0.loadQueuedResources();
return;
}
public function __downloadButton_click(arg0:flash.events::MouseEvent)
{
this.gotoServiceMainPage();
return;
}
private function loadConfig()
{
this.playerStartButton.enabled = false;
CustomCursorManager.showBusyCursor();
this.loadConfigController.data = this._model.config;
addEventListener(ModelEvent.XML_LOAD_COMPLETE, this.config_loadCompleteHandler);
loadConfigController.load();
return;
}
public Setter function loggerWrapper(arg0:mx.core::UIComponent)
{
var loc0:* = this._1435122461loggerWrapper;
if(loc0 !== arg0)
{
this._1435122461loggerWrapper = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "loggerWrapper", loc0, arg0));
}
return;
}
private function faultHandler(arg0:mx.rpc.events::FaultEvent)
{
this.removeLoadCardServiceListeners(ILoadCardService(arg0.target));
return;
}
public Setter function screenshot(arg0:mx.controls::Image)
{
var loc0:* = this._416447130screenshot;
if(loc0 !== arg0)
{
this._416447130screenshot = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "screenshot", loc0, arg0));
}
return;
}
private function _BlogPlayer_bindingExprs()
{
var loc0:* = undefined;
loc0 = ( (this.isDebug)? LogEventLevel.ALL : LogEventLevel.WARN );
loc0 = this.isDebug;
loc0 = this.isDebug;
return;
}
public Getter function preview() : mx.containers::Canvas
{
return this._318184504preview;
}
private function gotoServiceMainPage()
{
var loc0:* = new URLRequest(Config.instance.serviceURL);
navigateToURL(loc0, "_blank");
return;
}
private function getBackgroundVO(arg0:XML) : ru.yandex.kraski.universalpainter.data::ClipartVO
{
var loc0:* = arg0.background[0];
return ( (loc0)? getClipartVOByClassName(loc0.resource.symbol) : null );
}
public Getter function playAgainButton() : ru.yandex.kraski.universalpainter.view.comps::HandCursorButton
{
return this._1354231074playAgainButton;
}
public Getter function loggerWrapper() : mx.core::UIComponent
{
return this._1435122461loggerWrapper;
}
private function removeLoadCardServiceListeners(arg0:ru.yandex.kraski.universalpainter.services::ILoadCardService)
{
arg0.removeEventListener(ResultEvent.RESULT, this.resultHandler);
arg0.removeEventListener(FaultEvent.FAULT, this.faultHandler);
return;
}
private function photoframes_completeHandler(arg0:ru.yandex.kraski.universalpainter.events::ModelEvent)
{
debug("photoframes's library loaded");
removeEventListener(ModelEvent.PHOTOFRAMES_LOAD_COMPLETE, this.photoframes_completeHandler);
this.loadCard();
return;
}
private function getPhotoframeVO(arg0:XML) : ru.yandex.kraski.universalpainter.data::ClipartVO
{
photoframeNode = null;
cardXML = arg0;
var loc2:* = 0;
var loc3:* = cardXML.visual;
var loc1:* = new XMLList("");
for(loc2 in loc3)
{
var loc4:* = loc3.__getNextEnumerablePropertyValue();
var loc5:* = loc3.__getNextEnumerablePropertyValue();
if(type == "Photoframe")
{
loc1.loc4 = 0;
}
}
photoframeNode = loc1;
return ( (photoframeNode)? getClipartVOByClassName(photoframeNode.resource.symbol) : null );
}
private function _BlogPlayer_bindingsSetup() : Array
{
binding = null;
result = [];
binding = new Binding(this, function()
{
return ( (isDebug)? LogEventLevel.ALL : LogEventLevel.WARN );
}, function()
{
traceTarget.level = ;
return;
}, "traceTarget.level");
result[0] = binding;
binding = new Binding(this, function()
{
return isDebug;
}, function()
{
_BlogPlayer_HBox2.visible = ;
return;
}, "_BlogPlayer_HBox2.visible");
result[1] = binding;
binding = new Binding(this, function()
{
return isDebug;
}, function()
{
_BlogPlayer_HBox2.includeInLayout = ;
return;
}, "_BlogPlayer_HBox2.includeInLayout");
result[2] = binding;
return result;
}
public Setter function getCodeButton(arg0:ru.yandex.kraski.universalpainter.view.comps::HandCursorButton)
{
var loc0:* = this._1704619147getCodeButton;
if(loc0 !== arg0)
{
this._1704619147getCodeButton = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "getCodeButton", loc0, arg0));
}
return;
}
private function app_rollOverHandler(arg0:flash.events::MouseEvent)
{
CustomCursorManager.setCursorByName(CursorType.POINTER);
removeEventListener(MouseEvent.ROLL_OVER, this.app_rollOverHandler);
return;
}
public function __playerStartButton_click(arg0:flash.events::MouseEvent)
{
this.loadConfig();
return;
}
}
public class BlogPlayer__embed_css__2078891259 extends blogPlayAgainButton_skin implements {mx.core}::IBorder, {mx.core}::IFlexAsset, {mx.core}::IFlexDisplayObject
{
//========================= Methods
public static function BlogPlayer__embed_css__2078891259()
{
return;
}
public function BlogPlayer__embed_css__2078891259()
{
super();
try {
NEW_ACTIVATION_OBJECT.name = NameUtil.createUniqueName(this);
} catch (e:Error) {
var loc1:* = e;
someVal = null;
}
return;
}
public function toString() : String
{
return NameUtil.displayObjectToString(this);
}
public Getter function borderMetrics() : mx.core::EdgeMetrics
{
if(scale9Grid == null)
{
return EdgeMetrics.EMPTY;
}
return new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil(measuredWidth - scale9Grid.right), Math.ceil(measuredHeight - scale9Grid.bottom));
}
}
public class BlogPlayer__embed_css__2093910380 extends blogPaintYourselfButton_skin implements {mx.core}::IBorder, {mx.core}::IFlexAsset, {mx.core}::IFlexDisplayObject
{
//========================= Methods
public static function BlogPlayer__embed_css__2093910380()
{
return;
}
public function BlogPlayer__embed_css__2093910380()
{
super();
try {
NEW_ACTIVATION_OBJECT.name = NameUtil.createUniqueName(this);
} catch (e:Error) {
var loc1:* = e;
someVal = null;
}
return;
}
public function toString() : String
{
return NameUtil.displayObjectToString(this);
}
public Getter function borderMetrics() : mx.core::EdgeMetrics
{
if(scale9Grid == null)
{
return EdgeMetrics.EMPTY;
}
return new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil(measuredWidth - scale9Grid.right), Math.ceil(measuredHeight - scale9Grid.bottom));
}
}
public class _BlogPlayerWatcherSetupUtil extends flash.display::Sprite implements {mx.binding}::IWatcherSetupUtil
{
//========================= Methods
public static function _BlogPlayerWatcherSetupUtil()
{
return;
}
public function _BlogPlayerWatcherSetupUtil()
{
super();
return;
}
public static function init(arg0:mx.core::IFlexModuleFactory)
{
BlogPlayer.watcherSetupUtil = ;
return;
}
public function setup(arg0:Object, arg1:Function, arg2:Array, arg3:Array)
{
arg3[0] = new PropertyWatcher("isDebug", {"propertyChange" : true}, [arg2[0], arg2[1], arg2[2]], arg1);
updateParent(arg0);
return;
}
}
public class BlogPlayer__embed_css__162016752 extends blogPlayerStartButton_skin implements {mx.core}::IBorder, {mx.core}::IFlexAsset, {mx.core}::IFlexDisplayObject
{
//========================= Methods
public static function BlogPlayer__embed_css__162016752()
{
return;
}
public function BlogPlayer__embed_css__162016752()
{
super();
try {
NEW_ACTIVATION_OBJECT.name = NameUtil.createUniqueName(this);
} catch (e:Error) {
var loc1:* = e;
someVal = null;
}
return;
}
public function toString() : String
{
return NameUtil.displayObjectToString(this);
}
public Getter function borderMetrics() : mx.core::EdgeMetrics
{
if(scale9Grid == null)
{
return EdgeMetrics.EMPTY;
}
return new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil(measuredWidth - scale9Grid.right), Math.ceil(measuredHeight - scale9Grid.bottom));
}
}
public dynamic class BlogPlayerPreloaderAftertaste extends mx.flash::UIMovieClip
{
//========================= Methods
public static function BlogPlayerPreloaderAftertaste()
{
return;
}
public function BlogPlayerPreloaderAftertaste()
{
super();
return;
}
}
public class BlogPlayer__embed_css__1502235314 extends blogGetCodeButton_skin implements {mx.core}::IBorder, {mx.core}::IFlexAsset, {mx.core}::IFlexDisplayObject
{
//========================= Methods
public static function BlogPlayer__embed_css__1502235314()
{
return;
}
public function BlogPlayer__embed_css__1502235314()
{
super();
try {
NEW_ACTIVATION_OBJECT.name = NameUtil.createUniqueName(this);
} catch (e:Error) {
var loc1:* = e;
someVal = null;
}
return;
}
public function toString() : String
{
return NameUtil.displayObjectToString(this);
}
public Getter function borderMetrics() : mx.core::EdgeMetrics
{
if(scale9Grid == null)
{
return EdgeMetrics.EMPTY;
}
return new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil(measuredWidth - scale9Grid.right), Math.ceil(measuredHeight - scale9Grid.bottom));
}
}
public class BlogPlayer__embed_css__1017935931 extends blogDownloadButton_skin implements {mx.core}::IBorder, {mx.core}::IFlexAsset, {mx.core}::IFlexDisplayObject
{
//========================= Methods
public static function BlogPlayer__embed_css__1017935931()
{
return;
}
public function BlogPlayer__embed_css__1017935931()
{
super();
try {
NEW_ACTIVATION_OBJECT.name = NameUtil.createUniqueName(this);
} catch (e:Error) {
var loc1:* = e;
someVal = null;
}
return;
}
public function toString() : String
{
return NameUtil.displayObjectToString(this);
}
public Getter function borderMetrics() : mx.core::EdgeMetrics
{
if(scale9Grid == null)
{
return EdgeMetrics.EMPTY;
}
return new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil(measuredWidth - scale9Grid.right), Math.ceil(measuredHeight - scale9Grid.bottom));
}
}
public dynamic class PhotoframeCursorIcon extends flash.display::MovieClip
{
//========================= Methods
public static function PhotoframeCursorIcon()
{
return;
}
public function PhotoframeCursorIcon()
{
super();
return;
}
}
public dynamic class PointerCursorIcon extends flash.display::MovieClip
{
//========================= Methods
public static function PointerCursorIcon()
{
return;
}
public function PointerCursorIcon()
{
super();
return;
}
}
public dynamic class FingerCursorIcon extends flash.display::MovieClip
{
//========================= Methods
public static function FingerCursorIcon()
{
return;
}
public function FingerCursorIcon()
{
super();
return;
}
}
public dynamic class TextCursorIcon extends flash.display::MovieClip
{
//========================= Methods
public static function TextCursorIcon()
{
return;
}
public function TextCursorIcon()
{
super();
return;
}
}
public dynamic class Brush extends ru.yandex.kraski.universalpainter.cursors::BrushCursorClass
{
//========================= Methods
public static function Brush()
{
return;
}
public function Brush()
{
super();
return;
}
}
public dynamic class DragCursorIcon extends flash.display::MovieClip
{
//========================= Methods
public static function DragCursorIcon()
{
return;
}
public function DragCursorIcon()
{
super();
return;
}
}
public dynamic class HandCursorIcon extends flash.display::MovieClip
{
//========================= Methods
public static function HandCursorIcon()
{
return;
}
public function HandCursorIcon()
{
super();
return;
}
}
public dynamic class RectPaintSymbol extends flash.display::MovieClip
{
//========================= Variables
public var mc : MovieClip;
//========================= Methods
public static function RectPaintSymbol()
{
return;
}
public function RectPaintSymbol()
{
super();
return;
}
}
public dynamic class HeartPaintSymbol extends flash.display::MovieClip
{
//========================= Methods
public static function HeartPaintSymbol()
{
return;
}
public function HeartPaintSymbol()
{
super();
return;
}
}
public dynamic class FlowerPaintSymbol extends flash.display::MovieClip
{
//========================= Variables
public var mc : MovieClip;
//========================= Methods
public static function FlowerPaintSymbol()
{
return;
}
public function FlowerPaintSymbol()
{
super();
return;
}
}
public dynamic class PentaPaintSymbol extends flash.display::MovieClip
{
//========================= Methods
public static function PentaPaintSymbol()
{
return;
}
public function PentaPaintSymbol()
{
super();
addFrameScript(39, this.frame40);
return;
}
internal function frame40()
{
gotoAndPlay(6);
return;
}
}
}
package skins_fla
{
public dynamic class blog_icon_play_7 extends flash.display::MovieClip
{
//========================= Methods
public static function blog_icon_play_7()
{
return;
}
public function blog_icon_play_7()
{
super();
addFrameScript(0, this.frame1);
return;
}
internal function frame1()
{
stop();
return;
}
}
public dynamic class blog_icon_save_2 extends flash.display::MovieClip
{
//========================= Methods
public static function blog_icon_save_2()
{
return;
}
public function blog_icon_save_2()
{
super();
addFrameScript(0, this.frame1);
return;
}
internal function frame1()
{
stop();
return;
}
}
public dynamic class blog_icon_brush_main_12 extends flash.display::MovieClip
{
//========================= Methods
public static function blog_icon_brush_main_12()
{
return;
}
public function blog_icon_brush_main_12()
{
super();
addFrameScript(0, this.frame1);
return;
}
internal function frame1()
{
stop();
return;
}
}
public dynamic class blog_icon_mail_main_9 extends flash.display::MovieClip
{
//========================= Methods
public static function blog_icon_mail_main_9()
{
return;
}
public function blog_icon_mail_main_9()
{
super();
addFrameScript(0, this.frame1);
return;
}
internal function frame1()
{
stop();
return;
}
}
}
package ru.yandex.kraski.universalpainter.services
{
public class URLsBuilder extends Object
{
//========================= Methods
public static function URLsBuilder()
{
return;
}
public function URLsBuilder()
{
super();
return;
}
public static function getLoadCardURL(arg0:String) : String
{
return Config.instance.servantURL + "/get-xml/" + this.getFullStoragePath(arg0) + "?kraski_ver=2&nocache=" + valueOf();
}
private static function extractStorageNum(arg0:String) : String
{
return arg0.split(".")[1];
}
public static function getPictureUploadURL(arg0:String, arg1:int) : String
{
return Config.instance.uploadURL + "/custom-image-upload" + "?slide_n=" + arg1 + "&hash=" + arg0 + "&kraski_ver=2";
}
public static function getSaveCardURL(arg0:String) : String
{
return Config.instance.uploadURL + "/upload-xml";
}
public static function getCreateNewCardURL(arg0:String) : String
{
return Config.instance.serviceURL + "/pre.xml?hash=" + arg0 + "&kraski_ver=2";
}
public static function getScreenshotUploadURL() : String
{
return Config.instance.uploadURL + "/screenshot-upload";
}
public static function getScreenshotURL(arg0:String) : String
{
return Config.instance.servantURL + "/get/" + this.getFullStoragePath(arg0) + "_scr";
}
public static function getCardPlayerPage(arg0:String) : String
{
return Config.instance.serviceURL + "/view.xml?hash=" + arg0;
}
public static function getNewHashURL() : String
{
return Config.instance.serviceURL + "/newcard.xml?kraski_ver=2";
}
public static function getHelpURL() : String
{
return Config.instance.serviceURL + "/help.xml";
}
private static function extractStorageDirectory(arg0:String) : String
{
return arg0.substr(0, 4);
}
private static function getFullStoragePath(arg0:String) : String
{
return this.extractStorageNum(arg0) + "/" + this.extractStorageDirectory(arg0) + "/" + arg0;
}
public static function getConfigURL() : String
{
return Config.instance.appBaseURL + "/config.xml";
}
public static function getPictureDownloadURL(arg0:String, arg1:int = 0) : String
{
return Config.instance.servantURL + "/get-custom/" + this.getFullStoragePath(arg0) + "_img" + arg1 + "?kraski_ver=2";
}
}
public class ServiceLocatorImpl extends Object
{
//========================= Variables
public var _createNewCardService : ICreateNewCardService;
public var _saveCardService : ISaveCardService;
public var _loadCardForPlayService : ILoadCardService;
public var _loadConfigService : ILoadConfigService;
public var _loadCardForEditService : ILoadCardService;
public var _loadPictureService : ILoadPictureService;
//========================= Methods
public static function ServiceLocatorImpl()
{
return;
}
public function ServiceLocatorImpl()
{
super();
return;
}
public Getter function createNewCardService() : ru.yandex.kraski.universalpainter.services::ICreateNewCardService
{
return this._createNewCardService;
}
public Getter function loadCardForPlayService() : ru.yandex.kraski.universalpainter.services::ILoadCardService
{
return this._loadCardForPlayService;
}
public Getter function saveCardService() : ru.yandex.kraski.universalpainter.services::ISaveCardService
{
return this._saveCardService;
}
public Getter function loadConfigService() : ru.yandex.kraski.universalpainter.services::ILoadConfigService
{
return this._loadConfigService;
}
public Getter function loadPictureService() : ru.yandex.kraski.universalpainter.services::ILoadPictureService
{
return this._loadPictureService;
}
public Getter function loadCardForEditService() : ru.yandex.kraski.universalpainter.services::ILoadCardService
{
return this._loadCardForEditService;
}
}
public interface ILoadCardServiceimplements {flash.events}::IEventDispatcher
{
//========================= Methods
public function load(arg0:String);
}
public class ServiceLocator extends Object
{
//========================= Variables
private static var _impl : ServiceLocatorImpl;
//========================= Methods
public static function ServiceLocator()
{
return;
}
public function ServiceLocator()
{
super();
return;
}
public static Getter function createNewCardService() : ru.yandex.kraski.universalpainter.services::ICreateNewCardService
{
return this._impl.createNewCardService;
}
public static Getter function loadConfigService() : ru.yandex.kraski.universalpainter.services::ILoadConfigService
{
return this._impl.loadConfigService;
}
public static Getter function loadCardForPlayService() : ru.yandex.kraski.universalpainter.services::ILoadCardService
{
return this._impl.loadCardForPlayService;
}
public static Getter function loadCardForEditService() : ru.yandex.kraski.universalpainter.services::ILoadCardService
{
return this._impl.loadCardForEditService;
}
public static Getter function saveCardService() : ru.yandex.kraski.universalpainter.services::ISaveCardService
{
return this._impl.saveCardService;
}
public static Getter function implementation() : ru.yandex.kraski.universalpainter.services::ServiceLocatorImpl
{
return this._impl;
}
public static Setter function implementation(arg0:ru.yandex.kraski.universalpainter.services::ServiceLocatorImpl)
{
this._impl = ;
return;
}
public static Getter function loadPictureService() : ru.yandex.kraski.universalpainter.services::ILoadPictureService
{
return this._impl.loadPictureService;
}
}
public interface ICreateNewCardServiceimplements {flash.events}::IEventDispatcher
{
//========================= Methods
public function createCard();
}
public interface ILoadConfigServiceimplements {flash.events}::IEventDispatcher
{
//========================= Methods
public function load();
}
public interface ILoadPictureServiceimplements {flash.events}::IEventDispatcher
{
//========================= Methods
public function downloadPicture(arg0:int);
public function load(arg0:ru.yandex.kraski.universalpainter.data::Card);
}
public interface ISaveCardServiceimplements {flash.events}::IEventDispatcher
{
//========================= Methods
public function save(arg0:ru.yandex.kraski.universalpainter.data::Card, arg1:flash.display::DisplayObject);
}
public class KraskiService extends flash.events::EventDispatcher
{
//========================= Variables
private var _className : String;
//========================= Methods
public static function KraskiService()
{
return;
}
public function KraskiService()
{
super();
return;
}
public Getter function className() : String
{
if(this._className)
{
this._className = join(".");
}
return this._className;
}
}
}
package ru.yandex.profiling
{
public class FpsMeter extends mx.controls::Label
{
//========================= Variables
private var _frames : int = 0;
private var _timestamp : int;
//========================= Methods
public static function FpsMeter()
{
return;
}
public function FpsMeter()
{
super();
this.addEventListener("addedToStage", this.___FpsMeter_Label1_addedToStage);
this.addEventListener("removedFromStage", this.___FpsMeter_Label1_removedFromStage);
return;
}
private function start()
{
addEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
this._timestamp = getTimer();
return;
}
private function stop()
{
removeEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
return;
}
public function ___FpsMeter_Label1_addedToStage(arg0:flash.events::Event)
{
this.start();
return;
}
public function initialize()
{
this.initialize();
return;
}
private function enterFrameHandler(arg0:flash.events::Event)
{
var loc0:* = 0;
var loc1:* = this;
var loc2:* = this._frames + 1;
loc1._frames = this._frames;
if(this._frames == 10)
{
loc0 = getTimer();
this = "fps: " + Math.round(10000 / loc0 - this._timestamp);
this._timestamp = loc0;
this._frames = 0;
}
return;
}
public function ___FpsMeter_Label1_removedFromStage(arg0:flash.events::Event)
{
this.stop();
return;
}
public Setter function text(arg0:String)
{
return;
}
public Setter function htmlText(arg0:String)
{
return;
}
}
public class MemoryUsageMeter extends mx.controls::Label
{
//========================= Variables
private var _timer : Timer;
//========================= Methods
public static function MemoryUsageMeter()
{
return;
}
public function MemoryUsageMeter()
{
this._timer = new Timer(500);
super();
this.addEventListener("addedToStage", this.___MemoryUsageMeter_Label1_addedToStage);
this.addEventListener("removedFromStage", this.___MemoryUsageMeter_Label1_removedFromStage);
return;
}
public function initialize()
{
this.initialize();
return;
}
public function ___MemoryUsageMeter_Label1_removedFromStage(arg0:flash.events::Event)
{
this.stop();
return;
}
private function start()
{
_timer.addEventListener(TimerEvent.TIMER, this.timerHandler);
_timer.start();
return;
}
private function timerHandler(arg0:flash.events::TimerEvent)
{
this = "memory: " + Math.round(System.totalMemory / 1024 * 1024) + " MB";
return;
}
private function stop()
{
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, this.timerHandler);
return;
}
public Setter function text(arg0:String)
{
return;
}
public function ___MemoryUsageMeter_Label1_addedToStage(arg0:flash.events::Event)
{
this.start();
return;
}
public Setter function htmlText(arg0:String)
{
return;
}
}
}
package ru.yandex.kraski.universalpainter.services.fake
{
public class FakeServiceLocatorImpl extends ru.yandex.kraski.universalpainter.services::ServiceLocatorImpl
{
//========================= Methods
public static function FakeServiceLocatorImpl()
{
return;
}
public function FakeServiceLocatorImpl()
{
super();
this._loadPictureService = new FakeLoadPictureService();
this._saveCardService = new FakeSaveCardService();
this._createNewCardService = new FakeCreateNewCardService();
this._loadCardForEditService = new FakeLoadCardService();
this._loadCardForPlayService = new FakeLoadCardService();
this._loadConfigService = new FakeLoadConfigService();
return;
}
}
public class FakeLoadPictureService extends flash.events::EventDispatcher implements {ru.yandex.kraski.universalpainter.services}::ILoadPictureService
{
//========================= Variables
private static const className : String = "ru.yandex.kraski.universalpainter.services.FakeLoadPictureService";
//========================= Methods
public static function FakeLoadPictureService()
{
this.className = "ru.yandex.kraski.universalpainter.services.FakeLoadPictureService";
return;
}
public function FakeLoadPictureService()
{
super();
return;
}
private function download_completeHandler(arg0:flash.events::Event)
{
info("picture loaded");
var loc0:* = LoaderInfo(arg0.target);
this.removeDownloadListeners(loc0);
dispatchEvent(new ResultEvent(ResultEvent.RESULT, false, true, loc0.content));
return;
}
public function downloadPicture(arg0:int)
{
var loc0:* = new Loader();
this.addDownloadListeners(loc0.contentLoaderInfo);
loc0.load(new URLRequest("testData/testPicture.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
return;
}
private function removeDownloadListeners(arg0:flash.display::LoaderInfo)
{
arg0.removeEventListener(Event.COMPLETE, this.download_completeHandler);
arg0.removeEventListener(IOErrorEvent.IO_ERROR, this.download_ioErrorHandler);
arg0.removeEventListener(ProgressEvent.PROGRESS, this.download_progressHandler);
return;
}
private function download_progressHandler(arg0:flash.events::ProgressEvent)
{
info("download progress: {0} of {1} Kbytes loaded ({2}%)", toFixed(0), toFixed(0), toFixed(0));
return;
}
private function addDownloadListeners(arg0:flash.display::LoaderInfo)
{
arg0.addEventListener(Event.COMPLETE, this.download_completeHandler);
arg0.addEventListener(IOErrorEvent.IO_ERROR, this.download_ioErrorHandler);
arg0.addEventListener(ProgressEvent.PROGRESS, this.download_progressHandler);
return;
}
public function load(arg0:ru.yandex.kraski.universalpainter.data::Card)
{
this.downloadPicture(0);
return;
}
private function download_ioErrorHandler(arg0:flash.events::IOErrorEvent)
{
info(arg0.toString());
this.removeDownloadListeners(LoaderInfo(arg0.target));
dispatchEvent(FaultEvent.createEvent(new Fault(arg0.type, arg0.toString())));
return;
}
}
public class FakeLoadConfigService extends ru.yandex.kraski.universalpainter.services::KraskiService implements {ru.yandex.kraski.universalpainter.services}::ILoadConfigService
{
//========================= Methods
public static function FakeLoadConfigService()
{
return;
}
public function FakeLoadConfigService()
{
super();
return;
}
private function completeHandler(arg0:flash.events::Event)
{
var loc0:* = URLLoader(arg0.target);
this.removeListeners(loc0);
dispatchEvent(ResultEvent.createEvent(XML(loc0.data)));
return;
}
private function removeListeners(arg0:flash.net::URLLoader)
{
arg0.removeEventListener(Event.COMPLETE, this.completeHandler);
arg0.removeEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
arg0.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, this.errorHandler);
return;
}
private function errorHandler(arg0:flash.events::ErrorEvent)
{
this.removeListeners(URLLoader(arg0.target));
dispatchEvent(FaultEvent.createEvent(new Fault("ConfigLoadingError", arg0.toString())));
return;
}
public function load()
{
var loc0:* = new URLLoader();
loc0.addEventListener(Event.COMPLETE, this.completeHandler);
loc0.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
loc0.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.errorHandler);
loc0.load(new URLRequest(URLsBuilder.getConfigURL()));
return;
}
}
public class FakeCreateNewCardService extends flash.events::EventDispatcher implements {ru.yandex.kraski.universalpainter.services}::ICreateNewCardService
{
//========================= Methods
public static function FakeCreateNewCardService()
{
return;
}
public function FakeCreateNewCardService()
{
super();
return;
}
public function createCard()
{
dispatchEvent(ResultEvent.createEvent(new XML("<new hash=\"7569f8dc55cdfd6994e34879e13bff10.0\"/>")));
return;
}
}
public class FakeLoadCardService extends flash.events::EventDispatcher implements {ru.yandex.kraski.universalpainter.services}::ILoadCardService
{
//========================= Methods
public static function FakeLoadCardService()
{
return;
}
public function FakeLoadCardService()
{
super();
return;
}
public function load(arg0:String)
{
dispatchEvent(ResultEvent.createEvent(new XML("<card picturesTotal=\"0\">
</card>")));
return;
}
}
public class FakeSaveCardService extends flash.events::EventDispatcher implements {ru.yandex.kraski.universalpainter.services}::ISaveCardService
{
//========================= Variables
private static const CLASS_NAME : String = "ru.yandex.kraski.universalpainter.services.FakeSaveCardService";
//========================= Methods
public static function FakeSaveCardService()
{
this.CLASS_NAME = "ru.yandex.kraski.universalpainter.services.FakeSaveCardService";
return;
}
public function FakeSaveCardService()
{
super();
return;
}
public function save(arg0:ru.yandex.kraski.universalpainter.data::Card, arg1:flash.display::DisplayObject)
{
info("Sending request emulation:
" + "url: {0}
" + "method: POST
" + "xml_data: {1}
" + "hash: {2}", URLsBuilder.getSaveCardURL(arg0.hash), toXMLString(), arg0.hash);
dispatchEvent(ResultEvent.createEvent(new XML("<save-result hash=\"" + Escape(arg0.hash) + "\"/>")));
return;
}
}
}
package ru.yandex.kraski.universalpainter.cursors
{
public class CursorType extends Object
{
//========================= Variables
public static const FINGER : String = "finger";
public static const PHOTOFRAME : String = "photoframe";
public static const ERASER : String = "eraser";
public static const TEXT : String = "text";
public static const HAND : String = "hand";
public static const DRAG : String = "drag";
public static const BRUSH : String = "brush";
public static const POINTER : String = "pointer";
//========================= Methods
public static function CursorType()
{
this.POINTER = "pointer";
this.DRAG = "drag";
this.ERASER = "eraser";
this.FINGER = "finger";
this.HAND = "hand";
this.TEXT = "text";
this.BRUSH = "brush";
this.PHOTOFRAME = "photoframe";
return;
}
public function CursorType()
{
super();
return;
}
}
public class CustomCursorManager extends Object
{
//========================= Variables
private var _stage : Stage;
//========================= Methods
public static function CustomCursorManager()
{
return;
}
public function CustomCursorManager()
{
super();
return;
}
public static function showCursor()
{
CursorManager.showCursor();
return;
}
public static function hideCursor()
{
CursorManager.hideCursor();
return;
}
public static function setCursorByClass(arg0:Class) : int
{
CursorManager.removeAllCursors();
return CursorManager.setCursor(arg0);
}
public static function setCursorByName(arg0:String) : int
{
CursorManager.removeAllCursors();
return CursorManager.setCursor(CursorFactory.create(arg0));
}
public static function showBusyCursor()
{
CursorManager.removeAllCursors();
CursorManager.setBusyCursor();
return;
}
public static function removeCursorAt(arg0:int)
{
CursorManager.removeCursor(arg0);
return;
}
private function addStageListeners()
{
stage.addEventListener(Event.MOUSE_LEAVE, this.stage_mouseLeaveHandler);
return;
}
private function stage_mouseMoveHandler(arg0:flash.events::MouseEvent)
{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, this.stage_mouseMoveHandler);
this.showCursor();
return;
}
private function stage_mouseLeaveHandler(arg0:flash.events::Event)
{
this.hideCursor();
stage.addEventListener(MouseEvent.MOUSE_MOVE, this.stage_mouseMoveHandler);
return;
}
public Setter function stage(arg0:flash.display::Stage)
{
if(this._stage)
{
}
this._stage = arg0;
this.addStageListeners();
return;
}
public Getter function stage() : flash.display::Stage
{
return this._stage;
}
}
public class CursorFactory extends Object
{
//========================= Methods
public static function CursorFactory()
{
return;
}
public function CursorFactory()
{
super();
return;
}
public static function create(arg0:String) : Class
{
var loc0:* = arg0;
switch(loc0)
{
case CursorType.POINTER:
return PointerCursorIcon;
case CursorType.HAND:
return HandCursorIcon;
case CursorType.DRAG:
return DragCursorIcon;
case CursorType.FINGER:
return FingerCursorIcon;
case CursorType.TEXT:
return TextCursorIcon;
case CursorType.BRUSH:
return Brush;
case CursorType.PHOTOFRAME:
return PhotoframeCursorIcon;
default:
break;
}
}
}
public class BrushCursorClass extends flash.display::MovieClip
{
//========================= Variables
private var _color : uint;
private var _oldRotation : Number;
private var _oldX : Number;
private var _oldY : Number;
//========================= Methods
public static function BrushCursorClass()
{
return;
}
public function BrushCursorClass()
{
super();
CursorModel.setCurrentInstance(this);
this.mouseChildren = false;
this.mouseEnabled = false;
addEventListener(Event.ADDED_TO_STAGE, this.addedToStageHandler);
return;
}
public Getter function color() : uint
{
return this._color;
}
private function addedToStageHandler(arg0:flash.events::Event)
{
addEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
addEventListener(Event.REMOVED_FROM_STAGE, this.removedFromStageHandler);
return;
}
private function applyFilter(arg0:flash.filters::BitmapFilter)
{
this["brush"]["tip"]["body"].filters = ;
return;
}
private function enterFrameHandler(arg0:flash.events::Event)
{
if(isNaN(this["brush"].rotation))
{
this["brush"].rotation = 0;
}
this["brush"].rotation = 0;
this["shadow"].rotation = 0;
var loc0:* = stage.mouseX - this._oldX;
var loc1:* = stage.mouseY - this._oldY;
this._oldRotation = -loc0 + loc1;
this._oldX = stage.mouseX;
this._oldY = stage.mouseY;
return;
}
private function removedFromStageHandler(arg0:flash.events::Event)
{
removeEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
removeEventListener(Event.REMOVED_FROM_STAGE, this.removedFromStageHandler);
return;
}
private function validate()
{
this.applyFilter(new ColorMatrixFilter(ColorUtils.createFilterMatrix(this._color)));
return;
}
public Setter function color(arg0:uint)
{
this._color = arg0;
this.validate();
return;
}
}
}
package ru.yandex.kraski.universalpainter.controller
{
public class Controller extends flash.events::EventDispatcher
{
//========================= Variables
public var _app : Application;
private var _className : String;
public var _model : Model;
//========================= Methods
public static function Controller()
{
return;
}
public function Controller()
{
super();
return;
}
public Getter function app() : mx.core::Application
{
return this._app;
}
public function register()
{
debug("registering controller: {0}", this);
this._app = Application(Application.application);
dispatchEvent(new ControllerEvent(ControllerEvent.REGISTER));
return;
}
public Getter function model() : ru.yandex.kraski.universalpainter.data::Model
{
return this._model;
}
public Setter function model(arg0:ru.yandex.kraski.universalpainter.data::Model)
{
this._model = arg0;
return;
}
public Getter function className() : String
{
if(this._className)
{
this._className = join(".");
}
return this._className;
}
public function unregister()
{
debug("unregistering controller: {0}", this);
dispatchEvent(new ControllerEvent(ControllerEvent.UNREGISTER));
return;
}
}
public class ResourceManager extends ru.yandex.kraski.universalpainter.controller::Controller
{
//========================= Variables
private static var allowInstantiation : Boolean = False;
private static const IMAGE_NEED_LOAD : String = "needLoad";
private static const LOADING_STATE : String = "loading";
private static var _instance : ResourceManager;
private static const WAITING_STATE : String = "waiting";
private var picturesQueued : int = 0;
private var currentImageIndex : int;
private var state : String;
private var currentClipartIndex : int = 1342177279;
private var currentClipartDescriptor : ClipartDescriptor;
private var images : Array;
//========================= Methods
public static function ResourceManager()
{
this.WAITING_STATE = "waiting";
this.LOADING_STATE = "loading";
this.IMAGE_NEED_LOAD = "needLoad";
this.allowInstantiation = false;
return;
}
public function ResourceManager()
{
this.images = [];
super();
if(this.allowInstantiation)
{
}
this.state = this.WAITING_STATE;
return;
}
public static Getter function instance() : ru.yandex.kraski.universalpainter.controller::ResourceManager
{
if(this._instance)
{
this.allowInstantiation = true;
this._instance = ;
this.allowInstantiation = false;
}
return this._instance;
}
public function queueClipart(arg0:ru.yandex.kraski.universalpainter.data::ClipartVO)
{
var loc0:* = _model.clipartDescriptors;
var loc1:* = loc0.getDescriptorByBriefUrl(arg0.briefUrl);
if(loc1)
{
loc0.createClipartDescriptor(_model.config.clipartURL, arg0);
}
return;
}
private function image_faultHandler(arg0:mx.rpc.events::FaultEvent)
{
this.removeImageDownloadListeners(ILoadPictureService(arg0.target));
error(arg0.toString());
delete images.currentImageIndex;
var loc0:* = this;
var loc1:* = this.picturesQueued - 1;
loc0.picturesQueued = this.picturesQueued;
this.loadNextClipart();
return;
}
public function queuePhotoframes()
{
var loc0:* = _model.libraryClipartData.photoframesCategory;
var loc1:* = 0;
while(loc1 < loc0.categoryItems.length)
{
this.queueClipart(loc0.categoryItems[loc1]);
loc1++;
}
return;
}
private function image_resultHandler(arg0:mx.rpc.events::ResultEvent)
{
this.removeImageDownloadListeners(ILoadPictureService(arg0.target));
this.images[currentImageIndex] = arg0.result;
var loc0:* = this;
var loc1:* = this.picturesQueued - 1;
loc0.picturesQueued = this.picturesQueued;
this.loadNextClipart();
return;
}
private function clipart_loadErrorHandler(arg0:flash.events::IOErrorEvent)
{
error("Clipart loading error. {0}", this.currentClipartDescriptor.fullURL);
this.loadNextClipart();
return;
}
public function queueClipartsFromCategory(arg0:int)
{
var loc0:* = _model.libraryClipartData.clipartsCategories[arg0];
var loc1:* = 0;
while(loc1 < loc0.categoryItems.length)
{
this.queueClipart(loc0.categoryItems[loc1]);
loc1++;
}
return;
}
private function loadNextClipart()
{
if(this.currentClipartIndex == _model.clipartDescriptors.count - 1)
{
if(this.picturesQueued > 0)
{
this.loadNextImage();
return;
}
this.state = this.WAITING_STATE;
debug("Loading complete, i'm waiting...");
dispatchEvent(new ModelEvent(ModelEvent.CLIPARTS_LOAD_COMPLETE));
return;
}
var loc1:* = this;
var loc2:* = this.currentClipartIndex + 1;
loc1.currentClipartIndex = this.currentClipartIndex;
this.currentClipartDescriptor = _model.clipartDescriptors.descriptorsList[currentClipartIndex];
debug("begin loading clipart {0} (index: {1}) from url {2}", this.currentClipartDescriptor.className, this.currentClipartIndex, this.currentClipartDescriptor.fullURL);
var loc0:* = new Loader();
addEventListener(Event.COMPLETE, this.clipart_loadCompleteHandler);
addEventListener(IOErrorEvent.IO_ERROR, this.clipart_loadErrorHandler);
addEventListener(IOErrorEvent.NETWORK_ERROR, this.clipart_loadErrorHandler);
addEventListener(IOErrorEvent.VERIFY_ERROR, this.clipart_loadErrorHandler);
addEventListener(ProgressEvent.PROGRESS, this.clipart_progressHandler);
loc0.load(new URLRequest(this.currentClipartDescriptor.fullURL), new LoaderContext(false, ApplicationDomain.currentDomain));
this.state = this.LOADING_STATE;
return;
}
private function clipart_loadCompleteHandler(arg0:flash.events::Event)
{
this.currentClipartDescriptor.fullURL = LoaderInfo(arg0.target).url;
this.currentClipartDescriptor.loaded = true;
debug("complete loading clipart {0} (index: {1})", this.currentClipartDescriptor.className, this.currentClipartIndex);
this.loadNextClipart();
return;
}
public Setter function model(arg0:ru.yandex.kraski.universalpainter.data::Model)
{
this = arg0;
register();
return;
}
public function clearClipartsQueue()
{
splice(this.currentClipartIndex + 1, _model.clipartDescriptors.count - this.currentClipartIndex - 1);
return;
}
private function removeImageDownloadListeners(arg0:ru.yandex.kraski.universalpainter.services::ILoadPictureService)
{
arg0.removeEventListener(ResultEvent.RESULT, this.image_resultHandler);
arg0.removeEventListener(FaultEvent.FAULT, this.image_faultHandler);
return;
}
private function loadNextImage()
{
var loc0:* = 0;
while(this.images[loc0] != this.IMAGE_NEED_LOAD)
{
loc0++;
}
this.currentImageIndex = loc0;
var loc1:* = ServiceLocator.loadPictureService;
loc1.addEventListener(ResultEvent.RESULT, this.image_resultHandler);
loc1.addEventListener(FaultEvent.FAULT, this.image_faultHandler);
loc1.downloadPicture(this.currentImageIndex);
return;
}
public function loadQueuedResources()
{
if(this.state == this.WAITING_STATE)
{
this.loadNextClipart();
}
return;
}
public function queuePicture(arg0:int)
{
if(this.images[arg0])
{
info("Reloading image {0}", arg0);
}
this.images.IMAGE_NEED_LOAD = ;
var loc0:* = this;
var loc1:* = this.picturesQueued + 1;
loc0.picturesQueued = this.picturesQueued;
return;
}
private function clipart_progressHandler(arg0:flash.events::ProgressEvent)
{
this.currentClipartDescriptor.bytesLoaded = arg0.bytesLoaded;
this.currentClipartDescriptor.bytesTotal = arg0.bytesTotal;
dispatchEvent(new ModelEvent(ModelEvent.CLIPART_LOAD_PROGRESS));
return;
}
public function queueBackgrounds()
{
var loc0:* = _model.libraryClipartData.backgroundsCategory;
var loc1:* = 0;
while(loc1 < loc0.categoryItems.length)
{
this.queueClipart(loc0.categoryItems[loc1]);
loc1++;
}
return;
}
public function loadAllCliparts()
{
var loc0:* = _model.libraryClipartData.clipartsCategories;
var loc1:* = 0;
while(loc1 < loc0.length)
{
this.queueClipartsFromCategory(loc1);
loc1++;
}
return;
}
public function getPictureContent(arg0:int) : flash.display::Bitmap
{
return (this.images[arg0]) as Bitmap;
}
}
public class PhotoframesLoadingController extends ru.yandex.kraski.universalpainter.controller::Controller
{
//========================= Variables
private static var _instance : PhotoframesLoadingController;
private static var allowInstantiation : Boolean = False;
//========================= Methods
public static function PhotoframesLoadingController()
{
this.allowInstantiation = false;
return;
}
public function PhotoframesLoadingController()
{
super();
if(this.allowInstantiation)
{
}
return;
}
public static Getter function instance() : ru.yandex.kraski.universalpainter.controller::PhotoframesLoadingController
{
if(this._instance)
{
this.allowInstantiation = true;
this._instance = ;
this.allowInstantiation = false;
}
return this._instance;
}
private function photoframesCategory_completeHandler(arg0:flash.events::Event)
{
removeEventListener(Event.COMPLETE, this.photoframesLibrary_completeHandler);
model.libraryClipartData.photoframesCategory.categoryXML = 0;
dispatchEvent(new ModelEvent(ModelEvent.PHOTOFRAMES_LOAD_COMPLETE));
return;
}
private function photoframesLibrary_completeHandler(arg0:flash.events::Event)
{
removeEventListener(Event.COMPLETE, this.photoframesLibrary_completeHandler);
var loc0:* = XML(arg0.target.data);
var loc1:* = new LibraryClipartCategory(loc0.name, loc0.path);
model.libraryClipartData.photoframesCategory = new LibraryClipartCategory(loc0.name, loc0.path);
var loc2:* = new URLLoader();
addEventListener(Event.COMPLETE, this.photoframesCategory_completeHandler);
loc2.load(new URLRequest(model.config.clipartURL + "/" + loc1.url));
return;
}
public function load()
{
var loc0:* = new URLLoader();
loc0.addEventListener(Event.COMPLETE, this.photoframesLibrary_completeHandler);
loc0.load(new URLRequest(model.config.photoframesLibraryURL));
return;
}
}
public class LoadLibraryController extends ru.yandex.kraski.universalpainter.controller::Controller
{
//========================= Variables
private static var _instance : LoadLibraryController;
private static var allowInstantiation : Boolean = False;
private var _data : Model;
private var currentCategoryIndex : int;
private var categories : Array;
//========================= Methods
public static function LoadLibraryController()
{
this.allowInstantiation = false;
return;
}
public function LoadLibraryController()
{
super();
if(this.allowInstantiation)
{
}
return;
}
public static Getter function instance() : ru.yandex.kraski.universalpainter.controller::LoadLibraryController
{
if(this._instance)
{
this.allowInstantiation = true;
this._instance = ;
this.allowInstantiation = false;
}
return this._instance;
}
private function libraryClipart_loadCompleteHandler(arg0:flash.events::Event)
{
this._data.libraryClipartData.libraryXML = 0;
this.categories = this._data.libraryClipartData.clipartsCategories;
this.currentCategoryIndex = 0;
this.loadCategoryXML(this.categories.currentCategoryIndex);
return;
}
private function categoryXML_loadCompleteHandler(arg0:flash.events::Event)
{
var loc0:* = this.categories.currentCategoryIndex;
loc0.categoryXML = 0;
var loc1:* = this;
var loc2:* = this.currentCategoryIndex + 1;
loc1.currentCategoryIndex = this.currentCategoryIndex;
if(this.currentCategoryIndex < this.categories.length)
{
this.loadCategoryXML(this.categories.currentCategoryIndex);
}
else
{
dispatchEvent(new ModelEvent(ModelEvent.LIBRARY_LOAD_COMPLETE));
}
return;
}
public function load()
{
var loc0:* = new URLLoader();
loc0.addEventListener(Event.COMPLETE, this.libraryClipart_loadCompleteHandler);
debug("loadind library from url {0}", this._data.config.libraryClipartURL);
loc0.load(new URLRequest(this._data.config.libraryClipartURL));
return;
}
public Setter function data(arg0:ru.yandex.kraski.universalpainter.data::Model)
{
this._data = arg0;
register();
return;
}
private function loadCategoryXML(arg0:ru.yandex.kraski.universalpainter.data::LibraryClipartCategory)
{
var loc0:* = new URLLoader();
loc0.addEventListener(Event.COMPLETE, this.categoryXML_loadCompleteHandler);
loc0.load(new URLRequest(this._data.config.clipartURL + "/" + arg0.url));
return;
}
}
public class BackgroundsLoadingController extends ru.yandex.kraski.universalpainter.controller::Controller
{
//========================= Variables
private static var _instance : BackgroundsLoadingController;
private static var allowInstantiation : Boolean = False;
//========================= Methods
public static function BackgroundsLoadingController()
{
this.allowInstantiation = false;
return;
}
public function BackgroundsLoadingController()
{
super();
if(this.allowInstantiation)
{
}
return;
}
public static Getter function instance() : ru.yandex.kraski.universalpainter.controller::BackgroundsLoadingController
{
if(this._instance)
{
this.allowInstantiation = true;
this._instance = ;
this.allowInstantiation = false;
}
return this._instance;
}
private function backgroundsLibrary_completeHandler(arg0:flash.events::Event)
{
removeEventListener(Event.COMPLETE, this.backgroundsLibrary_completeHandler);
var loc0:* = XML(arg0.target.data);
var loc1:* = new LibraryClipartCategory(loc0.name, loc0.path);
model.libraryClipartData.backgroundsCategory = new LibraryClipartCategory(loc0.name, loc0.path);
var loc2:* = new URLLoader();
addEventListener(Event.COMPLETE, this.backgroundsCategory_completeHandler);
loc2.load(new URLRequest(model.config.clipartURL + "/" + loc1.url));
return;
}
private function backgroundsCategory_completeHandler(arg0:flash.events::Event)
{
removeEventListener(Event.COMPLETE, this.backgroundsCategory_completeHandler);
model.libraryClipartData.backgroundsCategory.categoryXML = 0;
dispatchEvent(new ModelEvent(ModelEvent.BACKGROUNDS_LOAD_COMPLETE));
return;
}
public function load()
{
var loc0:* = new URLLoader();
loc0.addEventListener(Event.COMPLETE, this.backgroundsLibrary_completeHandler);
loc0.load(new URLRequest(model.config.backgroundsLibraryURL));
return;
}
}
public class Player extends flash.events::EventDispatcher
{
//========================= Variables
private var currentVisualIndex : int;
private var logger : ILogger;
private var _paintCanvas : PaintCanvas;
private var _card : Card;
private var background : Background;
private var visualList : Array;
//========================= Methods
public static function Player()
{
return;
}
public function Player()
{
this.logger = Log.getLogger("ru.yandex.kraski.universalpainter.controller.Player");
super();
return;
}
private function addAnimatedBackground()
{
logger.debug("addAnimatedBackground()");
paintCanvas.setBackground(this.background);
background.addEventListener(VisualEvent.PLAY_FINISH, this.backgroundFinishHandler);
background.showDrawingProcess();
return;
}
public function stop()
{
this.stopCard();
return;
}
private function addAnimatedVisual(arg0:int)
{
var loc0:* = Visual(this.visualList[arg0]);
loc0.addEventListener(VisualEvent.PLAY_FINISH, this.visualFinishHandler);
addVisual(loc0, loc0.depth);
debug("begin showing visual {0}", loc0);
loc0.showDrawingProcess();
return;
}
private function stopPlayingVisuals()
{
var loc1:* = null;
if(this.paintCanvas.background)
{
removeEventListener(VisualEvent.PLAY_FINISH, this.backgroundFinishHandler);
showDrawingResult();
}
var loc0:* = 0;
while(loc0 < this.paintCanvas.visualsContainer.numChildren)
{
loc1 = Visual(getChildAt(loc0));
loc1.removeEventListener(VisualEvent.PLAY_FINISH, this.visualFinishHandler);
loc1.showDrawingResult();
loc0++;
}
return;
}
private function recreateVisuals()
{
paintCanvas.setBackground(this.background);
if(this.background)
{
this.background.animationEnabled = true;
}
var loc0:* = 0;
while(loc0 < this.visualList.length)
{
Visual(this.visualList[loc0]).animationEnabled = true;
addVisual(Visual(this.visualList[loc0]), Visual(this.visualList[loc0]).depth);
loc0++;
}
return;
}
public Getter function paintCanvas() : ru.yandex.kraski.universalpainter.view::PaintCanvas
{
return this._paintCanvas;
}
public Getter function card() : ru.yandex.kraski.universalpainter.data::Card
{
return this._card;
}
private function playCard()
{
logger.debug("playCard()");
this.background = this.card.background;
this.visualList = concat();
logger.debug("card visuals list: {0}", visualList.toString());
visualList.sortOn("creationOrder", Array.NUMERIC);
this.cleanCard();
this.currentVisualIndex = 0;
if(this.background)
{
this.addAnimatedBackground();
}
else
{
this.startPlayingVisuals();
}
return;
}
private function visualFinishHandler(arg0:ru.yandex.kraski.universalpainter.events::VisualEvent)
{
removeEventListener(VisualEvent.PLAY_FINISH, this.visualFinishHandler);
var loc0:* = this;
var loc1:* = this.currentVisualIndex + 1;
loc0.currentVisualIndex = this.currentVisualIndex;
if(this.currentVisualIndex < this.visualList.length)
{
this.addAnimatedVisual(this.currentVisualIndex);
}
else
{
dispatchEvent(new PlayerEvent(PlayerEvent.PLAY_FINISNED));
}
return;
}
private function startPlayingVisuals()
{
if(this.visualList.length == 0)
{
dispatchEvent(new PlayerEvent(PlayerEvent.PLAY_FINISNED));
}
else
{
this.addAnimatedVisual(this.currentVisualIndex);
}
return;
}
private function backgroundFinishHandler(arg0:ru.yandex.kraski.universalpainter.events::VisualEvent)
{
background.removeEventListener(VisualEvent.PLAY_FINISH, this.backgroundFinishHandler);
this.startPlayingVisuals();
return;
}
public Setter function paintCanvas(arg0:ru.yandex.kraski.universalpainter.view::PaintCanvas)
{
this._paintCanvas = arg0;
return;
}
private function stopCard()
{
this.currentVisualIndex = 0;
this.stopPlayingVisuals();
this.cleanCard();
this.recreateVisuals();
return;
}
public function play()
{
this.playCard();
return;
}
public Setter function card(arg0:ru.yandex.kraski.universalpainter.data::Card)
{
this._card = arg0;
return;
}
private function cleanCard()
{
logger.debug("cleanCard()");
paintCanvas.setBackground(null);
clean();
return;
}
}
public class ContextMenuManager extends Object
{
//========================= Methods
public static function ContextMenuManager()
{
return;
}
public function ContextMenuManager()
{
super();
return;
}
public function addVersionToContextMenu(arg0:String)
{
var loc0:* = new ContextMenu();
loc0.hideBuiltInItems();
var loc1:* = new ContextMenuItem(arg0 + " " + "1.1.2");
push(loc1);
Application.application.contextMenu = new ContextMenu();
return;
}
}
public class LoadConfigController extends ru.yandex.kraski.universalpainter.controller::Controller
{
//========================= Variables
private static var _instance : LoadConfigController;
private static var allowInstantiation : Boolean = False;
private var _data : Config;
//========================= Methods
public static function LoadConfigController()
{
this.allowInstantiation = false;
return;
}
public function LoadConfigController()
{
super();
if(this.allowInstantiation)
{
}
return;
}
public static Getter function instance() : ru.yandex.kraski.universalpainter.controller::LoadConfigController
{
if(this._instance)
{
this.allowInstantiation = true;
this._instance = ;
this.allowInstantiation = false;
}
return this._instance;
}
public Setter function data(arg0:ru.yandex.kraski.universalpainter.data::Config)
{
this._data = arg0;
register();
return;
}
public function load()
{
var loc0:* = ServiceLocator.loadConfigService;
loc0.addEventListener(ResultEvent.RESULT, this.resultHandler);
loc0.addEventListener(FaultEvent.FAULT, this.faultHandler);
loc0.load();
return;
}
private function faultHandler(arg0:mx.rpc.events::FaultEvent)
{
this.removeServiceListeners(ILoadConfigService(arg0.target));
error(arg0.toString());
return;
}
private function resultHandler(arg0:mx.rpc.events::ResultEvent)
{
this.removeServiceListeners(ILoadConfigService(arg0.target));
_data.parseXML(XML(arg0.result));
return;
}
private function removeServiceListeners(arg0:ru.yandex.kraski.universalpainter.services::ILoadConfigService)
{
arg0.removeEventListener(ResultEvent.RESULT, this.resultHandler);
arg0.removeEventListener(FaultEvent.FAULT, this.faultHandler);
return;
}
}
}
package ru.yandex.kraski.universalpainter.events
{
public class PlayerEvent extends flash.events::Event
{
//========================= Variables
public static const PLAY_FINISNED : String = "playFinished";
//========================= Methods
public static function PlayerEvent()
{
this.PLAY_FINISNED = "playFinished";
return;
}
public function PlayerEvent(arg0:String, arg1:Boolean = false, arg2:Boolean = false)
{
super(arg0, arg1, arg2);
return;
}
}
public class ModelEvent extends flash.events::Event
{
//========================= Variables
public static const PHOTOFRAME_CHANGE : String = "photoframeChange";
public static const TEXT_COLOR_CHANGE : String = "textColorChange";
public static const VISUAL_CHANGE : String = "visualChange";
public static const BACKGROUNDS_LOAD_COMPLETE : String = "backgroundsLoadComplete";
public static const CLIPART_LOAD_PROGRESS : String = "clipartsLoadPrtogress";
public static const BACKGROUND_COLOR_CHANGE : String = "backgroundColorChange";
public static const XML_LOAD_COMPLETE : String = "xmlLoadComplete";
public static const PHOTOFRAMES_LOAD_COMPLETE : String = "photoframesLoadComplete";
public static const PAINT_SIZE_CHANGE : String = "paintSizeChange";
public static const BRUSH_COLOR_CHANGE : String = "brushColorChange";
public static const CLIPARTS_LOAD_COMPLETE : String = "clipartsLoadComplete";
public static const CARD_CLEAR : String = "cardClear";
public static const CARD_CHANGE : String = "cardChange";
public static const CURRENT_FONT_CHANGE : String = "currentFontChange";
public static const ACTIVE_COLOR_CHANGE : String = "activeColorChange";
public static const CHANGE_TOOL : String = "changeTool";
public static const LIBRARY_LOAD_COMPLETE : String = "libraryLoadComplete";
public static const PAINT_CLASS_CHANGE : String = "paintClassChange";
public static const VISUAL_SELECT : String = "visualSelect";
public static const CARD_FULL : String = "cardFull";
public static const BACKGROUND_CHANGE : String = "backgroundChange";
public static const VISUAL_REMOVE : String = "visualRemove";
public static const CARD_WEIGHT_CHANGE : String = "cardWeightChange";
public static const STROKE_POINT_APPEND : String = "strokePointAppend";
public static const XML_PARSE_ERROR : String = "xmlParseError";
public static const CLIPART_COLOR_CHANGE : String = "clipartColorChange";
public static const VISUAL_APPEND : String = "visualAppend";
public var visual : Visual;
public var index : int;
public var message : String = "";
public var result : String = "";
//========================= Methods
public static function ModelEvent()
{
this.XML_LOAD_COMPLETE = "xmlLoadComplete";
this.XML_PARSE_ERROR = "xmlParseError";
this.CLIPARTS_LOAD_COMPLETE = "clipartsLoadComplete";
this.CLIPART_LOAD_PROGRESS = "clipartsLoadPrtogress";
this.LIBRARY_LOAD_COMPLETE = "libraryLoadComplete";
this.BACKGROUNDS_LOAD_COMPLETE = "backgroundsLoadComplete";
this.PHOTOFRAMES_LOAD_COMPLETE = "photoframesLoadComplete";
this.VISUAL_APPEND = "visualAppend";
this.VISUAL_CHANGE = "visualChange";
this.VISUAL_REMOVE = "visualRemove";
this.BACKGROUND_CHANGE = "backgroundChange";
this.PHOTOFRAME_CHANGE = "photoframeChange";
this.STROKE_POINT_APPEND = "strokePointAppend";
this.CHANGE_TOOL = "changeTool";
this.CARD_CLEAR = "cardClear";
this.CARD_CHANGE = "cardChange";
this.CARD_WEIGHT_CHANGE = "cardWeightChange";
this.CARD_FULL = "cardFull";
this.PAINT_SIZE_CHANGE = "paintSizeChange";
this.PAINT_CLASS_CHANGE = "paintClassChange";
this.VISUAL_SELECT = "visualSelect";
this.CURRENT_FONT_CHANGE = "currentFontChange";
this.ACTIVE_COLOR_CHANGE = "activeColorChange";
this.BACKGROUND_COLOR_CHANGE = "backgroundColorChange";
this.BRUSH_COLOR_CHANGE = "brushColorChange";
this.CLIPART_COLOR_CHANGE = "clipartColorChange";
this.TEXT_COLOR_CHANGE = "textColorChange";
return;
}
public function ModelEvent(arg0:String, arg1:Boolean = false, arg2:Boolean = false)
{
super(arg0, arg1, arg2);
return;
}
}
public class ControllerEvent extends flash.events::Event
{
//========================= Variables
public static const REGISTER : String = "register";
public static const UNREGISTER : String = "unregister";
//========================= Methods
public static function ControllerEvent()
{
this.REGISTER = "register";
this.UNREGISTER = "unregister";
return;
}
public function ControllerEvent(arg0:String, arg1:Boolean = false, arg2:Boolean = false)
{
super(arg0, arg1, arg2);
return;
}
}
public class SwapVisualDepthEvent extends flash.events::Event
{
//========================= Variables
public static const SWAP_DEPTH : String = "swapDepth";
public var visual : Visual;
public var newDepth : int;
public var oldDepth : int;
//========================= Methods
public static function SwapVisualDepthEvent()
{
this.SWAP_DEPTH = "swapDepth";
return;
}
public function SwapVisualDepthEvent(arg0:String, arg1:ru.yandex.kraski.universalpainter.visual::Visual, arg2:int, arg3:int, arg4:Boolean = false, arg5:Boolean = false)
{
super(arg0, arg4, arg5);
this.visual = arg1;
this.oldDepth = arg2;
this.newDepth = arg3;
return;
}
public function clone() : flash.events::Event
{
return new SwapVisualDepthEvent(type, this.visual, this.oldDepth, this.newDepth, bubbles, cancelable);
}
}
public class LineEvent extends flash.events::Event
{
//========================= Variables
public static const ADD_POINT : String = "addPoint";
public static const FINISH : String = "finish";
public static const FILL : String = "fill";
public var x : Number;
public var y : Number;
//========================= Methods
public static function LineEvent()
{
this.ADD_POINT = "addPoint";
this.FINISH = "finish";
this.FILL = "fill";
return;
}
public function LineEvent(arg0:String, arg1:Boolean = false, arg2:Boolean = false)
{
super(arg0, arg1, arg2);
return;
}
public function clone() : flash.events::Event
{
return new LineEvent(type, bubbles, cancelable);
}
}
public class VisualEvent extends flash.events::Event
{
//========================= Variables
public static const GEOM_CHANGE : String = "geomChange";
public static const CREATION_COMPLETE : String = "creationComplete";
public static const DESERIALIZING_COMPLETE : String = "deserializingComplete";
public static const PLAY_FINISH : String = "playFinish";
//========================= Methods
public static function VisualEvent()
{
this.GEOM_CHANGE = "geomChange";
this.PLAY_FINISH = "playFinish";
this.CREATION_COMPLETE = "creationComplete";
this.DESERIALIZING_COMPLETE = "deserializingComplete";
return;
}
public function VisualEvent(arg0:String, arg1:Boolean = false, arg2:Boolean = false)
{
super(arg0, arg1, arg2);
return;
}
public function clone() : flash.events::Event
{
return new VisualEvent(type, bubbles, cancelable);
}
}
public class PhotoframeEvent extends flash.events::Event
{
//========================= Variables
public static const UPLOAD_PHOTO : String = "uploadPhoto";
public var container : MovieClip;
public var button : MovieClip;
//========================= Methods
public static function PhotoframeEvent()
{
this.UPLOAD_PHOTO = "uploadPhoto";
return;
}
public function PhotoframeEvent(arg0:String, arg1:flash.display::MovieClip, arg2:flash.display::MovieClip, arg3:Boolean = false, arg4:Boolean = false)
{
super(arg0, arg3, arg4);
this.container = arg1;
this.button = arg2;
return;
}
}
public class PhotoframePictureEvent extends flash.events::Event
{
//========================= Variables
public static const SELECT_PHOTO : String = "selectPhoto";
public var photo : PhotoframePicture;
//========================= Methods
public static function PhotoframePictureEvent()
{
this.SELECT_PHOTO = "selectPhoto";
return;
}
public function PhotoframePictureEvent(arg0:String, arg1:ru.yandex.kraski.universalpainter.visual::PhotoframePicture = null, arg2:Boolean = false, arg3:Boolean = false)
{
super(arg0, arg2, arg3);
this.photo = arg1;
return;
}
}
public class LibraryAssetEvent extends flash.events::Event
{
//========================= Variables
public static const INTRO_FINISH : String = "introFinish";
//========================= Methods
public static function LibraryAssetEvent()
{
this.INTRO_FINISH = "introFinish";
return;
}
public function LibraryAssetEvent(arg0:String, arg1:Boolean = false, arg2:Boolean = false)
{
super(arg0, arg1, arg2);
return;
}
}
public class TextEvent extends flash.events::Event
{
//========================= Variables
public static const TEXT_CHANGE : String = "textChange";
public static const TEXT_CHANGING : String = "textChanging";
public var oldText : String;
public var newText : String;
//========================= Methods
public static function TextEvent()
{
this.TEXT_CHANGE = "textChange";
this.TEXT_CHANGING = "textChanging";
return;
}
public function TextEvent(arg0:String, arg1:Boolean = false, arg2:Boolean = false)
{
super(arg0, arg1, arg2);
return;
}
public function clone() : flash.events::Event
{
var loc0:* = new TextEvent(type, bubbles, cancelable);
loc0.oldText = ;
loc0.newText = ;
return loc0;
}
}
}
package ru.yandex.kraski.universalpainter.paints
{
public class PaintType extends Object implements {flash.events}::IEventDispatcher
{
//========================= Variables
private static var _268885634SNOW_PAINT : Class;
private static var _1223207963PENTA_PAINT : Class;
private static var _141578861SMOOTH_PAINT : Class;
private static var _staticBindingEventDispatcher : EventDispatcher;
private static var _1513347355HEART_PAINT : Class;
private static var _1746188835RECT_PAINT : Class;
private static var _1748840007SPRAYER_PAINT : Class;
private static var _2145674SOLID_PAINT : Class;
private static var _1401527974FLOWER_PAINT : Class;
private static var _10424734RUNNING_PAINT : Class;
private var _bindingEventDispatcher : EventDispatcher;
//========================= Methods
public static function PaintType()
{
this._2145674SOLID_PAINT = SolidPaint;
this._141578861SMOOTH_PAINT = SmoothPaint;
this._10424734RUNNING_PAINT = RunningPaint;
this._1748840007SPRAYER_PAINT = SprayerPaint;
this._1513347355HEART_PAINT = HeartPaint;
this._1746188835RECT_PAINT = RectPaint;
this._1401527974FLOWER_PAINT = FlowerPaint;
this._1223207963PENTA_PAINT = PentaPaint;
this._268885634SNOW_PAINT = SnowPaint;
this._staticBindingEventDispatcher = new EventDispatcher();
return;
}
public function PaintType()
{
this._bindingEventDispatcher = new EventDispatcher(IEventDispatcher(this));
super();
return;
}
public static Getter function SNOW_PAINT() : Class
{
return PaintType._268885634SNOW_PAINT;
}
public static Setter function SNOW_PAINT(arg0:Class)
{
var loc1:* = null;
var loc0:* = PaintType._268885634SNOW_PAINT;
if(loc0 !== arg0)
{
PaintType._268885634SNOW_PAINT = ;
loc1 = PaintType.staticEventDispatcher;
if(loc1 != null)
{
loc1.dispatchEvent(PropertyChangeEvent.createUpdateEvent(PaintType, "SNOW_PAINT", loc0, arg0));
}
}
return;
}
public static Getter function SOLID_PAINT() : Class
{
return PaintType._2145674SOLID_PAINT;
}
public static Setter function RECT_PAINT(arg0:Class)
{
var loc1:* = null;
var loc0:* = PaintType._1746188835RECT_PAINT;
if(loc0 !== arg0)
{
PaintType._1746188835RECT_PAINT = ;
loc1 = PaintType.staticEventDispatcher;
if(loc1 != null)
{
loc1.dispatchEvent(PropertyChangeEvent.createUpdateEvent(PaintType, "RECT_PAINT", loc0, arg0));
}
}
return;
}
public static Getter function SPRAYER_PAINT() : Class
{
return PaintType._1748840007SPRAYER_PAINT;
}
public static Getter function staticEventDispatcher() : flash.events::IEventDispatcher
{
return this._staticBindingEventDispatcher;
}
public static Setter function HEART_PAINT(arg0:Class)
{
var loc1:* = null;
var loc0:* = PaintType._1513347355HEART_PAINT;
if(loc0 !== arg0)
{
PaintType._1513347355HEART_PAINT = ;
loc1 = PaintType.staticEventDispatcher;
if(loc1 != null)
{
loc1.dispatchEvent(PropertyChangeEvent.createUpdateEvent(PaintType, "HEART_PAINT", loc0, arg0));
}
}
return;
}
public static Setter function SMOOTH_PAINT(arg0:Class)
{
var loc1:* = null;
var loc0:* = PaintType._141578861SMOOTH_PAINT;
if(loc0 !== arg0)
{
PaintType._141578861SMOOTH_PAINT = ;
loc1 = PaintType.staticEventDispatcher;
if(loc1 != null)
{
loc1.dispatchEvent(PropertyChangeEvent.createUpdateEvent(PaintType, "SMOOTH_PAINT", loc0, arg0));
}
}
return;
}
public static Setter function SOLID_PAINT(arg0:Class)
{
var loc1:* = null;
var loc0:* = PaintType._2145674SOLID_PAINT;
if(loc0 !== arg0)
{
PaintType._2145674SOLID_PAINT = ;
loc1 = PaintType.staticEventDispatcher;
if(loc1 != null)
{
loc1.dispatchEvent(PropertyChangeEvent.createUpdateEvent(PaintType, "SOLID_PAINT", loc0, arg0));
}
}
return;
}
public static Getter function RUNNING_PAINT() : Class
{
return PaintType._10424734RUNNING_PAINT;
}
public static Setter function SPRAYER_PAINT(arg0:Class)
{
var loc1:* = null;
var loc0:* = PaintType._1748840007SPRAYER_PAINT;
if(loc0 !== arg0)
{
PaintType._1748840007SPRAYER_PAINT = ;
loc1 = PaintType.staticEventDispatcher;
if(loc1 != null)
{
loc1.dispatchEvent(PropertyChangeEvent.createUpdateEvent(PaintType, "SPRAYER_PAINT", loc0, arg0));
}
}
return;
}
public static Getter function HEART_PAINT() : Class
{
return PaintType._1513347355HEART_PAINT;
}
public static Getter function FLOWER_PAINT() : Class
{
return PaintType._1401527974FLOWER_PAINT;
}
public static Getter function RECT_PAINT() : Class
{
return PaintType._1746188835RECT_PAINT;
}
public static Getter function SMOOTH_PAINT() : Class
{
return PaintType._141578861SMOOTH_PAINT;
}
public static Setter function PENTA_PAINT(arg0:Class)
{
var loc1:* = null;
var loc0:* = PaintType._1223207963PENTA_PAINT;
if(loc0 !== arg0)
{
PaintType._1223207963PENTA_PAINT = ;
loc1 = PaintType.staticEventDispatcher;
if(loc1 != null)
{
loc1.dispatchEvent(PropertyChangeEvent.createUpdateEvent(PaintType, "PENTA_PAINT", loc0, arg0));
}
}
return;
}
public static Setter function FLOWER_PAINT(arg0:Class)
{
var loc1:* = null;
var loc0:* = PaintType._1401527974FLOWER_PAINT;
if(loc0 !== arg0)
{
PaintType._1401527974FLOWER_PAINT = ;
loc1 = PaintType.staticEventDispatcher;
if(loc1 != null)
{
loc1.dispatchEvent(PropertyChangeEvent.createUpdateEvent(PaintType, "FLOWER_PAINT", loc0, arg0));
}
}
return;
}
public static Setter function RUNNING_PAINT(arg0:Class)
{
var loc1:* = null;
var loc0:* = PaintType._10424734RUNNING_PAINT;
if(loc0 !== arg0)
{
PaintType._10424734RUNNING_PAINT = ;
loc1 = PaintType.staticEventDispatcher;
if(loc1 != null)
{
loc1.dispatchEvent(PropertyChangeEvent.createUpdateEvent(PaintType, "RUNNING_PAINT", loc0, arg0));
}
}
return;
}
public static Getter function PENTA_PAINT() : Class
{
return PaintType._1223207963PENTA_PAINT;
}
public function dispatchEvent(arg0:flash.events::Event) : Boolean
{
return _bindingEventDispatcher.dispatchEvent(arg0);
}
public function hasEventListener(arg0:String) : Boolean
{
return _bindingEventDispatcher.hasEventListener(arg0);
}
public function willTrigger(arg0:String) : Boolean
{
return _bindingEventDispatcher.willTrigger(arg0);
}
public function addEventListener(arg0:String, arg1:Function, arg2:Boolean = false, arg3:int = 0, arg4:Boolean = false)
{
_bindingEventDispatcher.addEventListener(arg0, arg1, arg2, arg3, arg4);
return;
}
public function removeEventListener(arg0:String, arg1:Function, arg2:Boolean = false)
{
_bindingEventDispatcher.removeEventListener(arg0, arg1, arg2);
return;
}
}
public class Paint extends Object
{
//========================= Variables
public var size : Number;
private var _width : Number = 0;
private var _height : Number = 0;
public var color : uint;
private var _className : String;
public var _pointWeight : Number = 0;
public var points : Array;
public var _context : Sprite;
//========================= Methods
public static function Paint()
{
return;
}
public function Paint(arg0:uint, arg1:Number)
{
this.points = [];
super();
this.color = arg0;
this.size = arg1;
this._pointWeight = PaintsWeight.DEFAULT_PAINT_WEIGHT;
return;
}
public function fill(arg0:flash.display::Sprite)
{
this.context = ;
return;
}
public function finish()
{
return;
}
public function clear(arg0:flash.display::Sprite)
{
clear();
DisplayUtil.removeAllChildren(arg0);
return;
}
public function appendPoint(arg0:flash.display::Sprite, arg1:Number, arg2:Number)
{
this.context = ;
points.push({"x" : arg1, "y" : arg2});
return;
}
public function resumeAnimation()
{
return;
}
public Setter function width(arg0:Number)
{
this._width = arg0;
return;
}
public Setter function height(arg0:Number)
{
this._height = arg0;
return;
}
public Getter function xml() : XML
{
return new XML("<paint type=\"" + Escape(this.className) + "\" color=\"" + Escape(toString(16)) + "\" size=\"" + Escape(this.size) + "\"/>");
}
public Setter function context(arg0:flash.display::Sprite)
{
if(this._context != arg0)
{
this.setNewContext(arg0);
}
return;
}
public Getter function height() : Number
{
return this._height;
}
public Getter function width() : Number
{
return this._width;
}
public function pauseAnimation()
{
return;
}
public Getter function pointWeight() : Number
{
return this._pointWeight;
}
public function setNewContext(arg0:flash.display::Sprite)
{
debug("change context");
this._context = arg0;
return;
}
public Getter function className() : String
{
if(this._className)
{
this._className = join(".");
}
return this._className;
}
public Getter function distance() : Number
{
return Math.sqrt(this.size) * 10;
}
public Getter function context() : flash.display::Sprite
{
return this._context;
}
}
public class PaintsWeight extends Object
{
//========================= Variables
public static var ART_PAINT_WEIGHT : Number = 1,5;
public static var SPRAYER_PAINT_WEIGHT : Number = 4;
public static var DEFAULT_PAINT_WEIGHT : Number = 0,4;
public static var SNOW_PAINT_WEIGHT : Number = 4;
public static var FLOWER_PAINT_WEIGHT : Number = 0,8;
//========================= Methods
public static function PaintsWeight()
{
this.DEFAULT_PAINT_WEIGHT = 0,4;
this.FLOWER_PAINT_WEIGHT = 0,8;
this.ART_PAINT_WEIGHT = 1,5;
this.SNOW_PAINT_WEIGHT = 4;
this.SPRAYER_PAINT_WEIGHT = 4;
return;
}
public function PaintsWeight()
{
super();
return;
}
}
}
package ru.yandex.lib.logger
{
public class Logger extends flash.display::Sprite
{
//========================= Variables
private static const OPEN_PASSWORD : String = "iddqd";
private var passwordTimer : Timer;
private var _target : ConsoleTarget;
private var console : Console;
private var password : String = "";
//========================= Methods
public static function Logger()
{
this.OPEN_PASSWORD = "iddqd";
return;
}
public function Logger()
{
this.passwordTimer = new Timer(1000);
super();
this.mouseEnabled = false;
this.console = new Console();
addChild(this.console);
this._target = new ConsoleTarget(this.console);
addEventListener(Event.ADDED_TO_STAGE, this.addedToStageHandler);
return;
}
private function addedToStageHandler(arg0:flash.events::Event)
{
stage.addEventListener(Event.RESIZE, this.stage_resiseHandler);
stage.addEventListener(KeyboardEvent.KEY_DOWN, this.keyDownHandler);
passwordTimer.addEventListener(TimerEvent.TIMER, this.password_timerHandler);
passwordTimer.start();
return;
}
private function password_timerHandler(arg0:flash.events::TimerEvent)
{
this.password = "";
return;
}
private function stage_resiseHandler(arg0:flash.events::Event)
{
console.setSize();
return;
}
public Getter function target() : ru.yandex.lib.logger.target::LineFormattedTarget
{
return this._target;
}
private function keyDownHandler(arg0:flash.events::KeyboardEvent)
{
passwordTimer.stop();
passwordTimer.start();
var loc0:* = String.fromCharCode(arg0.charCode);
this.password = this.password + loc0;
if(this.password == this.OPEN_PASSWORD)
{
this.console.visible = true;
this.password = "";
}
return;
}
}
}
package ru.yandex.kraski.universalpainter.data
{
public class Card extends flash.events::EventDispatcher
{
//========================= Variables
public static const MAX_WEIGHT : int = 1000;
private var _isCardXMLActual : Boolean = True;
public var picturesTotal : int = 0;
private var logger : ILogger;
private var _weight : Number = 0;
private var _photoframe : Photoframe;
private var _cardXML : XML;
private var _modified : Boolean = False;
private var _visualsList : Array;
private var _background : Background;
private var _empty : Boolean = True;
private var _currentLine : Line;
private var _hash : String;
//========================= Methods
public static function Card()
{
this.MAX_WEIGHT = 1000;
return;
}
public function Card(arg0:ru.yandex.kraski.universalpainter.data::ClipartDescriptorsList)
{
this.logger = Log.getLogger("ru.yandex.kraski.universalpainter.data.Card");
this._visualsList = [];
this._cardXML = new XML("<card v=\"1.0\"/>");
super();
return;
}
public static function fromXML(arg0:ru.yandex.kraski.universalpainter.data::ClipartDescriptorsList, arg1:XML = null) : ru.yandex.kraski.universalpainter.data::Card
{
var loc2:* = null;
var loc3:* = null;
var loc4:* = null;
var loc5:* = null;
var loc6:* = null;
var loc0:* = new this(arg0);
if(arg1)
{
return loc0;
}
loc0.picturesTotal = 0;
var loc1:* = new VisualFactory(arg0);
var loc7:* = 0;
var loc8:* = arg1.background;
for(loc7 in loc8)
{
loc2 = loc8.__getNextEnumerablePropertyValue();
loc4 = arg0.getDescriptorByBriefUrl(loc2.resource.src);
loc5 = new Background(loc4);
deserialize(loc2);
loc0.addBackground(loc5);
}
loc7 = 0;
loc8 = arg1.visual;
for(loc7 in loc8)
{
loc3 = loc8.__getNextEnumerablePropertyValue();
loc6 = loc1.create(loc3);
loc0.addElement(loc6);
if(loc6 is Photoframe)
{
hideUploadButtons();
Photoframe(loc6).mouseChildren = false;
Photoframe(loc6).mouseEnabled = false;
}
}
loc0._isCardXMLActual = false;
loc0.modified = false;
return loc0;
}
private Setter function _615513399modified(arg0:Boolean)
{
this._modified = arg0;
return;
}
private Setter function _2058039875isEmpty(arg0:Boolean)
{
if(arg0)
{
if((! || this.visualsList.length > 0))
{
}
}
else
{
if(this._background == null && this.visualsList.length == 0)
{
}
}
this._isCardXMLActual = this._isCardXMLActual && this._empty == arg0;
this._empty = arg0;
return;
}
private function swapItemsInArray(arg0:Array, arg1:int, arg2:int)
{
if(arg2 >= arg0.length)
{
return;
}
var loc0:* = arg0.concat();
var loc1:* = arg0.concat()[arg1];
arg0[arg1] = loc0[arg2];
arg0.loc1 = ;
this.updateDepths();
return;
}
public function swapVisualListElements(arg0:ru.yandex.kraski.universalpainter.visual::Visual, arg1:int, arg2:int)
{
this.swapItemsInArray(this.visualsList, arg1, arg2);
this._isCardXMLActual = false;
this.modified = true;
dispatchEvent(new SwapVisualDepthEvent(SwapVisualDepthEvent.SWAP_DEPTH, arg0, arg1, arg2));
return;
}
public Setter function isEmpty(arg0:Boolean)
{
var loc0:* = this.isEmpty;
if(loc0 !== arg0)
{
this._2058039875isEmpty = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "isEmpty", loc0, arg0));
}
return;
}
public Getter function hash() : String
{
return this._hash;
}
public Setter function modified(arg0:Boolean)
{
var loc0:* = this.modified;
if(loc0 !== arg0)
{
this._615513399modified = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "modified", loc0, arg0));
}
return;
}
public function addElement(arg0:ru.yandex.kraski.universalpainter.visual::Visual, arg1:int = 1342177279)
{
logger.debug("adding element: {0}", arg0);
var loc0:* = ( (arg1 == 255)? this._visualsList.length : arg1 );
arg0.creationOrder = this.visualsList.length;
arg0.depth = ;
_visualsList.splice(loc0, 0, arg0);
if(arg0 is Photoframe)
{
this._photoframe = (arg0) as Photoframe;
}
if(arg0 is Line)
{
this._currentLine = (arg0) as Line;
addEventListener(LineEvent.ADD_POINT, this.validateWeight, false, 0, true);
}
this.updateCardStatus();
this.validateWeight();
this._isCardXMLActual = false;
this.modified = true;
var loc1:* = new ModelEvent(ModelEvent.VISUAL_APPEND);
new ModelEvent(ModelEvent.VISUAL_APPEND).visual = ;
loc1.index = ;
dispatchEvent(loc1);
return;
}
public Setter function hash(arg0:String)
{
if(this._hash)
{
}
debug("card hash={0}", arg0);
this._hash = arg0;
return;
}
private function generateCardXML()
{
logger.debug("generating card xml...");
this.deleteCardXMLNodes();
if(this._background)
{
_cardXML.appendChild(_background.serialize());
}
i = 0;
while(i < this._visualsList.length)
{
try {
_cardXML.appendChild(serialize());
} catch (e:flash.errors::ScriptTimeoutError) {
var loc1:* = e;
i = null;
i = i - 1;
}
i = i + 1;
}
this._cardXML.picturesTotal = 0;
this._isCardXMLActual = true;
return;
}
public function validateWeight(arg0:flash.events::Event = null)
{
var loc0:* = 0;
if(this.background)
{
loc0 = loc0 + this.background.weight;
}
var loc1:* = 0;
while(loc1 < this.visualsTotal)
{
loc0 = loc0 + Visual(this._visualsList[loc1]).weight;
loc1++;
}
this.weight = loc0;
return;
}
public function addBackground(arg0:ru.yandex.kraski.universalpainter.visual::Background)
{
this._background = arg0;
this.updateCardStatus();
this.validateWeight();
this._isCardXMLActual = false;
this.modified = true;
var loc0:* = new ModelEvent(ModelEvent.BACKGROUND_CHANGE);
loc0.visual = ;
dispatchEvent(loc0);
return;
}
public Getter function background() : ru.yandex.kraski.universalpainter.visual::Background
{
return this._background;
}
private function updateDepths()
{
var loc0:* = 0;
while(loc0 < this.visualsList.length)
{
Visual(this.visualsList[loc0]).depth = 0;
loc0++;
}
return;
}
public Getter function isEmpty() : Boolean
{
return this._empty;
}
public Getter function modified() : Boolean
{
return this._modified;
}
private function updateCardStatus()
{
this.isEmpty = this._background == null && this.visualsList.length == 0;
return;
}
public Getter function visualsTotal() : int
{
return this._visualsList.length;
}
public function clear()
{
this._visualsList = [];
this._background = null;
this._photoframe = null;
this.updateCardStatus();
this.validateWeight();
this._isCardXMLActual = false;
this.modified = true;
dispatchEvent(new ModelEvent(ModelEvent.CARD_CLEAR));
return;
}
public function removeElement(arg0:ru.yandex.kraski.universalpainter.visual::Visual)
{
var loc0:* = _visualsList.indexOf(arg0);
var loc1:* = new ModelEvent(ModelEvent.VISUAL_REMOVE);
loc1.visual = this._visualsList[loc0];
_visualsList.splice(loc0, 1);
if(arg0 is Photoframe)
{
this._photoframe = null;
}
this.updateCardStatus();
this.validateWeight();
this._isCardXMLActual = false;
this.modified = true;
dispatchEvent(loc1);
return;
}
private function deleteCardXMLNodes()
{
delete _cardXML.visual;
delete _cardXML.background;
return;
}
public Setter function cardXML(arg0:XML)
{
}
public Getter function cardXML() : XML
{
this.generateCardXML();
return this._cardXML;
}
public Setter function weight(arg0:Number)
{
this._weight = arg0;
if(this._weight >= this.MAX_WEIGHT)
{
dispatchEvent(new ModelEvent(ModelEvent.CARD_FULL));
}
else
{
dispatchEvent(new ModelEvent(ModelEvent.CARD_WEIGHT_CHANGE));
}
return;
}
public Getter function visualsList() : Array
{
return this._visualsList;
}
public Getter function weight() : Number
{
return this._weight;
}
public function destroy()
{
var loc0:* = 0;
while(loc0 < this._visualsList.length)
{
destroy();
loc0++;
}
this._visualsList = null;
if(this._background)
{
_background.destroy();
this._background = null;
}
this._photoframe = null;
this._currentLine = null;
return;
}
public Getter function photoframe() : ru.yandex.kraski.universalpainter.visual::Photoframe
{
return this._photoframe;
}
}
public class Config extends flash.events::EventDispatcher
{
//========================= Variables
private static var _instance : Config;
private var _backgroundsLibraryUrl : String;
private var _urlLibraryClipart : String;
private var _cardId : String;
private var _appParameters : Object;
private var _photoframesLibraryUrl : String;
private var _urlClipartDir : String;
//========================= Methods
public static function Config()
{
return;
}
public function Config()
{
super();
if(this._instance)
{
}
return;
}
public static Setter function instance(arg0:ru.yandex.kraski.universalpainter.data::Config)
{
this._instance = ;
return;
}
public static Getter function instance() : ru.yandex.kraski.universalpainter.data::Config
{
if(this._instance)
{
this._instance = ;
this._instance._appParameters = Application.application.stage.loaderInfo.parameters;
}
return this._instance;
}
public function parseXML(arg0:XML)
{
swfConfigItems = null;
value = arg0;
try {
swfConfigItems = children();
var loc2:* = 0;
var loc3:* = swfConfigItems;
var loc1:* = new XMLList("");
for(loc2 in loc3)
{
var loc4:* = loc3.__getNextEnumerablePropertyValue();
var loc5:* = loc3.__getNextEnumerablePropertyValue();
if(name == "urlClipartDir")
{
loc1.loc4 = 0;
}
}
this._urlClipartDir = loc1.value;
loc2 = 0;
loc3 = swfConfigItems;
loc1 = new XMLList("");
for(loc2 in loc3)
{
loc4 = loc3.__getNextEnumerablePropertyValue();
loc5 = loc3.__getNextEnumerablePropertyValue();
if(name == "urlLibraryClipart")
{
loc1.loc4 = 0;
}
}
this._urlLibraryClipart = loc1.value;
loc2 = 0;
loc3 = swfConfigItems;
loc1 = new XMLList("");
for(loc2 in loc3)
{
loc4 = loc3.__getNextEnumerablePropertyValue();
loc5 = loc3.__getNextEnumerablePropertyValue();
if(name == "backgroundsLibraryUrl")
{
loc1.loc4 = 0;
}
}
_backgroundsLibraryUrl = loc1.value;
loc2 = 0;
loc3 = swfConfigItems;
loc1 = new XMLList("");
for(loc2 in loc3)
{
loc4 = loc3.__getNextEnumerablePropertyValue();
loc5 = loc3.__getNextEnumerablePropertyValue();
if(name == "photoframesLibraryUrl")
{
loc1.loc4 = 0;
}
}
_photoframesLibraryUrl = loc1.value;
dispatchEvent(new ModelEvent(ModelEvent.XML_LOAD_COMPLETE));
} catch (error:Error) {
loc1 = error;
value = null;
dispatchEvent(new ModelEvent(ModelEvent.XML_PARSE_ERROR));
}
return;
}
public Getter function photoframesLibraryURL() : String
{
return this.appBaseURL + "/" + this._photoframesLibraryUrl;
}
public Getter function serviceURL() : String
{
return this._appParameters.baseUrl;
}
public Setter function cardHash(arg0:String)
{
this._cardId = arg0;
return;
}
public Getter function uploadURL() : String
{
return this._appParameters.uploadUrl;
}
public Getter function cardHash() : String
{
return ( (this._cardId)? this._cardId : this._appParameters.cardHash );
}
public Getter function libraryClipartURL() : String
{
return this.appBaseURL + "/" + this._urlLibraryClipart;
}
public Getter function backgroundsLibraryURL() : String
{
return this.appBaseURL + "/" + this._backgroundsLibraryUrl;
}
public Getter function clipartURL() : String
{
return this.appBaseURL + "/" + this._urlClipartDir;
}
public Getter function appBaseURL() : String
{
var loc0:* = Application.application.systemManager.loaderInfo.url;
return loc0.substr(0, loc0.lastIndexOf("/"));
}
public Getter function servantURL() : String
{
return this._appParameters.servantUrl;
}
}
public class Model extends flash.events::EventDispatcher
{
//========================= Variables
private static var _1067928431desktopPlayerAppName : String = "Плеер";
private static var _2136642985blogPlayerAppName : String = "Плеер";
private static var _1859882851desktopEditorAppName : String = "Редактор рисунков";
private static var _1672547127webPlayerAppName : String = "Плеер";
private static var _1830465749webEditorAppName : String = "Редактор рисунков";
private static var _staticBindingEventDispatcher : EventDispatcher;
private var _paintSize : int;
private var _fonts : Array;
private var _sizes : ArrayCollection;
private var _backgroundColor : YaColor;
private var className : String = "DataModel";
private var _currentFont : Font = Null;
private var _configData : Config;
private var _currentAssetsType : int;
private var _currentClipartsCategory : LibraryClipartCategory;
private var _textColor : YaColor;
private var _libraryClipartData : LibraryClipartData;
private var _activeColor : YaColor;
private var _paintClass : Class;
private var _selectedVisual : EditableVisual;
private var _brushColor : YaColor;
private var _clipartColor : YaColor;
private var _currentTool : String;
private var _card : Card;
private var _clipartDescriptors : ClipartDescriptorsList;
private var _fontNamesList : Array;
//========================= Methods
public static function Model()
{
this._1830465749webEditorAppName = "Редактор рисунков";
this._1672547127webPlayerAppName = "Плеер";
this._2136642985blogPlayerAppName = "Плеер";
this._1859882851desktopEditorAppName = "Редактор рисунков";
this._1067928431desktopPlayerAppName = "Плеер";
this._staticBindingEventDispatcher = new EventDispatcher();
return;
}
public function Model(arg0:mx.core::Application, arg1:flash.events::IEventDispatcher = null)
{
this._paintClass = SmoothPaint;
this._brushColor = new YaColor(16711680);
this._clipartColor = new YaColor();
this._textColor = new YaColor();
this._backgroundColor = new YaColor(16777215);
this._activeColor = new YaColor(16711680);
this._sizes = new ArrayCollection([4, 8, 12, 18, 24]);
this._paintSize = this._sizes[2];
this._fontNamesList = ["VeraCrouz", "dsnote", "ITCOfficinaSans-Book"];
this._fonts = [];
super(arg1);
this.initFonts();
this._configData = Config.instance;
this._libraryClipartData = new LibraryClipartData();
this._clipartDescriptors = new ClipartDescriptorsList();
return;
}
public static Getter function desktopEditorAppName() : String
{
return Model._1859882851desktopEditorAppName;
}
public static Setter function desktopPlayerAppName(arg0:String)
{
var loc1:* = null;
var loc0:* = Model._1067928431desktopPlayerAppName;
if(loc0 !== arg0)
{
Model._1067928431desktopPlayerAppName = ;
loc1 = Model.staticEventDispatcher;
if(loc1 != null)
{
loc1.dispatchEvent(PropertyChangeEvent.createUpdateEvent(Model, "desktopPlayerAppName", loc0, arg0));
}
}
return;
}
public static Getter function desktopPlayerAppName() : String
{
return Model._1067928431desktopPlayerAppName;
}
public static Getter function webEditorAppName() : String
{
return Model._1830465749webEditorAppName;
}
public static Setter function desktopEditorAppName(arg0:String)
{
var loc1:* = null;
var loc0:* = Model._1859882851desktopEditorAppName;
if(loc0 !== arg0)
{
Model._1859882851desktopEditorAppName = ;
loc1 = Model.staticEventDispatcher;
if(loc1 != null)
{
loc1.dispatchEvent(PropertyChangeEvent.createUpdateEvent(Model, "desktopEditorAppName", loc0, arg0));
}
}
return;
}
public static Getter function blogPlayerAppName() : String
{
return Model._2136642985blogPlayerAppName;
}
public static Setter function blogPlayerAppName(arg0:String)
{
var loc1:* = null;
var loc0:* = Model._2136642985blogPlayerAppName;
if(loc0 !== arg0)
{
Model._2136642985blogPlayerAppName = ;
loc1 = Model.staticEventDispatcher;
if(loc1 != null)
{
loc1.dispatchEvent(PropertyChangeEvent.createUpdateEvent(Model, "blogPlayerAppName", loc0, arg0));
}
}
return;
}
public static Getter function staticEventDispatcher() : flash.events::IEventDispatcher
{
return this._staticBindingEventDispatcher;
}
public static Setter function webPlayerAppName(arg0:String)
{
var loc1:* = null;
var loc0:* = Model._1672547127webPlayerAppName;
if(loc0 !== arg0)
{
Model._1672547127webPlayerAppName = ;
loc1 = Model.staticEventDispatcher;
if(loc1 != null)
{
loc1.dispatchEvent(PropertyChangeEvent.createUpdateEvent(Model, "webPlayerAppName", loc0, arg0));
}
}
return;
}
public static Setter function webEditorAppName(arg0:String)
{
var loc1:* = null;
var loc0:* = Model._1830465749webEditorAppName;
if(loc0 !== arg0)
{
Model._1830465749webEditorAppName = ;
loc1 = Model.staticEventDispatcher;
if(loc1 != null)
{
loc1.dispatchEvent(PropertyChangeEvent.createUpdateEvent(Model, "webEditorAppName", loc0, arg0));
}
}
return;
}
public static Getter function webPlayerAppName() : String
{
return Model._1672547127webPlayerAppName;
}
public Setter function activeColor(arg0:ru.yandex.utils::YaColor)
{
var loc0:* = this.activeColor;
if(loc0 !== arg0)
{
this._1077332995activeColor = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "activeColor", loc0, arg0));
}
return;
}
private Setter function _1936508347selectedVisual(arg0:ru.yandex.kraski.universalpainter.visual::EditableVisual)
{
this._selectedVisual = arg0;
dispatchEvent(new ModelEvent(ModelEvent.VISUAL_SELECT));
return;
}
public Getter function fonts() : Array
{
return this._fonts;
}
public Getter function paintSize() : int
{
return this._paintSize;
}
private Setter function _600824168currentFont(arg0:flash.text::Font)
{
this._currentFont = arg0;
info("Current font changed: {0}", this._currentFont.fontName);
dispatchEvent(new ModelEvent(ModelEvent.CURRENT_FONT_CHANGE));
return;
}
public Setter function paintClass(arg0:Class)
{
var loc0:* = this.paintClass;
if(loc0 !== arg0)
{
this._774720442paintClass = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "paintClass", loc0, arg0));
}
return;
}
public Setter function paintSize(arg0:int)
{
var loc0:* = this.paintSize;
if(loc0 !== arg0)
{
this._1360007809paintSize = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "paintSize", loc0, arg0));
}
return;
}
public Setter function selectedVisual(arg0:ru.yandex.kraski.universalpainter.visual::EditableVisual)
{
var loc0:* = this.selectedVisual;
if(loc0 !== arg0)
{
this._1936508347selectedVisual = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "selectedVisual", loc0, arg0));
}
return;
}
public Getter function card() : ru.yandex.kraski.universalpainter.data::Card
{
return this._card;
}
public Getter function sizes() : mx.collections::ArrayCollection
{
return this._sizes;
}
public Getter function currentFont() : flash.text::Font
{
return this._currentFont;
}
public Getter function clipartColor() : ru.yandex.utils::YaColor
{
return _clipartColor.clone();
}
public Setter function brushColor(arg0:ru.yandex.utils::YaColor)
{
var loc0:* = this.brushColor;
if(loc0 !== arg0)
{
this._2101943369brushColor = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "brushColor", loc0, arg0));
}
return;
}
private Setter function _1077332995activeColor(arg0:ru.yandex.utils::YaColor)
{
if(_activeColor.isEquals(arg0))
{
_activeColor.copy(arg0);
dispatchEvent(new ModelEvent(ModelEvent.ACTIVE_COLOR_CHANGE));
}
return;
}
public Setter function currentClipartsCategory(arg0:ru.yandex.kraski.universalpainter.data::LibraryClipartCategory)
{
var loc0:* = this.currentClipartsCategory;
if(loc0 !== arg0)
{
this._1871864201currentClipartsCategory = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "currentClipartsCategory", loc0, arg0));
}
return;
}
private Setter function _1063571914textColor(arg0:ru.yandex.utils::YaColor)
{
if(_textColor.isEquals(arg0))
{
_textColor.copy(arg0);
dispatchEvent(new ModelEvent(ModelEvent.TEXT_COLOR_CHANGE));
}
return;
}
public Setter function card(arg0:ru.yandex.kraski.universalpainter.data::Card)
{
var loc0:* = this.card;
if(loc0 !== arg0)
{
this._3046160card = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "card", loc0, arg0));
}
return;
}
public Getter function libraryClipartData() : ru.yandex.kraski.universalpainter.data::LibraryClipartData
{
return this._libraryClipartData;
}
private Setter function _109453458sizes(arg0:mx.collections::ArrayCollection)
{
return;
}
public Setter function textColor(arg0:ru.yandex.utils::YaColor)
{
var loc0:* = this.textColor;
if(loc0 !== arg0)
{
this._1063571914textColor = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "textColor", loc0, arg0));
}
return;
}
public Setter function clipartColor(arg0:ru.yandex.utils::YaColor)
{
var loc0:* = this.clipartColor;
if(loc0 !== arg0)
{
this._1897062896clipartColor = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "clipartColor", loc0, arg0));
}
return;
}
public Setter function backgroundColor(arg0:ru.yandex.utils::YaColor)
{
var loc0:* = this.backgroundColor;
if(loc0 !== arg0)
{
this._1287124693backgroundColor = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "backgroundColor", loc0, arg0));
}
return;
}
private Setter function _601241265currentTool(arg0:String)
{
if(arg0 == null)
{
return;
}
if(arg0 == this._currentTool)
{
return;
}
info("current tool change: {0} -> {1}", this._currentTool, arg0);
this._currentTool = arg0;
dispatchEvent(new ModelEvent(ModelEvent.CHANGE_TOOL));
return;
}
public Getter function currentTool() : String
{
return this._currentTool;
}
public Getter function currentAssetsType() : int
{
return this._currentAssetsType;
}
private Setter function _1287124693backgroundColor(arg0:ru.yandex.utils::YaColor)
{
if(_backgroundColor.isEquals(arg0))
{
_backgroundColor.copy(arg0);
info("background color: {0}", this._backgroundColor);
dispatchEvent(new ModelEvent(ModelEvent.BACKGROUND_COLOR_CHANGE));
}
return;
}
public Getter function paintClass() : Class
{
return this._paintClass;
}
public Getter function selectedVisual() : ru.yandex.kraski.universalpainter.visual::EditableVisual
{
return this._selectedVisual;
}
public Setter function sizes(arg0:mx.collections::ArrayCollection)
{
var loc0:* = this.sizes;
if(loc0 !== arg0)
{
this._109453458sizes = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "sizes", loc0, arg0));
}
return;
}
public Getter function textColor() : ru.yandex.utils::YaColor
{
return _textColor.clone();
}
public Getter function config() : ru.yandex.kraski.universalpainter.data::Config
{
return this._configData;
}
public Getter function brushColor() : ru.yandex.utils::YaColor
{
return _brushColor.clone();
}
private Setter function _2101943369brushColor(arg0:ru.yandex.utils::YaColor)
{
if(_brushColor.isEquals(arg0))
{
_brushColor.copy(arg0);
info("brush color: {0}", this._brushColor);
dispatchEvent(new ModelEvent(ModelEvent.BRUSH_COLOR_CHANGE));
}
return;
}
public Getter function clipartDescriptors() : ru.yandex.kraski.universalpainter.data::ClipartDescriptorsList
{
return this._clipartDescriptors;
}
private function initFonts()
{
var loc2:* = 0;
var loc0:* = Font.enumerateFonts();
var loc1:* = 0;
while(loc1 < loc0.length)
{
loc2 = 0;
while(loc2 < this._fontNamesList.length)
{
if(Font(loc0[loc1]).fontName == this._fontNamesList[loc2])
{
fonts.push(loc0[loc1]);
}
loc2++;
}
loc1++;
}
return;
}
public Getter function backgroundColor() : ru.yandex.utils::YaColor
{
return _backgroundColor.clone();
}
public Setter function currentFont(arg0:flash.text::Font)
{
var loc0:* = this.currentFont;
if(loc0 !== arg0)
{
this._600824168currentFont = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "currentFont", loc0, arg0));
}
return;
}
private Setter function _774720442paintClass(arg0:Class)
{
this._paintClass = arg0;
dispatchEvent(new ModelEvent(ModelEvent.PAINT_CLASS_CHANGE));
return;
}
private Setter function _1897062896clipartColor(arg0:ru.yandex.utils::YaColor)
{
if(_clipartColor.isEquals(arg0))
{
_clipartColor.copy(arg0);
dispatchEvent(new ModelEvent(ModelEvent.CLIPART_COLOR_CHANGE));
}
return;
}
public Setter function currentTool(arg0:String)
{
var loc0:* = this.currentTool;
if(loc0 !== arg0)
{
this._601241265currentTool = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "currentTool", loc0, arg0));
}
return;
}
private Setter function _1203055690currentAssetsType(arg0:int)
{
if(this._currentAssetsType != arg0)
{
info("changing assets type: {0} -> {1}", AssetsType.getName(this._currentAssetsType), AssetsType.getName(arg0));
this._currentAssetsType = arg0;
}
return;
}
public Setter function currentAssetsType(arg0:int)
{
var loc0:* = this.currentAssetsType;
if(loc0 !== arg0)
{
this._1203055690currentAssetsType = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "currentAssetsType", loc0, arg0));
}
return;
}
private Setter function _1360007809paintSize(arg0:int)
{
this._paintSize = arg0;
dispatchEvent(new ModelEvent(ModelEvent.PAINT_SIZE_CHANGE));
return;
}
private Setter function _3046160card(arg0:ru.yandex.kraski.universalpainter.data::Card)
{
this._card = arg0;
dispatchEvent(new ModelEvent(ModelEvent.CARD_CHANGE));
return;
}
private Setter function _1871864201currentClipartsCategory(arg0:ru.yandex.kraski.universalpainter.data::LibraryClipartCategory)
{
this._currentClipartsCategory = arg0;
return;
}
public Getter function activeColor() : ru.yandex.utils::YaColor
{
return _activeColor.clone();
}
public Getter function currentClipartsCategory() : ru.yandex.kraski.universalpainter.data::LibraryClipartCategory
{
return this._currentClipartsCategory;
}
}
public class ClipartVO extends Object
{
//========================= Variables
private var _defaultColor : uint;
private var _photoButtonsNames : Array;
private var _className : String;
private var _colorableMovieClips : Array;
private var _id : String;
private var _briefUrl : String;
//========================= Methods
public static function ClipartVO()
{
return;
}
public function ClipartVO()
{
super();
return;
}
public Setter function defaultColor(arg0:uint)
{
this._defaultColor = arg0;
return;
}
public Setter function className(arg0:String)
{
this._className = arg0;
return;
}
public Getter function briefUrl() : String
{
return this._briefUrl;
}
public Getter function photoButtonsNames() : Array
{
return _photoButtonsNames.concat();
}
public Getter function id() : String
{
return this._id;
}
public Setter function colorableMovieClips(arg0:Array)
{
this._colorableMovieClips = arg0.concat();
return;
}
public Getter function className() : String
{
return this._className;
}
public Getter function defaultColor() : uint
{
return this._defaultColor;
}
public Setter function briefUrl(arg0:String)
{
this._briefUrl = arg0;
return;
}
public Getter function colorableMovieClips() : Array
{
return _colorableMovieClips.concat();
}
public Setter function photoButtonsNames(arg0:Array)
{
this._photoButtonsNames = arg0.concat();
return;
}
public Setter function id(arg0:String)
{
this._id = arg0;
return;
}
}
public class LibraryClipartCategory extends flash.events::EventDispatcher
{
//========================= Variables
private var _categoryItems : Array;
private var _path : String;
private var _name : String;
private var _isDefault : Boolean = False;
//========================= Methods
public static function LibraryClipartCategory()
{
return;
}
public function LibraryClipartCategory(arg0:String, arg1:String)
{
this._categoryItems = [];
super();
this._name = arg0;
this._path = arg1;
return;
}
public Getter function categoryItems() : Array
{
return this._categoryItems;
}
public Getter function name() : String
{
return this._name;
}
public Setter function isDefault(arg0:Boolean)
{
this._isDefault = arg0;
return;
}
public Getter function url() : String
{
return this._path + "/" + "props.xml";
}
public Setter function categoryXML(arg0:XML)
{
xmlList = null;
itemXML = null;
clipartVO = null;
value = arg0;
try {
xmlList = elements("item");
var loc1:* = 0;
var loc2:* = xmlList;
for(loc1 in loc2)
{
itemXML = loc2.__getNextEnumerablePropertyValue();
clipartVO = new ClipartVO();
clipartVO.briefUrl = 0;
clipartVO.className = itemXML.className;
clipartVO.defaultColor = 0;
clipartVO.colorableMovieClips = 0;
clipartVO.photoButtonsNames = 0;
clipartVO.id = itemXML.id;
categoryItems.push(clipartVO);
}
dispatchEvent(new ModelEvent(ModelEvent.XML_LOAD_COMPLETE));
} catch (error:Error) {
loc1 = error;
value = null;
dispatchEvent(new ModelEvent(ModelEvent.XML_PARSE_ERROR));
}
return;
}
public function getClipartVOByClassName(arg0:String) : ru.yandex.kraski.universalpainter.data::ClipartVO
{
var loc1:* = null;
var loc0:* = 0;
while(loc0 < this._categoryItems.length)
{
loc1 = this._categoryItems[loc0];
if(loc1.className == arg0)
{
return loc1;
}
loc0++;
}
return null;
}
public Getter function isDefault() : Boolean
{
return this._isDefault;
}
private Setter function _3373707name(arg0:String)
{
this._name = arg0;
return;
}
public Setter function name(arg0:String)
{
var loc0:* = this.name;
if(loc0 !== arg0)
{
this._3373707name = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "name", loc0, arg0));
}
return;
}
}
public class ClipartDescriptor extends flash.events::EventDispatcher
{
//========================= Variables
private var _defaultColor : uint;
private var _briefURL : String;
private var _clipartClass : Class;
private var _bytesLoaded : Number;
private var _photoButtonsNames : Array;
private var _fullURL : String;
private var _className : String;
private var _loaded : Boolean = False;
private var _colorableMovieClips : Array;
private var _bytesTotal : Number;
private var _id : String;
//========================= Methods
public static function ClipartDescriptor()
{
return;
}
public function ClipartDescriptor()
{
this._colorableMovieClips = [];
this._photoButtonsNames = [];
super();
return;
}
public Getter function loaded() : Boolean
{
return this._loaded;
}
public Setter function loaded(arg0:Boolean)
{
var loc0:* = this.loaded;
if(loc0 !== arg0)
{
this._1097519099loaded = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "loaded", loc0, arg0));
}
return;
}
private Setter function _195384981briefURL(arg0:String)
{
this._briefURL = arg0;
return;
}
private Setter function _511252384fullURL(arg0:String)
{
this._fullURL = arg0;
return;
}
public Getter function briefURL() : String
{
return this._briefURL;
}
public Getter function bytesTotal() : Number
{
return this._bytesTotal;
}
public Getter function id() : String
{
return this._id;
}
public function getNewInstance() : ru.yandex.kraski.universalpainter.visual::LibraryAsset
{
var loc0:* = new this._clipartClass();
loc0.colorableMovieClips = colorableMovieClips;
loc0.color = defaultColor;
return loc0;
}
public Getter function photoButtonsNames() : Array
{
return _photoButtonsNames.concat();
}
public Getter function defaultColor() : uint
{
return this._defaultColor;
}
public Getter function className() : String
{
return this._className;
}
public Setter function bytesLoaded(arg0:Number)
{
var loc0:* = this.bytesLoaded;
if(loc0 !== arg0)
{
this._326983600bytesLoaded = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "bytesLoaded", loc0, arg0));
}
return;
}
public Setter function briefURL(arg0:String)
{
var loc0:* = this.briefURL;
if(loc0 !== arg0)
{
this._195384981briefURL = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "briefURL", loc0, arg0));
}
return;
}
private Setter function _326983600bytesLoaded(arg0:Number)
{
this._bytesLoaded = arg0;
return;
}
public Setter function bytesTotal(arg0:Number)
{
var loc0:* = this.bytesTotal;
if(loc0 !== arg0)
{
this._1382331801bytesTotal = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "bytesTotal", loc0, arg0));
}
return;
}
public Setter function id(arg0:String)
{
var loc0:* = this.id;
if(loc0 !== arg0)
{
this._3355id = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "id", loc0, arg0));
}
return;
}
public Setter function photoButtonsNames(arg0:Array)
{
var loc0:* = this.photoButtonsNames;
if(loc0 !== arg0)
{
this._501712793photoButtonsNames = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "photoButtonsNames", loc0, arg0));
}
return;
}
private Setter function _676255326defaultColor(arg0:uint)
{
this._defaultColor = arg0;
return;
}
private Setter function _1382331801bytesTotal(arg0:Number)
{
this._bytesTotal = arg0;
return;
}
public Setter function fullURL(arg0:String)
{
var loc0:* = this.fullURL;
if(loc0 !== arg0)
{
this._511252384fullURL = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "fullURL", loc0, arg0));
}
return;
}
public Setter function defaultColor(arg0:uint)
{
var loc0:* = this.defaultColor;
if(loc0 !== arg0)
{
this._676255326defaultColor = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "defaultColor", loc0, arg0));
}
return;
}
public Setter function className(arg0:String)
{
var loc0:* = this.className;
if(loc0 !== arg0)
{
this._9888733className = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "className", loc0, arg0));
}
return;
}
public Getter function bytesLoaded() : Number
{
return this._bytesLoaded;
}
private Setter function _501712793photoButtonsNames(arg0:Array)
{
this._photoButtonsNames = arg0.concat();
return;
}
private Setter function _9888733className(arg0:String)
{
this._className = arg0;
return;
}
public Getter function fullURL() : String
{
return this._fullURL;
}
public Setter function colorableMovieClips(arg0:Array)
{
var loc0:* = this.colorableMovieClips;
if(loc0 !== arg0)
{
this._2040945424colorableMovieClips = ;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "colorableMovieClips", loc0, arg0));
}
return;
}
public function toString() : String
{
return "ClipartDescriptor for " + this.className;
}
private Setter function _1097519099loaded(arg0:Boolean)
{
if(! && arg0)
{
this._loaded = arg0;
this._clipartClass = (getDefinitionByName(this.className)) as Class;
}
return;
}
private Setter function _3355id(arg0:String)
{
this._id = arg0;
return;
}
private Setter function _2040945424colorableMovieClips(arg0:Array)
{
this._colorableMovieClips = arg0.concat();
return;
}
public Getter function colorableMovieClips() : Array
{
return _colorableMovieClips.concat();
}
}
public class ClipartDescriptorsList extends Object
{
//========================= Variables
private var _descriptorsList : Array;
//========================= Methods
public static function ClipartDescriptorsList()
{
return;
}
public function ClipartDescriptorsList()
{
super();
this._descriptorsList = [];
return;
}
public Getter function descriptorsList() : Array
{
return this._descriptorsList;
}
public function getDescriptorByFullUrl(arg0:String) : ru.yandex.kraski.universalpainter.data::ClipartDescriptor
{
return this.findDescriptorByField("fullURL", arg0);
}
public function createClipartDescriptor(arg0:String, arg1:ru.yandex.kraski.universalpainter.data::ClipartVO)
{
var loc0:* = arg1.briefUrl;
if(loc0.length == 0)
{
}
var loc1:* = arg0 + "/" + loc0;
if(this.getDescriptorByFullUrl(loc1) != null)
{
}
var loc2:* = new ClipartDescriptor();
new ClipartDescriptor().id = arg1.id;
loc2.briefURL = arg1.briefUrl;
loc2.fullURL = 0;
loc2.className = arg1.className;
loc2.colorableMovieClips = arg1.colorableMovieClips;
loc2.photoButtonsNames = arg1.photoButtonsNames;
loc2.defaultColor = arg1.defaultColor;
_descriptorsList.push(loc2);
return;
}
public function toString() : String
{
return "Clipart Descriptors: " + this._descriptorsList;
}
public Getter function count() : int
{
return this._descriptorsList.length;
}
public function getDescriptorByBriefUrl(arg0:String) : ru.yandex.kraski.universalpainter.data::ClipartDescriptor
{
return this.findDescriptorByField("briefURL", arg0);
}
public function addResourceUrls(arg0:String, arg1:String)
{
if(arg1.length == 0)
{
}
var loc0:* = arg0 + "/" + arg1;
if(this.getDescriptorByFullUrl(loc0) != null)
{
}
var loc1:* = new ClipartDescriptor();
new ClipartDescriptor().briefURL = ;
loc1.fullURL = 0;
_descriptorsList.push(loc1);
return;
}
public function getDescriptorById(arg0:String) : ru.yandex.kraski.universalpainter.data::ClipartDescriptor
{
return this.findDescriptorByField("id", arg0);
}
public function filter(arg0:Array) : Array
{
var loc2:* = 0;
var loc3:* = 0;
var loc4:* = null;
if((!arg0 || arg0.length == 0))
{
return this.toArray();
}
var loc0:* = [];
var loc1:* = 0;
while(loc1 < arg0.length)
{
loc2 = LibraryClipartCategory(arg0[loc1]).categoryItems.length;
loc3 = 0;
while(loc3 < loc2)
{
loc4 = arg0[loc1].categoryItems[loc3];
loc0.push(this.getDescriptorByBriefUrl(loc4.briefUrl));
loc3++;
}
loc1++;
}
return loc0;
}
private function findDescriptorByField(arg0:String, arg1:Object) : ru.yandex.kraski.universalpainter.data::ClipartDescriptor
{
var loc1:* = null;
var loc0:* = 0;
while(loc0 < this.count)
{
loc1 = this._descriptorsList[loc0];
if(this._descriptorsList[loc0][arg0] == arg1)
{
return loc1;
}
loc0++;
}
return null;
}
public function toArray() : Array
{
return _descriptorsList.concat();
}
}
public class AnimationType extends Object
{
//========================= Variables
public static const ALL : String = "all";
public static const NONE : String = "none";
public static const LINES_ONLY : String = "linesOnly";
//========================= Methods
public static function AnimationType()
{
this.NONE = "none";
this.ALL = "all";
this.LINES_ONLY = "linesOnly";
return;
}
public function AnimationType()
{
super();
return;
}
}
public class AssetsType extends Object
{
//========================= Variables
public static const CLIPARTS : int = 0;
public static const PHOTO_FRAMES : int = 3;
public static const FONTS : int = 2;
public static const BACKGROUNDS : int = 1;
private static const NAMES : Array;
//========================= Methods
public static function AssetsType()
{
this.CLIPARTS = 0;
this.BACKGROUNDS = 1;
this.FONTS = 2;
this.PHOTO_FRAMES = 3;
this.NAMES = ["cliparts", "backgrounds", "fonts", "photoframes"];
return;
}
public function AssetsType()
{
super();
return;
}
public static function getName(arg0:int) : String
{
return this.NAMES[arg0];
}
}
public class LibraryClipartData extends flash.events::EventDispatcher
{
//========================= Variables
private var _defaultClipartCategoryIndex : int = 0;
private var _backgroundsCategory : LibraryClipartCategory;
private var _photoframesCategory : LibraryClipartCategory;
private var _clipartsCategories : Array;
//========================= Methods
public static function LibraryClipartData()
{
return;
}
public function LibraryClipartData()
{
this._clipartsCategories = [];
super();
return;
}
public Getter function defaultClipartCategoryIndex() : int
{
return this._defaultClipartCategoryIndex;
}
public Getter function photoframesCategory() : ru.yandex.kraski.universalpainter.data::LibraryClipartCategory
{
return this._photoframesCategory;
}
public Getter function backgroundsCategory() : ru.yandex.kraski.universalpainter.data::LibraryClipartCategory
{
return this._backgroundsCategory;
}
public Setter function photoframesCategory(arg0:ru.yandex.kraski.universalpainter.data::LibraryClipartCategory)
{
this._photoframesCategory = arg0;
return;
}
public Setter function backgroundsCategory(arg0:ru.yandex.kraski.universalpainter.data::LibraryClipartCategory)
{
this._backgroundsCategory = arg0;
return;
}
public function getClipartVOByClassName(arg0:String) : ru.yandex.kraski.universalpainter.data::ClipartVO
{
var loc1:* = null;
var loc0:* = 0;
while(loc0 < this._clipartsCategories.length)
{
loc1 = getClipartVOByClassName(arg0);
if(loc1)
{
return loc1;
}
loc0++;
}
}
public Setter function libraryXML(arg0:XML)
{
xmlList = null;
itemXML = null;
clipartCategoryData = null;
currentCategoryIndex = 0;
value = arg0;
try {
xmlList = elements("category");
currentCategoryIndex = 0;
var loc1:* = 0;
var loc2:* = xmlList;
for(loc1 in loc2)
{
itemXML = loc2.__getNextEnumerablePropertyValue();
clipartCategoryData = new LibraryClipartCategory(itemXML.name, itemXML.path);
clipartCategoryData.isDefault = false;
if(clipartCategoryData.isDefault)
{
this._defaultClipartCategoryIndex = currentCategoryIndex;
}
clipartsCategories.push(clipartCategoryData);
currentCategoryIndex = currentCategoryIndex + 1;
}
dispatchEvent(new ModelEvent(ModelEvent.XML_LOAD_COMPLETE));
} catch (error:Error) {
loc1 = error;
value = null;
dispatchEvent(new ModelEvent(ModelEvent.XML_PARSE_ERROR));
}
return;
}
public Getter function clipartsCategories() : Array
{
return this._clipartsCategories;
}
}
public class EmbeddedFonts extends Object
{
//========================= Variables
private static var Font1 : Class;
private static var Font2 : Class;
//========================= Methods
public static function EmbeddedFonts()
{
this.Font1 = EmbeddedFonts_Font1;
this.Font2 = EmbeddedFonts_Font2;
return;
}
public function EmbeddedFonts()
{
super();
return;
}
}
public class LineDescriptor extends flash.events::EventDispatcher
{
//========================= Variables
private var _points : Array;
private var _height : Number;
private var _width : Number;
private const FILL_DENSITY : Number = 50;
private var _paintClass : Class;
private var _size : Number;
private var _color : uint;
//========================= Methods
public static function LineDescriptor()
{
return;
}
public function LineDescriptor()
{
this._points = [];
super();
return;
}
public Getter function size() : Number
{
return this._size;
}
public function fill()
{
var loc0:* = 0;
while(loc0 < this.FILL_DENSITY)
{
_points.push({"x" : int(Math.random() * this.width), "y" : int(Math.random() * this.height)});
loc0++;
}
dispatchEvent(new LineEvent(LineEvent.FILL));
return;
}
public Setter function size(arg0:Number)
{
this._size = arg0;
return;
}
public Setter function color(arg0:uint)
{
this._color = arg0;
return;
}
private function dispatchAddPointEvent(arg0:Number, arg1:Number)
{
var loc0:* = new LineEvent(LineEvent.ADD_POINT);
loc0.x = ;
loc0.y = ;
dispatchEvent(loc0);
return;
}
public Setter function points(arg0:Array)
{
this._points = arg0.concat();
return;
}
private function distanceBetween(arg0:Number, arg1:Number, arg2:Number, arg3:Number) : Number
{
var loc0:* = arg2 - arg0;
var loc1:* = arg3 - arg1;
return Math.sqrt(loc0 * loc0 + loc1 * loc1);
}
public Setter function width(arg0:Number)
{
this._width = arg0;
return;
}
public Setter function height(arg0:Number)
{
this._height = arg0;
return;
}
public Getter function width() : Number
{
return this._width;
}
public function finish()
{
dispatchEvent(new LineEvent(LineEvent.FINISH));
return;
}
public Getter function color() : uint
{
return this._color;
}
public Getter function height() : Number
{
return this._height;
}
public Getter function points() : Array
{
return this._points;
}
public function addPoint(arg0:Number, arg1:Number)
{
if((this.paintClass is SmoothPaint || this.paintClass is RunningPaint || this.points.length < 1))
{
points.push({"x" : arg0, "y" : arg1});
this.dispatchAddPointEvent(arg0, arg1);
}
else
{
if(this.distanceBetween(arg0, arg1, this.points[this.points.length].x, this.points[this.points.length].y) > this.size)
{
points.push({"x" : arg0, "y" : arg1});
this.dispatchAddPointEvent(arg0, arg1);
}
}
return;
}
public Setter function paintClass(arg0:Class)
{
this._paintClass = arg0;
return;
}
public Getter function paintClass() : Class
{
return this._paintClass;
}
}
public class VisualsWeight extends Object
{
//========================= Variables
public static var PICTURE_WEIGHT : Number = 25;
public static var CLIPART_WEIGHT : Number = 25;
public static var TEXT_WEIGHT : Number = 5;
public static var BACKGROUND_WEIGHT : Number = 0;
public static var PHOTOFRAME_WEIGHT : Number = 20;
//========================= Methods
public static function VisualsWeight()
{
this.BACKGROUND_WEIGHT = 0;
this.CLIPART_WEIGHT = 25;
this.PHOTOFRAME_WEIGHT = 20;
this.PICTURE_WEIGHT = 25;
this.TEXT_WEIGHT = 5;
return;
}
public function VisualsWeight()
{
super();
return;
}
}
public class PhotoframeState extends Object
{
//========================= Variables
public static const DEFAULT : int = 0;
public static const EDIT : int = 1;
//========================= Methods
public static function PhotoframeState()
{
this.DEFAULT = 0;
this.EDIT = 1;
return;
}
public function PhotoframeState()
{
super();
return;
}
}
public class EmbeddedFonts_Font2 extends mx.core::FontAsset
{
//========================= Methods
public static function EmbeddedFonts_Font2()
{
return;
}
public function EmbeddedFonts_Font2()
{
super();
return;
}
}
public class EmbeddedFonts_Font1 extends mx.core::FontAsset
{
//========================= Methods
public static function EmbeddedFonts_Font1()
{
return;
}
public function EmbeddedFonts_Font1()
{
super();
return;
}
}
public class CursorModel extends Object
{
//========================= Variables
private static var _currentInstance : BrushCursorClass;
//========================= Methods
public static function CursorModel()
{
return;
}
public function CursorModel()
{
super();
return;
}
public static function getCurrentInstance() : ru.yandex.kraski.universalpainter.cursors::BrushCursorClass
{
return this._currentInstance;
}
public static function setCurrentInstance(arg0:ru.yandex.kraski.universalpainter.cursors::BrushCursorClass)
{
this._currentInstance = ;
return;
}
}
}
package ru.yandex.kraski.universalpainter.paints.simple
{
public class SimplePaint extends ru.yandex.kraski.universalpainter.paints::Paint
{
//========================= Methods
public static function SimplePaint()
{
return;
}
public function SimplePaint(arg0:uint, arg1:Number)
{
super(arg0, arg1);
return;
}
public function fill(arg0:flash.display::Sprite)
{
this.fill(arg0);
clear();
beginFill(color);
drawRect(0, 0, width, height);
endFill();
return;
}
}
public class SmoothPaint extends ru.yandex.kraski.universalpainter.paints.simple::SimplePaint
{
//========================= Variables
public static var smoothingEnabled : Boolean = True;
//========================= Methods
public static function SmoothPaint()
{
this.smoothingEnabled = true;
return;
}
public function SmoothPaint(arg0:uint, arg1:Number)
{
super(arg0, arg1);
return;
}
public function finish()
{
var loc0:* = null;
var loc1:* = 0;
var loc2:* = 0;
var loc3:* = null;
var loc4:* = NaN;
var loc5:* = NaN;
var loc6:* = null;
this.finish();
if(this.smoothingEnabled && points.length > 2)
{
clear(context);
loc0 = [];
loc1 = 0;
while(loc1 < points.length)
{
loc3 = [points[loc1]];
loc4 = [points[loc1]][0].x;
loc5 = loc3[0].y;
loc1++;
while((loc1 < points.length && !))
{
loc6 = points[loc1];
if((points[loc1].x - loc4 * loc6.x - loc4 + loc6.y - loc5 * loc6.y - loc5 > 100 * size || loc1 == points.length - 1 || points[0].gap))
{
loc4 = loc6.x;
loc5 = loc6.y;
loc3.push(loc6);
}
loc1++;
}
loc0.push(loc3);
}
loc2 = 0;
while(loc2 < loc0.length)
{
this.drawSmoothLine(loc0[loc2]);
loc2++;
}
}
return;
}
private function drawSmoothLine(arg0:Array)
{
var loc0:* = 0;
var loc1:* = NaN;
var loc2:* = NaN;
var loc3:* = NaN;
var loc4:* = NaN;
var loc5:* = NaN;
var loc6:* = NaN;
var loc7:* = NaN;
var loc8:* = NaN;
lineStyle(size, color);
moveTo(arg0[0].x, arg0[0].y);
if(arg0.length < 2)
{
}
else
{
if(arg0.length == 2)
{
lineTo(arg0[1].x, arg0[1].y);
}
else
{
curveTo(arg0[1].x - arg0[2].x - arg0[0].x / 2, arg0[1].y - arg0[2].y - arg0[0].y / 2, arg0[1].x, arg0[1].y);
loc0 = 1;
while(loc0 < arg0.length - 2)
{
loc1 = arg0[loc0].x;
loc2 = arg0[loc0].y;
loc3 = arg0[loc0].x;
loc4 = arg0[loc0].y;
loc5 = arg0[0].x;
loc6 = arg0[0].y;
loc7 = arg0[0].x;
loc8 = arg0[0].y;
curveTo(loc1 + loc5 - loc3 / 6, loc2 + loc6 - loc4 / 6, loc1 + loc5 - loc3 / 6 + loc5 - loc7 - loc1 / 6 / 2, loc2 + loc6 - loc4 / 6 + loc6 - loc8 - loc2 / 6 / 2);
curveTo(loc5 - loc7 - loc1 / 6, loc6 - loc8 - loc2 / 6, loc5, loc6);
loc0++;
}
curveTo(arg0[0].x - arg0[0].x - arg0[arg0.length].x / 2, arg0[0].y - arg0[0].y - arg0[arg0.length].y / 2, arg0[arg0.length].x, arg0[arg0.length].y);
}
}
return;
}
public function appendPoint(arg0:flash.display::Sprite, arg1:Number, arg2:Number)
{
this.appendPoint(arg0, arg1, arg2);
lineStyle(size, color);
if(points.length == 1)
{
moveTo(arg1, arg2);
lineTo(arg1 + 1, arg2 + 1);
}
else
{
lineTo(arg1, arg2);
}
return;
}
}
public class SolidPaint extends ru.yandex.kraski.universalpainter.paints.simple::SimplePaint
{
//========================= Variables
private var point : Object;
//========================= Methods
public static function SolidPaint()
{
return;
}
public function SolidPaint(arg0:uint, arg1:Number)
{
super(arg0, arg1);
return;
}
}
}
package ru.yandex.kraski.universalpainter.view.comps
{
public class HandCursorButton extends mx.controls::Button
{
//========================= Variables
private var _isOver : Boolean = False;
//========================= Methods
public static function HandCursorButton()
{
return;
}
public function HandCursorButton()
{
super();
return;
}
public function initialize()
{
this.initialize();
return;
}
public Setter function enabled(arg0:Boolean)
{
this = arg0;
if(!arg0 && this._isOver)
{
CustomCursorManager.setCursorByName(CursorType.POINTER);
}
return;
}
public function rollOutHandler(arg0:flash.events::MouseEvent)
{
this.rollOutHandler(arg0);
this._isOver = false;
if(arg0.buttonDown)
{
CustomCursorManager.setCursorByName(CursorType.POINTER);
}
return;
}
public function rollOverHandler(arg0:flash.events::MouseEvent)
{
this.rollOverHandler(arg0);
this._isOver = true;
if(this.enabled && !)
{
CustomCursorManager.setCursorByName(CursorType.FINGER);
}
return;
}
}
}
package ru.yandex.kraski.universalpainter.view
{
public class PaintCanvas extends mx.core::UIComponent
{
//========================= Variables
public static const WIDTH : int = 475;
public static const HEIGHT : int = 475;
private var _animation : String;
private var _model : Model;
private var highlightedClipart : Clipart;
private var _resizerContainer : SimpleContainer;
private var _background : Background;
private var _bgColor : YaColor;
private var _visualsContainer : VisualsContainer;
private var _card : Card;
//========================= Methods
public static function PaintCanvas()
{
this.WIDTH = 475;
this.HEIGHT = 475;
return;
}
public function PaintCanvas()
{
this._bgColor = new YaColor(16777215);
super();
this.addEventListener("initialize", this.___PaintCanvas_UIComponent1_initialize);
return;
}
private function card_visualAppendedHandler(arg0:ru.yandex.kraski.universalpainter.events::ModelEvent)
{
visualsContainer.addVisual(arg0.visual, arg0.index);
this.updateVisualAnimation(arg0.visual);
return;
}
public Setter function animation(arg0:String)
{
if(this._animation != arg0)
{
this._animation = arg0;
this.updateCardContentAnimation();
}
return;
}
private function card_swapDepthHandler(arg0:ru.yandex.kraski.universalpainter.events::SwapVisualDepthEvent)
{
visualsContainer.swapChildrenAt(arg0.oldDepth, arg0.newDepth);
return;
}
private function card_changeHandler(arg0:ru.yandex.kraski.universalpainter.events::ModelEvent)
{
this.card = this._model.card;
return;
}
private function createVisualContainer()
{
this.visualsContainer = new VisualsContainer();
visualsContainer.setSize(this.WIDTH, this.HEIGHT);
addChild(this.visualsContainer);
return;
}
public Getter function visualsContainer() : ru.yandex.kraski.universalpainter.view::VisualsContainer
{
return this._visualsContainer;
}
private function removeVisuals()
{
visualsContainer.clean();
this.setBackground(null);
return;
}
private function init()
{
this.createVisualContainer();
this.createResizerContainer();
return;
}
private function card_backgroundChangedHandler(arg0:ru.yandex.kraski.universalpainter.events::ModelEvent)
{
this.setBackground(Background(arg0.visual));
return;
}
public function initialize()
{
this.initialize();
return;
}
private function updateVisualAnimation(arg0:ru.yandex.kraski.universalpainter.visual::Visual)
{
var loc0:* = this._animation;
switch(loc0)
{
case AnimationType.ALL:
arg0.animationEnabled = true;
break;
case AnimationType.NONE:
arg0.animationEnabled = false;
break;
case AnimationType.LINES_ONLY:
arg0.animationEnabled = true;
break;
default:
break;
}
debug("{0} animation {1}", arg0, ( (arg0.animationEnabled)? "enabled" : "disabled" ));
return;
}
public Setter function visualsContainer(arg0:ru.yandex.kraski.universalpainter.view::VisualsContainer)
{
if(this._visualsContainer)
{
}
this._visualsContainer = arg0;
return;
}
private function addModelListeners()
{
_model.addEventListener(ModelEvent.CARD_CHANGE, this.card_changeHandler);
return;
}
public Setter function card(arg0:ru.yandex.kraski.universalpainter.data::Card)
{
if(this._card)
{
this.removeCardListeners();
this.removeVisuals();
this._card = null;
}
this._card = arg0;
if(this._card)
{
this.addCardListeners();
this.addVisuals();
this.updateCardContentAnimation();
}
return;
}
private function updateCardContentAnimation()
{
if(this._card)
{
return;
}
if(this._card.background)
{
this.updateVisualAnimation(this._card.background);
}
var loc0:* = 0;
while(loc0 < this._card.visualsList.length)
{
this.updateVisualAnimation(this._card.visualsList[loc0]);
loc0++;
}
return;
}
public Getter function bgColor() : ru.yandex.utils::YaColor
{
return _bgColor.clone();
}
public function erase(arg0:ru.yandex.kraski.universalpainter.visual::Eraser)
{
return;
}
public Getter function card() : ru.yandex.kraski.universalpainter.data::Card
{
return this._card;
}
public Getter function model() : ru.yandex.kraski.universalpainter.data::Model
{
return this._model;
}
public Getter function background() : ru.yandex.kraski.universalpainter.visual::Background
{
return this._background;
}
public function setBackground(arg0:ru.yandex.kraski.universalpainter.visual::Background)
{
if(this._background)
{
this._background.animationEnabled = false;
removeChild(this._background);
}
this._background = arg0;
if(arg0)
{
addChildAt(this._background, 0);
this.updateVisualAnimation(this._background);
invalidateDisplayList();
}
return;
}
public Getter function animation() : String
{
return this._animation;
}
public function highlight(arg0:ru.yandex.kraski.universalpainter.visual::Clipart)
{
if(this.highlightedClipart == arg0)
{
return;
}
if(this.highlightedClipart)
{
highlightedClipart.hideBox();
}
this.highlightedClipart = arg0;
if(this.highlightedClipart)
{
highlightedClipart.drawBox();
}
return;
}
private function removeModelListeners()
{
_model.removeEventListener(ModelEvent.CARD_CHANGE, this.card_changeHandler);
return;
}
public Setter function bgColor(arg0:ru.yandex.utils::YaColor)
{
info("bgColor = #{0}", arg0);
_bgColor.copy(arg0);
if(this._background)
{
this._background.color = ;
}
return;
}
public function getTopmostEditableVisualUnderPoint(arg0:Number, arg1:Number) : ru.yandex.kraski.universalpainter.visual::EditableVisual
{
return visualsContainer.getTopmostEditableVisualUnderPoint(localToGlobal(new Point(arg0, arg1)));
}
public function ___PaintCanvas_UIComponent1_initialize(arg0:mx.events::FlexEvent)
{
this.init();
return;
}
private function card_cardClearHandler(arg0:ru.yandex.kraski.universalpainter.events::ModelEvent)
{
this.removeVisuals();
return;
}
private function addVisuals()
{
this.setBackground(this.card.background);
var loc0:* = 0;
while(loc0 < this.card.visualsList.length)
{
visualsContainer.addVisual(this.card.visualsList[loc0]);
loc0++;
}
return;
}
public Setter function model(arg0:ru.yandex.kraski.universalpainter.data::Model)
{
if(this._model)
{
}
this._model = arg0;
this.addModelListeners();
this.card = this._model.card;
return;
}
private function card_loadCompleteHandler(arg0:ru.yandex.kraski.universalpainter.events::ModelEvent)
{
this.addVisuals();
return;
}
public function measure()
{
var loc0:* = this.WIDTH;
this.width = this.WIDTH;
this.minWidth = loc0;
loc0 = this.HEIGHT;
this.height = this.HEIGHT;
this.minHeight = loc0;
return;
}
public Getter function resizerContainer() : flash.display::Sprite
{
return this._resizerContainer;
}
public Getter function screenshot() : String
{
var loc0:* = ImageSnapshot.captureImage(this.visualsContainer, 0, new JPEGEncoder(80));
return ImageSnapshot.encodeImageAsBase64(loc0);
}
private function removeCardListeners()
{
_card.removeEventListener(ModelEvent.CARD_CLEAR, this.card_cardClearHandler);
_card.removeEventListener(ModelEvent.VISUAL_APPEND, this.card_visualAppendedHandler);
_card.removeEventListener(ModelEvent.BACKGROUND_CHANGE, this.card_backgroundChangedHandler);
_card.removeEventListener(ModelEvent.XML_LOAD_COMPLETE, this.card_loadCompleteHandler);
_card.removeEventListener(ModelEvent.VISUAL_REMOVE, this.card_visualRemovedHandler);
_card.removeEventListener(SwapVisualDepthEvent.SWAP_DEPTH, this.card_swapDepthHandler);
return;
}
private function addCardListeners()
{
_card.addEventListener(ModelEvent.CARD_CLEAR, this.card_cardClearHandler);
_card.addEventListener(ModelEvent.VISUAL_APPEND, this.card_visualAppendedHandler);
_card.addEventListener(ModelEvent.BACKGROUND_CHANGE, this.card_backgroundChangedHandler);
_card.addEventListener(ModelEvent.XML_LOAD_COMPLETE, this.card_loadCompleteHandler);
_card.addEventListener(ModelEvent.VISUAL_REMOVE, this.card_visualRemovedHandler);
_card.addEventListener(SwapVisualDepthEvent.SWAP_DEPTH, this.card_swapDepthHandler);
return;
}
public function updateDisplayList(arg0:Number, arg1:Number)
{
this.updateDisplayList(arg0, arg1);
graphics.clear();
graphics.beginFill(16777215);
graphics.drawRect(0, 0, arg0, arg1);
graphics.endFill();
if(this._background)
{
this._background.width = ;
this._background.height = ;
}
return;
}
private function card_visualRemovedHandler(arg0:ru.yandex.kraski.universalpainter.events::ModelEvent)
{
arg0.visual.animationEnabled = false;
visualsContainer.removeChild(arg0.visual);
return;
}
private function createResizerContainer()
{
this._resizerContainer = new SimpleContainer();
_resizerContainer.setSize(this.WIDTH, this.HEIGHT);
this._resizerContainer.mouseEnabled = false;
this._resizerContainer.mouseChildren = false;
addChild(this._resizerContainer);
return;
}
}
public class SimpleContainer extends flash.display::Sprite
{
//========================= Methods
public static function SimpleContainer()
{
return;
}
public function SimpleContainer()
{
super();
return;
}
public function clean()
{
DisplayUtil.removeAllChildren(this);
return;
}
public function setSize(arg0:int, arg1:int)
{
graphics.clear();
graphics.beginFill(16777215, 0);
graphics.drawRect(0, 0, arg0, arg1);
graphics.endFill();
this.scrollRect = new Rectangle(0, 0, arg0, arg1);
return;
}
}
public class VisualsContainer extends ru.yandex.kraski.universalpainter.view::SimpleContainer
{
//========================= Methods
public static function VisualsContainer()
{
return;
}
public function VisualsContainer()
{
super();
return;
}
public function clean()
{
var loc0:* = 0;
while(loc0 < numChildren)
{
if(getChildAt(loc0) is Visual)
{
Visual(getChildAt(loc0)).animationEnabled = false;
}
loc0++;
}
this.clean();
return;
}
public function addVisual(arg0:ru.yandex.kraski.universalpainter.visual::Visual, arg1:int = 1342177279)
{
if(arg0 is Eraser)
{
addChild(new Sprite());
}
else
{
this.addVisualToDepth(arg0, arg1);
}
return;
}
public function getTopmostEditableVisualUnderPoint(arg0:flash.geom::Point) : ru.yandex.kraski.universalpainter.visual::EditableVisual
{
var loc1:* = null;
var loc0:* = numChildren - 1;
while(loc0 >= 0)
{
loc1 = (getChildAt(loc0)) as EditableVisual;
if(loc1 && loc1.hitTest(arg0.x, arg0.y))
{
return loc1;
}
loc0 = loc0 - 1;
}
return null;
}
private function addVisualToDepth(arg0:ru.yandex.kraski.universalpainter.visual::Visual, arg1:int)
{
if((arg1 == 255 || arg1 > numChildren))
{
addChild(arg0);
}
else
{
addChildAt(arg0, arg1);
}
return;
}
}
}
package ru.yandex.kraski.universalpainter.services.web
{
public class WebServiceLocatorImpl extends ru.yandex.kraski.universalpainter.services::ServiceLocatorImpl
{
//========================= Methods
public static function WebServiceLocatorImpl()
{
return;
}
public function WebServiceLocatorImpl()
{
super();
this._loadPictureService = new LoadPictureService();
this._saveCardService = new SaveCardService();
this._createNewCardService = new CreateNewCardService();
this._loadCardForEditService = new LoadCardService();
this._loadCardForPlayService = new LoadCardService();
this._loadConfigService = new LoadConfigService();
return;
}
}
public class LoadPictureService extends ru.yandex.kraski.universalpainter.services::KraskiService implements {ru.yandex.kraski.universalpainter.services}::ILoadPictureService
{
//========================= Variables
private var card : Card;
private var file : FileReference;
//========================= Methods
public static function LoadPictureService()
{
return;
}
public function LoadPictureService()
{
super();
return;
}
private function upload_progressHandler(arg0:flash.events::ProgressEvent)
{
this.logProgress("upload picture progress:", arg0.bytesLoaded, arg0.bytesTotal);
return;
}
private function removeDownloadListeners(arg0:flash.display::LoaderInfo)
{
arg0.removeEventListener(Event.COMPLETE, this.download_completeHandler);
arg0.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, this.download_errorHandler);
arg0.removeEventListener(IOErrorEvent.IO_ERROR, this.download_errorHandler);
return;
}
public function load(arg0:ru.yandex.kraski.universalpainter.data::Card)
{
this.card = ;
this.file = new FileReference();
file.addEventListener(Event.CANCEL, this.cancelHandler);
file.addEventListener(Event.SELECT, this.selectHandler);
file.browse([new FileFilter("Изображения", "*.jpg;*.gif;*.png")]);
return;
}
private function upload_securityErrorHandler(arg0:flash.events::SecurityErrorEvent)
{
this.removeUploadListeners();
this.abort(new Fault("UploadPictureSecurityError", arg0.toString()));
return;
}
private function download_errorHandler(arg0:flash.events::IOErrorEvent)
{
this.removeDownloadListeners(LoaderInfo(arg0.target));
this.abort(new Fault("DownloadPictureError", arg0.toString()));
return;
}
private function logProgress(arg0:String, arg1:Number, arg2:Number)
{
info(arg0 + " {0} of {1} Kbytes ({2}%)", toFixed(0), toFixed(0), toFixed(0));
return;
}
private function upload_completeHandler(arg0:flash.events::Event)
{
this.removeUploadListeners();
this.downloadPicture(this.card.picturesTotal);
return;
}
private function selectHandler(arg0:flash.events::Event)
{
this.removeBrowseListeners();
dispatchEvent(new Event("startProgress"));
this.uploadPicture();
return;
}
private function removeBrowseListeners()
{
file.removeEventListener(Event.CANCEL, this.cancelHandler);
file.removeEventListener(Event.SELECT, this.selectHandler);
return;
}
private function download_completeHandler(arg0:flash.events::Event)
{
var loc0:* = LoaderInfo(arg0.target);
this.removeDownloadListeners(loc0);
this.complete(Bitmap(loc0.content));
return;
}
private function upload_ioErrorHandler(arg0:flash.events::IOErrorEvent)
{
this.removeUploadListeners();
this.abort(new Fault("UploadPictureError", arg0.toString()));
return;
}
public function downloadPicture(arg0:int)
{
var loc0:* = new Loader();
addEventListener(Event.COMPLETE, this.download_completeHandler);
addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.download_errorHandler);
addEventListener(IOErrorEvent.IO_ERROR, this.download_errorHandler);
var loc1:* = new URLRequest(URLsBuilder.getPictureDownloadURL(Config.instance.cardHash, arg0));
debug("beginning image loading: {0}", loc1.url);
var loc2:* = new LoaderContext(true, ApplicationDomain.currentDomain);
loc0.load(loc1, loc2);
return;
}
private function cancelHandler(arg0:flash.events::Event)
{
this.removeBrowseListeners();
dispatchEvent(new Event(Event.CANCEL));
return;
}
private function complete(arg0:flash.display::Bitmap)
{
debug("image loaded");
dispatchEvent(ResultEvent.createEvent(new Bitmap(clone(), PixelSnapping.AUTO, true)));
return;
}
private function removeUploadListeners()
{
file.removeEventListener(Event.COMPLETE, this.upload_completeHandler);
file.removeEventListener(IOErrorEvent.IO_ERROR, this.upload_ioErrorHandler);
file.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, this.upload_securityErrorHandler);
file.removeEventListener(ProgressEvent.PROGRESS, this.upload_progressHandler);
return;
}
private function uploadPicture()
{
file.addEventListener(Event.COMPLETE, this.upload_completeHandler);
file.addEventListener(IOErrorEvent.IO_ERROR, this.upload_ioErrorHandler);
file.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.upload_securityErrorHandler);
file.addEventListener(ProgressEvent.PROGRESS, this.upload_progressHandler);
var loc0:* = this.card;
var loc1:* = this.card.picturesTotal + 1;
loc0.picturesTotal = this.card.picturesTotal;
file.upload(new URLRequest(URLsBuilder.getPictureUploadURL(this.card.hash, this.card.picturesTotal)));
return;
}
private function download_progressHandler(arg0:flash.events::ProgressEvent)
{
this.logProgress("download picture progress:", arg0.bytesLoaded, arg0.bytesTotal);
return;
}
private function abort(arg0:mx.rpc::Fault)
{
error(arg0.faultCode, arg0.message);
dispatchEvent(FaultEvent.createEvent(arg0));
return;
}
}
public class CreateNewCardService extends flash.events::EventDispatcher implements {ru.yandex.kraski.universalpainter.services}::ICreateNewCardService
{
//========================= Variables
private static const CLASS_NAME : String = "ru.yandex.kraski.universalpainter.services.CreateNewCardService";
private var newHash : String;
//========================= Methods
public static function CreateNewCardService()
{
this.CLASS_NAME = "ru.yandex.kraski.universalpainter.services.CreateNewCardService";
return;
}
public function CreateNewCardService()
{
super();
return;
}
private function abort(arg0:mx.rpc::Fault)
{
error(arg0.faultCode, arg0.message);
dispatchEvent(FaultEvent.createEvent(arg0));
return;
}
private function validateResult(arg0:XML)
{
var loc0:* = null;
if(length() > 0)
{
this.newHash = arg0.hash;
loc0 = new HTTPService();
loc0.url = 0;
loc0.resultFormat = "e4x";
loc0.addEventListener(ResultEvent.RESULT, this.createCard_resultHandler);
loc0.addEventListener(FaultEvent.FAULT, this.faultHandler);
loc0.send();
}
else
{
dispatchEvent(FaultEvent.createEvent(new Fault("GetNewHashError", "Invalid server response:
" + arg0)));
}
return;
}
private function getNewHash_resultHandler(arg0:mx.rpc.events::ResultEvent)
{
this.removeServiceListeners(HTTPService(arg0.target));
this.validateResult(XML(arg0.result));
return;
}
private function faultHandler(arg0:mx.rpc.events::FaultEvent)
{
this.removeServiceListeners(HTTPService(arg0.target));
dispatchEvent(FaultEvent.createEvent(arg0.fault));
return;
}
private function createCard_resultHandler(arg0:mx.rpc.events::ResultEvent)
{
this.removeServiceListeners(HTTPService(arg0.target));
var loc0:* = XML(arg0.result);
if(loc0.auth.value == "ok")
{
dispatchEvent(ResultEvent.createEvent(this.newHash));
}
else
{
if(loc0.auth.value == "failed")
{
this.abort(new Fault("UserNotAuthorized", "Picture can not be uploaded because user not authorized."));
}
else
{
this.abort(new Fault("InvalidCheckAuthResponse", "Picture can not be uploaded because check auth response " + "is not valid:
" + loc0.toXMLString()));
}
}
return;
}
public function createCard()
{
var loc0:* = new HTTPService();
loc0.url = 0;
loc0.resultFormat = "e4x";
loc0.addEventListener(ResultEvent.RESULT, this.getNewHash_resultHandler);
loc0.addEventListener(FaultEvent.FAULT, this.faultHandler);
loc0.send();
return;
}
private function removeServiceListeners(arg0:mx.rpc.http::HTTPService)
{
arg0.removeEventListener(ResultEvent.RESULT, this.getNewHash_resultHandler);
arg0.removeEventListener(ResultEvent.RESULT, this.createCard_resultHandler);
arg0.removeEventListener(FaultEvent.FAULT, this.faultHandler);
return;
}
}
public class LoadConfigService extends flash.events::EventDispatcher implements {ru.yandex.kraski.universalpainter.services}::ILoadConfigService
{
//========================= Methods
public static function LoadConfigService()
{
return;
}
public function LoadConfigService()
{
super();
return;
}
private function completeHandler(arg0:flash.events::Event)
{
var loc0:* = URLLoader(arg0.target);
this.removeListeners(loc0);
dispatchEvent(ResultEvent.createEvent(XML(loc0.data)));
return;
}
private function removeListeners(arg0:flash.net::URLLoader)
{
arg0.removeEventListener(Event.COMPLETE, this.completeHandler);
arg0.removeEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
arg0.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, this.errorHandler);
return;
}
private function errorHandler(arg0:flash.events::ErrorEvent)
{
this.removeListeners(URLLoader(arg0.target));
dispatchEvent(FaultEvent.createEvent(new Fault("ConfigLoadingError", arg0.toString())));
return;
}
public function load()
{
var loc0:* = new URLLoader();
loc0.addEventListener(Event.COMPLETE, this.completeHandler);
loc0.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
loc0.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.errorHandler);
loc0.load(new URLRequest(URLsBuilder.getConfigURL()));
return;
}
}
public class LoadCardService extends ru.yandex.kraski.universalpainter.services::KraskiService implements {ru.yandex.kraski.universalpainter.services}::ILoadCardService
{
//========================= Variables
private var service : HTTPService;
//========================= Methods
public static function LoadCardService()
{
return;
}
public function LoadCardService()
{
super();
this.service = new HTTPService();
this.service.resultFormat = "text";
return;
}
private function resultHandler(arg0:mx.rpc.events::ResultEvent)
{
this.removeServiceListeners(HTTPService(arg0.target));
var loc0:* = new XML(arg0.result);
if(loc0 && loc0.name() == "card")
{
dispatchEvent(ResultEvent.createEvent(loc0));
}
else
{
error("Invalid card XML: {0}", loc0);
dispatchEvent(FaultEvent.createEvent(new Fault("InvalidCardXML", "Invalid card XML:
" + loc0)));
}
return;
}
private function faultHandler(arg0:mx.rpc.events::FaultEvent)
{
this.removeServiceListeners(HTTPService(arg0.target));
error("Card loading error: {0}", arg0.toString());
dispatchEvent(FaultEvent.createEvent(arg0.fault));
return;
}
public function load(arg0:String)
{
this.service.url = 0;
service.addEventListener(ResultEvent.RESULT, this.resultHandler);
service.addEventListener(FaultEvent.FAULT, this.faultHandler);
service.send();
return;
}
private function removeServiceListeners(arg0:mx.rpc.http::HTTPService)
{
arg0.removeEventListener(ResultEvent.RESULT, this.resultHandler);
arg0.removeEventListener(FaultEvent.FAULT, this.faultHandler);
return;
}
}
public class SaveCardService extends flash.events::EventDispatcher implements {ru.yandex.kraski.universalpainter.services}::ISaveCardService
{
//========================= Variables
private static const CLASS_NAME : String = "ru.yandex.kraski.universalpainter.services.SaveCardService";
private var screenshotSource : DisplayObject;
private var cardHash : String;
//========================= Methods
public static function SaveCardService()
{
this.CLASS_NAME = "ru.yandex.kraski.universalpainter.services.SaveCardService";
return;
}
public function SaveCardService()
{
super();
return;
}
public function save(arg0:ru.yandex.kraski.universalpainter.data::Card, arg1:flash.display::DisplayObject)
{
this.cardHash = arg0.hash;
this.screenshotSource = ;
var loc0:* = new HTTPService();
loc0.url = 0;
loc0.method = "POST";
loc0.resultFormat = "e4x";
loc0.request = ;
loc0.addEventListener(ResultEvent.RESULT, this.save_resultHandler);
loc0.addEventListener(FaultEvent.FAULT, this.save_faultHandler);
loc0.send();
return;
}
private function upload_faultHandler(arg0:mx.rpc.events::FaultEvent)
{
this.removeUploadServiceListeners(HTTPService(arg0.target));
error(arg0.toString());
dispatchEvent(FaultEvent.createEvent(new Fault("UploadScreenshotError", arg0.toString())));
return;
}
private function uploadScreenshot()
{
var loc0:* = ImageSnapshot.captureImage(this.screenshotSource, 0, new JPEGEncoder());
var loc1:* = new HTTPService();
loc1.url = 0;
loc1.resultFormat = "e4x";
loc1.method = "POST";
loc1.request = ;
loc1.addEventListener(ResultEvent.RESULT, this.upload_resultHandler);
loc1.addEventListener(FaultEvent.FAULT, this.upload_faultHandler);
loc1.send();
return;
}
private function save_faultHandler(arg0:mx.rpc.events::FaultEvent)
{
this.removeSaveServiceListeners(HTTPService(arg0.target));
error(arg0.toString());
dispatchEvent(FaultEvent.createEvent(arg0.fault));
return;
}
private function save_resultHandler(arg0:mx.rpc.events::ResultEvent)
{
this.removeSaveServiceListeners(HTTPService(arg0.target));
if(this.cardHash == XML(arg0.result).hash.value)
{
this.uploadScreenshot();
}
else
{
dispatchEvent(FaultEvent.createEvent(new Fault("SaveImageError", "Invalid server response: " + arg0.result)));
}
return;
}
private function removeUploadServiceListeners(arg0:mx.rpc.http::HTTPService)
{
arg0.removeEventListener(ResultEvent.RESULT, this.upload_resultHandler);
arg0.removeEventListener(FaultEvent.FAULT, this.upload_faultHandler);
return;
}
private function removeSaveServiceListeners(arg0:mx.rpc.http::HTTPService)
{
arg0.removeEventListener(ResultEvent.RESULT, this.save_resultHandler);
arg0.removeEventListener(FaultEvent.FAULT, this.save_faultHandler);
return;
}
private function upload_resultHandler(arg0:mx.rpc.events::ResultEvent)
{
this.removeUploadServiceListeners(HTTPService(arg0.target));
dispatchEvent(ResultEvent.createEvent(this.cardHash));
return;
}
}
}
package ru.yandex.kraski.universalpainter.paints.art
{
public class ArtPaint extends ru.yandex.kraski.universalpainter.paints::Paint
{
//========================= Methods
public static function ArtPaint()
{
return;
}
public function ArtPaint(arg0:uint, arg1:Number)
{
super(arg0, arg1);
this._pointWeight = PaintsWeight.ART_PAINT_WEIGHT;
return;
}
public function fill(arg0:flash.display::Sprite)
{
this.fill(arg0);
var loc0:* = 0;
while(loc0 < points.length)
{
appendPoint(arg0, points[loc0].x, points[loc0].y);
loc0++;
}
return;
}
}
}
package ru.yandex.kraski.universalpainter.paints.art.wave
{
public class WavePaint extends ru.yandex.kraski.universalpainter.paints.art::ArtPaint
{
//========================= Variables
private var symbolClass : Class;
private var colorTransform : ColorTransform;
private var curFrame : int = 1;
//========================= Methods
public static function WavePaint()
{
return;
}
public function WavePaint(arg0:uint, arg1:Number, arg2:Class)
{
super(arg0, arg1);
this.symbolClass = arg2;
this.colorTransform = new ColorTransform(1, 1, 1, 1, arg0 >> 16, arg0 >> 8 & 255, arg0 & 255);
return;
}
public function appendPoint(arg0:flash.display::Sprite, arg1:Number, arg2:Number)
{
var loc1:* = null;
this.appendPoint(arg0, arg1, arg2);
var loc0:* = size / 20;
loc1 = new this.symbolClass();
new this.symbolClass().transform.colorTransform = ;
loc1.x = ;
loc1.y = ;
var loc2:* = loc0;
loc1.scaleY = 0;
loc1.scaleX = undefined;
loc1.play();
arg0.addChild(loc1);
return;
}
public function pauseAnimation()
{
this.pauseAnimation();
if(context == null)
{
return;
}
var loc0:* = 0;
while(loc0 < context.numChildren)
{
stop();
loc0++;
}
return;
}
public function resumeAnimation()
{
var loc1:* = null;
this.resumeAnimation();
if(context == null)
{
return;
}
var loc0:* = 0;
while(loc0 < context.numChildren)
{
loc1 = MovieClip(context.getChildAt(loc0));
if(this.curFrame <= 1)
{
this.curFrame = loc1.totalFrames;
}
else
{
var loc2:* = this;
var loc3:* = this.curFrame - 1;
loc2.curFrame = this.curFrame;
}
loc1.gotoAndPlay(this.curFrame);
loc0++;
}
return;
}
}
public class RectPaint extends ru.yandex.kraski.universalpainter.paints.art.wave::WavePaint
{
//========================= Methods
public static function RectPaint()
{
return;
}
public function RectPaint(arg0:uint, arg1:Number)
{
super(arg0, arg1, RectPaintSymbol);
return;
}
}
}
package ru.yandex.kraski.universalpainter.paints.art.snow
{
public class SnowPaint extends ru.yandex.kraski.universalpainter.paints.art::ArtPaint
{
//========================= Variables
public var snowballs : Array;
//========================= Methods
public static function SnowPaint()
{
return;
}
public function SnowPaint(arg0:uint, arg1:Number)
{
super(arg0, arg1);
this.snowballs = [];
return;
}
public function clear(arg0:flash.display::Sprite)
{
this.clear(arg0);
this.snowballs = [];
return;
}
private function enterFrameHandler(arg0:flash.events::Event)
{
var loc2:* = null;
if(_context == null)
{
return;
}
var loc0:* = this.snowballs.length;
var loc1:* = 0;
while(loc1 < loc0)
{
loc2 = this.snowballs[loc1];
if(this.snowballs[loc1].visible)
{
loc2.move();
}
loc1++;
}
return;
}
public function appendPoint(arg0:flash.display::Sprite, arg1:Number, arg2:Number)
{
this.appendPoint(_context, arg1, arg2);
this._pointWeight = PaintsWeight.SNOW_PAINT_WEIGHT;
this.context = ;
var loc0:* = new SnowBuilder();
createSnowForPoint(this, arg1, arg2, color, 1 + size / 10);
return;
}
public function resumeAnimation()
{
this.resumeAnimation();
if(_context)
{
_context.addEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
}
return;
}
public function setNewContext(arg0:flash.display::Sprite)
{
if(_context)
{
_context.removeEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
}
this.setNewContext(arg0);
if(_context)
{
_context.addEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
}
return;
}
public function erase(arg0:flash.display::Sprite, arg1:flash.display::Sprite)
{
var loc2:* = null;
var loc0:* = this.snowballs.length;
var loc1:* = 0;
while(loc1 < loc0)
{
loc2 = this.snowballs[loc1];
if(hitTestObject(arg1))
{
loc2.visible = false;
}
loc1++;
}
return;
}
public function pauseAnimation()
{
this.pauseAnimation();
if(_context)
{
_context.removeEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
}
return;
}
}
public class SnowBall extends flash.display::Shape
{
//========================= Variables
private var scaleIncrement : Number = 0,05;
private var _startX : Number;
private var _startY : Number;
private var snowDistance : Number = -28;
private var _vx : Number;
private var _color : uint;
private var initialScale : Number = 0,5;
private var _vy : Number;
private var _radius : Number;
private var initialAlpha : Number = 1;
//========================= Methods
public static function SnowBall()
{
return;
}
public function SnowBall(arg0:uint, arg1:Number)
{
super();
this._color = arg0;
this._radius = arg1;
var loc0:* = this.initialScale;
this.scaleY = this.initialScale;
this.scaleX = loc0;
this.drawCircle();
return;
}
private function drawCircle()
{
var loc0:* = graphics;
loc0.clear();
loc0.beginFill(this._color);
loc0.drawCircle(0, 0, this._radius);
loc0.endFill();
return;
}
public Setter function vy(arg0:Number)
{
this._vy = arg0;
return;
}
public Getter function vx() : Number
{
return this._vx;
}
public Setter function vx(arg0:Number)
{
this._vx = arg0;
return;
}
public function move()
{
if(y - this._startY > this.snowDistance)
{
this.alpha = this.initialAlpha;
this.x = this._startX;
this.y = this._startY;
var loc0:* = this.initialScale;
this.scaleY = this.initialScale;
this.scaleX = loc0;
}
else
{
this.alpha = 0,98 - y - this._startY / this.snowDistance;
this.x = x + this._vx;
this.y = y + this._vy;
this.scaleX = scaleX + this.scaleIncrement;
this.scaleY = scaleX;
}
return;
}
public Getter function vy() : Number
{
return this._vy;
}
public Setter function startY(arg0:Number)
{
this._startY = arg0;
this.y = arg0;
return;
}
public Getter function startX() : Number
{
return this._startX;
}
public Getter function startY() : Number
{
return this._startY;
}
public Setter function startX(arg0:Number)
{
this._startX = arg0;
this.x = arg0;
return;
}
}
public class SnowBuilder extends Object
{
//========================= Variables
private var _size : int;
private var _color : uint;
private var _currrentSnowIndex : int = 0;
private const SNOW_QUANTITY : int = 4;
private var _interval : int;
private var _context : Sprite;
private const SNOW_DELAY : int = 300;
private var _x : Number;
private var _y : Number;
private var _targetPaint : SnowPaint;
//========================= Methods
public static function SnowBuilder()
{
return;
}
public function SnowBuilder()
{
super();
return;
}
public function createSnowForPoint(arg0:ru.yandex.kraski.universalpainter.paints.art.snow::SnowPaint, arg1:Number, arg2:Number, arg3:uint, arg4:Number)
{
this._targetPaint = arg0;
this._context = arg0.context;
this._x = arg1;
this._y = arg2;
this._color = arg3;
this._size = arg4;
this.addSnow();
this._interval = setInterval(this.addSnow, this.SNOW_DELAY);
return;
}
private function addSnow()
{
var loc1:* = this;
var loc2:* = this._currrentSnowIndex + 1;
loc1._currrentSnowIndex = this._currrentSnowIndex;
if(this._currrentSnowIndex >= this.SNOW_QUANTITY)
{
clearInterval(this._interval);
}
var loc0:* = new SnowBall(this._color, this._size);
loc0.startX = 0;
loc0.startY = 0;
loc0.vx = 0;
loc0.vy = 2;
_context.addChild(loc0);
push(loc0);
return;
}
}
}
package ru.yandex.kraski.universalpainter.paints.art.sprayer
{
public class SprayerPaint extends ru.yandex.kraski.universalpainter.paints.art::ArtPaint
{
//========================= Variables
private var numDots : Number;
private const DOT_PER_POINT : int = 20;
//========================= Methods
public static function SprayerPaint()
{
return;
}
public function SprayerPaint(arg0:uint, arg1:Number)
{
super(arg0, arg1);
this.numDots = arg1 * this.DOT_PER_POINT;
this._pointWeight = PaintsWeight.SPRAYER_PAINT_WEIGHT;
return;
}
private function makeSpot(arg0:Number, arg1:Number, arg2:Number) : flash.display::Sprite
{
var loc0:* = null;
loc0 = new Sprite();
new Sprite().x = 0;
loc0.y = 0;
lineStyle(1, color);
var loc1:* = 0;
while(loc1 < this.numDots)
{
this.drawDot(loc0.graphics, YaNumberUtil.getRandomFromRange(0, 2 * arg2), YaNumberUtil.getRandomFromRange(0, 2 * arg2));
loc1++;
}
return loc0;
}
private function drawDot(arg0:flash.display::Graphics, arg1:Number, arg2:Number)
{
arg0.moveTo(arg1, arg2);
arg0.lineTo(arg1 + 0,1, arg2 + 0,1);
return;
}
public function appendPoint(arg0:flash.display::Sprite, arg1:Number, arg2:Number)
{
this.appendPoint(arg0, arg1, arg2);
var loc0:* = 1 + size;
arg0.addChild(this.makeSpot(arg1, arg2, loc0));
return;
}
public function erase(arg0:flash.display::Sprite, arg1:flash.display::Sprite)
{
var loc0:* = 0;
while(loc0 < arg0.numChildren)
{
if(hitTestObject(arg1))
{
arg0.getChildAt(loc0).visible = false;
}
loc0++;
}
return;
}
}
}
package ru.yandex.kraski.universalpainter.paints.art.random
{
public class RandomPaint extends ru.yandex.kraski.universalpainter.paints.art::ArtPaint
{
//========================= Variables
private var symbolClass : Class;
private var frameToGo : uint = 1;
private var colorTransform : ColorTransform;
//========================= Methods
public static function RandomPaint()
{
return;
}
public function RandomPaint(arg0:Class, arg1:uint, arg2:Number)
{
super(arg1, arg2);
this.symbolClass = arg0;
this.colorTransform = new ColorTransform(1, 1, 1, 1, arg1 >> 16 & 255, arg1 >> 8 & 255, arg1 & 255);
return;
}
public function resumeAnimation()
{
this.resumeAnimation();
if(context == null)
{
return;
}
var loc0:* = 0;
while(loc0 < context.numChildren)
{
play();
loc0++;
}
return;
}
public function appendPoint(arg0:flash.display::Sprite, arg1:Number, arg2:Number)
{
var loc0:* = null;
this.appendPoint(arg0, arg1, arg2);
loc0 = new this.symbolClass();
loc0 = new this.symbolClass();
new this.symbolClass().transform.colorTransform = ;
var loc1:* = points.length * 0,1;
while(loc1 > 1)
{
loc1 = loc1 - 1;
}
loc0.x = ;
loc0.y = ;
var loc3:* = 4 * size / 100;
loc0.scaleY = 0;
loc0.scaleX = undefined;
loc0.rotation = 0;
var loc2:* = int(loc0.totalFrames * loc1);
if(int(loc0.totalFrames * loc1) > loc0.totalFrames)
{
loc2 = loc2 - loc0.totalFrames;
}
loc0.gotoAndPlay(loc2);
arg0.addChild(loc0);
return;
}
public function erase(arg0:flash.display::Sprite, arg1:flash.display::Sprite)
{
var loc0:* = 0;
while(loc0 < arg0.numChildren)
{
if(hitTestObject(arg1))
{
arg0.getChildAt(loc0).visible = false;
}
loc0++;
}
return;
}
public function pauseAnimation()
{
this.pauseAnimation();
if(context == null)
{
return;
}
var loc0:* = 0;
while(loc0 < context.numChildren)
{
stop();
loc0++;
}
return;
}
}
public class HeartPaint extends ru.yandex.kraski.universalpainter.paints.art.random::RandomPaint
{
//========================= Methods
public static function HeartPaint()
{
return;
}
public function HeartPaint(arg0:uint, arg1:Number)
{
super(HeartPaintSymbol, arg0, arg1);
return;
}
}
public class FlowerPaint extends ru.yandex.kraski.universalpainter.paints.art.random::RandomPaint
{
//========================= Methods
public static function FlowerPaint()
{
return;
}
public function FlowerPaint(arg0:uint, arg1:Number)
{
super(FlowerPaintSymbol, arg0, arg1);
this._pointWeight = PaintsWeight.FLOWER_PAINT_WEIGHT;
return;
}
}
public class PentaPaint extends ru.yandex.kraski.universalpainter.paints.art.random::RandomPaint
{
//========================= Methods
public static function PentaPaint()
{
return;
}
public function PentaPaint(arg0:uint, arg1:Number)
{
super(PentaPaintSymbol, arg0, arg1);
return;
}
}
}
package ru.yandex.kraski.universalpainter.paints.dotted
{
public class RunningPaint extends ru.yandex.kraski.universalpainter.paints::Paint
{
//========================= Variables
private var timer : Timer;
private var phase : Number;
//========================= Methods
public static function RunningPaint()
{
return;
}
public function RunningPaint(arg0:uint, arg1:Number)
{
super(arg0, arg1);
return;
}
private function timerHandler(arg0:flash.events::TimerEvent = null)
{
clear();
this.drawDotted(points, this.phase);
this.phase = this.phase + 0,02 % 1;
return;
}
private function drawDotted(arg0:Array, arg1:Number)
{
var loc5:* = NaN;
var loc6:* = NaN;
var loc8:* = null;
var loc9:* = NaN;
var loc10:* = NaN;
var loc11:* = NaN;
var loc12:* = NaN;
var loc13:* = NaN;
debug("drawing from phase {0}", arg1);
var loc0:* = 10 * size;
var loc1:* = arg0[0].x;
var loc2:* = arg0[0].y;
lineStyle(size, color, 1, false, LineScaleMode.NONE, CapsStyle.NONE);
moveTo(loc1, loc2);
var loc3:* = arg1 < 0,5;
var loc4:* = loc0 * arg1 * 2 % 1;
var loc7:* = 0;
while(loc7 < arg0.length)
{
loc8 = arg0[loc7];
loc9 = loc1 - loc8.x;
loc10 = loc2 - loc8.y;
loc11 = Math.sqrt(loc9 * loc9 + loc10 * loc10);
loc12 = 255 * loc10 / loc11;
loc13 = 255 * loc9 / loc11;
while(loc11 > loc4)
{
loc5 = loc1 + loc13 * loc4;
loc6 = loc2 + loc12 * loc4;
this.drawSegment(loc3, loc5, loc6);
loc1 = loc5;
loc2 = loc6;
loc11 = loc11 - loc4;
loc4 = loc0;
loc3 = !loc3;
}
loc1 = loc8.x;
loc2 = loc8.y;
loc4 = loc4 - loc11;
this.drawSegment(loc3, loc1, loc2);
loc7++;
}
return;
}
public function clear(arg0:flash.display::Sprite)
{
this.clear(arg0);
if(this.timer)
{
timer.stop();
timer.removeEventListener(TimerEvent.TIMER, this.timerHandler);
}
return;
}
public function pauseAnimation()
{
this.pauseAnimation();
if(this.timer)
{
timer.stop();
}
return;
}
private function drawSegment(arg0:Boolean, arg1:Number, arg2:Number)
{
if(arg0)
{
lineTo(arg1, arg2);
}
else
{
moveTo(arg1, arg2);
}
return;
}
public function finish()
{
this.finish();
if(points.length > 2)
{
this.phase = 0,5;
this.timer = new Timer(20);
timer.addEventListener(TimerEvent.TIMER, this.timerHandler);
timer.start();
this.timerHandler();
}
return;
}
public Getter function distance() : Number
{
return size * 2;
}
public function resumeAnimation()
{
this.resumeAnimation();
if(this.timer && !)
{
timer.start();
}
return;
}
public function appendPoint(arg0:flash.display::Sprite, arg1:Number, arg2:Number)
{
this.appendPoint(arg0, arg1, arg2);
clear();
this.drawDotted(points, 1);
return;
}
}
}
package ru.yandex.lib.logger.target
{
public class AbstractTarget extends Object implements {mx.logging}::ILoggingTarget, {mx.core}::IMXMLObject
{
//========================= Variables
private var _level : int = 0;
private var _loggerCount : uint = 0;
private var _id : String;
private var _filters : Array;
//========================= Methods
public static function AbstractTarget()
{
return;
}
public function AbstractTarget()
{
this._filters = ["*"];
super();
this._id = UIDUtil.createUID();
return;
}
public Getter function filters() : Array
{
return this._filters;
}
public Getter function level() : int
{
return this._level;
}
public Setter function level(arg0:int)
{
Log.removeTarget(this);
this._level = arg0;
Log.addTarget(this);
return;
}
public function removeLogger(arg0:mx.logging::ILogger)
{
if(arg0)
{
var loc0:* = this;
var loc1:* = this._loggerCount - 1;
loc0._loggerCount = this._loggerCount;
arg0.removeEventListener(LogEvent.LOG, this.logHandler);
}
return;
}
public function logEvent(arg0:mx.logging::LogEvent)
{
return;
}
public function initialized(arg0:Object, arg1:String)
{
this._id = arg1;
Log.addTarget(this);
return;
}
public function addLogger(arg0:mx.logging::ILogger)
{
if(arg0)
{
var loc0:* = this;
var loc1:* = this._loggerCount + 1;
loc0._loggerCount = this._loggerCount;
arg0.addEventListener(LogEvent.LOG, this.logHandler);
}
return;
}
public Getter function id() : String
{
return this._id;
}
private function logHandler(arg0:mx.logging::LogEvent)
{
if(arg0.level >= this.level)
{
this.logEvent(arg0);
}
return;
}
public Setter function filters(arg0:Array)
{
var loc0:* = null;
var loc1:* = 0;
var loc2:* = null;
var loc3:* = 0;
if(arg0 && arg0.length > 0)
{
loc3 = 0;
while(loc3 < arg0.length)
{
loc0 = arg0[loc3];
if(Log.hasIllegalCharacters(loc0))
{
loc2 = "chars invalid";
}
loc1 = loc0.indexOf("*");
if(loc1 >= 0 && !)
{
loc2 = "char placement";
}
loc3 = loc3 + 1;
}
}
else
{
arg0 = ["*"];
}
if(this._loggerCount > 0)
{
Log.removeTarget(this);
this._filters = arg0;
Log.addTarget(this);
}
else
{
this._filters = arg0;
}
return;
}
}
public class LineFormattedTarget extends ru.yandex.lib.logger.target::AbstractTarget
{
//========================= Variables
public var includeCategory : Boolean;
public var fieldSeparator : String = " ";
public var includeTime : Boolean;
public var includeLevel : Boolean;
public var includeDate : Boolean;
//========================= Methods
public static function LineFormattedTarget()
{
return;
}
public function LineFormattedTarget()
{
super();
this.includeTime = false;
this.includeDate = false;
this.includeCategory = false;
this.includeLevel = false;
return;
}
private function padTime(arg0:Number, arg1:Boolean = false) : String
{
if(arg1)
{
if(arg0 < 10)
{
return "00" + arg0.toString();
}
if(arg0 < 100)
{
return "0" + arg0.toString();
}
return arg0.toString();
}
else
{
}
return ( (arg0 > 9)? arg0.toString() : "0" + arg0.toString() );
}
public function logEvent(arg0:mx.logging::LogEvent)
{
var loc3:* = null;
var loc4:* = null;
var loc5:* = null;
var loc0:* = "";
if((this.includeDate || this.includeTime))
{
loc3 = new Date();
if(this.includeDate)
{
loc0 = loc3.getFullYear() + "-";
loc4 = toString();
if(Number(loc3.getMonth() + 1) < 10)
{
loc4 = "0" + loc4;
}
loc5 = toString();
if(loc3.getDate() < 10)
{
loc5 = "0" + loc5;
}
loc0 = loc0 + loc4 + "-" + loc5 + this.fieldSeparator;
}
if(this.includeTime)
{
loc0 = loc0 + this.padTime(loc3.getHours()) + ":" + this.padTime(loc3.getMinutes()) + ":" + this.padTime(loc3.getSeconds()) + "." + this.padTime(loc3.getMilliseconds(), true) + this.fieldSeparator;
}
}
var loc1:* = "";
if(this.includeLevel)
{
loc1 = "[" + LogEvent.getLevelString(arg0.level) + "]" + this.fieldSeparator;
}
var loc2:* = ( (this.includeCategory)? ILogger(arg0.target).category + this.fieldSeparator : "" );
this.internalLog(loc0 + loc1 + loc2 + arg0.message);
return;
}
public function internalLog(arg0:String)
{
return;
}
}
public class ConsoleTarget extends ru.yandex.lib.logger.target::LineFormattedTarget
{
//========================= Variables
private var console : Console;
private var currentLevel : int;
//========================= Methods
public static function ConsoleTarget()
{
return;
}
public function ConsoleTarget(arg0:ru.yandex.lib.logger.view::Console)
{
super();
this.includeTime = true;
this.includeDate = true;
this.includeCategory = false;
this.includeLevel = true;
this.console = arg0;
return;
}
public function logEvent(arg0:mx.logging::LogEvent)
{
this.currentLevel = arg0.level;
this.logEvent(arg0);
return;
}
public function internalLog(arg0:String)
{
var loc0:* = 0;
var loc1:* = this.currentLevel;
switch(loc1)
{
case LogEventLevel.DEBUG:
loc0 = 0;
break;
case LogEventLevel.INFO:
loc0 = 13056;
break;
case LogEventLevel.WARN:
loc0 = 255;
break;
case LogEventLevel.ERROR:
loc0 = 10040064;
break;
case LogEventLevel.FATAL:
loc0 = 16711680;
break;
default:
loc0 = 0;
break;
}
console.addMessage(arg0, loc0);
return;
}
}
public class UIDUtil extends Object
{
//========================= Variables
private static const ALPHA_CHAR_CODES : Array;
//========================= Methods
public static function UIDUtil()
{
this.ALPHA_CHAR_CODES = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70];
return;
}
public function UIDUtil()
{
super();
return;
}
public static function createUID() : String
{
var loc2:* = 0;
var loc3:* = 0;
var loc0:* = new Array(36);
var loc1:* = 0;
loc2 = 0;
while(loc2 < 8)
{
loc1 = loc1 + 1;
var loc6:* = loc1;
loc0[loc1] = this.ALPHA_CHAR_CODES[0];
loc2++;
}
loc2 = 0;
while(loc2 < 3)
{
loc1 = loc1 + 1;
loc6 = loc1;
loc0[loc1] = 45;
loc3 = 0;
while(loc3 < 4)
{
loc1 = loc1 + 1;
var loc7:* = loc1;
loc0[loc1] = this.ALPHA_CHAR_CODES[0];
loc3++;
}
loc2++;
}
loc1 = loc1 + 1;
loc6 = loc1;
loc0[loc1] = 45;
var loc4:* = getTime();
var loc5:* = substr(248);
loc2 = 0;
while(loc2 < 8)
{
loc1 = loc1 + 1;
loc7 = loc1;
loc0[loc1] = 0;
loc2++;
}
loc2 = 0;
while(loc2 < 4)
{
loc1 = loc1 + 1;
loc7 = loc1;
loc0[loc1] = this.ALPHA_CHAR_CODES[0];
loc2++;
}
return apply(null, loc0);
}
}
}
package ru.yandex.lib.logger.view
{
public class Console extends flash.display::Sprite
{
//========================= Variables
private var maxCountRowsTextField : TextField;
private var scrollBar : ScrollBar;
private var CloseButtonSkin : Class;
private var CopyButtonSkin : Class;
private var TextBackgroundSkin : Class;
private var ConsoleBackgroundSkin : Class;
private var _maxCountRows : int = 30;
private var logTextField : TextField;
private var background : Sprite;
private var copy : Sprite;
private var logMessages : Array;
private var close : Sprite;
private var textBackground : Sprite;
private var logTextMessages : Array;
//========================= Methods
public static function Console()
{
return;
}
public function Console()
{
this.logMessages = new Array();
this.logTextMessages = new Array();
this.ConsoleBackgroundSkin = Console_ConsoleBackgroundSkin;
this.TextBackgroundSkin = Console_TextBackgroundSkin;
this.CloseButtonSkin = Console_CloseButtonSkin;
this.CopyButtonSkin = Console_CopyButtonSkin;
super();
addEventListener(Event.ADDED_TO_STAGE, this.addedToStageHandler);
return;
}
public function setSize()
{
this.background.width = 0;
this.background.height = 0;
this.textBackground.width = 0;
this.textBackground.height = 0;
this.textBackground.x = 10;
this.textBackground.y = 20;
this.logTextField.width = this.textBackground.width;
this.logTextField.height = this.textBackground.height;
this.logTextField.x = this.textBackground.x;
this.logTextField.y = this.textBackground.y;
this.scrollBar.x = 0;
this.scrollBar.y = this.textBackground.y;
scrollBar.setHeight(this.textBackground.height);
this.close.x = 0;
this.close.y = 5;
this.copy.x = 0;
this.copy.y = 5;
this.maxCountRowsTextField.x = 10;
this.maxCountRowsTextField.y = 5;
this.x = stage.stageWidth - this.background.width / 2;
this.y = stage.stageHeight - this.background.height / 2;
return;
}
private Getter function logMessagesLength() : int
{
var loc0:* = this.maxCountRows;
if(this.logMessages.length < loc0)
{
loc0 = this.logMessages.length;
}
return loc0;
}
public Setter function maxCountRows(arg0:int)
{
var loc0:* = null;
if(arg0 > 0)
{
this._maxCountRows = arg0;
loc0 = SharedObject.getLocal("yalogger");
loc0.data.size = 30;
loc0.flush();
}
return;
}
public Getter function maxCountRows() : int
{
return this._maxCountRows;
}
private function maxCountRowsTextField_keyDownHandler(arg0:flash.events::KeyboardEvent)
{
var loc0:* = 0;
if(arg0.keyCode == Keyboard.ENTER)
{
loc0 = int(this.maxCountRowsTextField.text);
this.maxCountRows = loc0;
}
return;
}
private function getHTMLSpecial(arg0:String) : String
{
return replace(new RegExp(">", "gm"), "&gt;");
}
private function createChildren()
{
this.background = new this.ConsoleBackgroundSkin();
addChild(this.background);
this.textBackground = new this.TextBackgroundSkin();
addChild(this.textBackground);
this.logTextField = new TextField();
this.logTextField.selectable = true;
this.logTextField.multiline = true;
this.logTextField.wordWrap = true;
this.logTextField.htmlText = logHTMLText;
addChild(this.logTextField);
this.scrollBar = new ScrollBar();
addChild(this.scrollBar);
this.close = new this.CloseButtonSkin();
addChild(this.close);
close.addEventListener(MouseEvent.CLICK, this.close_mouseClickHandler);
this.visible = false;
this.copy = new this.CopyButtonSkin();
addChild(this.copy);
this.maxCountRowsTextField = new TextField();
this.maxCountRowsTextField.type = TextFieldType.INPUT;
this.maxCountRowsTextField.width = 50;
this.maxCountRowsTextField.height = 14;
var loc0:* = new TextFormat(null, 10);
this.maxCountRowsTextField.defaultTextFormat = new TextFormat(null, 10);
this.maxCountRowsTextField.border = true;
this.maxCountRowsTextField.background = true;
this.maxCountRowsTextField.backgroundColor = 16777215;
addChild(this.maxCountRowsTextField);
var loc1:* = SharedObject.getLocal("yalogger");
if(! && !)
{
this._maxCountRows = loc1.data.size;
}
this.maxCountRowsTextField.text = 0;
copy.addEventListener(MouseEvent.CLICK, this.copy_mouseClickHandler);
maxCountRowsTextField.addEventListener(KeyboardEvent.KEY_DOWN, this.maxCountRowsTextField_keyDownHandler);
scrollBar.addEventListener(ScrollBarEvent.UPDATE_SCROLL_POSITION, this.scrollBar_updateScrollPositionHandler);
logTextField.addEventListener(MouseEvent.MOUSE_WHEEL, this.logTextField_mouseWhellHandler);
return;
}
private function copy_mouseClickHandler(arg0:flash.events::MouseEvent)
{
System.setClipboard(this.logTextForClipboard);
this.logTextField.stage.focus = ;
logTextField.setSelection(0, this.logTextField.text.length);
return;
}
private function getFormattedMessage(arg0:String, arg1:uint) : String
{
return "<p><font color='#" + arg1.toString(16) + "'>" + this.getHTMLSpecial(arg0) + "</font></p>";
}
private function logTextField_mouseWhellHandler(arg0:flash.events::Event)
{
this.scrollBar.position = this.logTextField.scrollV;
return;
}
public function addMessage(arg0:String, arg1:uint = 0)
{
logTextMessages.push(arg0);
if(this.logTextMessages.length > this.maxCountRows)
{
logTextMessages.shift();
}
logMessages.push(this.getFormattedMessage(arg0, arg1));
if(this.logMessages.length > this.maxCountRows)
{
logMessages.shift();
}
if(this.logTextField != null)
{
this.logTextField.htmlText = logHTMLText;
this.logTextField.scrollV = this.logTextField.maxScrollV;
if(this.logTextField.maxScrollV > 1)
{
this.scrollBar.rowsPerScreen = 0;
this.scrollBar.numRows = this.logTextField.numLines;
this.scrollBar.position = this.logTextField.numLines;
}
}
return;
}
private function addedToStageHandler(arg0:flash.events::Event)
{
this.createChildren();
this.setSize();
return;
}
private function close_mouseClickHandler(arg0:flash.events::MouseEvent)
{
this.visible = false;
return;
}
private function scrollBar_updateScrollPositionHandler(arg0:ru.yandex.lib.logger.events::ScrollBarEvent)
{
this.logTextField.scrollV = this.scrollBar.position;
return;
}
private Getter function logHTMLText() : String
{
var loc0:* = "";
var loc1:* = 0;
while(loc1 < this.logMessagesLength)
{
loc0 = loc0 + this.logMessages[loc1];
loc1++;
}
return loc0;
}
private Getter function logTextForClipboard() : String
{
var loc0:* = "";
var loc1:* = 0;
while(loc1 < this.logMessagesLength)
{
loc0 = loc0 + this.logTextMessages[loc1] + "
";
loc1++;
}
return loc0;
}
}
public class Console_CopyButtonSkin extends mx.core::SpriteAsset
{
//========================= Methods
public static function Console_CopyButtonSkin()
{
return;
}
public function Console_CopyButtonSkin()
{
super();
return;
}
}
public class Console_ConsoleBackgroundSkin extends mx.core::SpriteAsset
{
//========================= Methods
public static function Console_ConsoleBackgroundSkin()
{
return;
}
public function Console_ConsoleBackgroundSkin()
{
super();
return;
}
}
public class Console_TextBackgroundSkin extends mx.core::SpriteAsset
{
//========================= Methods
public static function Console_TextBackgroundSkin()
{
return;
}
public function Console_TextBackgroundSkin()
{
super();
return;
}
}
public class Console_CloseButtonSkin extends mx.core::SpriteAsset
{
//========================= Methods
public static function Console_CloseButtonSkin()
{
return;
}
public function Console_CloseButtonSkin()
{
super();
return;
}
}
}
package ru.yandex.kraski.universalpainter.visual
{
public class VisualFactory extends Object
{
//========================= Variables
private var data : ClipartDescriptorsList;
//========================= Methods
public static function VisualFactory()
{
return;
}
public function VisualFactory(arg0:ru.yandex.kraski.universalpainter.data::ClipartDescriptorsList)
{
super();
this.data = arg0;
return;
}
private function picture_deserializingCompleteHandler(arg0:ru.yandex.kraski.universalpainter.events::VisualEvent)
{
var loc0:* = Picture(arg0.target);
loc0.removeEventListener(VisualEvent.DESERIALIZING_COMPLETE, this.picture_deserializingCompleteHandler);
if(loc0.content)
{
loc0.content = 0;
}
return;
}
/* here's the magic ;-) */
public function create(arg0:XML) : ru.yandex.kraski.universalpainter.visual::Visual
{
coords = null;
xy = null;
clipartDescriptor = null;
clipart = null;
line = null;
lineDescriptor = null;
text = null;
picture = null;
photoframeDescriptor = null;
photoframe = null;
picNode = null;
pic = null;
photoframePicture = null;
eraser = null;
xml = arg0;
i = 0;
if(xml.type == "Clipart")
{
clipartDescriptor = data.getDescriptorByBriefUrl(xml.resource.src);
if(clipartDescriptor != null)
{
clipart = new Clipart(clipartDescriptor);
deserialize(xml);
}
return clipart;
}
if(xml.type == "Line")
{
line = new Line();
lineDescriptor = new LineDescriptor();
lineDescriptor.color = 0;
lineDescriptor.size = xml.paint.size;
lineDescriptor.paintClass = 0;
coords = split(";");
i = 0;
while(i < coords.length)
{
xy = split(",");
addPoint(xy[0], xy[1]);
i = i + 1;
}
finish();
line.lineData = lineDescriptor;
deserialize(xml);
return line;
}
if(xml.type == "Text")
{
text = new Text();
deserialize(xml);
return text;
}
/* HERE! */
if(xml.type == "Picture")
{
picture = new Picture();
addEventListener(VisualEvent.DESERIALIZING_COMPLETE, this.picture_deserializingCompleteHandler);
deserialize(xml);
return picture;
}
if(xml.type == "Photoframe")
{
photoframeDescriptor = data.getDescriptorByBriefUrl(xml.resource.src);
if(photoframeDescriptor != null)
{
photoframe = new Photoframe(photoframeDescriptor);
deserialize(xml);
var loc1:* = 0;
var loc4:* = 0;
var loc5:* = xml.photos.visual;
var loc3:* = new XMLList("");
for(loc4 in loc5)
{
var loc6:* = loc5.__getNextEnumerablePropertyValue();
var loc7:* = loc5.__getNextEnumerablePropertyValue();
if(type == "PhotoframePicture")
{
loc3.loc6 = 0;
}
}
var loc2:* = loc3;
for(loc1 in loc2)
{
picNode = loc2.__getNextEnumerablePropertyValue();
pic = (this.create(picNode[0])) as PhotoframePicture;
addPicture(pic);
}
}
return photoframe;
}
if(xml.type == "PhotoframePicture")
{
photoframePicture = new PhotoframePicture();
deserialize(xml);
photoframePicture.content = 0;
return photoframePicture;
}
if(xml.type == "Eraser")
{
eraser = new Eraser();
coords = split(";");
i = 0;
while(i < coords.length)
{
if(coords[i] != "")
{
xy = split(",");
addPoint(Number(xy[0]), Number(xy[1]));
}
i = i + 1;
}
updateAfterLoad();
return eraser;
}
return null;
}
}
public class Visual extends flash.display::Sprite
{
//========================= Variables
private var _depth : int = 0;
public var _weight : Number = 0;
private var _creationOrder : int = 0;
private var _animationEnabled : Boolean = True;
//========================= Methods
public static function Visual()
{
return;
}
public function Visual()
{
super();
return;
}
public Setter function animationEnabled(arg0:Boolean)
{
if(this._animationEnabled != arg0)
{
this._animationEnabled = arg0;
if(this._animationEnabled)
{
this.resumeAnimation();
}
else
{
this.pauseAnimation();
}
}
return;
}
public Getter function depth() : int
{
return this._depth;
}
public Setter function depth(arg0:int)
{
this._depth = arg0;
return;
}
public function clear()
{
return;
}
public function showDrawingProcess()
{
return;
}
public Setter function color(arg0:ru.yandex.utils::YaColor)
{
return;
}
public function resumeAnimation()
{
return;
}
public Getter function animationEnabled() : Boolean
{
return this._animationEnabled;
}
public Setter function creationOrder(arg0:int)
{
this._creationOrder = arg0;
return;
}
public function deserialize(arg0:XML)
{
this.x = arg0.transform.x;
this.y = arg0.transform.y;
this.scaleX = arg0.transform.scaleX;
this.scaleY = arg0.transform.scaleY;
this.rotation = arg0.transform.rotation;
return;
}
public Getter function className() : String
{
var loc0:* = getQualifiedClassName(this);
loc0 = loc0.substring(loc0.search("::") + 2);
return loc0;
}
public function showDrawingResult()
{
return;
}
public function serialize() : XML
{
return new XML("<visual type=\"" + Escape(this.className) + "\" creationOrder=\"" + Escape(this.creationOrder) + "\" depth=\"" + Escape(this.depth) + "\">
" + "<transform x=\"" + Escape(x) + "\" y=\"" + Escape(y) + "\" scaleX=\"" + Escape(scaleX) + "\" scaleY=\"" + Escape(scaleY) + "\" rotation=\"" + Escape(rotation) + "\"/>" + "
</visual>");
}
public Getter function color() : ru.yandex.utils::YaColor
{
return new YaColor();
}
public function pauseAnimation()
{
return;
}
public Getter function creationOrder() : int
{
return this._creationOrder;
}
public function distance(arg0:Number, arg1:Number) : Number
{
return NaN;
}
public Getter function weight() : Number
{
return this._weight;
}
public function destroy()
{
return;
}
}
public class Line extends ru.yandex.kraski.universalpainter.visual::Visual
{
//========================= Variables
private var _pointIndex : int;
private var timer : Timer;
private var _savedPoints : Array;
private var _paintClass : Class;
private var _lineData : LineDescriptor;
private var _paint : Paint;
private var _size : Number;
private var _color : YaColor;
private const DRAWING_INTERVAL : Number = 20;
//========================= Methods
public static function Line()
{
return;
}
public function Line()
{
this._color = new YaColor();
this.timer = new Timer(this.DRAWING_INTERVAL);
super();
this.mouseChildren = false;
this.mouseEnabled = false;
return;
}
private function destroyCurrentPaint()
{
if(this._paint)
{
_paint.clear(this);
this._paint = null;
}
return;
}
private function fillHandler(arg0:ru.yandex.kraski.universalpainter.events::LineEvent)
{
this.restorePaint();
return;
}
public function clear()
{
this.clear();
if(this.timer)
{
this.stopTimer();
}
return;
}
public function showDrawingProcess()
{
this.showDrawingProcess();
this._pointIndex = 255;
this._savedPoints = concat();
this.setPoints([]);
timer.addEventListener(TimerEvent.TIMER, this.timerHandler);
timer.start();
this.timerHandler();
return;
}
private function finishPaint()
{
_paint.finish();
return;
}
private function timerHandler(arg0:flash.events::TimerEvent = null)
{
if(this._pointIndex >= this._savedPoints.length - 1)
{
this.stopTimer();
this.finishPaint();
dispatchEvent(new VisualEvent(VisualEvent.PLAY_FINISH));
}
else
{
var loc0:* = this;
var loc1:* = this._pointIndex + 1;
loc0._pointIndex = this._pointIndex;
_paint.appendPoint(this, this._savedPoints._pointIndex.x, this._savedPoints._pointIndex.y);
}
return;
}
public function resumeAnimation()
{
this.resumeAnimation();
_paint.resumeAnimation();
return;
}
private function removeListeners()
{
_lineData.removeEventListener(LineEvent.ADD_POINT, this.updateLineHandler);
_lineData.removeEventListener(LineEvent.FILL, this.fillHandler);
_lineData.removeEventListener(LineEvent.FINISH, this.finishHandler);
return;
}
private function updateProperties()
{
this._size = this.lineData.size;
this._paintClass = this.lineData.paintClass;
_color.copy(new YaColor(this.lineData.color));
this._paint = new this._paintClass(this._color.value, this._size);
this._paint.width = this.lineData.width;
this._paint.height = this.lineData.height;
this.restorePaint();
return;
}
public function showDrawingResult()
{
this.showDrawingResult();
this.stopTimer();
this.setPoints(this._savedPoints);
return;
}
private function stopTimer()
{
timer.stop();
timer.removeEventListener(TimerEvent.TIMER, this.timerHandler);
return;
}
private function addListeners()
{
_lineData.addEventListener(LineEvent.ADD_POINT, this.updateLineHandler);
_lineData.addEventListener(LineEvent.FILL, this.fillHandler);
_lineData.addEventListener(LineEvent.FINISH, this.finishHandler);
return;
}
public function serialize() : XML
{
var loc0:* = this.serialize();
var loc1:* = "";
var loc2:* = 0;
while(loc2 < this.lineData.points.length)
{
loc1 = loc1 + this.lineData.points[loc2].x + "," + this.lineData.points[loc2].y;
if(loc2 != this.lineData.points.length - 1)
{
loc1 = loc1 + ";";
}
loc2++;
}
loc0.points = 0;
loc0.paint = this._paint.xml;
return loc0;
}
public Getter function lineData() : ru.yandex.kraski.universalpainter.data::LineDescriptor
{
return this._lineData;
}
private function setPoints(arg0:Array)
{
this.lineData.points = 0;
this.destroyCurrentPaint();
this.updateProperties();
return;
}
private function updateLineHandler(arg0:ru.yandex.kraski.universalpainter.events::LineEvent)
{
_paint.appendPoint(this, arg0.x, arg0.y);
return;
}
public function pauseAnimation()
{
this.pauseAnimation();
_paint.pauseAnimation();
return;
}
private function restorePaint()
{
_paint.clear(this);
var loc0:* = 0;
while(loc0 < this.lineData.points.length)
{
_paint.appendPoint(this, this.lineData.points[loc0].x, this.lineData.points[loc0].y);
loc0++;
}
this.finishPaint();
return;
}
private function finishHandler(arg0:ru.yandex.kraski.universalpainter.events::LineEvent)
{
this.finishPaint();
return;
}
public Getter function weight() : Number
{
return this._paint.pointWeight * this.lineData.points.length;
}
public Setter function lineData(arg0:ru.yandex.kraski.universalpainter.data::LineDescriptor)
{
if(this._lineData)
{
this.removeListeners();
}
this._lineData = arg0;
this.addListeners();
this.updateProperties();
return;
}
public function deserialize(arg0:XML)
{
this.deserialize(arg0);
return;
}
}
public class Background extends ru.yandex.kraski.universalpainter.visual::Visual
{
//========================= Variables
public var _descriptor : ClipartDescriptor;
public var clipart : LibraryAsset;
public var _color : YaColor;
private var _playTimer : Timer;
//========================= Methods
public static function Background()
{
return;
}
public function Background(arg0:ru.yandex.kraski.universalpainter.data::ClipartDescriptor)
{
this._color = new YaColor();
this._playTimer = new Timer(50);
super();
this.mouseChildren = false;
this.mouseEnabled = false;
this._weight = VisualsWeight.BACKGROUND_WEIGHT;
this.descriptor = arg0;
this.clipart = arg0.getNewInstance();
this.mouseChildren = false;
addChild(this.clipart);
this.clipart.colorableMovieClips = arg0.colorableMovieClips;
this.clipart.color = arg0.defaultColor;
this.color = new YaColor(this.clipart.color);
return;
}
private function startTimer()
{
_playTimer.addEventListener(TimerEvent.TIMER, this.playTimerHandler);
_playTimer.start();
return;
}
public Setter function color(arg0:ru.yandex.utils::YaColor)
{
_color.copy(arg0);
this.clipart.color = this._color.value;
return;
}
public function clear()
{
this.clear();
if(this._playTimer)
{
this.stopTimer();
}
return;
}
private function setEffect()
{
this.alpha = 0;
this.startTimer();
return;
}
public function showDrawingProcess()
{
this.showDrawingProcess();
this.setEffect();
return;
}
public function resumeAnimation()
{
this.resumeAnimation();
clipart.play();
return;
}
private function playTimerHandler(arg0:flash.events::TimerEvent)
{
if(alpha >= 1)
{
this.clearEffect();
dispatchEvent(new VisualEvent(VisualEvent.PLAY_FINISH));
}
else
{
this.alpha = alpha + 0,05;
}
return;
}
public Setter function descriptor(arg0:ru.yandex.kraski.universalpainter.data::ClipartDescriptor)
{
this._descriptor = arg0;
return;
}
public function serialize() : XML
{
var loc0:* = new XML("<background type=\"" + Escape(className) + "\"/>");
loc0.appendChild(new XML("<resource src=\"" + Escape(this.descriptor.briefURL) + "\" symbol=\"" + Escape(this.descriptor.className) + "\" colorable=\"" + Escape(this.descriptor.colorableMovieClips) + "\" color=\"" + Escape(this.color.value) + "\"/>"));
return loc0;
}
public Getter function color() : ru.yandex.utils::YaColor
{
return _color.clone();
}
public function showDrawingResult()
{
this.showDrawingResult();
this.clearEffect();
return;
}
private function stopTimer()
{
_playTimer.stop();
_playTimer.removeEventListener(TimerEvent.TIMER, this.playTimerHandler);
return;
}
public function pauseAnimation()
{
this.pauseAnimation();
clipart.stop();
return;
}
public Getter function descriptor() : ru.yandex.kraski.universalpainter.data::ClipartDescriptor
{
return this._descriptor;
}
private function clearEffect()
{
this.alpha = 1;
this.stopTimer();
return;
}
public function deserialize(arg0:XML)
{
this.descriptor.briefURL = arg0.resource.src;
this.color = new YaColor(parseInt(arg0.resource.color));
return;
}
}
public class Photoframe extends ru.yandex.kraski.universalpainter.visual::Visual
{
//========================= Variables
private var _descriptor : ClipartDescriptor;
private var clipart : LibraryAsset;
private var photoButtonsNames : Array;
private var _color : YaColor;
private var showDrawingProcessIntervalId : uint;
//========================= Methods
public static function Photoframe()
{
return;
}
public function Photoframe(arg0:ru.yandex.kraski.universalpainter.data::ClipartDescriptor)
{
this._color = new YaColor();
super();
this._weight = VisualsWeight.PHOTOFRAME_WEIGHT;
this.descriptor = arg0;
this.clipart = arg0.getNewInstance();
addChild(this.clipart);
this.photoButtonsNames = arg0.photoButtonsNames;
this.frameClip.mouseChildren = false;
this.frameClip.mouseEnabled = false;
this.initPhotoHandlers();
return;
}
public function showUploadButtons()
{
var loc1:* = null;
var loc2:* = null;
var loc0:* = 0;
while(loc0 < this.photoButtonsNames.length)
{
loc1 = this.clipart[this.photoButtonsNames[loc0]];
loc2 = this.clipart[0];
if(this.getPhoto(loc2) == null)
{
loc1.visible = true;
}
loc0++;
}
return;
}
private function initPhotoHandlers()
{
var loc1:* = null;
var loc0:* = 0;
while(loc0 < this.photoButtonsNames.length)
{
loc1 = this.clipart[this.photoButtonsNames[loc0]];
loc1.addEventListener(MouseEvent.CLICK, this.photoButton_clickHandler);
loc1.addEventListener(MouseEvent.ROLL_OVER, this.photoButton_overHandler);
loc1.addEventListener(MouseEvent.ROLL_OUT, this.photoButton_outHandler);
loc0++;
}
loc0 = 0;
while(loc0 < this.photoButtonsNames.length)
{
loc1 = this.clipart[0];
loc1.addEventListener(MouseEvent.CLICK, this.photoContainer_clickHandler);
loc0++;
}
return;
}
public function setState(arg0:int)
{
var loc0:* = arg0;
switch(loc0)
{
case PhotoframeState.EDIT:
this.frameClip.alpha = 0,3;
return;
case PhotoframeState.DEFAULT:
this.frameClip.alpha = 1;
return;
default:
break;
}
return;
}
private function getUsedPhotos() : XML
{
var loc2:* = null;
var loc0:* = "";
var loc1:* = 0;
while(loc1 < this.photoButtonsNames.length)
{
loc2 = this.clipart[0];
if(this.getPhoto(loc2) != null)
{
loc0 = loc0 + serialize();
}
loc1++;
}
return new XML("<photos>" + loc0 + "</photos>");
}
public function showDrawingProcess()
{
this.showDrawingProcess();
this.showDrawingProcessIntervalId = setTimeout(this.delayFinish, 700);
return;
}
private function photoButton_overHandler(arg0:flash.events::MouseEvent)
{
CustomCursorManager.setCursorByName(CursorType.PHOTOFRAME);
return;
}
public function addPicture(arg0:ru.yandex.kraski.universalpainter.visual::PhotoframePicture)
{
var loc0:* = (clipart.getChildByName(arg0.relativeContainerName)) as MovieClip;
var loc1:* = (clipart.getChildByName(arg0.relativeButtonName)) as MovieClip;
arg0.relativeContainer = 0;
arg0.relativeButton = 0;
arg0.relativeButton.visible = false;
loc0.addChild(arg0);
return;
}
public function hideUploadButtons()
{
var loc0:* = 0;
while(loc0 < this.photoButtonsNames.length)
{
MovieClip(this.clipart[this.photoButtonsNames[loc0]]).visible = false;
loc0++;
}
return;
}
public function serialize() : XML
{
var loc0:* = new XML("<visual type=\"" + Escape(className) + "\" creationOrder=\"" + Escape(creationOrder) + "\" depth=\"" + Escape(depth) + "\"/>");
loc0.appendChild(new XML("<resource src=\"" + Escape(this.descriptor.briefURL) + "\" symbol=\"" + Escape(this.descriptor.className) + "\" photoButtonsNames=\"" + Escape(this.descriptor.photoButtonsNames) + "\" color=\"" + Escape(color.value) + "\"/>"));
loc0.appendChild(this.getUsedPhotos());
return loc0;
}
public function showDrawingResult()
{
this.showDrawingResult();
return;
}
public function getFirstPhotoframePicture() : ru.yandex.kraski.universalpainter.visual::PhotoframePicture
{
var loc0:* = 0;
while(loc0 < this.photoButtonsNames.length)
{
return this.getPhoto(this.clipart[0]);
loc0++;
}
return null;
}
private Getter function frameClip() : flash.display::MovieClip
{
debug("preparing to get \"frame\"");
return this.clipart["frame"];
}
public Setter function descriptor(arg0:ru.yandex.kraski.universalpainter.data::ClipartDescriptor)
{
this._descriptor = arg0;
return;
}
public Getter function descriptor() : ru.yandex.kraski.universalpainter.data::ClipartDescriptor
{
return this._descriptor;
}
private function delayFinish()
{
clearTimeout(this.showDrawingProcessIntervalId);
dispatchEvent(new VisualEvent(VisualEvent.PLAY_FINISH));
return;
}
private function photoButton_outHandler(arg0:flash.events::MouseEvent)
{
CustomCursorManager.setCursorByName(CursorType.POINTER);
return;
}
private function photoContainer_clickHandler(arg0:flash.events::MouseEvent)
{
if(arg0.target is PhotoframePicture)
{
arg0.stopPropagation();
dispatchEvent(new PhotoframePictureEvent(PhotoframePictureEvent.SELECT_PHOTO, (arg0.target) as PhotoframePicture));
}
return;
}
public function destroy()
{
var loc1:* = null;
var loc2:* = null;
var loc3:* = null;
this.destroy();
var loc0:* = 0;
while(loc0 < this.photoButtonsNames.length)
{
loc1 = this.clipart[this.photoButtonsNames[loc0]];
loc1.removeEventListener(MouseEvent.CLICK, this.photoButton_clickHandler);
loc1.removeEventListener(MouseEvent.ROLL_OVER, this.photoButton_overHandler);
loc1.removeEventListener(MouseEvent.ROLL_OUT, this.photoButton_outHandler);
loc0++;
}
loc0 = 0;
while(loc0 < this.photoButtonsNames.length)
{
loc2 = this.clipart[0];
loc2.removeEventListener(MouseEvent.CLICK, this.photoContainer_clickHandler);
loc3 = this.getPhoto(loc2);
if(this.getPhoto(loc2))
{
loc3.destroy();
}
loc0++;
}
removeChild(this.clipart);
this.clipart = null;
this.photoButtonsNames = null;
this._descriptor = null;
return;
}
private function getPhoto(arg0:flash.display::MovieClip) : ru.yandex.kraski.universalpainter.visual::PhotoframePicture
{
if(arg0.numChildren == 1 && arg0.getChildAt(0) is PhotoframePicture)
{
return (arg0.getChildAt(0)) as PhotoframePicture;
}
return null;
}
private function photoButton_clickHandler(arg0:flash.events::MouseEvent)
{
var loc0:* = (clipart.getChildByName(arg0.target.name + "_container")) as MovieClip;
dispatchEvent(new PhotoframeEvent(PhotoframeEvent.UPLOAD_PHOTO, loc0, (arg0.target) as MovieClip));
return;
}
public function deserialize(arg0:XML)
{
this.descriptor.briefURL = arg0.resource.src;
return;
}
}
public class EditableVisual extends ru.yandex.kraski.universalpainter.visual::Visual implements {ru.yandex.transformer}::ITransformerClient
{
//========================= Methods
public static function EditableVisual()
{
return;
}
public function EditableVisual()
{
super();
return;
}
public function shift(arg0:Number, arg1:Number)
{
this.x = x + arg0;
this.y = y + arg1;
return;
}
public function hitTest(arg0:Number, arg1:Number) : Boolean
{
return false;
}
private function printGeom(arg0:String, arg1:flash.display::DisplayObject)
{
debug("{0}
geom = {1}", arg0, arg1.transform.matrix);
debug("scaleX: {0}, scaleY: {1}
rotation: {2}", arg1.scaleX, arg1.scaleY, arg1.rotation);
return;
}
public function scale(arg0:Number)
{
this.scaleX = scaleX * arg0;
this.scaleY = scaleY * arg0;
return;
}
public function flip()
{
this.scaleX = scaleX * 255;
return;
}
public function unselect()
{
return;
}
public function rotate(arg0:Number)
{
this.rotation = rotation + arg0 / Math.PI * 180;
return;
}
public function select()
{
return;
}
public Getter function transformerBounds() : flash.geom::Rectangle
{
return getBounds(this);
}
public function setGeom(arg0:flash.geom::Matrix)
{
this.printGeom("before geometry change:", this);
debug("setting new geom: {0}", arg0.clone());
transform.matrix = 0;
this.printGeom("after geometry change:", this);
dispatchEvent(new VisualEvent(VisualEvent.GEOM_CHANGE));
return;
}
}
public class Clipart extends ru.yandex.kraski.universalpainter.visual::EditableVisual
{
//========================= Variables
private static const APPEARANCE_INTERVAL : Number = 500;
private var _descriptor : ClipartDescriptor;
private var clipart : LibraryAsset;
private var _color : YaColor;
//========================= Methods
public static function Clipart()
{
this.APPEARANCE_INTERVAL = 500;
return;
}
public function Clipart(arg0:ru.yandex.kraski.universalpainter.data::ClipartDescriptor)
{
this._color = new YaColor();
super();
this._weight = VisualsWeight.CLIPART_WEIGHT;
this.descriptor = arg0;
this.clipart = arg0.getNewInstance();
this.mouseChildren = false;
var loc0:* = clipart.getBounds(this);
this.clipart.x = 0;
this.clipart.y = 0;
addChild(this.clipart);
this.clipart.colorableMovieClips = arg0.colorableMovieClips;
this.clipart.color = arg0.defaultColor;
this.color = new YaColor(this.clipart.color);
return;
}
public function hitTest(arg0:Number, arg1:Number) : Boolean
{
return clipart.hitTestPoint(arg0, arg1, true);
}
public Setter function color(arg0:ru.yandex.utils::YaColor)
{
_color.copy(arg0);
this.clipart.color = this._color.value;
return;
}
public function clear()
{
this.clear();
clipart.removeEventListener(LibraryAssetEvent.INTRO_FINISH, this.introFinishHandler);
clipart.stopAnimation();
return;
}
public function showDrawingProcess()
{
this.showDrawingProcess();
clipart.addEventListener(LibraryAssetEvent.INTRO_FINISH, this.introFinishHandler);
clipart.startFullAnimation();
return;
}
public function resumeAnimation()
{
this.resumeAnimation();
clipart.play();
return;
}
public function playIntro()
{
clipart.playIntro();
return;
}
public function showDrawingResult()
{
this.showDrawingResult();
clipart.removeEventListener(LibraryAssetEvent.INTRO_FINISH, this.introFinishHandler);
clipart.stopAnimation();
return;
}
public function serialize() : XML
{
var loc0:* = this.serialize();
loc0.resource = ;
return loc0;
}
public Getter function color() : ru.yandex.utils::YaColor
{
return _color.clone();
}
public Setter function descriptor(arg0:ru.yandex.kraski.universalpainter.data::ClipartDescriptor)
{
this._descriptor = arg0;
return;
}
public function drawBox()
{
var loc0:* = this.clipart.width;
var loc1:* = this.clipart.height;
graphics.clear();
graphics.lineStyle(1, 0);
graphics.drawRect(-loc0 / 2, -loc1 / 2, loc0, loc1);
return;
}
public function hideBox()
{
graphics.clear();
return;
}
private function introFinishHandler(arg0:ru.yandex.kraski.universalpainter.events::LibraryAssetEvent)
{
clipart.removeEventListener(LibraryAssetEvent.INTRO_FINISH, this.introFinishHandler);
dispatchEvent(new VisualEvent(VisualEvent.PLAY_FINISH));
return;
}
public function startPreviewAnimation()
{
clipart.startPreviewAnimation();
return;
}
public Getter function descriptor() : ru.yandex.kraski.universalpainter.data::ClipartDescriptor
{
return this._descriptor;
}
public function pauseAnimation()
{
this.pauseAnimation();
clipart.stop();
return;
}
public function distance(arg0:Number, arg1:Number) : Number
{
return ( (clipart.hitTestPoint(arg0, arg1, true))? 0 : 1000 );
}
public Getter function transformerBounds() : flash.geom::Rectangle
{
return clipart.getBounds(this);
}
public function deserialize(arg0:XML)
{
this.deserialize(arg0);
this.descriptor.briefURL = arg0.resource.src;
this.color = new YaColor(parseInt(arg0.resource.color));
return;
}
}
public class Eraser extends ru.yandex.kraski.universalpainter.visual::Visual
{
//========================= Variables
private var size : Number;
private var _points : Array;
private var loaded : Boolean = False;
//========================= Methods
public static function Eraser()
{
return;
}
public function Eraser(arg0:Number = 18)
{
this._points = [];
super();
this.size = arg0;
return;
}
public function serialize() : XML
{
var loc0:* = this.serialize();
var loc1:* = "";
var loc2:* = 0;
while(loc2 < this._points.length)
{
loc1 = loc1 + this._points[loc2].x + "," + this._points[loc2].y;
loc1 = loc1 + ";";
loc2++;
}
loc0.points = 0;
return loc0;
}
public Setter function points(arg0:Array)
{
this.loaded = true;
var loc0:* = 0;
while(loc0 < arg0.length)
{
this.addPoint(arg0[loc0].x, arg0[loc0].y);
loc0++;
}
return;
}
public function addPoint(arg0:Number, arg1:Number)
{
_points.push({"x" : arg0, "y" : arg1});
if(this._points.length > 1)
{
graphics.lineTo(arg0, arg1);
}
else
{
graphics.beginFill(16777215);
graphics.lineStyle(0, 0, 0, false, "normal", "round");
graphics.drawCircle(arg0, arg1, this.size / 2);
graphics.endFill();
graphics.moveTo(arg0, arg1);
graphics.lineStyle(this.size, 0, 1, false, "normal", "round");
}
return;
}
public Getter function weight() : Number
{
return 0;
}
public function updateAfterLoad()
{
this.loaded = true;
return;
}
public Getter function lastRect() : flash.geom::Rectangle
{
var loc0:* = 0;
var loc1:* = NaN;
var loc2:* = NaN;
var loc3:* = NaN;
var loc4:* = NaN;
if(this.loaded)
{
loc0 = this._points.length;
loc1 = Math.min(this._points[loc0].x, this._points[0].x) - this.size / 2;
loc2 = Math.min(this._points[loc0].y, this._points[0].y) - this.size / 2;
loc3 = this.size + Math.abs(this._points[0].x - this._points[loc0].x);
loc4 = this.size + Math.abs(this._points[0].y - this._points[loc0].y);
return new Rectangle(loc1, loc2, loc3, loc4);
}
return new Rectangle(0, 0, PaintCanvas.WIDTH, PaintCanvas.HEIGHT);
}
}
public class LibraryAsset extends flash.display::MovieClip
{
//========================= Variables
private var _color : uint;
private var _brightness : Number = 0;
private var _colorableMovieClips : Array;
//========================= Methods
public static function LibraryAsset()
{
return;
}
public function LibraryAsset()
{
super();
return;
}
public Getter function color() : uint
{
return this._color;
}
public Setter function color(arg0:uint)
{
this._color = arg0;
this.validate();
return;
}
public Setter function colorableMovieClips(arg0:Array)
{
this._colorableMovieClips = arg0.concat();
return;
}
public function stopAnimation()
{
this["_playFullAnimation"] = false;
gotoAndStop("stop");
return;
}
public Getter function brightness() : Number
{
return this._brightness;
}
private function applyFilter(arg0:flash.filters::BitmapFilter)
{
var loc1:* = null;
var loc0:* = 0;
while(loc0 < this.colorableMovieClips.length)
{
loc1 = (this[this.colorableMovieClips[loc0]]) as MovieClip;
loc1["mc_color"].filters = ;
loc0++;
}
return;
}
public Setter function brightness(arg0:Number)
{
if(arg0 > 1)
{
arg0 = 1;
}
else
{
if(arg0 < 255)
{
arg0 = 255;
}
}
this._brightness = arg0;
this.validate();
return;
}
private function enterFrameHandler(arg0:flash.events::Event)
{
if(this["_introAnimationFinished"])
{
dispatchEvent(new LibraryAssetEvent(LibraryAssetEvent.INTRO_FINISH));
removeEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
this["_introAnimationFinished"] = false;
}
return;
}
private function validate()
{
this.applyFilter(new ColorMatrixFilter(ColorUtils.createFilterMatrix(this.color, this.brightness)));
return;
}
public Getter function colorableMovieClips() : Array
{
return _colorableMovieClips.concat();
}
public function playIntro()
{
this["_playFullAnimation"] = false;
gotoAndPlay("intro");
return;
}
public function startFullAnimation()
{
this["_playFullAnimation"] = true;
gotoAndPlay("intro");
addEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
return;
}
public function startPreviewAnimation()
{
this["_playFullAnimation"] = false;
gotoAndPlay("loop");
return;
}
}
public class Picture extends ru.yandex.kraski.universalpainter.visual::EditableVisual
{
//========================= Variables
private static var _serializeContent : Boolean = False;
private var _jpegData : ByteArray;
private var _index : int;
private var _content : Bitmap;
//========================= Methods
public static function Picture()
{
this._serializeContent = false;
return;
}
public function Picture()
{
super();
this._weight = VisualsWeight.PICTURE_WEIGHT;
return;
}
public static Getter function serializeContent() : Boolean
{
return this._serializeContent;
}
public static Setter function serializeContent(arg0:Boolean)
{
this._serializeContent = ;
return;
}
public Getter function content() : flash.display::Bitmap
{
return this._content;
}
public Getter function jpegData() : flash.utils::ByteArray
{
return this._jpegData;
}
public function hitTest(arg0:Number, arg1:Number) : Boolean
{
return ( (this._content)? _content.hitTestPoint(arg0, arg1, true) : false );
}
public Setter function color(arg0:ru.yandex.utils::YaColor)
{
return;
}
public function destroy()
{
this.destroy();
this.clearEffect();
this._jpegData = null;
removeChild(this._content);
dispose();
this._content = null;
return;
}
public function showDrawingProcess()
{
this.showDrawingProcess();
this.setEffect();
return;
}
public Getter function index() : int
{
return this._index;
}
private function setEffect()
{
this.alpha = 0;
addEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
return;
}
private function enterFrameHandler(arg0:flash.events::Event)
{
if(alpha >= 1)
{
this.clearEffect();
dispatchEvent(new VisualEvent(VisualEvent.PLAY_FINISH));
}
else
{
this.alpha = alpha + 0,05;
}
return;
}
private function completeHandler(arg0:flash.events::Event)
{
var loc0:* = LoaderInfo(arg0.target);
loc0.removeEventListener(Event.COMPLETE, this.completeHandler);
this.content = Bitmap(loc0.content);
dispatchEvent(new VisualEvent(VisualEvent.CREATION_COMPLETE));
return;
}
public function showDrawingResult()
{
this.showDrawingResult();
this.clearEffect();
return;
}
public function serialize() : XML
{
var loc1:* = null;
var loc0:* = this.serialize();
loc0.pictureIndex = ;
if(Picture.serializeContent)
{
debug("serializing content of {0}", this);
loc1 = new Base64Encoder();
loc1.insertNewLines = false;
loc1.encodeBytes(this._jpegData);
loc0.appendChild(new XML("<content>" + loc1.toString().ToXmlString() + "</content>"));
}
return loc0;
}
public Setter function jpegData(arg0:flash.utils::ByteArray)
{
this._jpegData = arg0;
var loc0:* = new Loader();
addEventListener(Event.COMPLETE, this.completeHandler);
loc0.loadBytes(this._jpegData);
return;
}
public Setter function index(arg0:int)
{
this._index = arg0;
return;
}
public Setter function content(arg0:flash.display::Bitmap)
{
if(this._content)
{
removeChild(this._content);
dispose();
}
this._content = arg0;
if(this._content)
{
this._content.smoothing = true;
this._content.x = 0;
this._content.y = 0;
addChild(this._content);
}
return;
}
public function distance(arg0:Number, arg1:Number) : Number
{
return ( (_content.hitTestPoint(arg0, arg1, true))? 0 : 1000 );
}
private function creationCompleteHandler(arg0:ru.yandex.kraski.universalpainter.events::VisualEvent)
{
removeEventListener(VisualEvent.CREATION_COMPLETE, this.creationCompleteHandler);
dispatchEvent(new VisualEvent(VisualEvent.DESERIALIZING_COMPLETE));
return;
}
public Getter function transformerBounds() : flash.geom::Rectangle
{
return _content.getBounds(this);
}
private function clearEffect()
{
this.alpha = 1;
removeEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
return;
}
public function deserialize(arg0:XML)
{
var loc0:* = null;
var loc1:* = null;
this.deserialize(arg0);
this._index = arg0.pictureIndex;
if(length() > 0)
{
loc0 = text();
loc1 = new Base64Decoder();
loc1.decode(loc0);
addEventListener(VisualEvent.CREATION_COMPLETE, this.creationCompleteHandler);
this.jpegData = loc1.toByteArray();
}
else
{
dispatchEvent(new VisualEvent(VisualEvent.DESERIALIZING_COMPLETE));
}
return;
}
}
public class Text extends ru.yandex.kraski.universalpainter.visual::EditableVisual
{
//========================= Variables
private static const APPEARANCE_INTERVAL : int = 400;
private static const DEFAULT_FONT_SIZE : int = 24;
private var _text : String = "";
private var _color : YaColor;
private var _font : Font;
private var tf : TextField;
//========================= Methods
public static function Text()
{
this.APPEARANCE_INTERVAL = 400;
this.DEFAULT_FONT_SIZE = 24;
return;
}
public function Text()
{
this._color = new YaColor();
super();
this._weight = VisualsWeight.TEXT_WEIGHT;
this.createTextField();
return;
}
public function getBounds(arg0:flash.display::DisplayObject) : flash.geom::Rectangle
{
var loc0:* = this.getBounds(arg0);
debug("bounds: {0}", loc0);
return loc0;
}
public function hitTest(arg0:Number, arg1:Number) : Boolean
{
return tf.hitTestPoint(arg0, arg1, true);
}
public Setter function color(arg0:ru.yandex.utils::YaColor)
{
_color.copy(arg0);
this.updateTextFormat();
return;
}
public function showDrawingProcess()
{
this.showDrawingProcess();
dispatchEvent(new VisualEvent(VisualEvent.PLAY_FINISH));
return;
}
public Getter function font() : flash.text::Font
{
return this._font;
}
public function startEdit()
{
info("Begin text edit");
this.setTextEditable();
this.tf.y = 0;
stage.focus = ;
tf.addEventListener(FocusEvent.FOCUS_OUT, this.focusOutHandler);
return;
}
private function focusOutHandler(arg0:flash.events::FocusEvent)
{
if(stage)
{
stage.focus = ;
}
return;
}
public Setter function text(arg0:String)
{
this._text = arg0;
this.tf.text = "";
dispatchEvent(new VisualEvent(VisualEvent.GEOM_CHANGE));
return;
}
public Getter function selection() : ru.yandex.utils::Range
{
return new Range(this.tf.selectionBeginIndex, this.tf.selectionEndIndex);
}
public function endEdit()
{
info("End text edit");
this.setTextNotEditable();
tf.removeEventListener(FocusEvent.FOCUS_OUT, this.focusOutHandler);
return;
}
public function showDrawingResult()
{
this.showDrawingResult();
return;
}
public Setter function selection(arg0:ru.yandex.utils::Range)
{
tf.setSelection(arg0.begin, arg0.end);
return;
}
public function serialize() : XML
{
var loc0:* = this.serialize();
loc0.text = this.tf.text;
loc0.font = this._font.fontName;
loc0.color = this.color.value;
return loc0;
}
public Getter function color() : ru.yandex.utils::YaColor
{
return _color.clone();
}
public Setter function font(arg0:flash.text::Font)
{
this._font = arg0;
this.updateTextFormat();
dispatchEvent(new VisualEvent(VisualEvent.GEOM_CHANGE));
return;
}
private function setTextNotEditable()
{
this.tf.type = TextFieldType.DYNAMIC;
this.tf.selectable = false;
this.tf.border = false;
tf.setSelection(0, 0);
return;
}
private function keyDownHandler(arg0:flash.events::KeyboardEvent)
{
dispatchEvent(new TextEvent(TextEvent.TEXT_CHANGING));
return;
}
private function updateTextFormat()
{
var loc0:* = this.tf.defaultTextFormat;
if(this._font)
{
loc0.font = this._font.fontName;
}
if(this._color)
{
loc0.color = this._color.value;
}
this.tf.defaultTextFormat = this.tf.defaultTextFormat;
tf.setTextFormat(loc0);
return;
}
private function getDefaultTextFormat() : flash.text::TextFormat
{
var loc0:* = new TextFormat();
loc0.size = 24;
loc0.align = TextFormatAlign.CENTER;
return loc0;
}
private function createTextField()
{
this.tf = new TextField();
this.tf.x = 0;
this.tf.autoSize = TextFieldAutoSize.CENTER;
this.tf.multiline = true;
this.tf.embedFonts = true;
this.tf.defaultTextFormat = 0;
this.setTextNotEditable();
tf.addEventListener(Event.CHANGE, this.changeHandler);
tf.addEventListener(KeyboardEvent.KEY_DOWN, this.keyDownHandler);
addChild(this.tf);
return;
}
private function setTextEditable()
{
this.tf.type = TextFieldType.INPUT;
this.tf.selectable = true;
this.tf.border = true;
tf.setSelection(0, this.tf.length);
return;
}
public Getter function text() : String
{
return this._text;
}
private function changeHandler(arg0:flash.events::Event)
{
var loc0:* = this._text;
this._text = this.tf.text;
this.tf.y = 0;
var loc1:* = new TextEvent(TextEvent.TEXT_CHANGE);
loc1.oldText = "";
loc1.newText = "";
dispatchEvent(loc1);
return;
}
public function deserialize(arg0:XML)
{
this.deserialize(arg0);
this.color = new YaColor(parseInt(arg0.color[0]));
this.text = arg0.text[0];
var loc0:* = Font.enumerateFonts();
var loc1:* = 0;
while(loc1 < loc0.length)
{
if(loc0[loc1].fontName == arg0.font[0])
{
this.font = loc0[loc1];
}
loc1++;
}
this.tf.y = 0;
return;
}
}
public class PhotoframePicture extends ru.yandex.kraski.universalpainter.visual::Picture
{
//========================= Variables
private var _relativeContainerName : String;
private var _relativeButtonName : String;
private var _relativeContainer : MovieClip;
private var _relativeButton : MovieClip;
//========================= Methods
public static function PhotoframePicture()
{
return;
}
public function PhotoframePicture()
{
super();
return;
}
public function serialize() : XML
{
var loc0:* = this.serialize();
loc0.relativeContainerName = this.relativeContainer.name;
loc0.relativeButtonName = this.relativeButton.name;
return loc0;
}
public Getter function relativeContainerName() : String
{
return this._relativeContainerName;
}
public Setter function relativeContainer(arg0:flash.display::MovieClip)
{
this._relativeContainer = arg0;
return;
}
public Setter function relativeContainerName(arg0:String)
{
this._relativeContainerName = arg0;
return;
}
public Setter function relativeButtonName(arg0:String)
{
this._relativeButtonName = arg0;
return;
}
public Getter function relativeContainer() : flash.display::MovieClip
{
return this._relativeContainer;
}
public Getter function relativeButtonName() : String
{
return this._relativeButtonName;
}
public function destroy()
{
this.destroy();
this._relativeButton = null;
this._relativeContainer = null;
var loc0:* = numChildren;
while(loc0 > 0)
{
removeChildAt(0);
loc0 = loc0 - 1;
}
return;
}
public Setter function relativeButton(arg0:flash.display::MovieClip)
{
this._relativeButton = arg0;
return;
}
public Getter function relativeButton() : flash.display::MovieClip
{
return this._relativeButton;
}
public function deserialize(arg0:XML)
{
this.deserialize(arg0);
this.relativeButtonName = arg0.relativeButtonName;
this.relativeContainerName = arg0.relativeContainerName;
return;
}
}
}
package ru.yandex.utils
{
public class DisplayUtil extends Object
{
//========================= Methods
public static function DisplayUtil()
{
return;
}
public function DisplayUtil()
{
super();
return;
}
public static function removeAllChildren(arg0:flash.display::DisplayObjectContainer)
{
while(arg0.numChildren)
{
arg0.removeChildAt(0);
}
return;
}
}
public class YaColor extends flash.events::EventDispatcher
{
//========================= Variables
private var _base : uint;
private var _value : uint;
private var _brightness : Number;
//========================= Methods
public static function YaColor()
{
return;
}
public function YaColor(arg0:uint = 0)
{
super();
this.value = arg0;
return;
}
public static Getter function WHITE() : ru.yandex.utils::YaColor
{
return new this(16777215);
}
public static Getter function BLACK() : ru.yandex.utils::YaColor
{
return new this(0);
}
private function getIntermediateValue(arg0:uint, arg1:uint, arg2:Number) : uint
{
if(arg2 <= 0)
{
return arg0;
}
if(arg2 >= 1)
{
return arg1;
}
return arg0 + uint(Math.round(arg2 * arg1 - arg0));
}
public Getter function green() : uint
{
return uint(this._value & 65280) >> 8;
}
public function isEquals(arg0:ru.yandex.utils::YaColor) : Boolean
{
return this._base == arg0._base && this._brightness == arg0._brightness;
}
public function setRGB(arg0:uint, arg1:uint, arg2:uint)
{
this.value = uint(arg0 << 16) + uint(arg1 << 8) + arg2;
return;
}
public Getter function base() : uint
{
return this._base;
}
private function setBrightness(arg0:Number)
{
if(arg0 < 255)
{
this._brightness = 255;
}
else
{
if(arg0 > 1)
{
this._brightness = 1;
}
else
{
this._brightness = arg0;
}
}
dispatchEvent(new Event("brightnessChange"));
return;
}
public function getTransformMatrix(arg0:ru.yandex.utils::YaColor) : Array
{
return null;
}
public Getter function brightness() : Number
{
return this._brightness;
}
private function setBase(arg0:int)
{
this._base = arg0;
dispatchEvent(new Event("baseChange"));
return;
}
public function clone() : ru.yandex.utils::YaColor
{
var loc0:* = new YaColor(this._base);
loc0.brightness = ;
return loc0;
}
public Getter function blue() : uint
{
return uint(this._value & 255);
}
public Setter function brightness(arg0:Number)
{
this.setBrightness(arg0);
this.updateValue();
return;
}
private function updateValue()
{
var loc0:* = new YaColor(this._base);
if(this._brightness > 0)
{
loc0 = loc0.getIntermediateColor(this.WHITE, this._brightness);
}
else
{
loc0 = BLACK.getIntermediateColor(loc0, this._brightness + 1);
}
this.setValue(loc0.value);
return;
}
public Setter function value(arg0:uint)
{
this.setBrightness(0);
this.setBase(arg0);
this.setValue(arg0);
return;
}
public function toString() : String
{
return "#" + _value.toString(16);
}
private function setValue(arg0:uint)
{
this._value = arg0;
dispatchEvent(new Event("valueChange"));
return;
}
public Getter function value() : uint
{
return this._value;
}
public function getIntermediateColor(arg0:ru.yandex.utils::YaColor, arg1:Number) : ru.yandex.utils::YaColor
{
var loc0:* = new YaColor();
loc0.setRGB(this.getIntermediateValue(this.red, arg0.red, arg1), this.getIntermediateValue(this.green, arg0.green, arg1), this.getIntermediateValue(this.blue, arg0.blue, arg1));
return loc0;
}
public function copy(arg0:ru.yandex.utils::YaColor)
{
this.setBase(arg0._base);
this.setBrightness(arg0._brightness);
this.updateValue();
return;
}
public Setter function base(arg0:uint)
{
this.setBase(arg0);
this.updateValue();
return;
}
public Getter function red() : uint
{
return uint(this._value & 16711680) >> 16;
}
}
public class YaNumberUtil extends Object
{
//========================= Methods
public static function YaNumberUtil()
{
return;
}
public function YaNumberUtil()
{
super();
return;
}
public static function getRandomFromRange(arg0:Number, arg1:Number) : Number
{
return Math.random() * arg1 - arg0 + arg0;
}
public static function getLeadingZeroCount(arg0:Number) : Number
{
var loc2:* = null;
var loc0:* = 0;
var loc1:* = arg0.toString();
var loc3:* = 0;
while(loc3 < loc1.length)
{
loc2 = loc1.charAt(loc3);
if(! && !)
{
return loc0;
}
if(loc2 == "0")
{
loc0 = loc0 + 1;
}
loc3++;
}
return loc0;
}
public static function equals(arg0:Number, arg1:Number, arg2:Number = 1E-06) : Boolean
{
return Math.abs(arg0 - arg1) < arg2;
}
}
public class ColorUtils extends Object
{
//========================= Methods
public static function ColorUtils()
{
return;
}
public function ColorUtils()
{
super();
return;
}
public static function getRGB_R(arg0:Number) : Number
{
return arg0 & 16711680 >> 16;
}
public static function getRGB_B(arg0:Number) : Number
{
return arg0 & 255;
}
public static function createFilterMatrix(arg0:uint, arg1:Number = 0) : Array
{
var loc0:* = new Array();
var loc1:* = this.getRGB_R(arg0) / 255;
var loc2:* = this.getRGB_G(arg0) / 255;
var loc3:* = this.getRGB_B(arg0) / 255;
var loc4:* = arg1 * 255;
loc0 = loc0.concat([loc1, 0, 0, 0, loc4]);
loc0 = loc0.concat([0, loc2, 0, 0, loc4]);
loc0 = loc0.concat([0, 0, loc3, 0, loc4]);
loc0 = loc0.concat([0, 0, 0, 1, 0]);
return loc0;
}
public static function getRGB_G(arg0:Number) : Number
{
return arg0 & 65280 >> 8;
}
}
public class Range extends Object
{
//========================= Variables
private var _begin : int;
private var _end : int;
//========================= Methods
public static function Range()
{
return;
}
public function Range(arg0:int = 0, arg1:int = 0)
{
super();
this._begin = arg0;
this._end = arg1;
return;
}
public Setter function begin(arg0:int)
{
this._begin = arg0;
return;
}
public function copy(arg0:ru.yandex.utils::Range)
{
this._begin = arg0._begin;
this._end = arg0._end;
return;
}
public Setter function end(arg0:int)
{
this._end = arg0;
return;
}
public Getter function begin() : int
{
return this._begin;
}
public Getter function end() : int
{
return this._end;
}
}
}
package ru.yandex.transformer
{
public interface ITransformerClient
{
//========================= Methods
public Getter function transformerBounds() : flash.geom::Rectangle;
}
}
package ru.yandex.lib.logger.log
{
public class Log extends Object
{
//========================= Variables
private static var _targets : Array;
private static var _loggers : Array;
private static var _targetLevel : int;
private static var NONE : int = 2147483647;
//========================= Methods
public static function Log()
{
this.NONE = int.MAX_VALUE;
this._targetLevel = 2147483647;
this._targets = ;
return;
}
public function Log()
{
super();
return;
}
public static function isDebug() : Boolean
{
return ( (this._targetLevel <= LogEventLevel.DEBUG)? true : false );
}
public static function flush()
{
this._loggers = ;
this._targets = ;
this._targetLevel = 2147483647;
return;
}
private static function checkCategory(arg0:String)
{
var loc0:* = null;
if((arg0 == null || arg0.length == 0))
{
loc0 = "invalid category length";
}
if((this.hasIllegalCharacters(arg0) || !))
{
loc0 = "invalid category chars";
}
return;
}
public static function getLogger(arg0:String) : mx.logging::ILogger
{
var loc1:* = null;
this.checkCategory(arg0);
if(this._loggers)
{
this._loggers = ;
}
var loc0:* = this._loggers[arg0];
if(loc0 == null)
{
loc0 = new LogLogger(arg0);
this._loggers.loc0 = ;
}
var loc2:* = 0;
while(loc2 < this._targets.length)
{
loc1 = ILoggingTarget(this._targets[loc2]);
if(this.categoryMatchInFilterList(arg0, loc1.filters))
{
loc1.addLogger(loc0);
}
loc2++;
}
return loc0;
}
private static function categoryMatchInFilterList(arg0:String, arg1:Array) : Boolean
{
var loc1:* = null;
var loc0:* = false;
var loc2:* = 255;
var loc3:* = 0;
while(loc3 < arg1.length)
{
loc1 = arg1[loc3];
loc2 = indexOf("*");
if(indexOf("*") == 0)
{
return true;
}
if(loc2 < 0)
{
var loc4:* = arg0.length;
loc2 = arg0.length;
}
else
{
}
loc2 = loc2 - 1;
if(arg0.substring(0, loc2) == loc1.substring(0, loc2))
{
return true;
}
loc3 = loc3 + 1;
}
return false;
}
public static function addTarget(arg0:mx.logging::ILoggingTarget)
{
var loc0:* = null;
var loc1:* = null;
var loc2:* = null;
var loc3:* = null;
if(arg0)
{
loc0 = arg0.filters;
var loc4:* = 0;
var loc5:* = this._loggers;
for(loc4 in loc5)
{
loc2 = loc5.__getNextEnumerablePropertyName();
if(this.categoryMatchInFilterList(loc2, loc0))
{
arg0.addLogger(ILogger(this._loggers[loc2]));
}
}
_targets.push(arg0);
if(this._targetLevel == this.NONE)
{
this._targetLevel = arg0.level;
}
else
{
if(arg0.level < this._targetLevel)
{
this._targetLevel = arg0.level;
}
}
}
else
{
loc3 = "invalid target!";
}
return;
}
public static function hasIllegalCharacters(arg0:String) : Boolean
{
return !;
}
public static function removeTarget(arg0:mx.logging::ILoggingTarget)
{
var loc0:* = null;
var loc1:* = null;
var loc2:* = null;
var loc3:* = 0;
var loc4:* = null;
if(arg0)
{
loc0 = arg0.filters;
var loc5:* = 0;
var loc6:* = this._loggers;
for(loc5 in loc6)
{
loc2 = loc6.__getNextEnumerablePropertyName();
if(this.categoryMatchInFilterList(loc2, loc0))
{
arg0.removeLogger(ILogger(this._loggers[loc2]));
}
}
loc3 = 0;
while(loc3 < this._targets.length)
{
if(arg0 == this._targets[loc3])
{
_targets.splice(loc3, 1);
loc3 = loc3 - 1;
}
loc3++;
}
this.resetTargetLevel();
}
else
{
loc4 = "invalid target!";
}
return;
}
public static function isWarn() : Boolean
{
return ( (this._targetLevel <= LogEventLevel.WARN)? true : false );
}
public static function isFatal() : Boolean
{
return ( (this._targetLevel <= LogEventLevel.FATAL)? true : false );
}
private static function resetTargetLevel()
{
var loc0:* = this.NONE;
var loc1:* = 0;
while(loc1 < this._targets.length)
{
if((loc0 == this.NONE || this._targets[loc1].level < loc0))
{
loc0 = this._targets[loc1].level;
}
loc1++;
}
this._targetLevel = this._targets[loc1].level;
return;
}
public static function isError() : Boolean
{
return ( (this._targetLevel <= LogEventLevel.ERROR)? true : false );
}
public static function isInfo() : Boolean
{
return ( (this._targetLevel <= LogEventLevel.INFO)? true : false );
}
}
public class LogLogger extends flash.events::EventDispatcher implements {mx.logging}::ILogger
{
//========================= Variables
private var _category : String;
//========================= Methods
public static function LogLogger()
{
return;
}
public function LogLogger(arg0:String)
{
super();
this._category = arg0;
return;
}
public function log(arg0:int, arg1:String)
{
var loc1:* = null;
var loc2:* = 0;
if(arg0 < LogEventLevel.DEBUG)
{
loc1 = "level limit!";
}
if(hasEventListener(LogEvent.LOG))
{
loc2 = 0;
while(loc2 < loc0.length)
{
arg1 = arg1.replace(new RegExp("\\{" + loc2 + "\\}", "g"), loc0[loc2]);
loc2++;
}
dispatchEvent(new LogEvent(arg1, arg0));
}
return;
}
public Getter function category() : String
{
return this._category;
}
public function fatal(arg0:String)
{
var loc1:* = 0;
if(hasEventListener(LogEvent.LOG))
{
loc1 = 0;
while(loc1 < loc0.length)
{
arg0 = arg0.replace(new RegExp("\\{" + loc1 + "\\}", "g"), loc0[loc1]);
loc1++;
}
dispatchEvent(new LogEvent(arg0, LogEventLevel.FATAL));
}
return;
}
public function error(arg0:String)
{
var loc1:* = 0;
if(hasEventListener(LogEvent.LOG))
{
loc1 = 0;
while(loc1 < loc0.length)
{
arg0 = arg0.replace(new RegExp("\\{" + loc1 + "\\}", "g"), loc0[loc1]);
loc1++;
}
dispatchEvent(new LogEvent(arg0, LogEventLevel.ERROR));
}
return;
}
public function warn(arg0:String)
{
var loc1:* = 0;
if(hasEventListener(LogEvent.LOG))
{
loc1 = 0;
while(loc1 < loc0.length)
{
arg0 = arg0.replace(new RegExp("\\{" + loc1 + "\\}", "g"), loc0[loc1]);
loc1++;
}
dispatchEvent(new LogEvent(arg0, LogEventLevel.WARN));
}
return;
}
public function info(arg0:String)
{
var loc1:* = 0;
if(hasEventListener(LogEvent.LOG))
{
loc1 = 0;
while(loc1 < loc0.length)
{
arg0 = arg0.replace(new RegExp("\\{" + loc1 + "\\}", "g"), loc0[loc1]);
loc1++;
}
dispatchEvent(new LogEvent(arg0, LogEventLevel.INFO));
}
return;
}
public function debug(arg0:String)
{
var loc1:* = 0;
if(hasEventListener(LogEvent.LOG))
{
loc1 = 0;
while(loc1 < loc0.length)
{
arg0 = arg0.replace(new RegExp("\\{" + loc1 + "\\}", "g"), loc0[loc1]);
loc1++;
}
dispatchEvent(new LogEvent(arg0, LogEventLevel.DEBUG));
}
return;
}
}
}
package ru.yandex.lib.logger.events
{
public class ScrollBarEvent extends flash.events::Event
{
//========================= Variables
public static const UPDATE_SCROLL_POSITION : String = "updateScrollPosition";
public var position : int = 0;
//========================= Methods
public static function ScrollBarEvent()
{
this.UPDATE_SCROLL_POSITION = "updateScrollPosition";
return;
}
public function ScrollBarEvent(arg0:String, arg1:Boolean = false, arg2:Boolean = false)
{
super(arg0, arg1, arg2);
return;
}
}
}
package ru.yandex.lib.logger.view.scrollbar
{
public class ScrollBar extends flash.display::Sprite
{
//========================= Variables
private var _numRows : int = 1;
private var ScrollBarScrubSkin : Class;
private var _rowsPerScreen : int = 1;
private var ScrollButtonUpSkin : Class;
private var ScrollButtonDownSkin : Class;
private var buttonUp : Sprite;
private var background : Sprite;
private var scrub : Sprite;
private var ScrollBarBackground : Class;
private var buttonDown : Sprite;
//========================= Methods
public static function ScrollBar()
{
return;
}
public function ScrollBar()
{
this.ScrollBarBackground = ScrollBar_ScrollBarBackground;
this.ScrollBarScrubSkin = ScrollBar_ScrollBarScrubSkin;
this.ScrollButtonDownSkin = ScrollBar_ScrollButtonDownSkin;
this.ScrollButtonUpSkin = ScrollBar_ScrollButtonUpSkin;
super();
this.background = new this.ScrollBarBackground();
addChild(this.background);
background.addEventListener(MouseEvent.CLICK, this.background_clickHandler);
this.scrub = new this.ScrollBarScrubSkin();
addChild(this.scrub);
this.scrub.x = 1;
scrub.addEventListener(MouseEvent.MOUSE_DOWN, this.scrub_mouseDownHandler);
this.buttonDown = new this.ScrollButtonDownSkin();
addChild(this.buttonDown);
this.buttonDown.x = 1;
buttonDown.addEventListener(MouseEvent.CLICK, this.buttonDown_clickHandler);
this.buttonUp = new this.ScrollButtonUpSkin();
addChild(this.buttonUp);
this.buttonUp.x = 1;
buttonUp.addEventListener(MouseEvent.CLICK, this.buttonUp_clickHandler);
return;
}
private function buttonUp_clickHandler(arg0:flash.events::MouseEvent)
{
if(this.position > 0)
{
this.position = this.position - 1;
}
if(this.position >= this.numRows - this.rowsPerScreen)
{
this.position = this.numRows - this.rowsPerScreen - 1;
}
this.sentUpdateEvent();
return;
}
private function stage_mouseMoveHandler(arg0:flash.events::MouseEvent)
{
this.sentUpdateEvent();
return;
}
private function buttonDown_clickHandler(arg0:flash.events::MouseEvent)
{
this.position = this.position + 1;
this.sentUpdateEvent();
return;
}
public Getter function rowsPerScreen() : int
{
return this._rowsPerScreen;
}
public Setter function position(arg0:int)
{
if(arg0 >= this.numRows - this.rowsPerScreen)
{
this.scrub.y = 0;
return;
}
if(arg0 >= 0)
{
this.scrub.y = 0;
}
return;
}
private function background_clickHandler(arg0:flash.events::MouseEvent)
{
if(mouseY <= this.buttonUp.height)
{
this.scrub.y = this.buttonUp.height;
}
else
{
if(mouseY >= this.buttonUp.height + this.scrubAreaHeight - this.scrub.height)
{
this.scrub.y = 0;
}
else
{
this.scrub.y = mouseY;
}
}
this.sentUpdateEvent();
return;
}
private function sentUpdateEvent()
{
var loc0:* = new ScrollBarEvent(ScrollBarEvent.UPDATE_SCROLL_POSITION);
dispatchEvent(loc0);
return;
}
public Setter function rowsPerScreen(arg0:int)
{
if(arg0 > 0)
{
this._rowsPerScreen = arg0;
}
return;
}
private Getter function scrubAreaHeight() : Number
{
return this.background.height - this.buttonDown.height - this.buttonUp.height;
}
public function setHeight(arg0:Number)
{
if(arg0 > 0)
{
this.background.height = ;
this.buttonUp.y = 0;
this.buttonDown.y = 0;
this.scrub.y = this.buttonUp.height;
this.scrub.height = scrubAreaHeight;
}
return;
}
private function stage_mouseUpHandler(arg0:flash.events::MouseEvent)
{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, this.stage_mouseMoveHandler);
stage.removeEventListener(MouseEvent.MOUSE_UP, this.stage_mouseUpHandler);
scrub.stopDrag();
this.sentUpdateEvent();
return;
}
public Getter function position() : int
{
return Math.ceil(this.scrub.y - this.buttonUp.height * this.numRows / this.scrubAreaHeight - this.scrub.height);
}
private function scrub_mouseDownHandler(arg0:flash.events::MouseEvent)
{
var loc0:* = new Rectangle(this.scrub.x, this.buttonUp.y + this.buttonUp.height, 0, this.scrubAreaHeight - this.scrub.height);
stage.addEventListener(MouseEvent.MOUSE_MOVE, this.stage_mouseMoveHandler);
stage.addEventListener(MouseEvent.MOUSE_UP, this.stage_mouseUpHandler);
scrub.startDrag(false, loc0);
return;
}
public Setter function numRows(arg0:int)
{
if(arg0 > 0)
{
this._numRows = arg0;
this.scrub.height = 0;
}
return;
}
public Getter function numRows() : int
{
return this._numRows;
}
}
public class ScrollBar_ScrollButtonUpSkin extends mx.core::SpriteAsset
{
//========================= Methods
public static function ScrollBar_ScrollButtonUpSkin()
{
return;
}
public function ScrollBar_ScrollButtonUpSkin()
{
super();
return;
}
}
public class ScrollBar_ScrollButtonDownSkin extends mx.core::SpriteAsset
{
//========================= Methods
public static function ScrollBar_ScrollButtonDownSkin()
{
return;
}
public function ScrollBar_ScrollButtonDownSkin()
{
super();
return;
}
}
public class ScrollBar_ScrollBarScrubSkin extends mx.core::SpriteAsset
{
//========================= Methods
public static function ScrollBar_ScrollBarScrubSkin()
{
return;
}
public function ScrollBar_ScrollBarScrubSkin()
{
super();
return;
}
}
public class ScrollBar_ScrollBarBackground extends mx.core::SpriteAsset
{
//========================= Methods
public static function ScrollBar_ScrollBarBackground()
{
return;
}
public function ScrollBar_ScrollBarBackground()
{
super();
return;
}
}
}
package BrushCursor_fla
{
public dynamic class kist_4 extends flash.display::MovieClip
{
//========================= Variables
public var tip : MovieClip;
//========================= Methods
public static function kist_4()
{
return;
}
public function kist_4()
{
super();
return;
}
}
public dynamic class kraska_9 extends flash.display::MovieClip
{
//========================= Variables
public var body : MovieClip;
//========================= Methods
public static function kraska_9()
{
return;
}
public function kraska_9()
{
super();
return;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment