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

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

funonmars.com graffiti_demo.swf

This is the info page for
Flash #240955

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


Text
Brush Size

Zoom

Hold down the SPACEBAR and click on canvas to move with the mouse.

Overlay

Brush Shape

Tools

clear

clear

postcard

postcard

undo

undo

redo

ActionScript [AS3]

Section 1
//BitString (com.adobe.images.BitString) package com.adobe.images { public class BitString { public var val:int;// = 0 public var len:int;// = 0 public function BitString(){ len = 0; val = 0; super(); } } }//package com.adobe.images
Section 2
//JPGEncoder (com.adobe.images.JPGEncoder) package com.adobe.images { import flash.display.*; import flash.utils.*; import flash.geom.*; public class JPGEncoder { private var fdtbl_UV:Array; private var std_ac_chrominance_values:Array; private var std_dc_chrominance_nrcodes:Array; private var std_dc_chrominance_values:Array; private var ZigZag:Array; private var YDC_HT:Array; private var bytenew:int;// = 0 private var fdtbl_Y:Array; private var YAC_HT:Array; private var std_ac_chrominance_nrcodes:Array; private var DU:Array; private var std_ac_luminance_values:Array; private var UVTable:Array; private var UDU:Array; private var YDU:Array; private var byteout:ByteArray; private var UVAC_HT:Array; private var UVDC_HT:Array; private var bytepos:int;// = 7 private var VDU:Array; private var std_ac_luminance_nrcodes:Array; private var std_dc_luminance_values:Array; private var YTable:Array; private var std_dc_luminance_nrcodes:Array; private var bitcode:Array; private var category:Array; public function JPGEncoder(_arg1:Number=50){ var _local2:int; ZigZag = [0, 1, 5, 6, 14, 15, 27, 28, 2, 4, 7, 13, 16, 26, 29, 42, 3, 8, 12, 17, 25, 30, 41, 43, 9, 11, 18, 24, 31, 40, 44, 53, 10, 19, 23, 32, 39, 45, 52, 54, 20, 22, 33, 38, 46, 51, 55, 60, 21, 34, 37, 47, 50, 56, 59, 61, 35, 36, 48, 49, 57, 58, 62, 63]; YTable = new Array(64); UVTable = new Array(64); fdtbl_Y = new Array(64); fdtbl_UV = new Array(64); std_dc_luminance_nrcodes = [0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0]; std_dc_luminance_values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; std_ac_luminance_nrcodes = [0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125]; std_ac_luminance_values = [1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, 50, 129, 145, 161, 8, 35, 66, 177, 193, 21, 82, 209, 240, 36, 51, 98, 114, 130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250]; std_dc_chrominance_nrcodes = [0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]; std_dc_chrominance_values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; std_ac_chrominance_nrcodes = [0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119]; std_ac_chrominance_values = [0, 1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34, 50, 129, 8, 20, 66, 145, 161, 177, 193, 9, 35, 51, 82, 240, 21, 98, 114, 209, 10, 22, 36, 52, 225, 37, 241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 130, 131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 226, 227, 228, 229, 230, 231, 232, 233, 234, 242, 243, 244, 245, 246, 247, 248, 249, 250]; bitcode = new Array(0xFFFF); category = new Array(0xFFFF); bytenew = 0; bytepos = 7; DU = new Array(64); YDU = new Array(64); UDU = new Array(64); VDU = new Array(64); super(); if (_arg1 <= 0){ _arg1 = 1; }; if (_arg1 > 100){ _arg1 = 100; }; _local2 = 0; if (_arg1 < 50){ _local2 = int((5000 / _arg1)); } else { _local2 = int((200 - (_arg1 * 2))); }; initHuffmanTbl(); initCategoryNumber(); initQuantTables(_local2); } private function RGB2YUV(_arg1:BitmapData, _arg2:int, _arg3:int):void{ var _local4:int; var _local5:int; var _local6:int; var _local7:uint; var _local8:Number; var _local9:Number; var _local10:Number; _local4 = 0; _local5 = 0; while (_local5 < 8) { _local6 = 0; while (_local6 < 8) { _local7 = _arg1.getPixel32((_arg2 + _local6), (_arg3 + _local5)); _local8 = Number(((_local7 >> 16) & 0xFF)); _local9 = Number(((_local7 >> 8) & 0xFF)); _local10 = Number((_local7 & 0xFF)); YDU[_local4] = ((((0.299 * _local8) + (0.587 * _local9)) + (0.114 * _local10)) - 128); UDU[_local4] = (((-0.16874 * _local8) + (-0.33126 * _local9)) + (0.5 * _local10)); VDU[_local4] = (((0.5 * _local8) + (-0.41869 * _local9)) + (-0.08131 * _local10)); _local4++; _local6++; }; _local5++; }; } private function writeWord(_arg1:int):void{ writeByte(((_arg1 >> 8) & 0xFF)); writeByte((_arg1 & 0xFF)); } private function writeByte(_arg1:int):void{ byteout.writeByte(_arg1); } private function writeDHT():void{ var _local1:int; writeWord(65476); writeWord(418); writeByte(0); _local1 = 0; while (_local1 < 16) { writeByte(std_dc_luminance_nrcodes[(_local1 + 1)]); _local1++; }; _local1 = 0; while (_local1 <= 11) { writeByte(std_dc_luminance_values[_local1]); _local1++; }; writeByte(16); _local1 = 0; while (_local1 < 16) { writeByte(std_ac_luminance_nrcodes[(_local1 + 1)]); _local1++; }; _local1 = 0; while (_local1 <= 161) { writeByte(std_ac_luminance_values[_local1]); _local1++; }; writeByte(1); _local1 = 0; while (_local1 < 16) { writeByte(std_dc_chrominance_nrcodes[(_local1 + 1)]); _local1++; }; _local1 = 0; while (_local1 <= 11) { writeByte(std_dc_chrominance_values[_local1]); _local1++; }; writeByte(17); _local1 = 0; while (_local1 < 16) { writeByte(std_ac_chrominance_nrcodes[(_local1 + 1)]); _local1++; }; _local1 = 0; while (_local1 <= 161) { writeByte(std_ac_chrominance_values[_local1]); _local1++; }; } private function writeBits(_arg1:BitString):void{ var _local2:int; var _local3:int; _local2 = _arg1.val; _local3 = (_arg1.len - 1); while (_local3 >= 0) { if ((_local2 & uint((1 << _local3)))){ bytenew = (bytenew | uint((1 << bytepos))); }; _local3--; bytepos--; if (bytepos < 0){ if (bytenew == 0xFF){ writeByte(0xFF); writeByte(0); } else { writeByte(bytenew); }; bytepos = 7; bytenew = 0; }; }; } private function initHuffmanTbl():void{ YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes, std_dc_luminance_values); UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes, std_dc_chrominance_values); YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes, std_ac_luminance_values); UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes, std_ac_chrominance_values); } public function encode(_arg1:BitmapData):ByteArray{ var _local2:Number; var _local3:Number; var _local4:Number; var _local5:int; var _local6:int; var _local7:BitString; byteout = new ByteArray(); bytenew = 0; bytepos = 7; writeWord(65496); writeAPP0(); writeDQT(); writeSOF0(_arg1.width, _arg1.height); writeDHT(); writeSOS(); _local2 = 0; _local3 = 0; _local4 = 0; bytenew = 0; bytepos = 7; _local5 = 0; while (_local5 < _arg1.height) { _local6 = 0; while (_local6 < _arg1.width) { RGB2YUV(_arg1, _local6, _local5); _local2 = processDU(YDU, fdtbl_Y, _local2, YDC_HT, YAC_HT); _local3 = processDU(UDU, fdtbl_UV, _local3, UVDC_HT, UVAC_HT); _local4 = processDU(VDU, fdtbl_UV, _local4, UVDC_HT, UVAC_HT); _local6 = (_local6 + 8); }; _local5 = (_local5 + 8); }; if (bytepos >= 0){ _local7 = new BitString(); _local7.len = (bytepos + 1); _local7.val = ((1 << (bytepos + 1)) - 1); writeBits(_local7); }; writeWord(65497); return (byteout); } private function initCategoryNumber():void{ var _local1:int; var _local2:int; var _local3:int; var _local4:int; _local1 = 1; _local2 = 2; _local4 = 1; while (_local4 <= 15) { _local3 = _local1; while (_local3 < _local2) { category[(32767 + _local3)] = _local4; bitcode[(32767 + _local3)] = new BitString(); bitcode[(32767 + _local3)].len = _local4; bitcode[(32767 + _local3)].val = _local3; _local3++; }; _local3 = -((_local2 - 1)); while (_local3 <= -(_local1)) { category[(32767 + _local3)] = _local4; bitcode[(32767 + _local3)] = new BitString(); bitcode[(32767 + _local3)].len = _local4; bitcode[(32767 + _local3)].val = ((_local2 - 1) + _local3); _local3++; }; _local1 = (_local1 << 1); _local2 = (_local2 << 1); _local4++; }; } private function writeDQT():void{ var _local1:int; writeWord(65499); writeWord(132); writeByte(0); _local1 = 0; while (_local1 < 64) { writeByte(YTable[_local1]); _local1++; }; writeByte(1); _local1 = 0; while (_local1 < 64) { writeByte(UVTable[_local1]); _local1++; }; } private function writeAPP0():void{ writeWord(65504); writeWord(16); writeByte(74); writeByte(70); writeByte(73); writeByte(70); writeByte(0); writeByte(1); writeByte(1); writeByte(0); writeWord(1); writeWord(1); writeByte(0); writeByte(0); } private function writeSOS():void{ writeWord(65498); writeWord(12); writeByte(3); writeByte(1); writeByte(0); writeByte(2); writeByte(17); writeByte(3); writeByte(17); writeByte(0); writeByte(63); writeByte(0); } private function processDU(_arg1:Array, _arg2:Array, _arg3:Number, _arg4:Array, _arg5:Array):Number{ var _local6:BitString; var _local7:BitString; var _local8:int; var _local9:Array; var _local10:int; var _local11:int; var _local12:int; var _local13:int; var _local14:int; _local6 = _arg5[0]; _local7 = _arg5[240]; _local9 = fDCTQuant(_arg1, _arg2); _local8 = 0; while (_local8 < 64) { DU[ZigZag[_local8]] = _local9[_local8]; _local8++; }; _local10 = (DU[0] - _arg3); _arg3 = DU[0]; if (_local10 == 0){ writeBits(_arg4[0]); } else { writeBits(_arg4[category[(32767 + _local10)]]); writeBits(bitcode[(32767 + _local10)]); }; _local11 = 63; while ((((_local11 > 0)) && ((DU[_local11] == 0)))) { _local11--; }; if (_local11 == 0){ writeBits(_local6); return (_arg3); }; _local8 = 1; while (_local8 <= _local11) { _local12 = _local8; while ((((DU[_local8] == 0)) && ((_local8 <= _local11)))) { _local8++; }; _local13 = (_local8 - _local12); if (_local13 >= 16){ _local14 = 1; while (_local14 <= (_local13 / 16)) { writeBits(_local7); _local14++; }; _local13 = int((_local13 & 15)); }; writeBits(_arg5[((_local13 * 16) + category[(32767 + DU[_local8])])]); writeBits(bitcode[(32767 + DU[_local8])]); _local8++; }; if (_local11 != 63){ writeBits(_local6); }; return (_arg3); } private function initQuantTables(_arg1:int):void{ var _local2:int; var _local3:Number; var _local4:Array; var _local5:Array; var _local6:Array; var _local7:int; var _local8:int; _local4 = [16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, 69, 56, 14, 17, 22, 29, 51, 87, 80, 62, 18, 22, 37, 56, 68, 109, 103, 77, 24, 35, 55, 64, 81, 104, 113, 92, 49, 64, 78, 87, 103, 121, 120, 101, 72, 92, 95, 98, 112, 100, 103, 99]; _local2 = 0; while (_local2 < 64) { _local3 = Math.floor((((_local4[_local2] * _arg1) + 50) / 100)); if (_local3 < 1){ _local3 = 1; } else { if (_local3 > 0xFF){ _local3 = 0xFF; }; }; YTable[ZigZag[_local2]] = _local3; _local2++; }; _local5 = [17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99, 24, 26, 56, 99, 99, 99, 99, 99, 47, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99]; _local2 = 0; while (_local2 < 64) { _local3 = Math.floor((((_local5[_local2] * _arg1) + 50) / 100)); if (_local3 < 1){ _local3 = 1; } else { if (_local3 > 0xFF){ _local3 = 0xFF; }; }; UVTable[ZigZag[_local2]] = _local3; _local2++; }; _local6 = [1, 1.387039845, 1.306562965, 1.175875602, 1, 0.785694958, 0.5411961, 0.275899379]; _local2 = 0; _local7 = 0; while (_local7 < 8) { _local8 = 0; while (_local8 < 8) { fdtbl_Y[_local2] = (1 / (((YTable[ZigZag[_local2]] * _local6[_local7]) * _local6[_local8]) * 8)); fdtbl_UV[_local2] = (1 / (((UVTable[ZigZag[_local2]] * _local6[_local7]) * _local6[_local8]) * 8)); _local2++; _local8++; }; _local7++; }; } private function writeSOF0(_arg1:int, _arg2:int):void{ writeWord(65472); writeWord(17); writeByte(8); writeWord(_arg2); writeWord(_arg1); writeByte(3); writeByte(1); writeByte(17); writeByte(0); writeByte(2); writeByte(17); writeByte(1); writeByte(3); writeByte(17); writeByte(1); } private function computeHuffmanTbl(_arg1:Array, _arg2:Array):Array{ var _local3:int; var _local4:int; var _local5:Array; var _local6:int; var _local7:int; _local3 = 0; _local4 = 0; _local5 = new Array(); _local6 = 1; while (_local6 <= 16) { _local7 = 1; while (_local7 <= _arg1[_local6]) { _local5[_arg2[_local4]] = new BitString(); _local5[_arg2[_local4]].val = _local3; _local5[_arg2[_local4]].len = _local6; _local4++; _local3++; _local7++; }; _local3 = (_local3 * 2); _local6++; }; return (_local5); } private function fDCTQuant(_arg1:Array, _arg2:Array):Array{ var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:int; var _local23:int; _local23 = 0; _local22 = 0; while (_local22 < 8) { _local3 = (_arg1[(_local23 + 0)] + _arg1[(_local23 + 7)]); _local10 = (_arg1[(_local23 + 0)] - _arg1[(_local23 + 7)]); _local4 = (_arg1[(_local23 + 1)] + _arg1[(_local23 + 6)]); _local9 = (_arg1[(_local23 + 1)] - _arg1[(_local23 + 6)]); _local5 = (_arg1[(_local23 + 2)] + _arg1[(_local23 + 5)]); _local8 = (_arg1[(_local23 + 2)] - _arg1[(_local23 + 5)]); _local6 = (_arg1[(_local23 + 3)] + _arg1[(_local23 + 4)]); _local7 = (_arg1[(_local23 + 3)] - _arg1[(_local23 + 4)]); _local11 = (_local3 + _local6); _local14 = (_local3 - _local6); _local12 = (_local4 + _local5); _local13 = (_local4 - _local5); _arg1[(_local23 + 0)] = (_local11 + _local12); _arg1[(_local23 + 4)] = (_local11 - _local12); _local15 = ((_local13 + _local14) * 0.707106781); _arg1[(_local23 + 2)] = (_local14 + _local15); _arg1[(_local23 + 6)] = (_local14 - _local15); _local11 = (_local7 + _local8); _local12 = (_local8 + _local9); _local13 = (_local9 + _local10); _local19 = ((_local11 - _local13) * 0.382683433); _local16 = ((0.5411961 * _local11) + _local19); _local18 = ((1.306562965 * _local13) + _local19); _local17 = (_local12 * 0.707106781); _local20 = (_local10 + _local17); _local21 = (_local10 - _local17); _arg1[(_local23 + 5)] = (_local21 + _local16); _arg1[(_local23 + 3)] = (_local21 - _local16); _arg1[(_local23 + 1)] = (_local20 + _local18); _arg1[(_local23 + 7)] = (_local20 - _local18); _local23 = (_local23 + 8); _local22++; }; _local23 = 0; _local22 = 0; while (_local22 < 8) { _local3 = (_arg1[(_local23 + 0)] + _arg1[(_local23 + 56)]); _local10 = (_arg1[(_local23 + 0)] - _arg1[(_local23 + 56)]); _local4 = (_arg1[(_local23 + 8)] + _arg1[(_local23 + 48)]); _local9 = (_arg1[(_local23 + 8)] - _arg1[(_local23 + 48)]); _local5 = (_arg1[(_local23 + 16)] + _arg1[(_local23 + 40)]); _local8 = (_arg1[(_local23 + 16)] - _arg1[(_local23 + 40)]); _local6 = (_arg1[(_local23 + 24)] + _arg1[(_local23 + 32)]); _local7 = (_arg1[(_local23 + 24)] - _arg1[(_local23 + 32)]); _local11 = (_local3 + _local6); _local14 = (_local3 - _local6); _local12 = (_local4 + _local5); _local13 = (_local4 - _local5); _arg1[(_local23 + 0)] = (_local11 + _local12); _arg1[(_local23 + 32)] = (_local11 - _local12); _local15 = ((_local13 + _local14) * 0.707106781); _arg1[(_local23 + 16)] = (_local14 + _local15); _arg1[(_local23 + 48)] = (_local14 - _local15); _local11 = (_local7 + _local8); _local12 = (_local8 + _local9); _local13 = (_local9 + _local10); _local19 = ((_local11 - _local13) * 0.382683433); _local16 = ((0.5411961 * _local11) + _local19); _local18 = ((1.306562965 * _local13) + _local19); _local17 = (_local12 * 0.707106781); _local20 = (_local10 + _local17); _local21 = (_local10 - _local17); _arg1[(_local23 + 40)] = (_local21 + _local16); _arg1[(_local23 + 24)] = (_local21 - _local16); _arg1[(_local23 + 8)] = (_local20 + _local18); _arg1[(_local23 + 56)] = (_local20 - _local18); _local23++; _local22++; }; _local22 = 0; while (_local22 < 64) { _arg1[_local22] = Math.round((_arg1[_local22] * _arg2[_local22])); _local22++; }; return (_arg1); } } }//package com.adobe.images
Section 3
//CanvasEvent (com.nocircleno.graffiti.events.CanvasEvent) package com.nocircleno.graffiti.events { import flash.geom.*; import flash.events.*; public class CanvasEvent extends Event { private var _canvasWidth:uint; private var _viewableRect:Rectangle; private var _canvasZoom:Number; private var _canvasHeight:uint; public static const ZOOM:String = "zoom"; public static const DRAG:String = "drag"; public function CanvasEvent(_arg1:String, _arg2:Number, _arg3:uint, _arg4:uint, _arg5:Rectangle, _arg6:Boolean=false, _arg7:Boolean=false){ super(_arg1, _arg6, _arg7); _canvasZoom = _arg2; _canvasWidth = _arg3; _canvasHeight = _arg4; _viewableRect = _arg5; } public function get viewableRect():Rectangle{ return (_viewableRect); } public function get canvasWidth():uint{ return (_canvasWidth); } public function get zoom():Number{ return (_canvasZoom); } public function get canvasHeight():uint{ return (_canvasHeight); } } }//package com.nocircleno.graffiti.events
Section 4
//Brush (com.nocircleno.graffiti.tools.brush.Brush) package com.nocircleno.graffiti.tools.brush { import flash.display.*; import flash.geom.*; import com.nocircleno.graffiti.tools.core.*; public class Brush extends Tool { private var _eighthSize:Number; private var _type:String; private var _fourthSize:Number; private var _size:Number; private var _color:uint; private var _halfSize:Number; public function Brush(_arg1:Number=4, _arg2:uint=0, _arg3:String=null, _arg4:String=null){ _renderType = ToolRenderType.CONTINUOUS; size = _arg1; color = _arg2; type = _arg3; mode = _arg4; } public function generateBrush(_arg1:Number=0, _arg2:int=-1):Sprite{ var _local3:Sprite; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:uint; _local3 = new Sprite(); if (_arg1 == 0){ _local6 = _size; _local7 = _halfSize; _local8 = _fourthSize; _local9 = _eighthSize; } else { _local6 = _arg1; _local7 = (_arg1 / 2); _local8 = (_arg1 / 4); _local9 = (_arg1 / 8); }; if (_arg2 < 0){ _local10 = _color; } else { _local10 = _arg2; }; if (_type == BrushType.ROUND){ _local3.graphics.beginFill(_local10, 1); _local3.graphics.drawCircle(0, 0, _local7); _local3.graphics.endFill(); } else { if ((((((_type == BrushType.HORIZONTAL_LINE)) || ((_type == BrushType.VERTICAL_LINE)))) || ((_type == BrushType.SQUARE)))){ if (_type == BrushType.HORIZONTAL_LINE){ _local4 = _local7; _local5 = _local9; } else { if (_type == BrushType.VERTICAL_LINE){ _local4 = _local9; _local5 = _local7; } else { if (_type == BrushType.SQUARE){ _local4 = _local7; _local5 = _local7; }; }; }; _local3.graphics.beginFill(_local10, 1); _local3.graphics.drawRect(-(_local4), -(_local5), (_local4 << 1), (_local5 << 1)); _local3.graphics.endFill(); } else { if (_type == BrushType.FORWARD_LINE){ _local3.graphics.beginFill(_local10, 1); _local3.graphics.moveTo((_local7 - _local9), -(_local7)); _local3.graphics.lineTo(_local7, -(_local7)); _local3.graphics.lineTo((-(_local7) + _local9), _local7); _local3.graphics.lineTo(-(_local7), _local7); _local3.graphics.lineTo((_local7 - _local9), -(_local7)); _local3.graphics.endFill(); } else { if (_type == BrushType.BACKWARD_LINE){ _local3.graphics.beginFill(_local10, 1); _local3.graphics.moveTo((-(_local7) + _local9), -(_local7)); _local3.graphics.lineTo(-(_local7), -(_local7)); _local3.graphics.lineTo((_local7 - _local9), _local7); _local3.graphics.lineTo(_local7, _local7); _local3.graphics.lineTo((-(_local7) + _local9), -(_local7)); _local3.graphics.endFill(); } else { if (_type == BrushType.DIAMOND){ _local3.graphics.beginFill(_local10, 1); _local3.graphics.moveTo(0, -(_local7)); _local3.graphics.lineTo(_local7, 0); _local3.graphics.lineTo(0, _local7); _local3.graphics.lineTo(-(_local7), 0); _local3.graphics.lineTo(0, -(_local7)); _local3.graphics.endFill(); }; }; }; }; }; return (_local3); } public function set size(_arg1:Number):void{ if (_arg1 > 0){ _size = _arg1; _halfSize = (_size / 2); _fourthSize = (_size / 4); _eighthSize = (_size / 8); }; } public function set color(_arg1:uint):void{ _color = _arg1; } public function get size():Number{ return (_size); } public function get type():String{ return (_type); } private function degrees(_arg1:Number):Number{ return (((_arg1 * 180) / Math.PI)); } public function get color():uint{ return (_color); } override public function apply(_arg1:DisplayObject, _arg2:Point, _arg3:Point=null):void{ var _local4:Sprite; var _local5:Number; var _local6:Number; var _local7:Point; var _local8:Point; var _local9:Number; _local4 = Sprite(_arg1); if (_arg3 == null){ if (_type == BrushType.ROUND){ _local4.graphics.beginFill(_color, 1); _local4.graphics.drawCircle(_arg2.x, _arg2.y, _halfSize); _local4.graphics.endFill(); } else { if ((((((_type == BrushType.HORIZONTAL_LINE)) || ((_type == BrushType.VERTICAL_LINE)))) || ((_type == BrushType.SQUARE)))){ if (_type == BrushType.HORIZONTAL_LINE){ _local5 = _halfSize; _local6 = _eighthSize; } else { if (_type == BrushType.VERTICAL_LINE){ _local5 = _eighthSize; _local6 = _halfSize; } else { if (_type == BrushType.SQUARE){ _local5 = _halfSize; _local6 = _halfSize; }; }; }; _local4.graphics.beginFill(_color, 1); _local4.graphics.drawRect((_arg2.x - _local5), (_arg2.y - _local6), (_local5 << 1), (_local6 << 1)); _local4.graphics.endFill(); } else { if (_type == BrushType.FORWARD_LINE){ _local4.graphics.beginFill(_color, 1); _local4.graphics.moveTo(((_arg2.x + _halfSize) - _eighthSize), (_arg2.y - _halfSize)); _local4.graphics.lineTo((_arg2.x + _halfSize), (_arg2.y - _halfSize)); _local4.graphics.lineTo(((_arg2.x - _halfSize) + _eighthSize), (_arg2.y + _halfSize)); _local4.graphics.lineTo((_arg2.x - _halfSize), (_arg2.y + _halfSize)); _local4.graphics.lineTo(((_arg2.x + _halfSize) - _eighthSize), (_arg2.y - _halfSize)); _local4.graphics.endFill(); } else { if (_type == BrushType.BACKWARD_LINE){ _local4.graphics.beginFill(_color, 1); _local4.graphics.moveTo(((_arg2.x - _halfSize) + _eighthSize), (_arg2.y - _halfSize)); _local4.graphics.lineTo((_arg2.x - _halfSize), (_arg2.y - _halfSize)); _local4.graphics.lineTo(((_arg2.x + _halfSize) - _eighthSize), (_arg2.y + _halfSize)); _local4.graphics.lineTo((_arg2.x + _halfSize), (_arg2.y + _halfSize)); _local4.graphics.lineTo(((_arg2.x - _halfSize) + _eighthSize), (_arg2.y - _halfSize)); _local4.graphics.endFill(); } else { if (_type == BrushType.DIAMOND){ _local4.graphics.beginFill(_color, 1); _local4.graphics.moveTo(_arg2.x, (_arg2.y - _halfSize)); _local4.graphics.lineTo((_arg2.x + _halfSize), _arg2.y); _local4.graphics.lineTo(_arg2.x, (_arg2.y + _halfSize)); _local4.graphics.lineTo((_arg2.x - _halfSize), _arg2.y); _local4.graphics.lineTo(_arg2.x, (_arg2.y - _halfSize)); _local4.graphics.endFill(); }; }; }; }; }; } else { if (_arg2.x <= _arg3.x){ _local7 = _arg2; _local8 = _arg3; } else { _local7 = _arg3; _local8 = _arg2; }; if (_type == BrushType.ROUND){ _local4.graphics.lineStyle(_size, _color, 1, false, LineScaleMode.NORMAL, CapsStyle.ROUND); _local4.graphics.moveTo(_arg2.x, _arg2.y); _local4.graphics.lineTo(_arg3.x, _arg3.y); } else { if ((((((_type == BrushType.HORIZONTAL_LINE)) || ((_type == BrushType.VERTICAL_LINE)))) || ((_type == BrushType.SQUARE)))){ if (_type == BrushType.HORIZONTAL_LINE){ _local5 = _halfSize; _local6 = _eighthSize; } else { if (_type == BrushType.VERTICAL_LINE){ _local5 = _eighthSize; _local6 = _halfSize; } else { if (_type == BrushType.SQUARE){ _local5 = _halfSize; _local6 = _halfSize; }; }; }; _local4.graphics.beginFill(_color, 1); if (_local7.y < _local8.y){ _local4.graphics.moveTo((_local7.x + _local5), (_local7.y - _local6)); _local4.graphics.lineTo((_local8.x + _local5), (_local8.y - _local6)); _local4.graphics.lineTo((_local8.x + _local5), (_local8.y + _local6)); _local4.graphics.lineTo((_local8.x - _local5), (_local8.y + _local6)); _local4.graphics.lineTo((_local7.x - _local5), (_local7.y + _local6)); _local4.graphics.lineTo((_local7.x - _local5), (_local7.y - _local6)); _local4.graphics.lineTo((_local7.x + _local5), (_local7.y - _local6)); } else { _local4.graphics.moveTo((_local7.x - _local5), (_local7.y - _local6)); _local4.graphics.lineTo((_local8.x - _local5), (_local8.y - _local6)); _local4.graphics.lineTo((_local8.x + _local5), (_local8.y - _local6)); _local4.graphics.lineTo((_local8.x + _local5), (_local8.y + _local6)); _local4.graphics.lineTo((_local7.x + _local5), (_local7.y + _local6)); _local4.graphics.lineTo((_local7.x - _local5), (_local7.y + _local6)); _local4.graphics.lineTo((_local7.x - _local5), (_local7.y - _local6)); }; _local4.graphics.endFill(); } else { if (_type == BrushType.FORWARD_LINE){ _local9 = degrees(Math.atan2((_local8.x - _local7.x), (_local8.y - _local7.y))); _local4.graphics.beginFill(_color, 1); _local4.graphics.moveTo((_local7.x - _halfSize), (_local7.y + _halfSize)); if (_local9 >= 135){ _local4.graphics.lineTo((_local8.x - _halfSize), (_local8.y + _halfSize)); _local4.graphics.lineTo(((_local8.x + _halfSize) - _eighthSize), (_local8.y - _halfSize)); _local4.graphics.lineTo((_local8.x + _halfSize), (_local8.y - _halfSize)); _local4.graphics.lineTo((_local7.x + _halfSize), (_local7.y - _halfSize)); _local4.graphics.lineTo(((_local7.x - _halfSize) + _eighthSize), (_local7.y + _halfSize)); } else { if (_local9 >= 90){ _local4.graphics.lineTo(((_local7.x + _halfSize) - _eighthSize), (_local7.y - _halfSize)); _local4.graphics.lineTo(((_local8.x + _halfSize) - _eighthSize), (_local8.y - _halfSize)); _local4.graphics.lineTo((_local8.x + _halfSize), (_local8.y - _halfSize)); _local4.graphics.lineTo(((_local8.x - _halfSize) + _eighthSize), (_local8.y + _halfSize)); _local4.graphics.lineTo(((_local7.x - _halfSize) + _eighthSize), (_local7.y + _halfSize)); } else { _local4.graphics.lineTo(((_local7.x + _halfSize) - _eighthSize), (_local7.y - _halfSize)); _local4.graphics.lineTo((_local7.x + _halfSize), (_local7.y - _halfSize)); _local4.graphics.lineTo((_local8.x + _halfSize), (_local8.y - _halfSize)); _local4.graphics.lineTo(((_local8.x - _halfSize) + _eighthSize), (_local8.y + _halfSize)); _local4.graphics.lineTo((_local8.x - _halfSize), (_local8.y + _halfSize)); _local4.graphics.lineTo(((_local7.x - _halfSize) + _eighthSize), (_local7.y + _halfSize)); }; }; _local4.graphics.lineTo((_local7.x - _halfSize), (_local7.y + _halfSize)); _local4.graphics.endFill(); } else { if (_type == BrushType.BACKWARD_LINE){ _local9 = degrees(Math.atan2((_local8.x - _local7.x), (_local8.y - _local7.y))); _local4.graphics.beginFill(_color, 1); _local4.graphics.moveTo((_local7.x - _halfSize), (_local7.y - _halfSize)); if (_local9 <= 45){ _local4.graphics.lineTo(((_local7.x - _halfSize) + _eighthSize), (_local7.y - _halfSize)); _local4.graphics.lineTo((_local7.x + _halfSize), (_local7.y + _halfSize)); _local4.graphics.lineTo((_local8.x + _halfSize), (_local8.y + _halfSize)); _local4.graphics.lineTo(((_local8.x + _halfSize) - _eighthSize), (_local8.y + _halfSize)); _local4.graphics.lineTo((_local8.x - _halfSize), (_local8.y - _halfSize)); } else { if (_local9 <= 90){ _local4.graphics.lineTo(((_local7.x - _halfSize) + _eighthSize), (_local7.y - _halfSize)); _local4.graphics.lineTo(((_local8.x - _halfSize) + _eighthSize), (_local8.y - _halfSize)); _local4.graphics.lineTo((_local8.x + _halfSize), (_local8.y + _halfSize)); _local4.graphics.lineTo(((_local8.x + _halfSize) - _eighthSize), (_local8.y + _halfSize)); _local4.graphics.lineTo(((_local7.x + _halfSize) - _eighthSize), (_local7.y + _halfSize)); } else { _local4.graphics.lineTo((_local8.x - _halfSize), (_local8.y - _halfSize)); _local4.graphics.lineTo(((_local8.x - _halfSize) + _eighthSize), (_local8.y - _halfSize)); _local4.graphics.lineTo((_local8.x + _halfSize), (_local8.y + _halfSize)); _local4.graphics.lineTo((_local7.x + _halfSize), (_local7.y + _halfSize)); _local4.graphics.lineTo(((_local7.x + _halfSize) - _eighthSize), (_local7.y + _halfSize)); }; }; _local4.graphics.lineTo((_local7.x - _halfSize), (_local7.y - _halfSize)); _local4.graphics.endFill(); } else { if (_type == BrushType.DIAMOND){ _local4.graphics.beginFill(_color, 1); if (Math.abs((_arg3.x - _arg2.x)) > Math.abs((_arg3.y - _arg2.y))){ _local4.graphics.moveTo(_local7.x, (_local7.y - _halfSize)); _local4.graphics.lineTo(_local8.x, (_local8.y - _halfSize)); _local4.graphics.lineTo((_local8.x + _halfSize), _local8.y); _local4.graphics.lineTo(_local8.x, (_local8.y + _halfSize)); _local4.graphics.lineTo(_local7.x, (_local7.y + _halfSize)); _local4.graphics.lineTo((_local7.x - _halfSize), _local7.y); _local4.graphics.lineTo(_local7.x, (_local7.y - _halfSize)); } else { if (_arg2.y < _arg3.y){ _local7 = _arg2; _local8 = _arg3; } else { _local7 = _arg3; _local8 = _arg2; }; _local4.graphics.moveTo((_local7.x + _halfSize), _local7.y); _local4.graphics.lineTo((_local8.x + _halfSize), _local8.y); _local4.graphics.lineTo(_local8.x, (_local8.y + _halfSize)); _local4.graphics.lineTo((_local8.x - _halfSize), _local8.y); _local4.graphics.lineTo((_local7.x - _halfSize), _local7.y); _local4.graphics.lineTo(_local7.x, (_local7.y - _halfSize)); _local4.graphics.lineTo((_local7.x + _halfSize), _local7.y); }; _local4.graphics.endFill(); }; }; }; }; }; }; } public function set type(_arg1:String):void{ if (((!((_arg1 == null))) && (BrushType.validType(_arg1)))){ _type = _arg1; } else { _type = BrushType.SQUARE; }; } } }//package com.nocircleno.graffiti.tools.brush
Section 5
//BrushType (com.nocircleno.graffiti.tools.brush.BrushType) package com.nocircleno.graffiti.tools.brush { public class BrushType { public static const SQUARE:String = "square"; public static const FORWARD_LINE:String = "forward_line"; public static const HORIZONTAL_LINE:String = "horizontal_line"; public static const BACKWARD_LINE:String = "backward_line"; public static const DIAMOND:String = "diamond"; public static const ROUND:String = "round"; public static const VERTICAL_LINE:String = "vertical_line"; public static function validType(_arg1:String):Boolean{ var _local2:Boolean; _local2 = false; if ((((((((((((((_arg1 == BrushType.SQUARE)) || ((_arg1 == BrushType.ROUND)))) || ((_arg1 == BrushType.HORIZONTAL_LINE)))) || ((_arg1 == BrushType.VERTICAL_LINE)))) || ((_arg1 == BrushType.FORWARD_LINE)))) || ((_arg1 == BrushType.BACKWARD_LINE)))) || ((_arg1 == BrushType.DIAMOND)))){ _local2 = true; }; return (_local2); } } }//package com.nocircleno.graffiti.tools.brush
Section 6
//Tool (com.nocircleno.graffiti.tools.core.Tool) package com.nocircleno.graffiti.tools.core { import flash.display.*; import flash.geom.*; public class Tool { protected var _mode:String; protected var _renderType:String; public function get mode():String{ return (_mode); } public function set mode(_arg1:String):void{ if (((!((_arg1 == null))) && (ToolMode.validMode(_arg1)))){ _mode = _arg1; } else { _mode = ToolMode.NORMAL; }; } public function apply(_arg1:DisplayObject, _arg2:Point, _arg3:Point=null):void{ } public function get renderType():String{ return (_renderType); } } }//package com.nocircleno.graffiti.tools.core
Section 7
//ToolMode (com.nocircleno.graffiti.tools.core.ToolMode) package com.nocircleno.graffiti.tools.core { public class ToolMode { public static const ERASE:String = "erase"; public static const NORMAL:String = "normal"; public static function validMode(_arg1:String):Boolean{ var _local2:Boolean; _local2 = false; if ((((_arg1 == ToolMode.NORMAL)) || ((_arg1 == ToolMode.ERASE)))){ _local2 = true; }; return (_local2); } } }//package com.nocircleno.graffiti.tools.core
Section 8
//ToolRenderType (com.nocircleno.graffiti.tools.core.ToolRenderType) package com.nocircleno.graffiti.tools.core { public class ToolRenderType { public static const DRAG:String = "drag"; public static const CONTINUOUS:String = "continuous"; } }//package com.nocircleno.graffiti.tools.core
Section 9
//GraffitiCanvas (com.nocircleno.graffiti.GraffitiCanvas) package com.nocircleno.graffiti { import flash.display.*; import flash.geom.*; import flash.events.*; import com.nocircleno.graffiti.tools.core.*; import com.nocircleno.graffiti.tools.brush.*; import com.nocircleno.graffiti.events.*; public class GraffitiCanvas extends Sprite { private var _maxHistoryLength:uint; private var _minZoom:uint;// = 1 private var _maxHeight:uint;// = 2800 private var _maxWidth:uint;// = 2800 private var _maxZoom:uint; private var canvas:Bitmap; private var _tool:Tool; private var _history:Array; private var container:Sprite; private var _canvasWidth:uint; private var drawing_space:Sprite; private var _prevPoint:Point; private var _canvasHeight:uint; private var _zoom:Number;// = 1 private var _canvasEnabled:Boolean;// = true private var _bmp:BitmapData; private var _historyPosition:uint;// = 0 private var overlay_do:DisplayObject; private var underlay_do:DisplayObject; private var _mouseDrag:Boolean;// = false public function GraffitiCanvas(_arg1:uint=100, _arg2:uint=100, _arg3:uint=0, _arg4:DisplayObject=null, _arg5:DisplayObject=null){ _canvasEnabled = true; _mouseDrag = false; _zoom = 1; _minZoom = 1; _maxWidth = 2800; _maxHeight = 2800; _historyPosition = 0; super(); _canvasWidth = ((_arg1 <= _maxWidth)) ? _arg1 : _maxWidth; _canvasHeight = ((_arg2 <= _maxHeight)) ? _arg2 : _maxHeight; _maxZoom = Math.floor((5500 / Math.max(_canvasWidth, _canvasHeight))); _tool = new Brush(16, 0, BrushType.DIAMOND); drawing_space = new Sprite(); container = new Sprite(); _bmp = new BitmapData(_canvasWidth, _canvasHeight, true, 0xFFFFFF); canvas = new Bitmap(_bmp, "auto", false); addChild(container); container.addChild(canvas); container.addChild(drawing_space); if (_arg4 != null){ overlay_do = _arg4; container.addChild(overlay_do); }; if (_arg5 != null){ underlay_do = _arg5; container.addChildAt(underlay_do, 0); }; this.scrollRect = new Rectangle(0, 0, _canvasWidth, _canvasHeight); this.addEventListener(MouseEvent.MOUSE_DOWN, mouseHandler); initHistory(_arg3); } public function clearCanvas():void{ if (_maxHistoryLength != 0){ writeToHistory(); }; _bmp.fillRect(new Rectangle(0, 0, _canvasWidth, _canvasHeight), 0xFFFFFF); } private function restoreFromHistory():void{ _bmp.lock(); _bmp.copyPixels(_history[_historyPosition], _history[_historyPosition].rect, new Point(0, 0)); _bmp.unlock(); } private function dragEventUpdater(_arg1:MouseEvent):void{ dispatchEvent(new CanvasEvent(CanvasEvent.DRAG, _zoom, _canvasWidth, _canvasHeight, getViewableRect())); } public function drawing():BitmapData{ var _local1:BitmapData; _local1 = new BitmapData(_canvasWidth, _canvasHeight, false, 0xFFFFFF); _local1.draw(container); return (_local1); } private function draw(_arg1:MouseEvent=null):void{ var _local2:Point; _local2 = new Point(container.mouseX, container.mouseY); if (_prevPoint == null){ _tool.apply(drawing_space, _local2); } else { _tool.apply(drawing_space, _prevPoint, _local2); }; if (_tool.renderType == ToolRenderType.CONTINUOUS){ _bmp.draw(drawing_space, new Matrix(), null, _tool.mode); drawing_space.graphics.clear(); _prevPoint = new Point(_local2.x, _local2.y); }; } public function get minZoom():Number{ return (_minZoom); } public function get maxZoom():Number{ return (_maxZoom); } public function get canvasWidth():uint{ return (_canvasWidth); } public function nextHistory():void{ if (_history != null){ if (_historyPosition != (_history.length - 1)){ _historyPosition++; restoreFromHistory(); }; }; } public function set activeTool(_arg1:Tool):void{ _tool = _arg1; } public function clearHistory():void{ var _local1:uint; if (_history != null){ _local1 = 0; while (_local1 < _history.length) { _history[_local1].dispose(); _local1++; }; _history = new Array(); }; } public function get mouseDrag():Boolean{ return (_mouseDrag); } public function set underlay(_arg1:DisplayObject):void{ if (underlay_do != null){ container.removeChild(underlay_do); }; underlay_do = _arg1; if (underlay_do != null){ container.addChildAt(underlay_do, 0); }; } public function set canvasEnabled(_arg1:Boolean):void{ _canvasEnabled = _arg1; this.mouseEnabled = _arg1; this.mouseChildren = _arg1; } public function get historyLength():uint{ return (((_history)!=null) ? _history.length : 0); } public function get maxHistoryLength():uint{ return (_maxHistoryLength); } public function get canvasHeight():uint{ return (_canvasHeight); } public function setCanvasPos(_arg1:Point):void{ container.x = _arg1.x; container.y = _arg1.y; if (container.x > 0){ container.x = 0; }; if (container.y > 0){ container.y = 0; }; if ((container.x + container.width) < _canvasWidth){ container.x = (_canvasWidth - container.width); }; if ((container.y + container.height) < _canvasHeight){ container.y = (_canvasHeight - container.height); }; } public function set zoom(_arg1:Number):void{ var _local2:Point; if ((((_arg1 >= _minZoom)) && ((_arg1 <= _maxZoom)))){ _local2 = new Point(((Math.abs(container.x) + (_canvasWidth / 2)) / _zoom), ((Math.abs(container.y) + (_canvasHeight / 2)) / _zoom)); _zoom = _arg1; container.scaleX = _zoom; container.scaleY = _zoom; container.x = ((-(_local2.x) * _zoom) + (_canvasWidth / 2)); container.y = ((-(_local2.y) * _zoom) + (_canvasHeight / 2)); if (container.x > 0){ container.x = 0; }; if (container.y > 0){ container.y = 0; }; if ((container.x + container.width) < _canvasWidth){ container.x = (_canvasWidth - container.width); }; if ((container.y + container.height) < _canvasHeight){ container.y = (_canvasHeight - container.height); }; dispatchEvent(new CanvasEvent(CanvasEvent.ZOOM, _zoom, _canvasWidth, _canvasHeight, getViewableRect())); }; } public function set overlay(_arg1:DisplayObject):void{ if (overlay_do != null){ container.removeChild(overlay_do); }; overlay_do = _arg1; if (overlay_do != null){ container.addChild(overlay_do); }; } private function writeToHistory():void{ if (_history.length == _maxHistoryLength){ _history[0].dispose(); _history.splice(0, 1); }; _history.push(_bmp.clone()); _historyPosition = (_history.length - 1); } public function get activeTool():Tool{ return (_tool); } private function initHistory(_arg1:uint):void{ _maxHistoryLength = _arg1; if (_maxHistoryLength != 0){ _history = new Array(); writeToHistory(); }; } public function get canvasEnabled():Boolean{ return (_canvasEnabled); } public function get zoom():Number{ return (_zoom); } public function get historyPosition():uint{ return (_historyPosition); } public function prevHistory():void{ if (_history != null){ if (_historyPosition != 0){ _historyPosition--; restoreFromHistory(); }; }; } private function mouseHandler(_arg1:MouseEvent):void{ if (((_canvasEnabled) && (((!((_tool == null))) || (_mouseDrag))))){ if (_arg1.type == MouseEvent.MOUSE_DOWN){ if (_mouseDrag){ container.startDrag(false, new Rectangle(-((container.width - _canvasWidth)), -((container.height - _canvasHeight)), (container.width - _canvasWidth), (container.height - _canvasHeight))); stage.addEventListener(MouseEvent.MOUSE_UP, mouseHandler); stage.addEventListener(MouseEvent.MOUSE_MOVE, dragEventUpdater); } else { stage.addEventListener(MouseEvent.MOUSE_MOVE, draw); draw(); stage.addEventListener(MouseEvent.MOUSE_UP, mouseHandler); }; } else { if (_arg1.type == MouseEvent.MOUSE_UP){ stopDrag(); if (_prevPoint != null){ if (_maxHistoryLength != 0){ writeToHistory(); }; _prevPoint = null; if (_tool.renderType == ToolRenderType.DRAG){ _bmp.draw(drawing_space, new Matrix(), null, _tool.mode); drawing_space.graphics.clear(); }; stage.removeEventListener(MouseEvent.MOUSE_MOVE, draw); } else { stage.removeEventListener(MouseEvent.MOUSE_MOVE, dragEventUpdater); }; stage.removeEventListener(MouseEvent.MOUSE_UP, mouseHandler); }; }; }; } public function set mouseDrag(_arg1:Boolean):void{ _mouseDrag = _arg1; } public function getViewableRect():Rectangle{ return (new Rectangle((Math.abs(container.x) / _zoom), (Math.abs(container.y) / _zoom), (_canvasWidth / _zoom), (_canvasHeight / _zoom))); } } }//package com.nocircleno.graffiti
Section 10
//BaseButton (fl.controls.BaseButton) package fl.controls { import flash.display.*; import flash.utils.*; import fl.core.*; import flash.events.*; import fl.events.*; public class BaseButton extends UIComponent { protected var _selected:Boolean;// = false private var unlockedMouseState:String; protected var pressTimer:Timer; protected var mouseState:String; protected var background:DisplayObject; private var _mouseStateLocked:Boolean;// = false protected var _autoRepeat:Boolean;// = false private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35}; public function BaseButton(){ _selected = false; _autoRepeat = false; _mouseStateLocked = false; super(); buttonMode = true; mouseChildren = false; useHandCursor = false; setupMouseEvents(); setMouseState("up"); pressTimer = new Timer(1, 0); pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true); } protected function endPress():void{ pressTimer.reset(); } public function set mouseStateLocked(_arg1:Boolean):void{ _mouseStateLocked = _arg1; if (_arg1 == false){ setMouseState(unlockedMouseState); } else { unlockedMouseState = mouseState; }; } public function get autoRepeat():Boolean{ return (_autoRepeat); } public function set autoRepeat(_arg1:Boolean):void{ _autoRepeat = _arg1; } override public function set enabled(_arg1:Boolean):void{ super.enabled = _arg1; mouseEnabled = _arg1; } public function get selected():Boolean{ return (_selected); } protected function mouseEventHandler(_arg1:MouseEvent):void{ if (_arg1.type == MouseEvent.MOUSE_DOWN){ setMouseState("down"); startPress(); } else { if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){ setMouseState("over"); endPress(); } else { if (_arg1.type == MouseEvent.ROLL_OUT){ setMouseState("up"); endPress(); }; }; }; } public function setMouseState(_arg1:String):void{ if (_mouseStateLocked){ unlockedMouseState = _arg1; return; }; if (mouseState == _arg1){ return; }; mouseState = _arg1; invalidate(InvalidationType.STATE); } protected function startPress():void{ if (_autoRepeat){ pressTimer.delay = Number(getStyleValue("repeatDelay")); pressTimer.start(); }; dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true)); } protected function buttonDown(_arg1:TimerEvent):void{ if (!_autoRepeat){ endPress(); return; }; if (pressTimer.currentCount == 1){ pressTimer.delay = Number(getStyleValue("repeatInterval")); }; dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true)); } public function set selected(_arg1:Boolean):void{ if (_selected == _arg1){ return; }; _selected = _arg1; invalidate(InvalidationType.STATE); } override public function get enabled():Boolean{ return (super.enabled); } override protected function draw():void{ if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){ drawBackground(); invalidate(InvalidationType.SIZE, false); }; if (isInvalid(InvalidationType.SIZE)){ drawLayout(); }; super.draw(); } protected function setupMouseEvents():void{ addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true); addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true); addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true); addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true); } protected function drawLayout():void{ background.width = width; background.height = height; } protected function drawBackground():void{ var _local1:String; var _local2:DisplayObject; _local1 = (enabled) ? mouseState : "disabled"; if (selected){ _local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1)); }; _local1 = (_local1 + "Skin"); _local2 = background; background = getDisplayObjectInstance(getStyleValue(_local1)); addChildAt(background, 0); if (((!((_local2 == null))) && (!((_local2 == background))))){ removeChild(_local2); }; } public static function getStyleDefinition():Object{ return (defaultStyles); } } }//package fl.controls
Section 11
//Button (fl.controls.Button) package fl.controls { import flash.display.*; import fl.core.*; import fl.managers.*; public class Button extends LabelButton implements IFocusManagerComponent { protected var emphasizedBorder:DisplayObject; protected var _emphasized:Boolean;// = false private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2}; public static var createAccessibilityImplementation:Function; public function Button(){ _emphasized = false; super(); } override public function drawFocus(_arg1:Boolean):void{ var _local2:Number; var _local3:*; super.drawFocus(_arg1); if (_arg1){ _local2 = Number(getStyleValue("emphasizedPadding")); if ((((_local2 < 0)) || (!(_emphasized)))){ _local2 = 0; }; _local3 = getStyleValue("focusRectPadding"); _local3 = ((_local3)==null) ? 2 : _local3; _local3 = (_local3 + _local2); uiFocusRect.x = -(_local3); uiFocusRect.y = -(_local3); uiFocusRect.width = (width + (_local3 * 2)); uiFocusRect.height = (height + (_local3 * 2)); }; } public function set emphasized(_arg1:Boolean):void{ _emphasized = _arg1; invalidate(InvalidationType.STYLES); } override protected function draw():void{ if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){ drawEmphasized(); }; super.draw(); if (emphasizedBorder != null){ setChildIndex(emphasizedBorder, (numChildren - 1)); }; } public function get emphasized():Boolean{ return (_emphasized); } override protected function initializeAccessibility():void{ if (Button.createAccessibilityImplementation != null){ Button.createAccessibilityImplementation(this); }; } protected function drawEmphasized():void{ var _local1:Object; var _local2:Number; if (emphasizedBorder != null){ removeChild(emphasizedBorder); }; emphasizedBorder = null; if (!_emphasized){ return; }; _local1 = getStyleValue("emphasizedSkin"); if (_local1 != null){ emphasizedBorder = getDisplayObjectInstance(_local1); }; if (emphasizedBorder != null){ addChildAt(emphasizedBorder, 0); _local2 = Number(getStyleValue("emphasizedPadding")); emphasizedBorder.x = (emphasizedBorder.y = -(_local2)); emphasizedBorder.width = (width + (_local2 * 2)); emphasizedBorder.height = (height + (_local2 * 2)); }; } public static function getStyleDefinition():Object{ return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles)); } } }//package fl.controls
Section 12
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement) package fl.controls { public class ButtonLabelPlacement { public static const TOP:String = "top"; public static const LEFT:String = "left"; public static const BOTTOM:String = "bottom"; public static const RIGHT:String = "right"; } }//package fl.controls
Section 13
//CheckBox (fl.controls.CheckBox) package fl.controls { import flash.display.*; public class CheckBox extends LabelButton { private static var defaultStyles:Object = {icon:null, upIcon:"CheckBox_upIcon", downIcon:"CheckBox_downIcon", overIcon:"CheckBox_overIcon", disabledIcon:"CheckBox_disabledIcon", selectedDisabledIcon:"CheckBox_selectedDisabledIcon", focusRectSkin:null, focusRectPadding:null, selectedUpIcon:"CheckBox_selectedUpIcon", selectedDownIcon:"CheckBox_selectedDownIcon", selectedOverIcon:"CheckBox_selectedOverIcon", textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5}; public static var createAccessibilityImplementation:Function; override public function drawFocus(_arg1:Boolean):void{ var _local2:Number; super.drawFocus(_arg1); if (_arg1){ _local2 = Number(getStyleValue("focusRectPadding")); uiFocusRect.x = (background.x - _local2); uiFocusRect.y = (background.y - _local2); uiFocusRect.width = (background.width + (_local2 << 1)); uiFocusRect.height = (background.height + (_local2 << 1)); }; } override public function get autoRepeat():Boolean{ return (false); } override public function set autoRepeat(_arg1:Boolean):void{ } override public function set toggle(_arg1:Boolean):void{ throw (new Error("Warning: You cannot change a CheckBox's toggle.")); } override public function get toggle():Boolean{ return (true); } override protected function configUI():void{ var _local1:Shape; var _local2:Graphics; super.configUI(); super.toggle = true; _local1 = new Shape(); _local2 = _local1.graphics; _local2.beginFill(0, 0); _local2.drawRect(0, 0, 100, 100); _local2.endFill(); background = (_local1 as DisplayObject); addChildAt(background, 0); } override protected function drawLayout():void{ var _local1:Number; super.drawLayout(); _local1 = Number(getStyleValue("textPadding")); switch (_labelPlacement){ case ButtonLabelPlacement.RIGHT: icon.x = _local1; textField.x = (icon.x + (icon.width + _local1)); background.width = ((textField.x + textField.width) + _local1); background.height = (Math.max(textField.height, icon.height) + (_local1 * 2)); break; case ButtonLabelPlacement.LEFT: icon.x = ((width - icon.width) - _local1); textField.x = (((width - icon.width) - (_local1 * 2)) - textField.width); background.width = ((textField.width + icon.width) + (_local1 * 3)); background.height = (Math.max(textField.height, icon.height) + (_local1 * 2)); break; case ButtonLabelPlacement.TOP: case ButtonLabelPlacement.BOTTOM: background.width = (Math.max(textField.width, icon.width) + (_local1 * 2)); background.height = ((textField.height + icon.height) + (_local1 * 3)); break; }; background.x = Math.min((icon.x - _local1), (textField.x - _local1)); background.y = Math.min((icon.y - _local1), (textField.y - _local1)); } override protected function drawBackground():void{ } override protected function initializeAccessibility():void{ if (CheckBox.createAccessibilityImplementation != null){ CheckBox.createAccessibilityImplementation(this); }; } public static function getStyleDefinition():Object{ return (defaultStyles); } } }//package fl.controls
Section 14
//ColorPicker (fl.controls.ColorPicker) package fl.controls { import flash.display.*; import fl.core.*; import flash.geom.*; import flash.events.*; import fl.managers.*; import fl.events.*; import flash.text.*; import flash.ui.*; public class ColorPicker extends UIComponent implements IFocusManagerComponent { protected var paletteBG:DisplayObject; protected var customColors:Array; protected var palette:Sprite; protected var isOpen:Boolean;// = false protected var swatchButton:BaseButton; protected var selectedSwatch:Sprite; protected var textFieldBG:DisplayObject; protected var colorWell:DisplayObject; protected var rollOverColor:int;// = -1 protected var colorHash:Object; protected var swatchSelectedSkin:DisplayObject; protected var _showTextField:Boolean;// = true protected var currRowIndex:int; protected var doOpen:Boolean;// = false protected var currColIndex:int; protected var swatchMap:Array; protected var _selectedColor:uint; protected var _editable:Boolean;// = true public var textField:TextField; protected var swatches:Sprite; protected static const SWATCH_STYLES:Object = {disabledSkin:"swatchSkin", downSkin:"swatchSkin", overSkin:"swatchSkin", upSkin:"swatchSkin"}; protected static const POPUP_BUTTON_STYLES:Object = {disabledSkin:"disabledSkin", downSkin:"downSkin", overSkin:"overSkin", upSkin:"upSkin"}; public static var defaultColors:Array; private static var defaultStyles:Object = {upSkin:"ColorPicker_upSkin", disabledSkin:"ColorPicker_disabledSkin", overSkin:"ColorPicker_overSkin", downSkin:"ColorPicker_downSkin", colorWell:"ColorPicker_colorWell", swatchSkin:"ColorPicker_swatchSkin", swatchSelectedSkin:"ColorPicker_swatchSelectedSkin", swatchWidth:10, swatchHeight:10, columnCount:18, swatchPadding:1, textFieldSkin:"ColorPicker_textFieldSkin", textFieldWidth:null, textFieldHeight:null, textPadding:3, background:"ColorPicker_backgroundSkin", backgroundPadding:5, textFormat:null, focusRectSkin:null, focusRectPadding:null, embedFonts:false}; public function ColorPicker(){ rollOverColor = -1; _editable = true; _showTextField = true; isOpen = false; doOpen = false; super(); } public function set imeMode(_arg1:String):void{ _imeMode = _arg1; } protected function drawSwatchHighlight():void{ var _local1:Object; var _local2:Number; cleanUpSelected(); _local1 = getStyleValue("swatchSelectedSkin"); _local2 = (getStyleValue("swatchPadding") as Number); if (_local1 != null){ swatchSelectedSkin = getDisplayObjectInstance(_local1); swatchSelectedSkin.x = 0; swatchSelectedSkin.y = 0; swatchSelectedSkin.width = ((getStyleValue("swatchWidth") as Number) + 2); swatchSelectedSkin.height = ((getStyleValue("swatchHeight") as Number) + 2); }; } protected function setColorWellColor(_arg1:ColorTransform):void{ if (!colorWell){ return; }; colorWell.transform.colorTransform = _arg1; } override protected function isOurFocus(_arg1:DisplayObject):Boolean{ return ((((_arg1 == textField)) || (super.isOurFocus(_arg1)))); } public function open():void{ var _local1:IFocusManager; if (!_enabled){ return; }; doOpen = true; _local1 = focusManager; if (_local1){ _local1.defaultButtonEnabled = false; }; invalidate(InvalidationType.STATE); } protected function setTextEditable():void{ if (!showTextField){ return; }; textField.type = (editable) ? TextFieldType.INPUT : TextFieldType.DYNAMIC; textField.selectable = editable; } protected function createSwatch(_arg1:uint):Sprite{ var _local2:Sprite; var _local3:BaseButton; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Graphics; _local2 = new Sprite(); _local3 = new BaseButton(); _local3.focusEnabled = false; _local4 = (getStyleValue("swatchWidth") as Number); _local5 = (getStyleValue("swatchHeight") as Number); _local3.setSize(_local4, _local5); _local3.transform.colorTransform = new ColorTransform(0, 0, 0, 1, (_arg1 >> 16), ((_arg1 >> 8) & 0xFF), (_arg1 & 0xFF), 0); copyStylesToChild(_local3, SWATCH_STYLES); _local3.mouseEnabled = false; _local3.drawNow(); _local3.name = "color"; _local2.addChild(_local3); _local6 = (getStyleValue("swatchPadding") as Number); _local7 = _local2.graphics; _local7.beginFill(0); _local7.drawRect(-(_local6), -(_local6), (_local4 + (_local6 * 2)), (_local5 + (_local6 * 2))); _local7.endFill(); _local2.addEventListener(MouseEvent.CLICK, onSwatchClick, false, 0, true); _local2.addEventListener(MouseEvent.MOUSE_OVER, onSwatchOver, false, 0, true); _local2.addEventListener(MouseEvent.MOUSE_OUT, onSwatchOut, false, 0, true); return (_local2); } protected function onSwatchOut(_arg1:MouseEvent):void{ var _local2:ColorTransform; _local2 = _arg1.target.transform.colorTransform; dispatchEvent(new ColorPickerEvent(ColorPickerEvent.ITEM_ROLL_OUT, _local2.color)); } override protected function keyDownHandler(_arg1:KeyboardEvent):void{ var _local2:ColorTransform; var _local3:Sprite; switch (_arg1.keyCode){ case Keyboard.SHIFT: case Keyboard.CONTROL: return; }; if (_arg1.ctrlKey){ switch (_arg1.keyCode){ case Keyboard.DOWN: open(); break; case Keyboard.UP: close(); break; }; return; }; if (!isOpen){ switch (_arg1.keyCode){ case Keyboard.UP: case Keyboard.DOWN: case Keyboard.LEFT: case Keyboard.RIGHT: case Keyboard.SPACE: open(); return; }; }; textField.maxChars = ((((_arg1.keyCode == "#".charCodeAt(0))) || ((textField.text.indexOf("#") > -1)))) ? 7 : 6; switch (_arg1.keyCode){ case Keyboard.TAB: _local3 = findSwatch(_selectedColor); setSwatchHighlight(_local3); return; case Keyboard.HOME: currColIndex = (currRowIndex = 0); break; case Keyboard.END: currColIndex = (swatchMap[(swatchMap.length - 1)].length - 1); currRowIndex = (swatchMap.length - 1); break; case Keyboard.PAGE_DOWN: currRowIndex = (swatchMap.length - 1); break; case Keyboard.PAGE_UP: currRowIndex = 0; break; case Keyboard.ESCAPE: if (isOpen){ selectedColor = _selectedColor; }; close(); return; case Keyboard.ENTER: return; case Keyboard.UP: currRowIndex = Math.max(-1, (currRowIndex - 1)); if (currRowIndex == -1){ currRowIndex = (swatchMap.length - 1); }; break; case Keyboard.DOWN: currRowIndex = Math.min(swatchMap.length, (currRowIndex + 1)); if (currRowIndex == swatchMap.length){ currRowIndex = 0; }; break; case Keyboard.RIGHT: currColIndex = Math.min(swatchMap[currRowIndex].length, (currColIndex + 1)); if (currColIndex == swatchMap[currRowIndex].length){ currColIndex = 0; currRowIndex = Math.min(swatchMap.length, (currRowIndex + 1)); if (currRowIndex == swatchMap.length){ currRowIndex = 0; }; }; break; case Keyboard.LEFT: currColIndex = Math.max(-1, (currColIndex - 1)); if (currColIndex == -1){ currColIndex = (swatchMap[currRowIndex].length - 1); currRowIndex = Math.max(-1, (currRowIndex - 1)); if (currRowIndex == -1){ currRowIndex = (swatchMap.length - 1); }; }; break; default: return; }; _local2 = swatchMap[currRowIndex][currColIndex].getChildByName("color").transform.colorTransform; rollOverColor = _local2.color; setColorWellColor(_local2); setSwatchHighlight(swatchMap[currRowIndex][currColIndex]); setColorText(_local2.color); } public function get editable():Boolean{ return (_editable); } override protected function focusInHandler(_arg1:FocusEvent):void{ super.focusInHandler(_arg1); setIMEMode(true); } protected function onStageClick(_arg1:MouseEvent):void{ if (((!(contains((_arg1.target as DisplayObject)))) && (!(palette.contains((_arg1.target as DisplayObject)))))){ selectedColor = _selectedColor; close(); }; } protected function onSwatchOver(_arg1:MouseEvent):void{ var _local2:BaseButton; var _local3:ColorTransform; _local2 = (_arg1.target.getChildByName("color") as BaseButton); _local3 = _local2.transform.colorTransform; setColorWellColor(_local3); setSwatchHighlight((_arg1.target as Sprite)); setColorText(_local3.color); dispatchEvent(new ColorPickerEvent(ColorPickerEvent.ITEM_ROLL_OVER, _local3.color)); } override public function set enabled(_arg1:Boolean):void{ super.enabled = _arg1; if (!_arg1){ close(); }; swatchButton.enabled = _arg1; } override protected function keyUpHandler(_arg1:KeyboardEvent):void{ var _local2:uint; var _local3:ColorTransform; var _local4:String; var _local5:Sprite; if (!isOpen){ return; }; _local3 = new ColorTransform(); if (((editable) && (showTextField))){ _local4 = textField.text; if (_local4.indexOf("#") > -1){ _local4 = _local4.replace(/^\s+|\s+$/g, ""); _local4 = _local4.replace(/#/g, ""); }; _local2 = parseInt(_local4, 16); _local5 = findSwatch(_local2); setSwatchHighlight(_local5); _local3.color = _local2; setColorWellColor(_local3); } else { _local2 = rollOverColor; _local3.color = _local2; }; if (_arg1.keyCode != Keyboard.ENTER){ return; }; dispatchEvent(new ColorPickerEvent(ColorPickerEvent.ENTER, _local2)); _selectedColor = rollOverColor; setColorText(_local3.color); rollOverColor = _local3.color; dispatchEvent(new ColorPickerEvent(ColorPickerEvent.CHANGE, selectedColor)); close(); } protected function drawBG():void{ var _local1:Object; var _local2:Number; _local1 = getStyleValue("background"); if (_local1 != null){ paletteBG = (getDisplayObjectInstance(_local1) as Sprite); }; if (paletteBG == null){ return; }; _local2 = Number(getStyleValue("backgroundPadding")); paletteBG.width = (Math.max((showTextField) ? textFieldBG.width : 0, swatches.width) + (_local2 * 2)); paletteBG.height = ((swatches.y + swatches.height) + _local2); palette.addChildAt(paletteBG, 0); } protected function positionTextField():void{ var _local1:Number; var _local2:Number; if (!showTextField){ return; }; _local1 = (getStyleValue("backgroundPadding") as Number); _local2 = (getStyleValue("textPadding") as Number); textFieldBG.x = (paletteBG.x + _local1); textFieldBG.y = (paletteBG.y + _local1); textField.x = (textFieldBG.x + _local2); textField.y = (textFieldBG.y + _local2); } protected function setEmbedFonts():void{ var _local1:Object; _local1 = getStyleValue("embedFonts"); if (_local1 != null){ textField.embedFonts = _local1; }; } public function set showTextField(_arg1:Boolean):void{ invalidate(InvalidationType.STYLES); _showTextField = _arg1; } protected function addStageListener(_arg1:Event=null):void{ stage.addEventListener(MouseEvent.MOUSE_DOWN, onStageClick, false, 0, true); } protected function drawPalette():void{ if (isOpen){ stage.removeChild(palette); }; palette = new Sprite(); drawTextField(); drawSwatches(); drawBG(); } protected function showPalette():void{ var _local1:Sprite; if (isOpen){ positionPalette(); return; }; addEventListener(Event.ENTER_FRAME, addCloseListener, false, 0, true); stage.addChild(palette); isOpen = true; positionPalette(); dispatchEvent(new Event(Event.OPEN)); stage.focus = textField; _local1 = selectedSwatch; if (_local1 == null){ _local1 = findSwatch(_selectedColor); }; setSwatchHighlight(_local1); } public function set editable(_arg1:Boolean):void{ _editable = _arg1; invalidate(InvalidationType.STATE); } public function set colors(_arg1:Array):void{ customColors = _arg1; invalidate(InvalidationType.DATA); } protected function drawTextField():void{ var _local1:Number; var _local2:Number; var _local3:Object; var _local4:TextFormat; var _local5:TextFormat; if (!showTextField){ return; }; _local1 = (getStyleValue("backgroundPadding") as Number); _local2 = (getStyleValue("textPadding") as Number); textFieldBG = getDisplayObjectInstance(getStyleValue("textFieldSkin")); if (textFieldBG != null){ palette.addChild(textFieldBG); textFieldBG.x = (textFieldBG.y = _local1); }; _local3 = UIComponent.getStyleDefinition(); _local4 = (enabled) ? (_local3.defaultTextFormat as TextFormat) : (_local3.defaultDisabledTextFormat as TextFormat); textField.setTextFormat(_local4); _local5 = (getStyleValue("textFormat") as TextFormat); if (_local5 != null){ textField.setTextFormat(_local5); } else { _local5 = _local4; }; textField.defaultTextFormat = _local5; setEmbedFonts(); textField.restrict = "A-Fa-f0-9#"; textField.maxChars = 6; palette.addChild(textField); textField.text = " #888888 "; textField.height = (textField.textHeight + 3); textField.width = (textField.textWidth + 3); textField.text = ""; textField.x = (textField.y = (_local1 + _local2)); textFieldBG.width = (textField.width + (_local2 * 2)); textFieldBG.height = (textField.height + (_local2 * 2)); setTextEditable(); } protected function setColorText(_arg1:uint):void{ if (textField == null){ return; }; textField.text = ("#" + colorToString(_arg1)); } protected function colorToString(_arg1:uint):String{ var _local2:String; _local2 = _arg1.toString(16); while (_local2.length < 6) { _local2 = ("0" + _local2); }; return (_local2); } public function get imeMode():String{ return (_imeMode); } public function set selectedColor(_arg1:uint):void{ var _local2:ColorTransform; if (!_enabled){ return; }; _selectedColor = _arg1; rollOverColor = -1; currColIndex = (currRowIndex = 0); _local2 = new ColorTransform(); _local2.color = _arg1; setColorWellColor(_local2); invalidate(InvalidationType.DATA); } override protected function focusOutHandler(_arg1:FocusEvent):void{ if (_arg1.relatedObject == textField){ setFocus(); return; }; if (isOpen){ close(); }; super.focusOutHandler(_arg1); setIMEMode(false); } protected function onPopupButtonClick(_arg1:MouseEvent):void{ if (isOpen){ close(); } else { open(); }; } protected function positionPalette():void{ var _local1:Point; var _local2:Number; _local1 = swatchButton.localToGlobal(new Point(0, 0)); _local2 = (getStyleValue("backgroundPadding") as Number); if ((_local1.x + palette.width) > stage.stageWidth){ palette.x = ((_local1.x - palette.width) << 0); } else { palette.x = (((_local1.x + swatchButton.width) + _local2) << 0); }; palette.y = (Math.max(0, Math.min(_local1.y, (stage.stageHeight - palette.height))) << 0); } public function get hexValue():String{ if (colorWell == null){ return (colorToString(0)); }; return (colorToString(colorWell.transform.colorTransform.color)); } override public function get enabled():Boolean{ return (super.enabled); } protected function setSwatchHighlight(_arg1:Sprite):void{ var _local2:Number; var _local3:*; if (_arg1 == null){ if (palette.contains(swatchSelectedSkin)){ palette.removeChild(swatchSelectedSkin); }; return; } else { if (((!(palette.contains(swatchSelectedSkin))) && ((colors.length > 0)))){ palette.addChild(swatchSelectedSkin); } else { if (!colors.length){ return; }; }; }; _local2 = (getStyleValue("swatchPadding") as Number); palette.setChildIndex(swatchSelectedSkin, (palette.numChildren - 1)); swatchSelectedSkin.x = ((swatches.x + _arg1.x) - 1); swatchSelectedSkin.y = ((swatches.y + _arg1.y) - 1); _local3 = _arg1.getChildByName("color").transform.colorTransform.color; currColIndex = colorHash[_local3].col; currRowIndex = colorHash[_local3].row; } protected function onSwatchClick(_arg1:MouseEvent):void{ var _local2:ColorTransform; _local2 = _arg1.target.getChildByName("color").transform.colorTransform; _selectedColor = _local2.color; dispatchEvent(new ColorPickerEvent(ColorPickerEvent.CHANGE, selectedColor)); close(); } override protected function draw():void{ if (isInvalid(InvalidationType.STYLES, InvalidationType.DATA)){ setStyles(); drawPalette(); setEmbedFonts(); invalidate(InvalidationType.DATA, false); invalidate(InvalidationType.STYLES, false); }; if (isInvalid(InvalidationType.DATA)){ drawSwatchHighlight(); setColorDisplay(); }; if (isInvalid(InvalidationType.STATE)){ setTextEditable(); if (doOpen){ doOpen = false; showPalette(); }; colorWell.visible = enabled; }; if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){ swatchButton.setSize(width, height); swatchButton.drawNow(); colorWell.width = width; colorWell.height = height; }; super.draw(); } protected function drawSwatches():void{ var _local1:Number; var _local2:Number; var _local3:uint; var _local4:uint; var _local5:Number; var _local6:Number; var _local7:uint; var _local8:int; var _local9:uint; var _local10:Sprite; _local1 = (getStyleValue("backgroundPadding") as Number); _local2 = (showTextField) ? ((textFieldBG.y + textFieldBG.height) + _local1) : _local1; swatches = new Sprite(); palette.addChild(swatches); swatches.x = _local1; swatches.y = _local2; _local3 = (getStyleValue("columnCount") as uint); _local4 = (getStyleValue("swatchPadding") as uint); _local5 = (getStyleValue("swatchWidth") as Number); _local6 = (getStyleValue("swatchHeight") as Number); colorHash = {}; swatchMap = []; _local7 = Math.min(0x0400, colors.length); _local8 = -1; _local9 = 0; while (_local9 < _local7) { _local10 = createSwatch(colors[_local9]); _local10.x = ((_local5 + _local4) * (_local9 % _local3)); if (_local10.x == 0){ swatchMap.push([_local10]); _local8++; } else { swatchMap[_local8].push(_local10); }; colorHash[colors[_local9]] = {swatch:_local10, row:_local8, col:(swatchMap[_local8].length - 1)}; _local10.y = (Math.floor((_local9 / _local3)) * (_local6 + _local4)); swatches.addChild(_local10); _local9++; }; } override protected function configUI():void{ var _local1:uint; super.configUI(); tabChildren = false; if (_slot1.defaultColors == null){ _slot1.defaultColors = []; _local1 = 0; while (_local1 < 216) { _slot1.defaultColors.push(((((((((_local1 / 6) % 3) << 0) + (((_local1 / 108) << 0) * 3)) * 51) << 16) | (((_local1 % 6) * 51) << 8)) | ((((_local1 / 18) << 0) % 6) * 51))); _local1++; }; }; colorHash = {}; swatchMap = []; textField = new TextField(); textField.tabEnabled = false; swatchButton = new BaseButton(); swatchButton.focusEnabled = false; swatchButton.useHandCursor = false; swatchButton.autoRepeat = false; swatchButton.setSize(25, 25); swatchButton.addEventListener(MouseEvent.CLICK, onPopupButtonClick, false, 0, true); addChild(swatchButton); palette = new Sprite(); palette.tabChildren = false; palette.cacheAsBitmap = true; } public function get showTextField():Boolean{ return (_showTextField); } public function get colors():Array{ return (((customColors)!=null) ? customColors : _slot1.defaultColors); } protected function findSwatch(_arg1:uint):Sprite{ var _local2:Object; if (!swatchMap.length){ return (null); }; _local2 = colorHash[_arg1]; if (_local2 != null){ return (_local2.swatch); }; return (null); } protected function setColorDisplay():void{ var _local1:ColorTransform; var _local2:Sprite; if (!swatchMap.length){ return; }; _local1 = new ColorTransform(0, 0, 0, 1, (_selectedColor >> 16), ((_selectedColor >> 8) & 0xFF), (_selectedColor & 0xFF), 0); setColorWellColor(_local1); setColorText(_selectedColor); _local2 = findSwatch(_selectedColor); setSwatchHighlight(_local2); if (((swatchMap.length) && ((colorHash[_selectedColor] == undefined)))){ cleanUpSelected(); }; } protected function cleanUpSelected():void{ if (((swatchSelectedSkin) && (palette.contains(swatchSelectedSkin)))){ palette.removeChild(swatchSelectedSkin); }; } public function get selectedColor():uint{ if (colorWell == null){ return (0); }; return (colorWell.transform.colorTransform.color); } private function addCloseListener(_arg1:Event){ removeEventListener(Event.ENTER_FRAME, addCloseListener); if (!isOpen){ return; }; addStageListener(); } protected function removeStageListener(_arg1:Event=null):void{ stage.removeEventListener(MouseEvent.MOUSE_DOWN, onStageClick, false); } protected function setStyles():void{ var _local1:DisplayObject; var _local2:Object; _local1 = colorWell; _local2 = getStyleValue("colorWell"); if (_local2 != null){ colorWell = (getDisplayObjectInstance(_local2) as DisplayObject); }; addChildAt(colorWell, getChildIndex(swatchButton)); copyStylesToChild(swatchButton, POPUP_BUTTON_STYLES); swatchButton.drawNow(); if (((((!((_local1 == null))) && (contains(_local1)))) && (!((_local1 == colorWell))))){ removeChild(_local1); }; } public function close():void{ var _local1:IFocusManager; if (isOpen){ stage.removeChild(palette); isOpen = false; dispatchEvent(new Event(Event.CLOSE)); }; _local1 = focusManager; if (_local1){ _local1.defaultButtonEnabled = true; }; removeStageListener(); cleanUpSelected(); } public static function getStyleDefinition():Object{ return (defaultStyles); } } }//package fl.controls
Section 15
//LabelButton (fl.controls.LabelButton) package fl.controls { import flash.display.*; import fl.core.*; import flash.events.*; import fl.managers.*; import fl.events.*; import flash.text.*; import flash.ui.*; public class LabelButton extends BaseButton implements IFocusManagerComponent { protected var _labelPlacement:String;// = "right" protected var _toggle:Boolean;// = false protected var icon:DisplayObject; protected var oldMouseState:String; protected var mode:String;// = "center" public var textField:TextField; protected var _label:String;// = "Label" private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false}; public static var createAccessibilityImplementation:Function; public function LabelButton(){ _labelPlacement = ButtonLabelPlacement.RIGHT; _toggle = false; _label = "Label"; mode = "center"; super(); } protected function toggleSelected(_arg1:MouseEvent):void{ selected = !(selected); dispatchEvent(new Event(Event.CHANGE, true)); } public function get labelPlacement():String{ return (_labelPlacement); } override protected function keyDownHandler(_arg1:KeyboardEvent):void{ if (!enabled){ return; }; if (_arg1.keyCode == Keyboard.SPACE){ if (oldMouseState == null){ oldMouseState = mouseState; }; setMouseState("down"); startPress(); }; } protected function setEmbedFont(){ var _local1:Object; _local1 = getStyleValue("embedFonts"); if (_local1 != null){ textField.embedFonts = _local1; }; } override protected function keyUpHandler(_arg1:KeyboardEvent):void{ if (!enabled){ return; }; if (_arg1.keyCode == Keyboard.SPACE){ setMouseState(oldMouseState); oldMouseState = null; endPress(); dispatchEvent(new MouseEvent(MouseEvent.CLICK)); }; } override public function get selected():Boolean{ return ((_toggle) ? _selected : false); } public function set labelPlacement(_arg1:String):void{ _labelPlacement = _arg1; invalidate(InvalidationType.SIZE); } public function set toggle(_arg1:Boolean):void{ if (((!(_arg1)) && (super.selected))){ selected = false; }; _toggle = _arg1; if (_toggle){ addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true); } else { removeEventListener(MouseEvent.CLICK, toggleSelected); }; invalidate(InvalidationType.STATE); } public function get label():String{ return (_label); } override public function set selected(_arg1:Boolean):void{ _selected = _arg1; if (_toggle){ invalidate(InvalidationType.STATE); }; } override protected function draw():void{ if (textField.text != _label){ label = _label; }; if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){ drawBackground(); drawIcon(); drawTextFormat(); invalidate(InvalidationType.SIZE, false); }; if (isInvalid(InvalidationType.SIZE)){ drawLayout(); }; if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){ if (((isFocused) && (focusManager.showFocusIndicator))){ drawFocus(true); }; }; validate(); } public function get toggle():Boolean{ return (_toggle); } override protected function configUI():void{ super.configUI(); textField = new TextField(); textField.type = TextFieldType.DYNAMIC; textField.selectable = false; addChild(textField); } override protected function drawLayout():void{ var _local1:Number; var _local2:String; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; _local1 = Number(getStyleValue("textPadding")); _local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement; textField.height = (textField.textHeight + 4); _local3 = (textField.textWidth + 4); _local4 = (textField.textHeight + 4); _local5 = ((icon)==null) ? 0 : (icon.width + _local1); _local6 = ((icon)==null) ? 0 : (icon.height + _local1); textField.visible = (label.length > 0); if (icon != null){ icon.x = Math.round(((width - icon.width) / 2)); icon.y = Math.round(((height - icon.height) / 2)); }; if (textField.visible == false){ textField.width = 0; textField.height = 0; } else { if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){ _local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1)))); if ((height - 2) > _local4){ _local8 = _local4; } else { _local8 = (height - 2); }; _local3 = _local7; textField.width = _local3; _local4 = _local8; textField.height = _local4; textField.x = Math.round(((width - _local3) / 2)); textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0)); if (icon != null){ icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1)); }; } else { _local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1)))); _local3 = _local7; textField.width = _local3; textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0)); textField.y = Math.round(((height - textField.height) / 2)); if (icon != null){ icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1)); }; }; }; super.drawLayout(); } override protected function initializeAccessibility():void{ if (LabelButton.createAccessibilityImplementation != null){ LabelButton.createAccessibilityImplementation(this); }; } protected function drawIcon():void{ var _local1:DisplayObject; var _local2:String; var _local3:Object; _local1 = icon; _local2 = (enabled) ? mouseState : "disabled"; if (selected){ _local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1)); }; _local2 = (_local2 + "Icon"); _local3 = getStyleValue(_local2); if (_local3 == null){ _local3 = getStyleValue("icon"); }; if (_local3 != null){ icon = getDisplayObjectInstance(_local3); }; if (icon != null){ addChildAt(icon, 1); }; if (((!((_local1 == null))) && (!((_local1 == icon))))){ removeChild(_local1); }; } public function set label(_arg1:String):void{ _label = _arg1; if (textField.text != _label){ textField.text = _label; dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE)); }; invalidate(InvalidationType.SIZE); invalidate(InvalidationType.STYLES); } protected function drawTextFormat():void{ var _local1:Object; var _local2:TextFormat; var _local3:TextFormat; _local1 = UIComponent.getStyleDefinition(); _local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat); textField.setTextFormat(_local2); _local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat); if (_local3 != null){ textField.setTextFormat(_local3); } else { _local3 = _local2; }; textField.defaultTextFormat = _local3; setEmbedFont(); } public static function getStyleDefinition():Object{ return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition())); } } }//package fl.controls
Section 16
//Slider (fl.controls.Slider) package fl.controls { import flash.display.*; import fl.core.*; import flash.events.*; import fl.managers.*; import fl.events.*; import flash.ui.*; public class Slider extends UIComponent implements IFocusManagerComponent { protected var _direction:String; protected var _liveDragging:Boolean;// = false protected var _value:Number;// = 0 protected var _snapInterval:Number;// = 0 protected var _minimum:Number;// = 0 protected var _maximum:Number;// = 10 protected var track:BaseButton; protected var _tickInterval:Number;// = 0 protected var tickContainer:Sprite; protected var thumb:BaseButton; protected static const TICK_STYLES:Object = {upSkin:"tickSkin"}; protected static const TRACK_STYLES:Object = {upSkin:"sliderTrackSkin", overSkin:"sliderTrackSkin", downSkin:"sliderTrackSkin", disabledSkin:"sliderTrackDisabledSkin"}; protected static const THUMB_STYLES:Object = {upSkin:"thumbUpSkin", overSkin:"thumbOverSkin", downSkin:"thumbDownSkin", disabledSkin:"thumbDisabledSkin"}; protected static var defaultStyles:Object = {thumbUpSkin:"SliderThumb_upSkin", thumbOverSkin:"SliderThumb_overSkin", thumbDownSkin:"SliderThumb_downSkin", thumbDisabledSkin:"SliderThumb_disabledSkin", sliderTrackSkin:"SliderTrack_skin", sliderTrackDisabledSkin:"SliderTrack_disabledSkin", tickSkin:"SliderTick_skin", focusRectSkin:null, focusRectPadding:null}; public function Slider(){ _direction = SliderDirection.HORIZONTAL; _minimum = 0; _maximum = 10; _value = 0; _tickInterval = 0; _snapInterval = 0; _liveDragging = false; super(); setStyles(); } public function get minimum():Number{ return (_minimum); } public function set minimum(_arg1:Number):void{ _minimum = _arg1; this.value = Math.max(_arg1, this.value); invalidate(InvalidationType.DATA); } public function get maximum():Number{ return (_maximum); } protected function positionThumb():void{ thumb.x = ((((_direction)==SliderDirection.VERTICAL) ? ((maximum - minimum) - value) : (value - minimum) / (maximum - minimum)) * _width); } protected function clearTicks():void{ if (((!(tickContainer)) || (!(tickContainer.parent)))){ return; }; removeChild(tickContainer); } protected function onTrackClick(_arg1:MouseEvent):void{ calculateValue(track.mouseX, InteractionInputType.MOUSE, SliderEventClickTarget.TRACK); if (!liveDragging){ dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.TRACK, InteractionInputType.MOUSE)); }; } public function set maximum(_arg1:Number):void{ _maximum = _arg1; this.value = Math.min(_arg1, this.value); invalidate(InvalidationType.DATA); } public function get liveDragging():Boolean{ return (_liveDragging); } protected function doDrag(_arg1:MouseEvent):void{ var _local2:Number; var _local3:Number; _local2 = (_width / snapInterval); _local3 = track.mouseX; calculateValue(_local3, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB); dispatchEvent(new SliderEvent(SliderEvent.THUMB_DRAG, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE)); } override protected function keyDownHandler(_arg1:KeyboardEvent):void{ var _local2:uint; var _local3:Number; var _local4:Boolean; if (!enabled){ return; }; _local2 = ((snapInterval)>0) ? snapInterval : 1; _local4 = (direction == SliderDirection.HORIZONTAL); if ((((((_arg1.keyCode == Keyboard.DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.LEFT)) && (_local4))))){ _local3 = (value - _local2); } else { if ((((((_arg1.keyCode == Keyboard.UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.RIGHT)) && (_local4))))){ _local3 = (value + _local2); } else { if ((((((_arg1.keyCode == Keyboard.PAGE_DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.HOME)) && (_local4))))){ _local3 = minimum; } else { if ((((((_arg1.keyCode == Keyboard.PAGE_UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.END)) && (_local4))))){ _local3 = maximum; }; }; }; }; if (!isNaN(_local3)){ _arg1.stopPropagation(); doSetValue(_local3, InteractionInputType.KEYBOARD, null, _arg1.keyCode); }; } override public function set enabled(_arg1:Boolean):void{ if (enabled == _arg1){ return; }; super.enabled = _arg1; track.enabled = (thumb.enabled = _arg1); } protected function thumbPressHandler(_arg1:MouseEvent):void{ stage.addEventListener(MouseEvent.MOUSE_MOVE, doDrag, false, 0, true); stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true); dispatchEvent(new SliderEvent(SliderEvent.THUMB_PRESS, value, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB)); } public function get snapInterval():Number{ return (_snapInterval); } protected function thumbReleaseHandler(_arg1:MouseEvent):void{ stage.removeEventListener(MouseEvent.MOUSE_MOVE, doDrag); stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler); dispatchEvent(new SliderEvent(SliderEvent.THUMB_RELEASE, value, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB)); dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE)); } public function set liveDragging(_arg1:Boolean):void{ _liveDragging = _arg1; } public function set value(_arg1:Number):void{ doSetValue(_arg1); } public function set direction(_arg1:String):void{ var _local2:Boolean; _direction = _arg1; _local2 = (_direction == SliderDirection.VERTICAL); if (isLivePreview){ if (_local2){ setScaleY(-1); y = track.height; } else { setScaleY(1); y = 0; }; positionThumb(); return; }; if (((_local2) && (componentInspectorSetting))){ if ((rotation % 90) == 0){ setScaleY(-1); }; }; if (!componentInspectorSetting){ rotation = (_local2) ? 90 : 0; }; } public function set tickInterval(_arg1:Number):void{ _tickInterval = _arg1; invalidate(InvalidationType.SIZE); } override public function get enabled():Boolean{ return (super.enabled); } override protected function draw():void{ if (isInvalid(InvalidationType.STYLES)){ setStyles(); invalidate(InvalidationType.SIZE, false); }; if (isInvalid(InvalidationType.SIZE)){ track.setSize(_width, track.height); track.drawNow(); thumb.drawNow(); }; if (tickInterval > 0){ drawTicks(); } else { clearTicks(); }; positionThumb(); super.draw(); } override protected function configUI():void{ super.configUI(); thumb = new BaseButton(); thumb.setSize(13, 13); thumb.autoRepeat = false; addChild(thumb); thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true); track = new BaseButton(); track.move(0, 0); track.setSize(80, 4); track.autoRepeat = false; track.useHandCursor = false; track.addEventListener(MouseEvent.CLICK, onTrackClick, false, 0, true); addChildAt(track, 0); } public function set snapInterval(_arg1:Number):void{ _snapInterval = _arg1; } public function get value():Number{ return (_value); } public function get direction():String{ return (_direction); } public function get tickInterval():Number{ return (_tickInterval); } override public function setSize(_arg1:Number, _arg2:Number):void{ if ((((_direction == SliderDirection.VERTICAL)) && (!(isLivePreview)))){ super.setSize(_arg2, _arg1); } else { super.setSize(_arg1, _arg2); }; invalidate(InvalidationType.SIZE); } protected function drawTicks():void{ var _local1:Number; var _local2:Number; var _local3:Number; var _local4:uint; var _local5:DisplayObject; clearTicks(); tickContainer = new Sprite(); _local1 = ((maximum)<1) ? (tickInterval / 100) : tickInterval; _local2 = ((maximum - minimum) / _local1); _local3 = (_width / _local2); _local4 = 0; while (_local4 <= _local2) { _local5 = getDisplayObjectInstance(getStyleValue("tickSkin")); _local5.x = (_local3 * _local4); _local5.y = ((track.y - _local5.height) - 2); tickContainer.addChild(_local5); _local4++; }; addChild(tickContainer); } protected function calculateValue(_arg1:Number, _arg2:String, _arg3:String, _arg4:int=undefined):void{ var _local5:Number; _local5 = ((_arg1 / _width) * (maximum - minimum)); if (_direction == SliderDirection.VERTICAL){ _local5 = (maximum - _local5); } else { _local5 = (minimum + _local5); }; doSetValue(_local5, _arg2, _arg3, _arg4); } protected function getPrecision(_arg1:Number):Number{ var _local2:String; _local2 = _arg1.toString(); if (_local2.indexOf(".") == -1){ return (0); }; return (_local2.split(".").pop().length); } protected function doSetValue(_arg1:Number, _arg2:String=null, _arg3:String=null, _arg4:int=undefined):void{ var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; _local5 = _value; if (((!((_snapInterval == 0))) && (!((_snapInterval == 1))))){ _local6 = Math.pow(10, getPrecision(snapInterval)); _local7 = (_snapInterval * _local6); _local8 = Math.round((_arg1 * _local6)); _local9 = (Math.round((_local8 / _local7)) * _local7); _arg1 = (_local9 / _local6); _value = Math.max(minimum, Math.min(maximum, _arg1)); } else { _value = Math.max(minimum, Math.min(maximum, Math.round(_arg1))); }; if (((!((_local5 == _value))) && (((((liveDragging) && (!((_arg3 == null))))) || ((_arg2 == InteractionInputType.KEYBOARD)))))){ dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, _arg3, _arg2, _arg4)); }; positionThumb(); } protected function setStyles():void{ copyStylesToChild(thumb, THUMB_STYLES); copyStylesToChild(track, TRACK_STYLES); } public static function getStyleDefinition():Object{ return (defaultStyles); } } }//package fl.controls
Section 17
//SliderDirection (fl.controls.SliderDirection) package fl.controls { public class SliderDirection { public static var HORIZONTAL:String = "horizontal"; public static var VERTICAL:String = "vertical"; } }//package fl.controls
Section 18
//ComponentShim (fl.core.ComponentShim) package fl.core { import flash.display.*; public dynamic class ComponentShim extends MovieClip { } }//package fl.core
Section 19
//InvalidationType (fl.core.InvalidationType) package fl.core { public class InvalidationType { public static const SIZE:String = "size"; public static const ALL:String = "all"; public static const DATA:String = "data"; public static const SCROLL:String = "scroll"; public static const STATE:String = "state"; public static const STYLES:String = "styles"; public static const SELECTED:String = "selected"; public static const RENDERER_STYLES:String = "rendererStyles"; } }//package fl.core
Section 20
//UIComponent (fl.core.UIComponent) package fl.core { import flash.display.*; import flash.utils.*; import flash.events.*; import fl.managers.*; import fl.events.*; import flash.text.*; import flash.system.*; public class UIComponent extends Sprite { protected var _enabled:Boolean;// = true private var _mouseFocusEnabled:Boolean;// = true protected var startHeight:Number; protected var _height:Number; protected var _oldIMEMode:String;// = null protected var startWidth:Number; public var focusTarget:IFocusManagerComponent; protected var errorCaught:Boolean;// = false protected var uiFocusRect:DisplayObject; protected var _width:Number; public var version:String;// = "3.0.0.15" protected var isFocused:Boolean;// = false protected var callLaterMethods:Dictionary; private var _focusEnabled:Boolean;// = true private var tempText:TextField; protected var invalidateFlag:Boolean;// = false protected var _inspector:Boolean;// = false protected var sharedStyles:Object; protected var invalidHash:Object; protected var isLivePreview:Boolean;// = false protected var _imeMode:String;// = null protected var instanceStyles:Object; protected var _x:Number; protected var _y:Number; public static var inCallLaterPhase:Boolean = false; private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)}; public static var createAccessibilityImplementation:Function; private static var focusManagers:Dictionary = new Dictionary(false); public function UIComponent(){ version = "3.0.0.15"; isLivePreview = false; invalidateFlag = false; _enabled = true; isFocused = false; _focusEnabled = true; _mouseFocusEnabled = true; _imeMode = null; _oldIMEMode = null; errorCaught = false; _inspector = false; super(); instanceStyles = {}; sharedStyles = {}; invalidHash = {}; callLaterMethods = new Dictionary(); StyleManager.registerInstance(this); configUI(); invalidate(InvalidationType.ALL); tabEnabled = (this is IFocusManagerComponent); focusRect = false; if (tabEnabled){ addEventListener(FocusEvent.FOCUS_IN, focusInHandler); addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler); addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); addEventListener(KeyboardEvent.KEY_UP, keyUpHandler); }; initializeFocusManager(); addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true); } public function drawFocus(_arg1:Boolean):void{ var _local2:Number; isFocused = _arg1; if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){ removeChild(uiFocusRect); uiFocusRect = null; }; if (_arg1){ uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite); if (uiFocusRect == null){ return; }; _local2 = Number(getStyleValue("focusRectPadding")); uiFocusRect.x = -(_local2); uiFocusRect.y = -(_local2); uiFocusRect.width = (width + (_local2 * 2)); uiFocusRect.height = (height + (_local2 * 2)); addChildAt(uiFocusRect, 0); }; } private function callLaterDispatcher(_arg1:Event):void{ var _local2:Dictionary; var _local3:Object; if (_arg1.type == Event.ADDED_TO_STAGE){ removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher); stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true); stage.invalidate(); return; }; _arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher); if (stage == null){ addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true); return; }; inCallLaterPhase = true; _local2 = callLaterMethods; for (_local3 in _local2) { _local3(); delete _local2[_local3]; }; inCallLaterPhase = false; } private function addedHandler(_arg1:Event):void{ removeEventListener("addedToStage", addedHandler); initializeFocusManager(); } protected function getStyleValue(_arg1:String):Object{ return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]); } protected function isOurFocus(_arg1:DisplayObject):Boolean{ return ((_arg1 == this)); } override public function get scaleX():Number{ return ((width / startWidth)); } override public function get scaleY():Number{ return ((height / startHeight)); } override public function set height(_arg1:Number):void{ if (_height == _arg1){ return; }; setSize(width, _arg1); } protected function keyDownHandler(_arg1:KeyboardEvent):void{ } protected function focusInHandler(_arg1:FocusEvent):void{ var _local2:IFocusManager; if (isOurFocus((_arg1.target as DisplayObject))){ _local2 = focusManager; if (((_local2) && (_local2.showFocusIndicator))){ drawFocus(true); isFocused = true; }; }; } public function setStyle(_arg1:String, _arg2:Object):void{ if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){ return; }; instanceStyles[_arg1] = _arg2; invalidate(InvalidationType.STYLES); } override public function get visible():Boolean{ return (super.visible); } public function get componentInspectorSetting():Boolean{ return (_inspector); } override public function get x():Number{ return ((isNaN(_x)) ? super.x : _x); } override public function get y():Number{ return ((isNaN(_y)) ? super.y : _y); } protected function setIMEMode(_arg1:Boolean){ var enabled = _arg1; if (_imeMode != null){ if (enabled){ IME.enabled = true; _oldIMEMode = IME.conversionMode; try { if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){ IME.conversionMode = _imeMode; }; errorCaught = false; } catch(e:Error) { errorCaught = true; throw (new Error(("IME mode not supported: " + _imeMode))); }; } else { if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){ IME.conversionMode = _oldIMEMode; }; IME.enabled = false; }; }; } public function set enabled(_arg1:Boolean):void{ if (_arg1 == _enabled){ return; }; _enabled = _arg1; invalidate(InvalidationType.STATE); } public function setSharedStyle(_arg1:String, _arg2:Object):void{ if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){ return; }; sharedStyles[_arg1] = _arg2; if (instanceStyles[_arg1] == null){ invalidate(InvalidationType.STYLES); }; } protected function keyUpHandler(_arg1:KeyboardEvent):void{ } public function set focusEnabled(_arg1:Boolean):void{ _focusEnabled = _arg1; } override public function set scaleX(_arg1:Number):void{ setSize((startWidth * _arg1), height); } public function get mouseFocusEnabled():Boolean{ return (_mouseFocusEnabled); } override public function set scaleY(_arg1:Number):void{ setSize(width, (startHeight * _arg1)); } protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{ var classDef:Object; var skin = _arg1; classDef = null; if ((skin is Class)){ return ((new (skin) as DisplayObject)); }; if ((skin is DisplayObject)){ (skin as DisplayObject).x = 0; (skin as DisplayObject).y = 0; return ((skin as DisplayObject)); }; try { classDef = getDefinitionByName(skin.toString()); } catch(e:Error) { try { classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object); } catch(e:Error) { }; }; if (classDef == null){ return (null); }; return ((new (classDef) as DisplayObject)); } protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{ var _local3:String; for (_local3 in _arg2) { _arg1.setStyle(_local3, getStyleValue(_arg2[_local3])); }; } protected function beforeComponentParameters():void{ } protected function callLater(_arg1:Function):void{ if (inCallLaterPhase){ return; }; callLaterMethods[_arg1] = true; if (stage != null){ stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true); stage.invalidate(); } else { addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true); }; } protected function createFocusManager():void{ if (focusManagers[stage] == null){ focusManagers[stage] = new FocusManager(stage); }; } override public function set visible(_arg1:Boolean):void{ var _local2:String; if (super.visible == _arg1){ return; }; super.visible = _arg1; _local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE; dispatchEvent(new ComponentEvent(_local2, true)); } protected function hookAccessibility(_arg1:Event):void{ removeEventListener(Event.ENTER_FRAME, hookAccessibility); initializeAccessibility(); } public function set componentInspectorSetting(_arg1:Boolean):void{ _inspector = _arg1; if (_inspector){ beforeComponentParameters(); } else { afterComponentParameters(); }; } override public function set x(_arg1:Number):void{ move(_arg1, _y); } public function drawNow():void{ draw(); } override public function set y(_arg1:Number):void{ move(_x, _arg1); } protected function checkLivePreview():Boolean{ var className:String; if (parent == null){ return (false); }; try { className = getQualifiedClassName(parent); } catch(e:Error) { }; return ((className == "fl.livepreview::LivePreviewParent")); } protected function focusOutHandler(_arg1:FocusEvent):void{ if (isOurFocus((_arg1.target as DisplayObject))){ drawFocus(false); isFocused = false; }; } public function set mouseFocusEnabled(_arg1:Boolean):void{ _mouseFocusEnabled = _arg1; } public function getFocus():InteractiveObject{ if (stage){ return (stage.focus); }; return (null); } protected function validate():void{ invalidHash = {}; } override public function get height():Number{ return (_height); } public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{ invalidHash[_arg1] = true; if (_arg2){ this.callLater(draw); }; } public function get enabled():Boolean{ return (_enabled); } protected function getScaleX():Number{ return (super.scaleX); } protected function getScaleY():Number{ return (super.scaleY); } public function get focusEnabled():Boolean{ return (_focusEnabled); } protected function afterComponentParameters():void{ } protected function draw():void{ if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){ if (((isFocused) && (focusManager.showFocusIndicator))){ drawFocus(true); }; }; validate(); } protected function configUI():void{ var _local1:Number; var _local2:Number; var _local3:Number; isLivePreview = checkLivePreview(); _local1 = rotation; rotation = 0; _local2 = super.width; _local3 = super.height; var _local4 = 1; super.scaleY = _local4; super.scaleX = _local4; setSize(_local2, _local3); move(super.x, super.y); rotation = _local1; startWidth = _local2; startHeight = _local3; if (numChildren > 0){ removeChildAt(0); }; } protected function setScaleX(_arg1:Number):void{ super.scaleX = _arg1; } protected function setScaleY(_arg1:Number):void{ super.scaleY = _arg1; } private function initializeFocusManager():void{ if (stage == null){ addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true); } else { createFocusManager(); }; } public function set focusManager(_arg1:IFocusManager):void{ UIComponent.focusManagers[this] = _arg1; } public function clearStyle(_arg1:String):void{ setStyle(_arg1, null); } protected function isInvalid(_arg1:String, ... _args):Boolean{ if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){ return (true); }; while (_args.length > 0) { if (invalidHash[_args.pop()]){ return (true); }; }; return (false); } public function setSize(_arg1:Number, _arg2:Number):void{ _width = _arg1; _height = _arg2; invalidate(InvalidationType.SIZE); dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false)); } override public function set width(_arg1:Number):void{ if (_width == _arg1){ return; }; setSize(_arg1, height); } public function setFocus():void{ if (stage){ stage.focus = this; }; } protected function initializeAccessibility():void{ if (UIComponent.createAccessibilityImplementation != null){ UIComponent.createAccessibilityImplementation(this); }; } public function get focusManager():IFocusManager{ var _local1:DisplayObject; _local1 = this; while (_local1) { if (UIComponent.focusManagers[_local1] != null){ return (IFocusManager(UIComponent.focusManagers[_local1])); }; _local1 = _local1.parent; }; return (null); } override public function get width():Number{ return (_width); } public function move(_arg1:Number, _arg2:Number):void{ _x = _arg1; _y = _arg2; super.x = Math.round(_arg1); super.y = Math.round(_arg2); dispatchEvent(new ComponentEvent(ComponentEvent.MOVE)); } public function validateNow():void{ invalidate(InvalidationType.ALL, false); draw(); } public function getStyle(_arg1:String):Object{ return (instanceStyles[_arg1]); } public static function getStyleDefinition():Object{ return (defaultStyles); } public static function mergeStyles(... _args):Object{ var _local2:Object; var _local3:uint; var _local4:uint; var _local5:Object; var _local6:String; _local2 = {}; _local3 = _args.length; _local4 = 0; while (_local4 < _local3) { _local5 = _args[_local4]; for (_local6 in _local5) { if (_local2[_local6] != null){ } else { _local2[_local6] = _args[_local4][_local6]; }; }; _local4++; }; return (_local2); } } }//package fl.core
Section 21
//ColorPickerEvent (fl.events.ColorPickerEvent) package fl.events { import flash.events.*; public class ColorPickerEvent extends Event { protected var _color:uint; public static const ITEM_ROLL_OUT:String = "itemRollOut"; public static const ITEM_ROLL_OVER:String = "itemRollOver"; public static const CHANGE:String = "change"; public static const ENTER:String = "enter"; public function ColorPickerEvent(_arg1:String, _arg2:uint){ super(_arg1, true); _color = _arg2; } override public function toString():String{ return (formatToString("ColorPickerEvent", "type", "bubbles", "cancelable", "color")); } public function get color():uint{ return (_color); } override public function clone():Event{ return (new ColorPickerEvent(type, color)); } } }//package fl.events
Section 22
//ComponentEvent (fl.events.ComponentEvent) package fl.events { import flash.events.*; public class ComponentEvent extends Event { public static const HIDE:String = "hide"; public static const BUTTON_DOWN:String = "buttonDown"; public static const MOVE:String = "move"; public static const RESIZE:String = "resize"; public static const ENTER:String = "enter"; public static const LABEL_CHANGE:String = "labelChange"; public static const SHOW:String = "show"; public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){ super(_arg1, _arg2, _arg3); } override public function toString():String{ return (formatToString("ComponentEvent", "type", "bubbles", "cancelable")); } override public function clone():Event{ return (new ComponentEvent(type, bubbles, cancelable)); } } }//package fl.events
Section 23
//InteractionInputType (fl.events.InteractionInputType) package fl.events { public class InteractionInputType { public static const MOUSE:String = "mouse"; public static const KEYBOARD:String = "keyboard"; } }//package fl.events
Section 24
//SliderEvent (fl.events.SliderEvent) package fl.events { import flash.events.*; public class SliderEvent extends Event { protected var _triggerEvent:String; protected var _keyCode:Number; protected var _value:Number; protected var _clickTarget:String; public static const CHANGE:String = "change"; public static const THUMB_PRESS:String = "thumbPress"; public static const THUMB_DRAG:String = "thumbDrag"; public static const THUMB_RELEASE:String = "thumbRelease"; public function SliderEvent(_arg1:String, _arg2:Number, _arg3:String, _arg4:String, _arg5:int=0){ _value = _arg2; _keyCode = _arg5; _triggerEvent = _arg4; _clickTarget = _arg3; super(_arg1); } public function get clickTarget():String{ return (_clickTarget); } override public function clone():Event{ return (new SliderEvent(type, _value, _clickTarget, _triggerEvent, _keyCode)); } override public function toString():String{ return (formatToString("SliderEvent", "type", "value", "bubbles", "cancelable", "keyCode", "triggerEvent", "clickTarget")); } public function get triggerEvent():String{ return (_triggerEvent); } public function get value():Number{ return (_value); } public function get keyCode():Number{ return (_keyCode); } } }//package fl.events
Section 25
//SliderEventClickTarget (fl.events.SliderEventClickTarget) package fl.events { public class SliderEventClickTarget { public static const TRACK:String = "track"; public static const THUMB:String = "thumb"; } }//package fl.events
Section 26
//FocusManager (fl.managers.FocusManager) package fl.managers { import fl.controls.*; import flash.display.*; import flash.utils.*; import fl.core.*; import flash.events.*; import flash.text.*; import flash.ui.*; public class FocusManager implements IFocusManager { private var focusableObjects:Dictionary; private var _showFocusIndicator:Boolean;// = true private var defButton:Button; private var focusableCandidates:Array; private var _form:DisplayObjectContainer; private var _defaultButtonEnabled:Boolean;// = true private var activated:Boolean;// = false private var _defaultButton:Button; private var calculateCandidates:Boolean;// = true private var lastFocus:InteractiveObject; private var lastAction:String; public function FocusManager(_arg1:DisplayObjectContainer){ activated = false; calculateCandidates = true; _showFocusIndicator = true; _defaultButtonEnabled = true; super(); focusableObjects = new Dictionary(true); if (_arg1 != null){ _form = _arg1; addFocusables(DisplayObject(_arg1)); _arg1.addEventListener(Event.ADDED, addedHandler); _arg1.addEventListener(Event.REMOVED, removedHandler); activate(); }; } public function get showFocusIndicator():Boolean{ return (_showFocusIndicator); } private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{ var _local5:int; var _local6:int; var _local7:DisplayObject; var _local8:IFocusManagerGroup; var _local9:int; var _local10:DisplayObject; var _local11:IFocusManagerGroup; _local5 = focusableCandidates.length; _local6 = _arg1; while (true) { if (_arg2){ _arg1--; } else { _arg1++; }; if (_arg3){ if (((_arg2) && ((_arg1 < 0)))){ break; }; if (((!(_arg2)) && ((_arg1 == _local5)))){ break; }; } else { _arg1 = ((_arg1 + _local5) % _local5); if (_local6 == _arg1){ break; }; }; if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){ _local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1])); if ((_local7 is IFocusManagerGroup)){ _local8 = IFocusManagerGroup(_local7); _local9 = 0; while (_local9 < focusableCandidates.length) { _local10 = focusableCandidates[_local9]; if ((_local10 is IFocusManagerGroup)){ _local11 = IFocusManagerGroup(_local10); if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){ _arg1 = _local9; break; }; }; _local9++; }; }; return (_arg1); }; }; return (_arg1); } public function set form(_arg1:DisplayObjectContainer):void{ _form = _arg1; } private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{ var focusable:IFocusManagerComponent; var io:InteractiveObject; var doc:DisplayObjectContainer; var i:int; var child:DisplayObject; var o = _arg1; var skipTopLevel = _arg2; if (!skipTopLevel){ if ((o is IFocusManagerComponent)){ focusable = IFocusManagerComponent(o); if (focusable.focusEnabled){ if (((focusable.tabEnabled) && (isTabVisible(o)))){ focusableObjects[o] = true; calculateCandidates = true; }; o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler); o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler); }; } else { if ((o is InteractiveObject)){ io = (o as InteractiveObject); if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){ focusableObjects[io] = true; calculateCandidates = true; }; io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler); io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler); }; }; }; if ((o is DisplayObjectContainer)){ doc = DisplayObjectContainer(o); o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler); if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){ i = 0; while (i < doc.numChildren) { try { child = doc.getChildAt(i); if (child != null){ addFocusables(doc.getChildAt(i)); }; } catch(error:SecurityError) { }; i = (i + 1); }; }; }; } private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{ return (_arg1.getChildIndex(_arg2)); } private function mouseFocusChangeHandler(_arg1:FocusEvent):void{ if ((_arg1.relatedObject is TextField)){ return; }; _arg1.preventDefault(); } private function focusOutHandler(_arg1:FocusEvent):void{ var _local2:InteractiveObject; _local2 = (_arg1.target as InteractiveObject); } private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{ var _local3:IFocusManagerGroup; if (!isEnabledAndVisible(_arg1)){ return (false); }; if ((_arg1 is IFocusManagerGroup)){ _local3 = IFocusManagerGroup(_arg1); if (_arg2 == _local3.groupName){ return (false); }; }; return (true); } public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{ var _local2:InteractiveObject; _local2 = _arg1; while (_arg1) { if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){ return (_arg1); }; _arg1 = _arg1.parent; }; return (_local2); } private function sortFocusableObjectsTabIndex():void{ var _local1:Object; var _local2:InteractiveObject; focusableCandidates = []; for (_local1 in focusableObjects) { _local2 = InteractiveObject(_local1); if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){ focusableCandidates.push(_local2); }; }; focusableCandidates.sort(sortByTabIndex); } private function removeFocusables(_arg1:DisplayObject):void{ var _local2:Object; var _local3:DisplayObject; if ((_arg1 is DisplayObjectContainer)){ _arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler); _arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler); for (_local2 in focusableObjects) { _local3 = DisplayObject(_local2); if (DisplayObjectContainer(_arg1).contains(_local3)){ if (_local3 == lastFocus){ lastFocus = null; }; _local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler); delete focusableObjects[_local2]; calculateCandidates = true; }; }; }; } private function addedHandler(_arg1:Event):void{ var _local2:DisplayObject; _local2 = DisplayObject(_arg1.target); if (_local2.stage){ addFocusables(DisplayObject(_arg1.target)); }; } private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{ while (_arg1 != InteractiveObject(form)) { if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){ return (_arg1); }; _arg1 = _arg1.parent; if (_arg1 == null){ break; }; }; return (null); } private function tabChildrenChangeHandler(_arg1:Event):void{ var _local2:DisplayObjectContainer; if (_arg1.target != _arg1.currentTarget){ return; }; calculateCandidates = true; _local2 = DisplayObjectContainer(_arg1.target); if (_local2.tabChildren){ addFocusables(_local2, true); } else { removeFocusables(_local2); }; } public function sendDefaultButtonEvent():void{ defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK)); } public function getFocus():InteractiveObject{ var _local1:InteractiveObject; _local1 = form.stage.focus; return (findFocusManagerComponent(_local1)); } private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{ var _local2:DisplayObjectContainer; var _local3:TextField; var _local4:SimpleButton; _local2 = DisplayObject(form).parent; while (_arg1 != _local2) { if ((_arg1 is UIComponent)){ if (!UIComponent(_arg1).enabled){ return (false); }; } else { if ((_arg1 is TextField)){ _local3 = TextField(_arg1); if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){ return (false); }; } else { if ((_arg1 is SimpleButton)){ _local4 = SimpleButton(_arg1); if (!_local4.enabled){ return (false); }; }; }; }; if (!_arg1.visible){ return (false); }; _arg1 = _arg1.parent; }; return (true); } public function set defaultButton(_arg1:Button):void{ var _local2:Button; _local2 = (_arg1) ? Button(_arg1) : null; if (_local2 != _defaultButton){ if (_defaultButton){ _defaultButton.emphasized = false; }; if (defButton){ defButton.emphasized = false; }; _defaultButton = _local2; defButton = _local2; if (_local2){ _local2.emphasized = true; }; }; } private function deactivateHandler(_arg1:Event):void{ var _local2:InteractiveObject; _local2 = InteractiveObject(_arg1.target); } public function setFocus(_arg1:InteractiveObject):void{ if ((_arg1 is IFocusManagerComponent)){ IFocusManagerComponent(_arg1).setFocus(); } else { form.stage.focus = _arg1; }; } private function setFocusToNextObject(_arg1:FocusEvent):void{ var _local2:InteractiveObject; if (!hasFocusableObjects()){ return; }; _local2 = getNextFocusManagerComponent(_arg1.shiftKey); if (_local2){ setFocus(_local2); }; } private function hasFocusableObjects():Boolean{ var _local1:Object; for (_local1 in focusableObjects) { return (true); }; return (false); } private function tabIndexChangeHandler(_arg1:Event):void{ calculateCandidates = true; } private function sortFocusableObjects():void{ var _local1:Object; var _local2:InteractiveObject; focusableCandidates = []; for (_local1 in focusableObjects) { _local2 = InteractiveObject(_local1); if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){ sortFocusableObjectsTabIndex(); return; }; focusableCandidates.push(_local2); }; focusableCandidates.sort(sortByDepth); } private function keyFocusChangeHandler(_arg1:FocusEvent):void{ showFocusIndicator = true; if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){ setFocusToNextObject(_arg1); _arg1.preventDefault(); }; } private function getIndexOfFocusedObject(_arg1:DisplayObject):int{ var _local2:int; var _local3:int; _local2 = focusableCandidates.length; _local3 = 0; _local3 = 0; while (_local3 < _local2) { if (focusableCandidates[_local3] == _arg1){ return (_local3); }; _local3++; }; return (-1); } public function hideFocus():void{ } private function removedHandler(_arg1:Event):void{ var _local2:int; var _local3:DisplayObject; var _local4:InteractiveObject; _local3 = DisplayObject(_arg1.target); if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){ if (_local3 == lastFocus){ IFocusManagerComponent(lastFocus).drawFocus(false); lastFocus = null; }; _local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler); delete focusableObjects[_local3]; calculateCandidates = true; } else { if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){ _local4 = (_local3 as InteractiveObject); if (_local4){ if (_local4 == lastFocus){ lastFocus = null; }; delete focusableObjects[_local4]; calculateCandidates = true; }; _local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler); }; }; removeFocusables(_local3); } private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{ var _local3:String; var _local4:String; var _local5:int; var _local6:String; var _local7:String; var _local8:String; var _local9:DisplayObject; var _local10:DisplayObject; _local3 = ""; _local4 = ""; _local8 = "0000"; _local9 = DisplayObject(_arg1); _local10 = DisplayObject(_arg2); while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) { _local5 = getChildIndex(_local9.parent, _local9); _local6 = _local5.toString(16); if (_local6.length < 4){ _local7 = (_local8.substring(0, (4 - _local6.length)) + _local6); }; _local3 = (_local7 + _local3); _local9 = _local9.parent; }; while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) { _local5 = getChildIndex(_local10.parent, _local10); _local6 = _local5.toString(16); if (_local6.length < 4){ _local7 = (_local8.substring(0, (4 - _local6.length)) + _local6); }; _local4 = (_local7 + _local4); _local10 = _local10.parent; }; return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0); } public function get defaultButton():Button{ return (_defaultButton); } private function activateHandler(_arg1:Event):void{ var _local2:InteractiveObject; _local2 = InteractiveObject(_arg1.target); if (lastFocus){ if ((lastFocus is IFocusManagerComponent)){ IFocusManagerComponent(lastFocus).setFocus(); } else { form.stage.focus = lastFocus; }; }; lastAction = "ACTIVATE"; } public function showFocus():void{ } public function set defaultButtonEnabled(_arg1:Boolean):void{ _defaultButtonEnabled = _arg1; } public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{ var _local2:DisplayObject; var _local3:String; var _local4:int; var _local5:Boolean; var _local6:int; var _local7:int; var _local8:IFocusManagerGroup; if (!hasFocusableObjects()){ return (null); }; if (calculateCandidates){ sortFocusableObjects(); calculateCandidates = false; }; _local2 = form.stage.focus; _local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2))); _local3 = ""; if ((_local2 is IFocusManagerGroup)){ _local8 = IFocusManagerGroup(_local2); _local3 = _local8.groupName; }; _local4 = getIndexOfFocusedObject(_local2); _local5 = false; _local6 = _local4; if (_local4 == -1){ if (_arg1){ _local4 = focusableCandidates.length; }; _local5 = true; }; _local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3); return (findFocusManagerComponent(focusableCandidates[_local7])); } private function mouseDownHandler(_arg1:MouseEvent):void{ var _local2:InteractiveObject; if (_arg1.isDefaultPrevented()){ return; }; _local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target)); if (!_local2){ return; }; showFocusIndicator = false; if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){ setFocus(_local2); }; lastAction = "MOUSEDOWN"; } private function isTabVisible(_arg1:DisplayObject):Boolean{ var _local2:DisplayObjectContainer; _local2 = _arg1.parent; while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) { if (!_local2.tabChildren){ return (false); }; _local2 = _local2.parent; }; return (true); } public function get nextTabIndex():int{ return (0); } private function keyDownHandler(_arg1:KeyboardEvent):void{ if (_arg1.keyCode == Keyboard.TAB){ lastAction = "KEY"; if (calculateCandidates){ sortFocusableObjects(); calculateCandidates = false; }; }; if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){ sendDefaultButtonEvent(); }; } private function focusInHandler(_arg1:FocusEvent):void{ var _local2:InteractiveObject; var _local3:Button; _local2 = InteractiveObject(_arg1.target); if (form.contains(_local2)){ lastFocus = findFocusManagerComponent(InteractiveObject(_local2)); if ((lastFocus is Button)){ _local3 = Button(lastFocus); if (defButton){ defButton.emphasized = false; defButton = _local3; _local3.emphasized = true; }; } else { if (((defButton) && (!((defButton == _defaultButton))))){ defButton.emphasized = false; defButton = _defaultButton; _defaultButton.emphasized = true; }; }; }; } private function tabEnabledChangeHandler(_arg1:Event):void{ var _local2:InteractiveObject; var _local3:Boolean; calculateCandidates = true; _local2 = InteractiveObject(_arg1.target); _local3 = (focusableObjects[_local2] == true); if (_local2.tabEnabled){ if (((!(_local3)) && (isTabVisible(_local2)))){ if (!(_local2 is IFocusManagerComponent)){ _local2.focusRect = false; }; focusableObjects[_local2] = true; }; } else { if (_local3){ delete focusableObjects[_local2]; }; }; } public function set showFocusIndicator(_arg1:Boolean):void{ _showFocusIndicator = _arg1; } public function get form():DisplayObjectContainer{ return (_form); } private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{ return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2)); } public function activate():void{ if (activated){ return; }; form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true); form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true); form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true); form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true); form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true); form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true); form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true); activated = true; if (lastFocus){ setFocus(lastFocus); }; } public function deactivate():void{ form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler); form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler); form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true); form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true); form.stage.removeEventListener(Event.ACTIVATE, activateHandler); form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler); form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true); activated = false; } public function get defaultButtonEnabled():Boolean{ return (_defaultButtonEnabled); } } }//package fl.managers
Section 27
//IFocusManager (fl.managers.IFocusManager) package fl.managers { import fl.controls.*; import flash.display.*; public interface IFocusManager { function getFocus():InteractiveObject; function deactivate():void; function set defaultButton(_arg1:Button):void; function set showFocusIndicator(_arg1:Boolean):void; function get defaultButtonEnabled():Boolean; function get nextTabIndex():int; function get defaultButton():Button; function get showFocusIndicator():Boolean; function setFocus(_arg1:InteractiveObject):void; function activate():void; function showFocus():void; function set defaultButtonEnabled(_arg1:Boolean):void; function hideFocus():void; function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject; function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject; } }//package fl.managers
Section 28
//IFocusManagerComponent (fl.managers.IFocusManagerComponent) package fl.managers { public interface IFocusManagerComponent { function set focusEnabled(_arg1:Boolean):void; function drawFocus(_arg1:Boolean):void; function setFocus():void; function get focusEnabled():Boolean; function get tabEnabled():Boolean; function get tabIndex():int; function get mouseFocusEnabled():Boolean; } }//package fl.managers
Section 29
//IFocusManagerGroup (fl.managers.IFocusManagerGroup) package fl.managers { public interface IFocusManagerGroup { function set groupName(_arg1:String):void; function set selected(_arg1:Boolean):void; function get groupName():String; function get selected():Boolean; } }//package fl.managers
Section 30
//StyleManager (fl.managers.StyleManager) package fl.managers { import flash.utils.*; import fl.core.*; import flash.text.*; public class StyleManager { private var globalStyles:Object; private var classToDefaultStylesDict:Dictionary; private var styleToClassesHash:Object; private var classToStylesDict:Dictionary; private var classToInstancesDict:Dictionary; private static var _instance:StyleManager; public function StyleManager(){ styleToClassesHash = {}; classToInstancesDict = new Dictionary(true); classToStylesDict = new Dictionary(true); classToDefaultStylesDict = new Dictionary(true); globalStyles = UIComponent.getStyleDefinition(); } public static function clearComponentStyle(_arg1:Object, _arg2:String):void{ var _local3:Class; var _local4:Object; _local3 = getClassDef(_arg1); _local4 = getInstance().classToStylesDict[_local3]; if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){ delete _local4[_arg2]; invalidateComponentStyle(_local3, _arg2); }; } private static function getClassDef(_arg1:Object):Class{ var component = _arg1; if ((component is Class)){ return ((component as Class)); }; try { return ((getDefinitionByName(getQualifiedClassName(component)) as Class)); } catch(e:Error) { if ((component is UIComponent)){ try { return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class)); } catch(e:Error) { }; }; }; return (null); } public static function clearStyle(_arg1:String):void{ setStyle(_arg1, null); } public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{ var _local4:Class; var _local5:Object; _local4 = getClassDef(_arg1); _local5 = getInstance().classToStylesDict[_local4]; if (_local5 == null){ _local5 = (getInstance().classToStylesDict[_local4] = {}); }; if (_local5 == _arg3){ return; }; _local5[_arg2] = _arg3; invalidateComponentStyle(_local4, _arg2); } private static function setSharedStyles(_arg1:UIComponent):void{ var _local2:StyleManager; var _local3:Class; var _local4:Object; var _local5:String; _local2 = getInstance(); _local3 = getClassDef(_arg1); _local4 = _local2.classToDefaultStylesDict[_local3]; for (_local5 in _local4) { _arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5)); }; } public static function getComponentStyle(_arg1:Object, _arg2:String):Object{ var _local3:Class; var _local4:Object; _local3 = getClassDef(_arg1); _local4 = getInstance().classToStylesDict[_local3]; return (((_local4)==null) ? null : _local4[_arg2]); } private static function getInstance(){ if (_instance == null){ _instance = new (StyleManager); }; return (_instance); } private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{ var _local3:Dictionary; var _local4:Object; var _local5:UIComponent; _local3 = getInstance().classToInstancesDict[_arg1]; if (_local3 == null){ return; }; for (_local4 in _local3) { _local5 = (_local4 as UIComponent); if (_local5 == null){ } else { _local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2)); }; }; } private static function invalidateStyle(_arg1:String):void{ var _local2:Dictionary; var _local3:Object; _local2 = getInstance().styleToClassesHash[_arg1]; if (_local2 == null){ return; }; for (_local3 in _local2) { invalidateComponentStyle(Class(_local3), _arg1); }; } public static function registerInstance(_arg1:UIComponent):void{ var inst:StyleManager; var classDef:Class; var target:Class; var defaultStyles:Object; var styleToClasses:Object; var n:String; var instance = _arg1; inst = getInstance(); classDef = getClassDef(instance); if (classDef == null){ return; }; if (inst.classToInstancesDict[classDef] == null){ inst.classToInstancesDict[classDef] = new Dictionary(true); target = classDef; while (defaultStyles == null) { if (target["getStyleDefinition"] != null){ defaultStyles = target["getStyleDefinition"](); break; }; try { target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class); } catch(err:Error) { try { target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class); } catch(e:Error) { defaultStyles = UIComponent.getStyleDefinition(); break; }; }; }; styleToClasses = inst.styleToClassesHash; for (n in defaultStyles) { if (styleToClasses[n] == null){ styleToClasses[n] = new Dictionary(true); }; styleToClasses[n][classDef] = true; }; inst.classToDefaultStylesDict[classDef] = defaultStyles; inst.classToStylesDict[classDef] = {}; }; inst.classToInstancesDict[classDef][instance] = true; setSharedStyles(instance); } public static function getStyle(_arg1:String):Object{ return (getInstance().globalStyles[_arg1]); } private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{ var _local3:Class; var _local4:StyleManager; var _local5:Object; _local3 = getClassDef(_arg1); _local4 = getInstance(); _local5 = _local4.classToStylesDict[_local3][_arg2]; if (_local5 != null){ return (_local5); }; _local5 = _local4.globalStyles[_arg2]; if (_local5 != null){ return (_local5); }; return (_local4.classToDefaultStylesDict[_local3][_arg2]); } public static function setStyle(_arg1:String, _arg2:Object):void{ var _local3:Object; _local3 = getInstance().globalStyles; if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){ return; }; _local3[_arg1] = _arg2; invalidateStyle(_arg1); } } }//package fl.managers
Section 31
//BrushShapeButtonBackwardSlash (BrushShapeButtonBackwardSlash) package { public dynamic class BrushShapeButtonBackwardSlash extends ItemButton { } }//package
Section 32
//BrushShapeButtonDiamond (BrushShapeButtonDiamond) package { public dynamic class BrushShapeButtonDiamond extends ItemButton { } }//package
Section 33
//BrushShapeButtonForwardSlash (BrushShapeButtonForwardSlash) package { public dynamic class BrushShapeButtonForwardSlash extends ItemButton { } }//package
Section 34
//BrushShapeButtonHorz (BrushShapeButtonHorz) package { public dynamic class BrushShapeButtonHorz extends ItemButton { } }//package
Section 35
//BrushShapeButtonRound (BrushShapeButtonRound) package { public dynamic class BrushShapeButtonRound extends ItemButton { } }//package
Section 36
//BrushShapeButtonSquare (BrushShapeButtonSquare) package { public dynamic class BrushShapeButtonSquare extends ItemButton { } }//package
Section 37
//BrushShapeButtonVert (BrushShapeButtonVert) package { public dynamic class BrushShapeButtonVert extends ItemButton { } }//package
Section 38
//CheckBox_disabledIcon (CheckBox_disabledIcon) package { import flash.display.*; public dynamic class CheckBox_disabledIcon extends MovieClip { } }//package
Section 39
//CheckBox_downIcon (CheckBox_downIcon) package { import flash.display.*; public dynamic class CheckBox_downIcon extends MovieClip { } }//package
Section 40
//CheckBox_overIcon (CheckBox_overIcon) package { import flash.display.*; public dynamic class CheckBox_overIcon extends MovieClip { } }//package
Section 41
//CheckBox_selectedDisabledIcon (CheckBox_selectedDisabledIcon) package { import flash.display.*; public dynamic class CheckBox_selectedDisabledIcon extends MovieClip { } }//package
Section 42
//CheckBox_selectedDownIcon (CheckBox_selectedDownIcon) package { import flash.display.*; public dynamic class CheckBox_selectedDownIcon extends MovieClip { } }//package
Section 43
//CheckBox_selectedOverIcon (CheckBox_selectedOverIcon) package { import flash.display.*; public dynamic class CheckBox_selectedOverIcon extends MovieClip { } }//package
Section 44
//CheckBox_selectedUpIcon (CheckBox_selectedUpIcon) package { import flash.display.*; public dynamic class CheckBox_selectedUpIcon extends MovieClip { } }//package
Section 45
//CheckBox_upIcon (CheckBox_upIcon) package { import flash.display.*; public dynamic class CheckBox_upIcon extends MovieClip { } }//package
Section 46
//ColorPicker_backgroundSkin (ColorPicker_backgroundSkin) package { import flash.display.*; public dynamic class ColorPicker_backgroundSkin extends MovieClip { } }//package
Section 47
//ColorPicker_colorWell (ColorPicker_colorWell) package { import flash.display.*; public dynamic class ColorPicker_colorWell extends MovieClip { } }//package
Section 48
//ColorPicker_disabledSkin (ColorPicker_disabledSkin) package { import flash.display.*; public dynamic class ColorPicker_disabledSkin extends MovieClip { } }//package
Section 49
//ColorPicker_downSkin (ColorPicker_downSkin) package { import flash.display.*; public dynamic class ColorPicker_downSkin extends MovieClip { } }//package
Section 50
//ColorPicker_overSkin (ColorPicker_overSkin) package { import flash.display.*; public dynamic class ColorPicker_overSkin extends MovieClip { } }//package
Section 51
//ColorPicker_swatchSelectedSkin (ColorPicker_swatchSelectedSkin) package { import flash.display.*; public dynamic class ColorPicker_swatchSelectedSkin extends MovieClip { } }//package
Section 52
//ColorPicker_swatchSkin (ColorPicker_swatchSkin) package { import flash.display.*; public dynamic class ColorPicker_swatchSkin extends Sprite { } }//package
Section 53
//ColorPicker_textFieldSkin (ColorPicker_textFieldSkin) package { import flash.display.*; public dynamic class ColorPicker_textFieldSkin extends MovieClip { } }//package
Section 54
//ColorPicker_upSkin (ColorPicker_upSkin) package { import flash.display.*; public dynamic class ColorPicker_upSkin extends MovieClip { } }//package
Section 55
//focusRectSkin (focusRectSkin) package { import flash.display.*; public dynamic class focusRectSkin extends MovieClip { } }//package
Section 56
//ItemButton (ItemButton) package { import flash.display.*; import flash.events.*; public class ItemButton extends MovieClip { private var _selected:Boolean;// = false public var button_states_mc:MovieClip; public function ItemButton(){ _selected = false; super(); button_states_mc.stop(); this.addEventListener(MouseEvent.ROLL_OVER, mouseHandler); this.addEventListener(MouseEvent.ROLL_OUT, mouseHandler); } public function set selected(_arg1:Boolean):void{ _selected = _arg1; if (_selected){ button_states_mc.gotoAndStop("selected"); } else { button_states_mc.gotoAndStop("up"); }; } public function get selected():Boolean{ return (_selected); } private function mouseHandler(_arg1:MouseEvent):void{ if (((!(_selected)) && (!(_arg1.buttonDown)))){ if (_arg1.type == MouseEvent.ROLL_OVER){ button_states_mc.gotoAndStop("over"); } else { if (_arg1.type == MouseEvent.ROLL_OUT){ button_states_mc.gotoAndStop("up"); }; }; }; } } }//package
Section 57
//Main (Main) package { import fl.controls.*; import flash.display.*; import com.adobe.images.*; import flash.utils.*; import flash.events.*; import com.nocircleno.graffiti.tools.core.*; import fl.events.*; import com.nocircleno.graffiti.tools.brush.*; import flash.text.*; import com.nocircleno.graffiti.*; import flash.ui.*; import flash.net.*; public class Main extends MovieClip { public var click_message_txt:TextField; private var _activeBrush:Brush; public var bs_round:MovieClip; private var _brushShape:String;// = "round" public var border:Sprite; private var _brush:Brush; public var zoom_slider_mc:Slider; private var _eraserSize:Number;// = 2 public var bs_forward_line:MovieClip; private var _eraserColor:uint;// = 0 public var selected_brush_shape_mc:MovieClip; public var undo_btn:SimpleButton; public var save_btn:SimpleButton; public var redo_btn:SimpleButton; public var overlay_cb:CheckBox; private var _eraserShape:String;// = "round" public var bs_square:MovieClip; private var _brushSize:Number;// = 2 public var eraser_tool_mc:MovieClip; public var size_slider_mc:Slider; public var color_picker_mc:ColorPicker; public var bs_horizontal_line:MovieClip; public var canvas:GraffitiCanvas; public var bs_backward_line:MovieClip; public var bs_diamond:MovieClip; public var clear_btn:SimpleButton; public var brush_tool_mc:MovieClip; public var bs_vertical_line:MovieClip; private var _eraser:Brush; public var overlay_mc:MovieClip; private var _brushColor:uint;// = 0 public function Main(){ _brushSize = 2; _brushShape = BrushType.ROUND; _brushColor = 0; _eraserSize = 2; _eraserShape = BrushType.ROUND; _eraserColor = 0; super(); addFrameScript(0, frame1); click_message_txt.alpha = 0; _brush = new Brush(2, 0, BrushType.ROUND); _eraser = new Brush(2, 0, BrushType.ROUND, ToolMode.ERASE); _activeBrush = _brush; brush_tool_mc.selected = true; setSelectedBrushShape(BrushType.ROUND); canvas = new GraffitiCanvas(450, 470, 5); canvas.x = 0; canvas.y = 100; canvas.activeTool = _activeBrush; addChild(canvas); overlay_mc = new OverlayImage(); canvas.overlay = overlay_mc; stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler); stage.addEventListener(KeyboardEvent.KEY_UP, keyHandler); canvas.addEventListener(MouseEvent.MOUSE_WHEEL, scrollHandler); color_picker_mc.focusEnabled = false; brush_tool_mc.addEventListener(MouseEvent.CLICK, toolHandler); eraser_tool_mc.addEventListener(MouseEvent.CLICK, toolHandler); bs_round.addEventListener(MouseEvent.CLICK, brushShapeHandler); bs_square.addEventListener(MouseEvent.CLICK, brushShapeHandler); bs_diamond.addEventListener(MouseEvent.CLICK, brushShapeHandler); bs_vertical_line.addEventListener(MouseEvent.CLICK, brushShapeHandler); bs_horizontal_line.addEventListener(MouseEvent.CLICK, brushShapeHandler); bs_forward_line.addEventListener(MouseEvent.CLICK, brushShapeHandler); bs_backward_line.addEventListener(MouseEvent.CLICK, brushShapeHandler); bs_round.buttonShapeID = BrushType.ROUND; bs_square.buttonShapeID = BrushType.SQUARE; bs_diamond.buttonShapeID = BrushType.DIAMOND; bs_vertical_line.buttonShapeID = BrushType.VERTICAL_LINE; bs_horizontal_line.buttonShapeID = BrushType.HORIZONTAL_LINE; bs_forward_line.buttonShapeID = BrushType.FORWARD_LINE; bs_backward_line.buttonShapeID = BrushType.BACKWARD_LINE; color_picker_mc.addEventListener(ColorPickerEvent.CHANGE, colorPickerHandler); size_slider_mc.addEventListener(SliderEvent.CHANGE, sliderHandler); overlay_cb.addEventListener(Event.CHANGE, overlayHandler); undo_btn.addEventListener(MouseEvent.CLICK, historyHandler); redo_btn.addEventListener(MouseEvent.CLICK, historyHandler); clear_btn.addEventListener(MouseEvent.CLICK, clearCanvasHandler); save_btn.addEventListener(MouseEvent.CLICK, saveHandler); zoom_slider_mc.maximum = canvas.maxZoom; zoom_slider_mc.addEventListener(SliderEvent.CHANGE, zoomHandler); __setProp_size_slider_mc_Scene1_BrushSize_1(); __setProp_overlay_cb_Scene1_BrushSize_1(); __setProp_zoom_slider_mc_Scene1_BrushSize_1(); } private function historyHandler(_arg1:MouseEvent):void{ if (_arg1.currentTarget == undo_btn){ canvas.prevHistory(); } else { if (_arg1.currentTarget == redo_btn){ canvas.nextHistory(); }; }; } function __setProp_size_slider_mc_Scene1_BrushSize_1(){ try { size_slider_mc["componentInspectorSetting"] = true; } catch(e:Error) { }; size_slider_mc.direction = "horizontal"; size_slider_mc.enabled = true; size_slider_mc.liveDragging = false; size_slider_mc.maximum = 40; size_slider_mc.minimum = 2; size_slider_mc.snapInterval = 0; size_slider_mc.tickInterval = 0; size_slider_mc.value = 0; size_slider_mc.visible = true; try { size_slider_mc["componentInspectorSetting"] = false; } catch(e:Error) { }; } private function colorPickerHandler(_arg1:ColorPickerEvent):void{ _activeBrush.color = _arg1.color; } function frame1(){ } private function toolHandler(_arg1:MouseEvent):void{ if (_arg1.currentTarget == brush_tool_mc){ brush_tool_mc.selected = true; eraser_tool_mc.selected = false; color_picker_mc.enabled = true; _activeBrush = _brush; canvas.activeTool = _activeBrush; } else { if (_arg1.currentTarget == eraser_tool_mc){ color_picker_mc.enabled = false; eraser_tool_mc.selected = true; brush_tool_mc.selected = false; _activeBrush = _eraser; canvas.activeTool = _activeBrush; }; }; setSelectedBrushShape(_activeBrush.type); size_slider_mc.value = _activeBrush.size; } function __setProp_overlay_cb_Scene1_BrushSize_1(){ try { overlay_cb["componentInspectorSetting"] = true; } catch(e:Error) { }; overlay_cb.enabled = true; overlay_cb.label = ""; overlay_cb.labelPlacement = "right"; overlay_cb.selected = true; overlay_cb.visible = true; try { overlay_cb["componentInspectorSetting"] = false; } catch(e:Error) { }; } private function brushShapeHandler(_arg1:MouseEvent):void{ setSelectedBrushShape(_arg1.currentTarget.buttonShapeID); } private function overlayHandler(_arg1:Event):void{ if (_arg1.currentTarget.selected){ canvas.overlay = overlay_mc; } else { canvas.overlay = null; }; } private function saveHandler(_arg1:MouseEvent):void{ var _local2:BitmapData; var _local3:JPGEncoder; var _local4:ByteArray; var _local5:URLRequestHeader; var _local6:int; var _local7:String; var _local8:URLRequest; _local2 = canvas.drawing(); _local3 = new JPGEncoder(85); _local4 = _local3.encode(_local2); _local2.dispose(); _local5 = new URLRequestHeader("Content-type", "application/octet-stream"); _local6 = Math.floor((Math.random() * 100)); _local7 = _local6.toString(); _local7 = (("graffo" + _local7) + ".jpg"); _local8 = new URLRequest(("http://www.funonmars.com/sendcard/images/jpg_graf.php?name=" + _local7)); _local8.requestHeaders.push(_local5); _local8.method = URLRequestMethod.POST; _local8.data = _local4; navigateToURL(_local8, "_blank"); } private function sliderHandler(_arg1:SliderEvent):void{ _activeBrush.size = _arg1.value; } private function setSelectedBrushShape(_arg1:String):void{ if (selected_brush_shape_mc != null){ selected_brush_shape_mc.selected = false; }; selected_brush_shape_mc = MovieClip(this.getChildByName(("bs_" + _arg1))); selected_brush_shape_mc.selected = true; if (_activeBrush.type != _arg1){ _activeBrush.type = _arg1; }; } private function clearCanvasHandler(_arg1:MouseEvent):void{ canvas.clearCanvas(); } public function scrollHandler(_arg1:MouseEvent):void{ canvas.zoom = (canvas.zoom + ((_arg1.delta / 3) * 1)); zoom_slider_mc.value = canvas.zoom; if (canvas.zoom > 1){ click_message_txt.alpha = 1; } else { click_message_txt.alpha = 0; }; } function __setProp_zoom_slider_mc_Scene1_BrushSize_1(){ try { zoom_slider_mc["componentInspectorSetting"] = true; } catch(e:Error) { }; zoom_slider_mc.direction = "horizontal"; zoom_slider_mc.enabled = true; zoom_slider_mc.liveDragging = true; zoom_slider_mc.maximum = 10; zoom_slider_mc.minimum = 1; zoom_slider_mc.snapInterval = 0; zoom_slider_mc.tickInterval = 0; zoom_slider_mc.value = 0; zoom_slider_mc.visible = true; try { zoom_slider_mc["componentInspectorSetting"] = false; } catch(e:Error) { }; } public function keyHandler(_arg1:KeyboardEvent):void{ if (_arg1.keyCode == Keyboard.SPACE){ if (_arg1.type == KeyboardEvent.KEY_UP){ canvas.mouseDrag = false; } else { if (_arg1.type == KeyboardEvent.KEY_DOWN){ canvas.mouseDrag = true; }; }; }; } private function zoomHandler(_arg1:SliderEvent):void{ canvas.zoom = _arg1.value; if (canvas.zoom > 1){ click_message_txt.alpha = 1; } else { click_message_txt.alpha = 0; }; } } }//package
Section 58
//OverlayImage (OverlayImage) package { import flash.display.*; public dynamic class OverlayImage extends MovieClip { } }//package
Section 59
//OverlayImagex (OverlayImagex) package { import flash.display.*; public dynamic class OverlayImagex extends MovieClip { } }//package
Section 60
//SliderThumb_disabledSkin (SliderThumb_disabledSkin) package { import flash.display.*; public dynamic class SliderThumb_disabledSkin extends MovieClip { } }//package
Section 61
//SliderThumb_downSkin (SliderThumb_downSkin) package { import flash.display.*; public dynamic class SliderThumb_downSkin extends MovieClip { } }//package
Section 62
//SliderThumb_overSkin (SliderThumb_overSkin) package { import flash.display.*; public dynamic class SliderThumb_overSkin extends MovieClip { } }//package
Section 63
//SliderThumb_upSkin (SliderThumb_upSkin) package { import flash.display.*; public dynamic class SliderThumb_upSkin extends MovieClip { } }//package
Section 64
//SliderTick_skin (SliderTick_skin) package { import flash.display.*; public dynamic class SliderTick_skin extends MovieClip { } }//package
Section 65
//SliderTrack_disabledSkin (SliderTrack_disabledSkin) package { import flash.display.*; public dynamic class SliderTrack_disabledSkin extends MovieClip { } }//package
Section 66
//SliderTrack_skin (SliderTrack_skin) package { import flash.display.*; public dynamic class SliderTrack_skin extends MovieClip { } }//package
Section 67
//ToolButtonBrush (ToolButtonBrush) package { public dynamic class ToolButtonBrush extends ItemButton { } }//package
Section 68
//ToolButtonEaser (ToolButtonEaser) package { public dynamic class ToolButtonEaser extends ItemButton { } }//package

