аЯрЁБс>ўџ ўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџRoot Entryџџџџџџџџ pЊ|YЊrЯƒRASHѕ3˜ГXЦ Р.Contentsџџџџџџџџџџџџ„0NPage 1џџџџџџџџ“uSymbol 21џџџџџџџџџџџџЕi#§џџџџџџџџџџџџџџџџџџџ"§џџџ ‡ўџџџ†… !ўџџџ$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџRoot Entryџџџџџџџџ pЊ|YЊrЯƒRASHРЯ}ЊГXЦ Р.ContentsџџџџџџџџУ0NPage 1џџџџџџџџџџџџ\ЕuSymbol 21џџџџџџџџџџџџЕiџџџџџџџџ#§џџџ§џџџўџџџџџџџџџџџџџџџ ‡џџџџ†… !ўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒАџџџџўџџџˆџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџБВГДЕЖЗИЙКЛМНОПРСТўџџџФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџSymbol 3џџџџџџџџ5ASymbol 1џџџџ9 џџџџџџџџџџџџџџџџџџџџџџџџџџCPicPageџџ CPicLayerџџ CPicFrameџџ CPicSprite€јџџ@ќџџ€јџџ@ќџџџџџџџўџ}vџўџџ onClipEvent(load) { //make cursor depth high enough so that //it is above all potentially painted pixels _root.cursor.swapDepths(10000); var i = 1; var down = 0; //user is initially not holding the left mouse button down var paint = 0; //the cursor is above the paint area (canvas) var min_x = _root.canvas._x + 1; var max_x = min_x + _root.canvas._width - 1; var min_y = _root.canvas._y + џџџџџџџџџџџџџџџџ‰ўџџџˆŠ‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂЃЄЅІЇЈЉЊЋЌ­ЎЏўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџCPicPageџџ CPicLayerџџ CPicFrame€€ џ№Vюџџ­џЭ3џџџ€їэч§­t.oщ8-’џ4њŠ$oЫ§о0є8J`џџF§џџн§"џ4‹’џц§8Ўbџџъч§4Цtœ4!џF#€ €0Y џџ8zЅ5пџџџ?џџџўџќkџўџџўџ€€€џџџџїэч§­t.oщ8-’џ4њŠ$oЫ§о0є8J`џџF§џџн§"џ4‹’џц§8Ўbџџъч§4Цtœ4!џF#€ €0Y џџ8zЅ5пѕ˜€8iЪWвЈ4v|.џЉ4а–ЎWўЏ0Ѕѕ8Spџџъ§џџўQџ4тЗНУBџэў‹ѕEм€ѕЕ ии€ €Е4кВОэў4яhЈћPџФ(€ €09 џџ8а”ќАџџџ?џџџўџ–џўџџўџ€€€џџџ?џџџўџѕџўџџўџ€€€ џџїэч§­t.oщ8-’џ4њŠ$oЫ§о0є8J`џџF§џџн§"џ4‹’џц§8Ўbџџъч§4Цtœ4!џF#€ €0Y џџ8zЅ5пџџџ?џџџўџENџўџџўџ€€ џўџLayer 1џџџџџџ€€€€џџџ?џџџўџ;2џўџџўџ€€€џА№џџўџџџ§џЫЖџџќџџ(#(#`ьџџџ­џЭ3џџџ€їэч§­t.oщ8-’џ4њŠ$oЫ§о0є8J`џџF§џџн§"џ4‹’џц§8Ўbџџъч§4Цtœ4!џF#€ €0Y џџ8zЅ5пѕ˜€8iЪWвЈ4v|.џЉ4а–ЎWўЏ0Ѕѕ8Spџџъ§џџўQџ4тЗНУBџэў‹ѕEм€ѕЕ ии€ €Е4кВОэў4яhЈћPџФ(€ €09 џџ8а”ќАџџџ?џџџўџ"џўџџўџ€€€ џА№џџўџџџ§џЫЖџџќџ€їXўiЪWвЈ4v|.џЉ4а–ЎWўЏ0Ѕѕ8Spџџъ§џџўQџ4тЗНУBџэў‹ѕEм€ѕЕ ии€ €Е4кВОэў4яhЈћPџФ(€ €09 џџ8а”ќАџџџ?џџџўџ &џўџџўџ€€€џџџ?џџџўџ‰kџўџџўџ€€ џўџLayer 8џџџџ€€€џ€€€€џ–œџџџ'5Wјџџџжџџџџџ+++џџrџџџUOУќџџDџџџџџџжџџџџџ+++џW€гїџŽї+Ф1ˆ49zУ%Tџ4зYЩц?џџkExN€TВг;€Яx4ЎЦУ<кў­4)ІєСў•К‡чВ€ЋW€Xcњд$.$>ъ€<pхOМ€'нж ЗћEры№€м€блћсФPpт€Cи#)5іI€џџџ?џџџўџ џўџџўџ€џџ CPicShape€€џrџџџUOџќџџ€џџџџџџжџџџџџ+++џw€­јŠў9zУ%Tџ4зYЩц?џџkExN€TВг;€Яx4ЎЦУ<кў­4)ІєСў•К‡чВ€ЋŽї+Ф1ˆ€€џ–œџџџ'5C”џџџжџџџџџ+++џзњд$.$>ъ€<pхOМ€'нж ЗћEры№€м€блћсФPpт€Cи#)5іI€џџџ?џџџўџ0џўџџўџ€€€џџџ?џџџўџл џўџџўџ€€ џўџLayer 7џџџџџfџ€€ џџCPicPageџџ CPicLayerџџ CPicFrameџџ CPicShape€€џP€ьь€€џџџ?џџ€€Layer 1џџџџO€џџ€€џџCPicPageџџ CPicLayerџџ CPicFrameџџ CPicShape€€Hџџs€€@ќ ўР0`њ0@ќ0 €€џџџ?џџџўџ Eџўџџўџ€€ џўџLayer 1џџџџO€џџ€€џџCPicPageџџ CPicLayerџџ CPicFrame€€џѓ@А0Рљ0Pћ0@џџџ?џџџўџI_џўџџўџ€€ џўџframeџџџџO€џџ€€џџCPicPageџџ CPicLayerџџ CPicFrameџџ CPicShape€€џџs€ ё0рђ00 €€џџџ?џџџўџšuџўџџўџ€€€™џџџ<ѓ ё0рђ00 џџџ?џџџўџP#џўџџўџ€€€џџџџ<s€€ ё0рђ00 џџџ?џџџўџю"џўџџўџ€€€џџџџ<s€€ ё0рђ00 џџџ?џџџўџ@Kџўџџўџ€€ џўџLayer 1џџџџO€џџ€€џџCPicPageџџ CPicLayerџџ CPicFrameџџ CPicButton€€џџџџџўџ  џўџџПon(rollOver) { _root.attachMovie("hilite", "hilite", 10); _root.hilite._x = _x; _root.hilite._y = _y; } on(rollOut) { removeMovieClip("_root.hilite"); } on(press) { mycolor.setRGB(0xFFFF00); //var cur_color = new Color(_root.cursor); _root.controller.cur_color.setRGB(default_color); } on(release,releaseOutside) { mycolor.setRGB(default_color); _root.controller.paint_color = default_color; } џўџ€€џџџ?џџџўџ2џўџџўџ€€ џўџ backgroundџџџџO€џџ€€џџCPicPageџџ CPicLayerџџ CPicFrameџџ CPicSprite,,Pn[,,€2џ €€џџџ?џџ€€Layer 1џџџџO€џџ€€џџCPicPageџџ CPicLayerџџ CPicFrameџџ CPicShape€€@ќџџИќџџџџџџs€ ё0рђ00 €€џџџ?џџ€€Layer 1џџџџO€џџ€€џџCPicPageџџ CPicLayerџџ CPicFrame€€џџџбu€Symbol 3џџџџџџџџ5ASymbol 1џџџџ9 џџџџџџџџџџџџџџџџџџџџџџџџSymbol 15џџџџџџџџџџџџ|2Symbol 13џџџџџџџџvOSymbol 11џџџџpESymbol 10џџџџџџџџџџџџjP  !"#$%&'()*+,-./01234ўџџџ6789:ўџџџ<=>?@ўџџџBCDEўџџџGHIJKLMNOPQRSTўџџџVWXYZ[\]^_`abcdefghiўџџџklmnoўџџџqrstuўџџџwxyz{ўџџџ}~€џўџџўџџўџ3€€џџџ?џџџўџі;џўџџўџ€€ џўџLayer 1џџџџO€џџ€€џџCPicPageџџ CPicLayerџџ CPicFrameџџ CPicSpritex€РxdџџџCPicText€€dH xTimes New Romanџџџџ(This Flash movie clip creates a BMP file (24bit Windows BitMap) that depicts what the user has painted on the canvas area. The user can paint in the 3 basic colors and create 40x30 bitmaps. All binary processing involved is done within Flash and the resulting data is sent to the server as a URI encoded byte-stream. The server just saves the data in a .bmp file and sends it to the user. The process is demanding and teeters on the border of what can or should be done using Flash. Check the accompanying tutorišxTimes New Romanџџџџ(al (on the same page) for implementation details. The fla source is available for download at the bottom of the page. Coded by Fotios (http://fotios.cc/)€€џџџ?џџ€€Layer 1џџџџO€џџ€€џџ CPicButton€€VqЋrЪpџџџџ €€€KЖKЖ# їџџџџџџџ2on (release) { removeMovieClip(_root.help); }€€џџџ?џџ€€buttonџџџџџOOџ€€џџCPicPageџџ CPicLayerџџ CPicFrame€€џџџѓ іРљР0€ 0@э0€ѓџџџ?џџ€€Layer 1џџџџO€џџ€€џџCPicPageџџ CPicLayerџџ CPicFrame€€џџџ?џџ€€€џџџ?џџ€€€џџџ?џџ€џџ CPicShape€€џџџџs€Рё0@ќ00Р€€џџџ?џџ€€Layer 1џџџџO€џџ€€џџCPicPageџџ CPicLayerџџ CPicFrameџџCPicText€€"оK(€№Tw Cen MT Condensed Extra Boldџ"(X€€џџџ?џџ€€Layer 1џџџџO€џџ€€1; var max_y = min_y + _root.canvas._height - 1; var paint_color = 0xFF0000; //color the painted pixel will have var mx, my, mxs, mys; var matrix = new Array(); //set the initial cursor color var cur_color = new Color(_root.cursoSymbol 19џџџџЊžSymbol 18џџџџџџџџџџџџЅ Symbol 17џџџџŒ/Symbol 16 џџџџџџџџ…Гr); cur_color.setRGB(paint_color); } onClipEvent(enterFrame) { //If appropriate conditions are met then paint a pixel //Do extra checking to ensure that //pixel is always painted within the canvas area if ( down && paint && _root._xmouse > min_x && _root._xmouse < max_x && _root._ymouse > min_y && _root._ymouse < max_y ) { mx = Math.floor(_root._xmouse); my = Math.floor(_root._ymouse); mxs = mx.toString(); mys = my.toString(); //If paint over occurs, remove old pixel if (matrix["x" + mxs + "y" + mys] != null) removeMovieClip(matrix["x" + mxs + "y" + mys]); _root.attachMovie("pixel", "pixel" + i, i); var pixelcolor = new Color("_root.pixel" + i); pixelcolor.setRGB(paint_color); //record pixel's color in the pixel mc itself _root["pixel"+i].acolor = paint_color; _root["pixel"+i]._x = mx; _root["pixel"+i]._y = my; matrix["x" + mxs + "y" + mys] = _root["pixel"+i]; i++;//increment pixel movie clip depth } //If mouse cursor is on top the canvas area do stuff if ( _root._xmouse > min_x && _root._xmouse < max_x && _root._ymouse > min_y && _root._ymouse < max_y ) { paint = true; Mouse.hide(); _root.cursor._x = _root._xmouse; _root.cursor._y = _root._ymouse; startDrag(_root.cursor); } else { paint = false; stopDrag(); _root.cursor._x = -62; _root.cursor._y = -62; Mouse.show() } } onClipEvent(mouseDown) { down = 1; } onClipEvent(mouseUp) { down = 0; } џўџ controllerџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='1'> </component> €(ћџџ№ћџџ(ћџџ№ћџџџџџџџўџ 8џўџџўџcursorџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='2'> </component> €Hєџџ@ќџџHєџџ@ќџџџџџџџўџџўџџx//This clip holds and sends the URI encoded string //of the generated BMP's byte values. //The loadVariables() call is in //the first frame of the clip //in the sendData() function onClipEvent(load) { var bmp_string = new String(); //will hold the URI encoded BMP //A value of end=1 will be set by return //of the loadVariables() call var end = 0; //the url value will be set by the loadVariables() return //and will point to the BMP on the server var url = ""; } onClipEvent(enterFrame) { if (end) { end = 0; _root.status = "BMP successfully sent"; //show the generated BMP, that is now stored on the server, in a new window getURL("javascript:void(window.open('" + _root.basePath + url + "','bmp','width=40,height=30,status=no,menubar=no,scrollbars=yes,screenX=0,left=0,screenY=0,top=0,left=0'));"); } }џўџholderџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='3'> </component> €€џџџ?џџџўџZzџўџџўџ€€ џўџ backgroundџџџџO€џџ€€џџ CPicButton с ѕn‡r с џџџџџўџ Ыcџўџџчon (press) { status = "Creating. Please wait..."; } on (release) { status = "Scanning canvas. Please wait..."; //Scan paint area. Paint area is defined by the dimensions of the 'canvas' clip scanPixelsBottom( _root.controller.matrix, pixeldata, _root.canvas._x, _root.canvas._x + _root.canvas._width, _root.canvas._y, _root.canvas._y + _root.canvas._height ); status = "Creating BMP data. Please Wait..."; create24bitBMP(_root.canvas._width, _root.canvas._height, pixeldata, bmp); status = "Encoding byte-stream. Please Wait..."; _root.holder.bmp_string = fullURIEncode(bmp); status = "Sending byte-stream..."; _root.holder.sendData(); } џўџ€№аPo[№аџџџџџўџЎVџўџ‚onClipEvent(load) { var default_color = 0xFF0000; var mycolor = new Color(this); mycolor.setRGB(default_color); } џўџredџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='4'> </component> €№‚Po[№‚џџџџџўџxXџўџ‚onClipEvent(load) { var default_color = 0x00FF00; var mycolor = new Color(this); mycolor.setRGB(default_color); } џўџgreenџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='5'> </component> €№4Po[№4џџџџџўџ6kџўџ‚onClipEvent(load) { var default_color = 0x0000FF; var mycolor = new Color(this); mycolor.setRGB(default_color); } џўџblueџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='6'> </component> €€€ѕn‡r Аџџџџџўџ §\џўџBon(release) { getURL("javascript:self.location.reload();"); }џўџ €€€ѕn‡r џџџџџўџ >џўџion (release) { attachMovie("help", "help", 32767); _root.help._x = 10; _root.help._y = 10; }џўџџџCPicText€€ ™ $žџўџ ŒTimes New Romanџџџџ(Helpџўџџўџџўџ€€€ ђЊж3џўџ ŒTimes New Romanџџ(Note: ŒTimes New RomanfЬџ( B ŒTimes New Roman333џ(If you get a message asking you whether to stop the script or not, ŒTimes New Roman333џ( just say 'no'џўџџўџџўџ€€џџџ?џџџўџдџўџџўџ€€ џўџbuttonsџџџџ™3Ьџ€€€€€ Ј Ž яžџўџ ŒTimes New Romanџџџџ(Create BMPџўџџўџџўџ€€€  ZJžџўџ ŒTimes New Romanџџџџ(Resetџўџџўџџўџ€€€ Жj "žУџўџstatus ŒTimes New Romanџџ(Readyџўџџўџџўџ1|2|4|3€€€ Тj †žРџўџ TextField3 ŒTimes New Romanџ(Statusџўџџўџџўџ1|2|4|3€€€ i џžРџўџ TextField3 ŒTimes New Romanџ(Hitsџўџџўџџўџ1|2|4|3€N@ N@ џџџџџўџ2_џўџ>onClipEvent(load) { loadVariables("counter.asp", this); }џўџcounterџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='7'> </component> €€џџџ?џџџўџIџўџџўџ€€ џўџlabelsџџџџџOџџ€€€xАxАџџџџџўџ}yџўџџўџcanvasџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='8'> </component> €€€ Zю Ѕџўџ |Times New Roman333џ(Flash Bitmap Creatorџўџџўџџўџ€€џџџ?џџџўџž:џўџџўџ€€ џўџcanvasџџџџџOOџ€€€€џџџ?џџџўџм џўџџU//Assumption: 1 Word = 2 bytes, 1 DWord = 4 bytes //Convention: endian = 1 means Big Endian, endian = 0 means Lil endian var basePath = "http://fotios.cc/cgi-bin/"; var pixeldata = new Array(); //holds raw pixel color values (3 numbers for each color - RGB) var bmp = new Array(); //holds the values representing the bytes of the bitmap ////////////////////////////////////////////////////////////////////////////////////////////// //This function will return a string that represents the values //in the passed array (arr) in fully URI encoded form. //Values are assumed to represent individual byte values (0-255) function fullURIEncode(arr) { var i; var len = arr.length; var uri; var d1, d2; var val; var hexdigit = new Array("A","B","C","D","E","F"); for (i = 0; i < len; i++) { val = arr[i]; d1 = Math.floor(val / 16); d2 = Math.floor(val % 16); if (d1 > 9) d1 = hexdigit[d1 - 10] if (d2 > 9) d2 = hexdigit[d2 - 10] uri += "%" + d1 + d2; } return uri; } ////////////////////////////////////////////////////////////////////////////////////////////// //This function will push a value beetween //0 and 255 in the passed array, as a single byte value function pushByte(arr, val) { arr.push(val); } ////////////////////////////////////////////////////////////////////////////////////////////// //This function will push a value between 0 and 65535 in the passed array //as 2 consecutive byte values (representing a full word value) in endian order function pushWord(arr, val, endian) { var MSB, LSB; LSB = Math.floor(val % 256); MSB = Math.floor(val / 256); //Order bytes in big //or lil endian order if (endian) { arr.push(MSB); arr.push(LSB); } else { arr.push(LSB); arr.push(MSB); } } ////////////////////////////////////////////////////////////////////////////////////////////// //Push 4 bytes (1 DWord) //in endian order function pushDWord(arr, val, endian) { var B = new Array(); //Byte array - LSB is B[0] B[0] = Math.floor(val % 256); B[1] = Math.floor(val / 256); if (B[1] == 256) B[1] = 0; val = Math.floor(val / 65536); B[2] = Math.floor(val % 256); B[3] = Math.floor(val / 256) //Order bytes in Big //or Lil endian order if (endian) { i = 3; while(i > -1) arr.push(B[i--]); } else { i = 0; while(i < 4) arr.push(B[i++]); } } ////////////////////////////////////////////////////////////////////////////////////////////// //Pass width and height of the bmp, as well as the array containing the pixel color values //of the image. Then this functon will encode this data in an appropriate 24bit BMP envelope //and push the byte values representing the resulting BMP file in the passed output array. //The BMP is a simple uncompressed 24bit color Windows BMP (no color table indexing is used) // //Assumption: All bitmap scanlines are of equal size function create24bitBMP(width, height, inarr, outarr) { outarr.length = 0; //reset output array //Determine number of padding bytes for each scanline var padnum = Math.floor( (width * 3) % 4 ); var inarrsize = inarr.length; var datasize = inarrsize + height * padnum; //pixel bytes plus padding bytes //Push the 'BM' identifier byte sequence //since this is a Windows BMP outarr.push(66); //'B' outarr.push(77); //'M' //filesize -> 4 bytes (full header size + pixel data) var filesize = datasize + 54; pushDWord(outarr, filesize, 0); //reserved -> 4 bytes - zero pushDWord(outarr, 0, 0); //bmp data offset -> 4 bytes - file start to start of bmp data (54) pushDWord(outarr, 54, 0); //bmp header size -> 4 bytes - / 28h - Windows 3.1x, 95, NT, & / 0Ch - OS/2 1.x / F0h - OS/2 2.x pushDWord(outarr, 40, 0); //width -> 4 bytes pushDWord(outarr, width, 0); //height -> 4 bytes pushDWord(outarr, height, 0); //planes -> 2 bytes (use just 1 plane) pushWord(outarr, 1, 0); //bits per pixel -> 2 bytes (24 for 24-bit bmp) pushWord(outarr, 24, 0); //compression spec -> 4 bytes (0 for no compression) pushDWord(outarr, 0, 0); //bmp data size -> 4 bytes (size of passed pixel array, pushDWord(outarr, datasize, 0); //HRes -> 4 bytes - pixels per meter (usually 3780) pushDWord(outarr, 3780, 0); //VRes -> 4 bytes - pixels per meter (usually 3780) pushDWord(outarr, 3780, 0); //Number of Colors in color table-> 4 bytes //All zero, since 24bit bmps do not use color table (palette) pushDWord(outarr, 0, 0); //Important Colors -> 4 bytes (all zero, since we use no palette) pushDWord(outarr, 0, 0); //Palette - Pallete colors are expressed by RGBByteQuads //There is nothing here since we use no palette in 24bit BMPs //BMP pixel data. 3 bytes per pixel (RGB Byte Triad) since this is a 24bit BMP). //Pad end of each scanline to next 32 bit boundary if needed (scanlines must be DWORD aligned) //RGB triad bytes should be Lil-Endian aligned. This means that the B byte is stored //in the lower address and the R byte in the higher var i=0, j=0, k; while(i < inarrsize) { outarr.push(inarr[i++]); j++; //if we reach the end of a scanline if (j/3 == width) { if (padnum) for(k=0;k<padnum;k++) outarr.push(0); //pad j = 0; } } } ////////////////////////////////////////////////////////////////////////////////////////////// //This function will scan the canvas area (defined by passed coords) //and push the pixel color values in the passed array (arr). //The color of each pixel, and if there is a painted pixel at all, //is determined by the matrix array which holds references (or not) //to attached pixel movie clips (a pixel is basically a 1x1 mc) function scanPixelsBottom(matrix, arr, min_x, max_x, min_y, max_y) { var i = 0, acolor; arr.length = 0; //reset output array var x, y; //start scanning from bottom //check if matrix[] exists for current x,y for(y = max_y; y > min_y; y--) { for(x = min_x; x < max_x; x++) { //i++; //if there is no stored reference in matrix //for current x,y coords then //push the white color (nothing painted here) if (matrix["x" + x + "y" + y] == null) { arr.push(0xFF); arr.push(0xFF); arr.push(0xFF); } else { acolor = matrix["x" + x + "y" + y].acolor; if (acolor == 0xFF0000) { arr.push(0x00); arr.push(0x00); arr.push(0xFF); } else if (acolor == 0x00FF00) { arr.push(0x00); arr.push(0xFF); arr.push(0x00); } else if (acolor == 0x0000FF) { arr.push(0xFF); arr.push(0x00); arr.push(0x00); } } }//for end }//for end //trace("number of scanned pixels = " + i); } џўџ€€ џўџactionsџџџџџџOџ€€nPixelsBottom(matrix, arr, min_x, max_x, min_y, max_y) џџCPicPageџџ CPicLayerџџ CPicFrameџџ CPicSprite€јџџ@ќџџ€јџџ@ќџџџџџџџўџ}vџўџџ onClipEvent(load) { //make cursor depth high enough so that //it is above all potentially painted pixels _root.cursor.swapDepths(10000); var i = 1; var down = 0; //user is initially not holding the left mouse button down var paint = 0; //the cursor is above the paint area (canvas) var min_x = _root.canvas._x + 1; var max_x = min_x + _root.canvas._width - 1; var min_y = _root.canvas._y + 1; var max_y = min_y + _root.canvas._height - 1; var paint_color = 0xFF0000; //color the painted pixel will have var mx, my, mxs, mys; var matrix = new Array(); //set the initial cursor color var cur_color = new Color(_root.cursor); cur_color.setRGB(paint_color); } onClipEvent(enterFrame) { //If appropriate conditions are met then paint a pixel //Do extra checking to ensure that //pixel is always painted within the canvas area if ( down && paint && _root._xmouse > min_x && _root._xmouse < max_x && _root._ymouse > min_y && _root._ymouse < max_y ) { mx = Math.floor(_root._xmouse); my = Math.floor(_root._ymouse); mxs = mx.toString(); mys = my.toString(); //If paint over occurs, remove old pixel if (matrix["x" + mxs + "y" + mys] != null) removeMovieClip(matrix["x" + mxs + "y" + mys]); _root.attachMovie("pixel", "pixel" + i, i); var pixelcolor = new Color("_root.pixel" + i); pixelcolor.setRGB(paint_color); //record pixel's color in the pixel mc itself _root["pixel"+i].acolor = paint_color; _root["pixel"+i]._x = mx; _root["pixel"+i]._y = my; matrix["x" + mxs + "y" + mys] = _root["pixel"+i]; i++;//increment pixel movie clip depth } //If mouse cursor is on top the canvas area do stuff if ( _root._xmouse > min_x && _root._xmouse < max_x && _root._ymouse > min_y && _root._ymouse < max_y ) { paint = true; Mouse.hide(); _root.cursor._x = _root._xmouse; _root.cursor._y = _root._ymouse; startDrag(_root.cursor); } else { paint = false; stopDrag(); _root.cursor._x = -62; _root.cursor._y = -62; Mouse.show() } } onClipEvent(mouseDown) { down = 1; } onClipEvent(mouseUp) { down = 0; } џўџ controllerџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='1'> </component> €(ћџџ№ћџџ(ћџџ№ћџџџџџџџўџ 8џўџџўџcursorџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='2'> </component> €Hєџџ@ќџџHєџџ@ќџџџџџџџўџџўџџx//This clip holds and sends the URI encoded string //of the generated BMP's byte values. //The loadVariables() call is in //the first frame of the clip //in the sendData() function onClipEvent(load) { var bmp_string = new String(); //will hold the URI encoded BMP //A value of end=1 will be set by return //of the loadVariables() call var end = 0; //the url value will be set by the loadVariables() return //and will point to the BMP on the server var url = ""; } onClipEvent(enterFrame) { if (end) { end = 0; _root.status = "BMP successfully sent"; //show the generated BMP, that is now stored on the server, in a new window getURL("javascript:void(window.open('" + _root.basePath + url + "','bmp','width=40,height=30,status=no,menubar=no,scrollbars=yes,screenX=0,left=0,screenY=0,top=0,left=0'));"); } }џўџholderџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='3'> </component> €€џџџ?џџџўџZzџўџџўџ€€ џўџ backgroundџџџџO€џџ€€џџ CPicButton с ѕn‡r с џџџџџўџ Ыcџўџџчon (press) { status = "Creating. Please wait..."; } on (release) { status = "Scanning canvas. Please wait..."; //Scan paint area. Paint area is defined by the dimensions of the 'canvas' clip scanPixelsBottom( _root.controller.matrix, pixeldata, _root.canvas._x, _root.canvas._x + _root.canvas._width, _root.canvas._y, _root.canvas._y + _root.canvas._height ); status = "Creating BMP data. Please Wait..."; create24bitBMP(_root.canvas._width, _root.canvas._height, pixeldata, bmp); status = "Encoding byte-stream. Please Wait..."; _root.holder.bmp_string = fullURIEncode(bmp); status = "Sending byte-stream..."; _root.holder.sendData(); } џўџ€№аPo[№аџџџџџўџЎVџўџ‚onClipEvent(load) { var default_color = 0xFF0000; var mycolor = new Color(this); mycolor.setRGB(default_color); } џўџredџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='4'> </component> €№‚Po[№‚џџџџџўџxXџўџ‚onClipEvent(load) { var default_color = 0x00FF00; var mycolor = new Color(this); mycolor.setRGB(default_color); } џўџgreenџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='5'> </component> €№4Po[№4џџџџџўџ6kџўџ‚onClipEvent(load) { var default_color = 0x0000FF; var mycolor = new Color(this); mycolor.setRGB(default_color); } џўџblueџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='6'> </component> €€€ѕn‡r Аџџџџџўџ §\џўџBon(release) { getURL("javascript:self.location.reload();"); }џўџ €€€ѕn‡r џџџџџўџ >џўџion (release) { attachMovie("help", "help", 32767); _root.help._x = 10; _root.help._y = 10; }џўџџџCPicText€€ ™ $žџўџ ŒTimes New Romanџџџџ(Helpџўџџўџџўџ€€€ ђЊж3џўџ ŒTimes New Romanџџ(Note: ŒTimes New RomanfЬџ( B ŒTimes New Roman333џ(If you get a message asking you whether to stop the script or not, ŒTimes New Roman333џ( just say 'no'џўџџўџџўџ€€џџџ?џџџўџдџўџџўџ€€ џўџbuttonsџџџџ™3Ьџ€€€€€ Ј Ž яžџўџ ŒTimes New Romanџџџџ(Create BMPџўџџўџџўџ€€€  ZJžџўџ ŒTimes New Romanџџџџ(Resetџўџџўџџўџ€€€ Жj "žУџўџstatus ŒTimes New Romanџџ(Readyџўџџўџџўџ1|2|4|3€€€ Тj †žРџўџ TextField3 ŒTimes New Romanџ(Statusџўџџўџџўџ1|2|4|3€€€ i џžРџўџ TextField3 ŒTimes New Romanџ(Hitsџўџџўџџўџ1|2|4|3€N@ N@ џџџџџўџ2_џўџOonClipEvent(load) { loadVariables(_root.basePath + "counter.asp", this); }џўџcounterџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='7'> </component> €€џџџ?џџџўџIџўџџўџ€€ џўџlabelsџџџџџOџџ€€€xАxАџџџџџўџ}yџўџџўџcanvasџўџ„<component metaDataFetched='true' schemaUrl='' schemaOperation='' sceneRootLabel='Scene 1' oldCopiedComponentPath='8'> </component> €€€ Zю Ѕџўџ |Times New Roman333џ(Flash Bitmap Creatorџўџџўџџўџ€€џџџ?џџџўџž:џўџџўџ€€ џўџcanvasџџџџџOOџ€€€€џџџ?џџџўџм џўџџU//Assumption: 1 Word = 2 bytes, 1 DWord = 4 bytes //Convention: endian = 1 means Big Endian, endian = 0 means Lil endian var basePath = "http://fotios.cc/cgi-bin/"; var pixeldata = new Array(); //holds raw pixel color values (3 numbers for each color - RGB) var bmp = new Array(); //holds the values representing the bytes of the bitmap ////////////////////////////////////////////////////////////////////////////////////////////// //This function will return a string that represents the values //in the passed array (arr) in fully URI encoded form. //Values are assumed to represent individual byte values (0-255) function fullURIEncode(arr) { var i; var len = arr.length; var uri; var d1, d2; var val; var hexdigit = new Array("A","B","C","D","E","F"); for (i = 0; i < len; i++) { val = arr[i]; d1 = Math.floor(val / 16); d2 = Math.floor(val % 16); if (d1 > 9) d1 = hexdigit[d1 - 10] if (d2 > 9) d2 = hexdigit[d2 - 10] uri += "%" + d1 + d2; } return uri; } ////////////////////////////////////////////////////////////////////////////////////////////// //This function will push a value beetween //0 and 255 in the passed array, as a single byte value function pushByte(arr, val) { arr.push(val); } ////////////////////////////////////////////////////////////////////////////////////////////// //This function will push a value between 0 and 65535 in the passed array //as 2 consecutive byte values (representing a full word value) in endian order function pushWord(arr, val, endian) { var MSB, LSB; LSB = Math.floor(val % 256); MSB = Math.floor(val / 256); //Order bytes in big //or lil endian order if (endian) { arr.push(MSB); arr.push(LSB); } else { arr.push(LSB); arr.push(MSB); } } ////////////////////////////////////////////////////////////////////////////////////////////// //Push 4 bytes (1 DWord) //in endian order function pushDWord(arr, val, endian) { var B = new Array(); //Byte array - LSB is B[0] B[0] = Math.floor(val % 256); B[1] = Math.floor(val / 256); if (B[1] == 256) B[1] = 0; val = Math.floor(val / 65536); B[2] = Math.floor(val % 256); B[3] = Math.floor(val / 256) //Order bytes in Big //or Lil endian order if (endian) { i = 3; while(i > -1) arr.push(B[i--]); } else { i8џџ CDocumentPagePage 1џўџScene 1џўџкN<џўџџўџџўџџўџџўџџџџџВУ3Dџўџџўџџўџџўџџўџџўџџўџџџџџџўџџўџџўџџўџџўџџўџџўџџўџџўџџўџ€ Symbol 21џўџ close_buttonџўџfV 4 bytes (full header size + pixel data) var filesize = datasize + 54; pushDWord(outarr, filesize, 0); //reserved -> 4 bytes - zero pushDWord(outarr, 0, 0); //bmp data offset -> 4 bytes - file start to start of bmp data (54) pushDWord(outarr, 54, 0); //bmp header size -> 4 bytes - / 28h - Windows 3.1x, 95, NT, & / 0Ch - OS/2 1.x / F0h - OS/2 2.x pushDWord(outarr, 40, 0); //width -> 4 bytes pushDWord(outarr, width, 0); //height -> 4 bytes pushDWord(outarr, height, 0); //planes -> 2 bytes (use just 1 plane) pushWord(outarr, 1, 0); //bits per pixel -> 2 bytes (24 for 24-bit bmp) pushWord(outarr, 24, 0); //compression spec -> 4 bytes (0 for no compression) pushDWord(outarr, 0, 0); //bmp data size -> 4 bytes (size of passed pixel array, pushDWord(outarr, datasize, 0); //HRes -> 4 bytes - pixels per meter (usually 3780) pushDWord(outarr, 3780, 0); //VRes -> 4 bytes - pixels per meter (usually 3780) pushDWord(outarr, 3780, 0); //Number of Colors in color table-> 4 bytes //All zero, since 24bit bmps do not use color table (palette) pushDWord(outarr, 0, 0); //Important Colors -> 4 bytes (all zero, since we use no palette) pushDWord(outarr, 0, 0); //Palette - Pallete colors are expressed by RGBByteQuads //There is nothing here since we use no palette in 24bit BMPs //BMP pixel data. 3 bytes per pixel (RGB Byte Triad) since this is a 24bit BMP). //Pad end of each scanline to next 32 bit boundary if needed (scanlines must be DWORD aligned) //RGB triad bytes should be Lil-Endian aligned. This means that the B byte is stored //in the lower address and the R byte in the higher var i=0, j=0, k; while(i < inarrsize) { outarr.push(inarr[i++]); j++; //if we reach the end of a scanline if (j/3 == width) { if (padnum) for(k=0;k<padnum;k++) outarr.push(0); //pad j = 0; } } } ////////////////////////////////////////////////////////////////////////////////////////////// //This function will scan the canvas area (defined by passed coords) //and push the pixel color values in the passed array (arr). //The color of each pixel, and if there is a painted pixel at all, //is determined by the matrix array which holds references (or not) //to attached pixel movie clips (a pixel is basically a 1x1 mc) function scanPixelsBottom(matrix, arr, min_x, max_x, min_y, max_y) { var i = 0, acolor; arr.length = 0; //reset output array var x, y; //start scanning from bottom //check if matrix[] exists for current x,y for(y = max_y; y > min_y; y--) { for(x = min_x; x < max_x; x++) { //i++; //if there is no stored reference in matrix //for current x,y coords then //push the white color (nothing painted here) if (matrix["x" + x + "y" + y] == null) { arr.push(0xFF); arr.push(0xFF); arr.push(0xFF); } else { acolor = matrix["x" + x + "y" + y].acolor; if (acolor == 0xFF0000) { arr.push(0x00); arr.push(0x00); arr.push(0xFF); } else if (acolor == 0x00FF00) { arr.push(0x00); arr.push(0xFF); arr.push(0x00); } else if (acolor == 0x0000FF) { arr.push(0xFF); arr.push(0x00); arr.push(0x00); } } }//for end }//for end //trace("number of scanned pixels = " + i); } џўџ€€ џўџactionsџџџџџџOџ€€ arr.push(0xFF); arr.push(08џџ CDocumentPagePage 1џўџScene 1џўџкN<џўџџўџџўџџўџџўџџџџџФ3Dџўџџўџџўџџўџџўџџўџџўџџџџџџўџџўџџўџџўџџўџџўџџўџџўџџўџџўџ€ Symbol 21џўџ close_buttonџўџfV