/** * 25-Line ActionScript Contest Entry * * Project: Firebending * Author: Eduard Ruzga * Email: wonderwhy.er@gmail.com * Date: 10.01.2009 * Share code if not finalist: Yes * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ // 3 free lines! Alter the parameters of the following lines or remove them. // Do not substitute other code for the three lines in this section [SWF(width=600, height=675, backgroundColor=0x333333, frameRate=30)] stage.align = ""; stage.scaleMode = StageScaleMode.NO_SCALE; // 25 lines begins here! var vars:Object={pallete:addChild(new Bitmap(new BitmapData(75,75))),bmp2:new Bitmap(new BitmapData(300,300,false,0))}; function setProps(props:Array) {for each (var trio:Array in props) {trio[0][trio[1]]=trio[2];}} setProps([[vars,"map",new BitmapData(300,300,false,0x888888)],[vars,"dm",new DisplacementMapFilter(new BitmapData(300,300,false,0),new Point(),BitmapDataChannel.BLUE,BitmapDataChannel.GREEN,50,50)],[vars,"color",0xFF4400],[vars,"p",new Sprite()],[vars,"shifts",[new Point(),new Point()]],[vars,"shifts2",[new Point(1,1),new Point(1,-1)]],[vars,"mDown",false],[vars.pallete,"y",600],[vars.bmp2,"scaleX",2],[vars.bmp2,"scaleY",2],[stage,"doubleClickEnabled",true],[vars,"lastX",mouseX],[vars,"lastY",mouseY]]); graphics.drawGraphicsData(Vector.([new GraphicsGradientFill("linear", [0xFF0000,0xFFFF00,0x00FF00,0x00FFFF,0x0000FF,0xFF00FF], [1,1,1,1,1,1], [12,58,104,150,196,242],new Matrix(0.0457763671875, 0, 0, 0.0457763671875, 37.5, 37.5)),new GraphicsPath(Vector.([1,2,2,2]),Vector.([0,0,75,0,75,75,0,75])),new GraphicsGradientFill("linear", [0xFFFFFF,0xFFFFFF,0x0,0x0], [1,0,0,1], [20,127,128,235], new Matrix(2.8029015056359343e-18, 0.0457763671875, -0.0457763671875, 2.8029015056359343e-18, 37.5,37.5)),new GraphicsPath(Vector.([1,2,2,2]),Vector.([0,0,75,0,75,75,0,75]))])); vars.pallete.bitmapData.draw(this); addChild(vars.bmp2); for (var xx:int=0; xx([new GraphicsStroke(3, false,"normal","none","round",3.0, new GraphicsSolidFill(vars.color)),new GraphicsPath(Vector.([1,2]),Vector.([vars.lastX/2,vars.lastY/2,mouseX/2,mouseY/2]))]));} setProps([[vars.dm,"scaleX",(vars.bmp2.mouseX-150)/5],[vars.dm,"scaleY",(vars.bmp2.mouseY-150)/5],[vars,"lastX",mouseX],[vars,"lastY",mouseY],]); vars.bmp2.bitmapData.draw(vars.p); vars.bmp2.bitmapData.applyFilter(vars.bmp2.bitmapData,vars.bmp2.bitmapData.rect,vars.bmp2.bitmapData.rect.topLeft,vars.dm);} addEventListener(Event.ENTER_FRAME,frame); stage.addEventListener(MouseEvent.DOUBLE_CLICK,function(e){vars.p.graphics.clear()}); stage.addEventListener(MouseEvent.MOUSE_DOWN,function(e){buttonMode=true}); stage.addEventListener(MouseEvent.MOUSE_UP,function(e){buttonMode=false}); stage.addEventListener(MouseEvent.CLICK,function(e:MouseEvent){if(new Rectangle(0,0,75,75).containsPoint(new Point(vars.pallete.mouseX,vars.pallete.mouseY))){vars.color=vars.pallete.bitmapData.getPixel(vars.pallete.mouseX,vars.pallete.mouseY)}}); setProps([[vars,"hint",addChild(new TextField())],[getChildAt(2),"y",605],[getChildAt(2),"x",85],[getChildAt(2),"width",600],[getChildAt(2),"htmlText"," Firebending\n Instructions: Hold mouse button to make fire sources. Double click to clear.\n Mouse position effects fire directions. To change color click on one you like in bottom left corner.\n Links: Example Video"],[getChildAt(2),"textColor",0xFFFFFF],[getChildAt(2),"selectable",false]]); // 25 lines ends here! 21 actually :)