Library Items

Symbol 1 GraphicUsed by:2
Symbol 2 MovieClip {OverlayImagex}Uses:1
Symbol 3 GraphicUsed by:4
Symbol 4 MovieClip {OverlayImage}Uses:3
Symbol 5 GraphicUsed by:9
Symbol 6 GraphicUsed by:9
Symbol 7 GraphicUsed by:9
Symbol 8 GraphicUsed by:9
Symbol 9 MovieClipUses:5 6 7 8Used by:11 13 15 17 19 21 23 24 26
Symbol 10 GraphicUsed by:11
Symbol 11 MovieClip {ToolButtonEaser}Uses:9 10Used by:Timeline
Symbol 12 GraphicUsed by:13
Symbol 13 MovieClip {ToolButtonBrush}Uses:9 12Used by:Timeline
Symbol 14 GraphicUsed by:15
Symbol 15 MovieClip {BrushShapeButtonBackwardSlash}Uses:9 14Used by:Timeline
Symbol 16 GraphicUsed by:17
Symbol 17 MovieClip {BrushShapeButtonForwardSlash}Uses:9 16Used by:Timeline
Symbol 18 GraphicUsed by:19
Symbol 19 MovieClip {BrushShapeButtonHorz}Uses:9 18Used by:Timeline
Symbol 20 GraphicUsed by:21 24
Symbol 21 MovieClip {BrushShapeButtonVert}Uses:9 20Used by:Timeline
Symbol 22 GraphicUsed by:23
Symbol 23 MovieClip {BrushShapeButtonDiamond}Uses:9 22Used by:Timeline
Symbol 24 MovieClip {BrushShapeButtonSquare}Uses:9 20Used by:Timeline
Symbol 25 GraphicUsed by:26
Symbol 26 MovieClip {BrushShapeButtonRound}Uses:9 25Used by:Timeline
Symbol 27 GraphicUsed by:28
Symbol 28 MovieClipUses:27Used by:50 68 83
Symbol 29 MovieClip {fl.core.ComponentShim}Used by:50 68 83
Symbol 30 GraphicUsed by:31
Symbol 31 MovieClip {ColorPicker_upSkin}Uses:30Used by:50
Symbol 32 GraphicUsed by:33
Symbol 33 MovieClip {ColorPicker_disabledSkin}Uses:32Used by:50
Symbol 34 GraphicUsed by:35
Symbol 35 MovieClip {ColorPicker_swatchSkin}Uses:34Used by:50
Symbol 36 GraphicUsed by:37 38
Symbol 37 MovieClipUses:36Used by:39 50
Symbol 38 MovieClipUses:36Used by:39 50
Symbol 39 MovieClip {ColorPicker_backgroundSkin}Uses:37 38Used by:50
Symbol 40 GraphicUsed by:41
Symbol 41 MovieClip {ColorPicker_downSkin}Uses:40Used by:50
Symbol 42 GraphicUsed by:43
Symbol 43 MovieClip {ColorPicker_textFieldSkin}Uses:42Used by:50
Symbol 44 GraphicUsed by:45
Symbol 45 MovieClip {ColorPicker_overSkin}Uses:44Used by:50
Symbol 46 GraphicUsed by:47
Symbol 47 MovieClip {ColorPicker_colorWell}Uses:46Used by:50
Symbol 48 GraphicUsed by:49
Symbol 49 MovieClip {ColorPicker_swatchSelectedSkin}Uses:48Used by:50
Symbol 50 MovieClip {fl.controls.ColorPicker}Uses:28 29 31 33 35 39 41 43 45 47 49 38 37Used by:Timeline
Symbol 51 GraphicUsed by:52 61
Symbol 52 MovieClip {CheckBox_upIcon}Uses:51Used by:68
Symbol 53 GraphicUsed by:54 62
Symbol 54 MovieClip {CheckBox_overIcon}Uses:53Used by:68
Symbol 55 GraphicUsed by:56 63
Symbol 56 MovieClip {CheckBox_downIcon}Uses:55Used by:68
Symbol 57 GraphicUsed by:58
Symbol 58 MovieClip {CheckBox_disabledIcon}Uses:57Used by:68
Symbol 59 GraphicUsed by:60
Symbol 60 MovieClipUses:59Used by:61 62 63 65
Symbol 61 MovieClip {CheckBox_selectedUpIcon}Uses:51 60Used by:68
Symbol 62 MovieClip {CheckBox_selectedOverIcon}Uses:53 60Used by:68
Symbol 63 MovieClip {CheckBox_selectedDownIcon}Uses:55 60Used by:68
Symbol 64 GraphicUsed by:65
Symbol 65 MovieClip {CheckBox_selectedDisabledIcon}Uses:64 60Used by:68
Symbol 66 GraphicUsed by:67
Symbol 67 MovieClip {focusRectSkin}Uses:66Used by:68 83
Symbol 68 MovieClip {fl.controls.CheckBox}Uses:28 29 52 54 56 58 61 62 63 65 67Used by:Timeline
Symbol 69 GraphicUsed by:70
Symbol 70 MovieClip {SliderThumb_upSkin}Uses:69Used by:83
Symbol 71 GraphicUsed by:72
Symbol 72 MovieClip {SliderThumb_overSkin}Uses:71Used by:83
Symbol 73 GraphicUsed by:74
Symbol 74 MovieClip {SliderThumb_downSkin}Uses:73Used by:83
Symbol 75 GraphicUsed by:76
Symbol 76 MovieClip {SliderThumb_disabledSkin}Uses:75Used by:83
Symbol 77 GraphicUsed by:78
Symbol 78 MovieClip {SliderTrack_skin}Uses:77Used by:83
Symbol 79 GraphicUsed by:80
Symbol 80 MovieClip {SliderTick_skin}Uses:79Used by:83
Symbol 81 GraphicUsed by:82
Symbol 82 MovieClip {SliderTrack_disabledSkin}Uses:81Used by:83
Symbol 83 MovieClip {fl.controls.Slider}Uses:28 29 70 72 74 76 78 80 82 67Used by:Timeline
Symbol 84 GraphicUsed by:Timeline
Symbol 85 FontUsed by:86 87 90 91 92
Symbol 86 TextUses:85Used by:Timeline
Symbol 87 TextUses:85Used by:Timeline
Symbol 88 FontUsed by:89 94 96 99 101 103 104 106
Symbol 89 EditableTextUses:88Used by:Timeline
Symbol 90 TextUses:85Used by:Timeline
Symbol 91 TextUses:85Used by:Timeline
Symbol 92 TextUses:85Used by:Timeline
Symbol 93 GraphicUsed by:97 105 107
Symbol 94 TextUses:88Used by:97
Symbol 95 GraphicUsed by:97 105 107
Symbol 96 TextUses:88Used by:97
Symbol 97 ButtonUses:93 94 95 96Used by:Timeline
Symbol 98 GraphicUsed by:102
Symbol 99 TextUses:88Used by:102
Symbol 100 GraphicUsed by:102
Symbol 101 TextUses:88Used by:102
Symbol 102 ButtonUses:98 99 100 101Used by:Timeline
Symbol 103 TextUses:88Used by:105
Symbol 104 TextUses:88Used by:105
Symbol 105 ButtonUses:93 103 95 104Used by:Timeline
Symbol 106 TextUses:88Used by:107
Symbol 107 ButtonUses:93 106 95Used by:Timeline

