Flash + Painting = Flainting

The Flash plugin is required to view this object.

This is my attempt to create ActionScript 3 generated paintings again. I like to think that these are digital paintings because it’s a bit abstract and you’re using design elements from painting. Well, it’s a little interactive too. You can hover over the instances of Kirby and he’ll pop out. Doing these will give me the chance to pick apart the neat things you can do with AS 3. The class is really simple and if you want, you can mess with it.

  1. package
  2. {
  3.         //import all the goodies to play with
  4.         import flash.display.MovieClip;
  5.         import flash.filters.BitmapFilterQuality;
  6.         import flash.filters.BlurFilter;
  7.         import flash.events.MouseEvent;
  8.        
  9.        
  10.         public class Main extends MovieClip
  11.         {
  12.                 //create blur filter
  13.                 var blur:BlurFilter = new BlurFilter();
  14.        
  15.                 public function Main()
  16.                 {
  17.                         init();
  18.                        
  19.                 }
  20.                
  21.                 public function init()
  22.                 {
  23.                         for(var i:int=0; i < 300; i++)
  24.                         {
  25.                                 //create an instance of a movieclip from the library
  26.                                 var clip:Circle = new Circle();
  27.                                 //generate x and y coordinates
  28.                                 var xpos:uint = 550*Math.cos(i);
  29.                                 var ypos:uint = 400*Math.sin(i);
  30.                                 var randomnumber:Number = Math.random()*25;
  31.                                
  32.                                 //use the random number for blur properties
  33.                                 blur.blurX = randomnumber;
  34.                                 blur.blurY = randomnumber;
  35.                                 blur.quality = BitmapFilterQuality.MEDIUM;
  36.                                
  37.                                 clip.x = Math.random()*xpos;
  38.                                 clip.y = Math.random()*ypos;
  39.                                 //remove clip if it’s beyond the borders
  40.                                 if(clip.x < 0 || clip.y < 0){clip.visible = false;}
  41.                                 clip.alpha = .50;
  42.                                 clip.scaleX = clip.scaleY = Math.random()*.5;
  43.                                 clip.filters = [blur];
  44.                                 //add an event listener to the instance
  45.                                 clip.addEventListener(MouseEvent.MOUSE_OVER, onHover, false,0 ,true);
  46.                                 addChild(clip);
  47.                         }
  48.                 }
  49.                
  50.                 public function onHover(event:MouseEvent)
  51.                 {
  52.                         //on mouse over, set the alpha property to 100%
  53.                         event.target.alpha = 1;
  54.                 }
  55.                
  56. }
This entry was posted in Actionscript 3. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>