LogoLogo
  • Home
  • Projects
  • About
  • Contact

A Simple Drawing Application and a Quick Glance at Safari

Devon O. · April 27, 2008 · Actionscript, Flash · 1 comments
2

Taking a well-deserved break from the Navy and coming home to Ireland, I had a little time to put together a small example of what may be accomplished with the UI tools from my last post. Here’s a simple little drawing application that allows the user to adjust the size, color and shape of the drawing tool. It’s easily enough created by instantiating a new DrawingTablet instance and passing the width, height, and color of the canvas as arguments. A fourth Boolean argument determines whether or not a “save” button is shown. Note that in this example, the save button doesn’t really do anything. In actual use, a BitmapData instance of the drawing would be passed to a DrawingEvent.SAVE event which could then be passed on to an image encoder (such as the ones included in Adobe’s as3corelib package which may be downloaded from Google Code, here).

So, for a quick example, the following document class may be used to create the .swf file below:

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package {    
 
    import com.onebyonedesign.drawing.DrawingTablet;
    import com.onebyonedesign.drawing.events.DrawingEvent;
    import flash.display.Sprite;    
 
    /**
    * Document class to illustrate com.onebyonedesign.drawing package
    * @author Devon O.
    */
    public class Test extends Sprite {    
 
        private var tablet:DrawingTablet;    
 
        public function Test():void {
            init();
        }    
 
        private function init():void {
            createTablet();
        }    
 
        private function createTablet():void {
            tablet = new DrawingTablet(300, 300, 0xFFFFCC);
            tablet.addEventListener(DrawingEvent.SAVE, onSave);
            tablet.x = 20;
            tablet.y = 20;
            addChild(tablet);
        }    
 
        private function onSave(de:DrawingEvent):void {
            //    de.image is a BitmapData instance which may then be passed to image encoder.
        }
    }
}

The .as files may be downloaded here for any interested parties.

In other news, I was surfing the other day when suddenly my Apple Updater popped up in front of me. An annoying little event that normally means it's time to update Quicktime or Itunes. This time, however, I was told I needed to update my Safari browser. Being a PC/Windows user, I figured this was a glitch. Turns out it wasn't though. Safari is now available for Windows. I tried it out. Doesn't seem to be a bad browser really, but it doesn't allow for mousewheel interaction. I realize there's no such thing in the Mac world, but as long as you're developing for a new environment, why not make use of all available API's. Personally, I'll stick to IE (yes, I use IE) for most cases, but it's nice to throw another browser into the testing stage mix when developing web based material.

EDIT: Okay, so it is only the Flash player running in the Safari browser that doesn't receive the mousewheel events. The mousewheel will trigger events within "regular" html pages.

  Facebook   Pinterest   Twitter   Google+
  • Adobe Gone Wild
    February 25, 2008 · 0 comments
    1675
    3
    Read more
  • Rockin and Rollin with the JiglibFlash Terrain
    March 16, 2010 · 8 comments
    2496
    6
    Read more
  • Mini Memory
    January 11, 2008 · 1 comments
    1748
    4
    Read more
1 Comments:

Sorry, the comment form is closed at this time.

Devon O. Wolfgang

AIR | Unity3D | AR/VR

Unity Certified Developer

Technical Reviewer of “The Essential Guide to Flash CS4 AIR Development” and “Starling Game Development Essentials”

Reviewer of “The Starling Handbook”

Unity Engineer at Touch Press.

Categories
  • Actionscript (95)
  • AIR (16)
  • Flash (99)
  • Games (7)
  • Liberty (13)
  • Life (53)
  • Shaders (20)
  • Unity3D (21)
Recent Comments
  • MainDepth on Unity Ripple or Shock Wave Effect
  • Devon O. on Unity Ripple or Shock Wave Effect
  • Feral_Pug on Unity Ripple or Shock Wave Effect
  • bavvireal on Unity3D Endless Runner Part I – Curved Worlds
  • Danielius Vargonas on Custom Post Processing with the LWRP
Archives
  • December 2020 (1)
  • December 2019 (1)
  • September 2019 (1)
  • February 2019 (2)
  • December 2018 (1)
  • July 2018 (1)
  • June 2018 (1)
  • May 2018 (2)
  • January 2018 (1)
  • December 2017 (2)
  • October 2017 (1)
  • September 2017 (2)
  • January 2017 (1)
  • July 2016 (1)
  • December 2015 (2)
  • March 2015 (1)
  • September 2014 (1)
  • January 2014 (1)
  • August 2013 (1)
  • July 2013 (1)
  • May 2013 (1)
  • March 2013 (2)
  • December 2012 (1)
  • November 2012 (1)
  • September 2012 (3)
  • June 2012 (2)
  • May 2012 (1)
  • April 2012 (1)
  • December 2011 (2)
  • October 2011 (3)
  • September 2011 (1)
  • August 2011 (1)
  • July 2011 (1)
  • May 2011 (2)
  • April 2011 (2)
  • March 2011 (1)
  • February 2011 (1)
  • January 2011 (2)
  • December 2010 (3)
  • October 2010 (5)
  • September 2010 (1)
  • July 2010 (2)
  • May 2010 (5)
  • April 2010 (2)
  • March 2010 (7)
  • February 2010 (5)
  • January 2010 (5)
  • December 2009 (3)
  • November 2009 (1)
  • October 2009 (5)
  • September 2009 (5)
  • August 2009 (1)
  • July 2009 (1)
  • June 2009 (2)
  • May 2009 (6)
  • April 2009 (4)
  • March 2009 (2)
  • February 2009 (4)
  • January 2009 (1)
  • December 2008 (5)
  • November 2008 (2)
  • September 2008 (1)
  • August 2008 (6)
  • July 2008 (6)
  • June 2008 (9)
  • May 2008 (4)
  • April 2008 (3)
  • March 2008 (4)
  • February 2008 (9)
  • January 2008 (7)
  • December 2007 (6)
Copyright © 2021 Devon O. Wolfgang