Instance Names

"size_slider_mc"Frame 1Symbol 83 MovieClip {fl.controls.Slider}
"zoom_slider_mc"Frame 1Symbol 83 MovieClip {fl.controls.Slider}
"click_message_txt"Frame 1Symbol 89 EditableText
"overlay_cb"Frame 1Symbol 68 MovieClip {fl.controls.CheckBox}
"color_picker_mc"Frame 1Symbol 50 MovieClip {fl.controls.ColorPicker}
"bs_round"Frame 1Symbol 26 MovieClip {BrushShapeButtonRound}
"bs_square"Frame 1Symbol 24 MovieClip {BrushShapeButtonSquare}
"bs_diamond"Frame 1Symbol 23 MovieClip {BrushShapeButtonDiamond}
"bs_vertical_line"Frame 1Symbol 21 MovieClip {BrushShapeButtonVert}
"bs_horizontal_line"Frame 1Symbol 19 MovieClip {BrushShapeButtonHorz}
"bs_forward_line"Frame 1Symbol 17 MovieClip {BrushShapeButtonForwardSlash}
"bs_backward_line"Frame 1Symbol 15 MovieClip {BrushShapeButtonBackwardSlash}
"brush_tool_mc"Frame 1Symbol 13 MovieClip {ToolButtonBrush}
"eraser_tool_mc"Frame 1Symbol 11 MovieClip {ToolButtonEaser}
"clear_btn"Frame 1Symbol 97 Button
"save_btn"Frame 1Symbol 102 Button
"undo_btn"Frame 1Symbol 105 Button
"redo_btn"Frame 1Symbol 107 Button
"button_states_mc"Symbol 11 MovieClip {ToolButtonEaser} Frame 1Symbol 9 MovieClip
"button_states_mc"Symbol 13 MovieClip {ToolButtonBrush} Frame 1Symbol 9 MovieClip
"button_states_mc"Symbol 15 MovieClip {BrushShapeButtonBackwardSlash} Frame 1Symbol 9 MovieClip
"button_states_mc"Symbol 17 MovieClip {BrushShapeButtonForwardSlash} Frame 1Symbol 9 MovieClip
"button_states_mc"Symbol 19 MovieClip {BrushShapeButtonHorz} Frame 1Symbol 9 MovieClip
"button_states_mc"Symbol 21 MovieClip {BrushShapeButtonVert} Frame 1Symbol 9 MovieClip
"button_states_mc"Symbol 23 MovieClip {BrushShapeButtonDiamond} Frame 1Symbol 9 MovieClip
"button_states_mc"Symbol 24 MovieClip {BrushShapeButtonSquare} Frame 1Symbol 9 MovieClip
"button_states_mc"Symbol 26 MovieClip {BrushShapeButtonRound} Frame 1Symbol 9 MovieClip

Special Tags

FileAttributes (69)Timeline Frame 1Access local files only, Metadata not present, AS3.

Labels

"up"Symbol 9 MovieClip Frame 1
"over"Symbol 9 MovieClip Frame 10
"selected"Symbol 9 MovieClip Frame 20




http://swfchan.com/49/240955/info.shtml
Created: 24/5 -2021 06:59:00 Last modified: 24/5 -2021 06:59:00 Server time: 14/05 -2024 18:00:07