<presentation>
  <info>
    <title>The Flash MX Drawing API</title>
    <author>Marc Majcher</author>
    <email>flash-drawing-API@majcher.com</email>
    <url>http://www.majcher.com/blabla/FlashDrawingAPI/</url>
    <date>November 19, 2003</date>
  </info>
  
  <style>
    <left-margin>65</left-margin>
    <top-margin>120</top-margin>
    <background-color>0xEEEEFF</background-color>
    <text-color>0x000066</text-color>
    <text-font>Arial</text-font>
    <text-leading>2</text-leading>
    <!-- background>sample/background.jpg</background -->
  </style>
  
  <slide>
    <title>The Flash MX Drawing API</title>
    <h1 align="center" class="center">The Flash MX Drawing API</h1>
  </slide>
 
  <slide>
    <title>The Flash MX Drawing API</title>
    <h1 align="center" class="center">The Flash MX Drawing API</h1>
    <h3 align="center" class="center">or</h3>
    <h2 align="center" class="center">Making Programmer Art Hurt Less</h2>
  </slide>
 
   <slide>
     <title>Introduction</title>
     <h1>Hi, I'm Marc, and I'm a Flash Nerd.</h1>
     <img src="nerds.jpg" class="mrt" />
   </slide>

  <slide>
    <title>What Is It?</title>
    <h1>Drawing API?  What?</h1>
    <img src="api.jpg" class="mrt" />
  </slide>

  <slide>
    <title>What Is It?</title>
    <h1>Drawing API?  What?</h1>
    <h2>API = Application Programming Interface</h2>
  </slide>

  <slide>
    <title>What Is It?</title>
    <h1>Drawing API?  What?</h1>
    <h2>It's a set of functions that allows you to draw 
stuff in Flash, using ActionScript instead of 
the drawing tools.</h2>
  </slide>

  <slide>
    <title>Why Use It?</title>
    <h1>Why draw with code?</h1>
  </slide>

  <slide>
    <title>Why Use It?</title>
    <h1>Why draw with code?</h1>
    <h2>It allows you to generate more dynamic graphics.</h2>
  </slide>

  <slide>
    <title>Why Use It?</title>
    <h1>Why draw with code?</h1>
    <h2>It allows you to generate more dynamic graphics.</h2>
    <h2>It lets you drive your interfaces with data.</h2>
  </slide>

  <slide>
    <title>Why Use It?</title>
    <h1>Why draw with code?</h1>
    <h2>It allows you to generate more dynamic graphics.</h2>
    <h2>It lets you drive your interfaces with data.</h2>
    <h2>It's fun!</h2>
  </slide>

  <slide>
    <title>Why Use It?</title>
    <h1>Why draw with code?</h1>
    <h2>It allows you to generate more dynamic graphics.</h2>
    <h2>It lets you drive your interfaces with data.</h2>
    <h2>It's fun!</h2>
    <h2>It obscures the shocking truth.</h2>
    <img src="recut100.gif" class="baby" />
  </slide>
  
  <slide>
    <title>Why Use It?</title>
    <h1>The Old Way</h1>
  </slide>

  <slide>
    <title>Why Use It?</title>
    <h1>The Old Way</h1>
    <h2>Create a line symbol, duplicate, position, resize...</h2>
  </slide>
  
  <slide>
    <title>Why Use It?</title>
    <h1>The Old Way</h1>
    <h2>Create a line symbol, duplicate, position, resize...</h2>
    <h2>That Sucks.</h2>
    <img src="vac2.jpg" class="mrt" />
  </slide>

  <slide>
    <title>Why Use It?</title>
    <h1>The Old Way</h1>
    <h2>Create a line symbol, duplicate, position, resize...</h2>
    <h2>That Sucks.</h2>
    <h2>Slow, clunky, hard to maintain.  But it's all we had.</h2>
  </slide>


  <slide>
    <title>Why Use It?</title>
    <h1>The New Way</h1>
    <h2>Use Flash MX built-in drawing methods.</h2>
    <img src="happy-baby.jpg" class="baby" />
  </slide>

  <slide>
    <title>Why Use It?</title>
    <h1>The New Way</h1>
    <h2>Use Flash MX built-in drawing methods.</h2>
    <h2>Fast, easy, no library clutter.</h2>
  </slide>


  <slide>
    <title>How Does It Work?</title>
    <h1>How Does It Work?</h1>
  </slide>

  <slide>
    <title>How Does It Work?</title>
    <h1>How Does It Work?</h1>
    <h2>Flash uses a "virtual pen" to draw in a MC</h2>
    <img src="pen.jpg" class="mrt" />
  </slide>

   <slide>
     <title>How Does It Work?</title>
     <h1 class="center">Enough Jibba-Jabba!  Let's see some code!</h1>
     <img src="sucka.jpg" class="mrt" />
  </slide>
  
  

  <slide>
    <title>Flash Drawing API</title>
    <h1>Draw using the methods of a MovieClip</h1>
  </slide>


  <slide>
    <title>Flash Drawing API</title>
    <h1>Draw using the methods of a MovieClip</h1>
    <h2>Use _root, or whatever's handy, or create a new one</h2>
  </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Draw using the methods of a MovieClip</h1>
    <pre>
    var canvas = _root.createEmptyMovieClip("example", 999);
    </pre>
  </slide>


  <slide>
    <title>Flash Drawing API</title>
    <h1>Set Line Style</h1>
  </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Set Line Style</h1>
    <h2>line width, color, alpha</h2>
  </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Set Line Style</h1>
    <h2>line width, color, alpha</h2>
    <pre>
    var canvas = _root.createEmptyMovieClip("example", 999);

    canvas.lineStyle( 2, 0xFF9900, 100 );
    </pre>
  </slide>


  <slide>
    <title>Flash Drawing API</title>
    <h1>Move the pen</h1>
 </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Move the pen</h1>
    <pre>
    var canvas = _root.createEmptyMovieClip("example", 999);
    canvas.lineStyle( 2, 0xFF9900, 100 );

    canvas.moveTo( 100, 100 );
    </pre>
 </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Draw a line (Finally!)</h1>
  </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Draw a line (Finally!)</h1>
    <h2>Draws from current position to (x,y)</h2>
  </slide>
  
  <slide>
    <title>Flash Drawing API</title>
    <h1>Draw a line (Finally!)</h1>
    <h2>Draws from current position to (x,y)</h2>
    <pre>
    var canvas = _root.createEmptyMovieClip("example", 999);
    canvas.lineStyle( 2, 0xFF9900, 100 );
    canvas.moveTo( 100, 100 );

    canvas.lineTo( 300, 250 );
    </pre>
  </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Draw a line (Finally!)</h1>
    <h2>Draws from current position to (x,y)</h2>
    <pre>
    var canvas = _root.createEmptyMovieClip("example", 999);
    canvas.lineStyle( 2, 0xFF9900, 100 );
    canvas.moveTo( 100, 100 );
    canvas.lineTo( 300, 250 );
    </pre>
    <object swf="example1.swf" />
  </slide>
  
  <slide>
    <title>Flash Drawing API</title>
    <h1>Drawing Curves</h1>
 </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Drawing Curves</h1>
    <h2>Little bit trickier, but basically the same.</h2>
 </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Drawing Curves</h1>
    <h2>Little bit trickier, but basically the same.</h2>
    <h2>Draws from current position to (x,y), with a control
    point.</h2>
 </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Drawing Curves</h1>
    <h2>Little bit trickier, but basically the same.</h2>
    <h2>Draws from current position to (x,y), with a control
    point.</h2>
    <pre>
    var canvas = _root.createEmptyMovieClip("example", 999);
    canvas.lineStyle( 2, 0xFF9900, 100 );
    canvas.moveTo( 100, 100 );
    canvas.lineTo( 300, 250 );

    canvas.curveTo( 200, 100, 350, 200 );
    </pre>
 </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Drawing Curves</h1>
    <h2>Little bit trickier, but basically the same.</h2>
    <h2>Draws from current position to (x,y), with a control
    point.</h2>
    <pre>
    var canvas = _root.createEmptyMovieClip("example", 999);
    canvas.lineStyle( 2, 0xFF9900, 100 );
    canvas.moveTo( 100, 100 );
    canvas.lineTo( 300, 250 );
    canvas.curveTo( 200, 100, 350, 200 );
    </pre>
    <object swf="example2.swf" />
 </slide>
 

  <slide>
    <title>Flash Drawing API</title>
    <h1>Drawing Curves</h1>
    <h2>Flash uses quadratic bezier curves</h2>
    <img src="quad.jpg" class="mrt" />
  </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Fills and Gradients</h1>
  </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Fills and Gradients</h1>
    <h2>It's pretty darn easy.</h2>
  </slide>
  
  <slide>
    <title>Flash Drawing API</title>
    <h1>Fills and Gradients</h1>
    <h2>Set fill color and alpha</h2>
    <pre>
    var canvas = _root.createEmptyMovieClip("example", 999);

    canvas.beginFill( 0x0022CC, 80 );
    
    canvas.lineStyle( 2, 0xFF9900, 100 );
    canvas.moveTo( 100, 100 );
    canvas.lineTo( 300, 250 );
    canvas.curveTo( 200, 100, 350, 200 );
    canvas.lineTo( 100, 100);
    
    canvas.endFill();
    </pre>
  </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Fills and Gradients</h1>
    <h2>Set fill color and alpha</h2>
    <pre>
    var canvas = _root.createEmptyMovieClip("example", 999);
    canvas.beginFill( 0x0022CC, 80 );
    canvas.lineStyle( 2, 0xFF9900, 100 );
    canvas.moveTo( 100, 100 );
    canvas.lineTo( 300, 250 );
    canvas.curveTo( 200, 100, 350, 200 );
    canvas.lineTo( 100, 100);
    canvas.endFill();
    </pre>
    <object swf="example3.swf" />
  </slide>
  
  <slide>
    <title>Flash Drawing API</title>
    <h1>Fills and Gradients</h1>
    <h2>Gradients are pretty much the same, only with more stuff.</h2>
  </slide>

  <slide>
    <title>Flash Drawing API</title>
    <h1>Fills and Gradients</h1>
    <h2>Gradients are pretty much the same, only with more stuff.</h2>
    <pre>
    canvas.beginGradientFill( fillType, colorArray, alphaArray, ratioArray, matrix );
    </pre>
  </slide>


  <slide>
    <title>Flash Drawing API</title>
    <h1>Fills and Gradients</h1>
    <h2>Gradients are pretty much the same, only with more stuff.</h2>
    <pre>
    var canvas = _root.createEmptyMovieClip("example", 999);

    canvas.beginGradientFill( "linear", [ 0xFF0000, 0x0000FF ], 
                              [ 100, 100 ], [ 0, 0xFF ],  { a:200, b:0, 
                              c:0, d:0, e:200, f:0, g:200, h:200, i:1} );

    canvas.lineStyle( 2, 0xFF9900, 100 );
    canvas.moveTo( 100, 100 );
    canvas.lineTo( 300, 250 );
    canvas.curveTo( 200, 100, 350, 200 );
    canvas.lineTo( 100, 100);
    canvas.endFill();
    </pre>
  </slide>


  <slide>
    <title>Flash Drawing API</title>
    <h1>Fills and Gradients</h1>
    <h2>Gradients are pretty much the same, only with more stuff.</h2>
    <pre>
    canvas.beginGradientFill( "linear", [ 0xFF0000, 0x0000FF ], 
                              [ 100, 100 ], [ 0, 0xFF ],  { a:200, b:0, 
                              c:0, d:0, e:200, f:0, g:200, h:200, i:1} );
    </pre>

    <object swf="example4.swf" />
  </slide>



  <slide>
    <title>Flash Drawing API</title>
    <h1>Cleaning up your mess</h1>
  </slide>
  
  <slide>
    <title>Flash Drawing API</title>
    <h1>Cleaning up your mess</h1>
    <pre>
    canvas.clear();
    </pre>
  </slide>
  
  <slide>
    <title>Flash Drawing API</title>
    <h1>Cleaning up your mess</h1>
    <pre>
    canvas.clear();
    </pre>
    <object swf="example0.swf" />
    <h2>animation, removing boggy redraw, OCD, etc...</h2>
  </slide>
  
  
  <slide>
    <title>The Good Stuff</title>
    <h1>And now, the fun stuff.</h1>
  </slide>

  <slide>
    <title>The Good Stuff</title>
    <h1>And now, the fun stuff.</h1>
    <h2>Unfortunately, I'm out of time.  Bye!</h2>
  </slide>
  
  <slide>
    <title>The Good Stuff</title>
    <h1>Drawing shapes</h1>
    <h2>Rectangles...</h2>
    <object swf="drawRect.swf" />
  </slide>

  <slide>
    <title>The Good Stuff</title>
    <h1>Drawing shapes</h1>
    <h2>Polygons...</h2>
    <object swf="drawPoly.swf" />
  </slide>

  <slide>
    <title>The Good Stuff</title>
    <h1>Drawing shapes</h1>
    <h2>Circles and wedges...</h2>
    <object swf="drawWedge.swf" />
  </slide>

  <slide>
    <title>The Good Stuff</title>
    <h1>Drawing shapes</h1>
    <h2>Circles and wedges...</h2>
    <h2>The thing about circles in Flash is, they're not really circles.</h2>
  </slide>

  <slide>
    <title>The Good Stuff</title>
    <h1>Drawing shapes</h1>
    <h2>Circles and wedges...</h2>
    <h2>The thing about circles in Flash is, they're not really circles.</h2>
    <h2>If you haven't noticed it by now, don't worry about it.</h2>
  </slide>



  <slide>
    <title>The Good Stuff</title>
    <h1>Custom Drawing Methods</h1>
    <h2>You can add your own methods to MovieClip object</h2>
  </slide>  

  <slide>
    <title>The Good Stuff</title>
    <h1>Custom Drawing Methods</h1>
    <h2>You can add your own methods to MovieClip object</h2>
    <pre>
    MovieClip.prototype.drawRect = function(x, y, w, h) {
      this.moveTo(x, y);
      this.lineTo(x + w, y);
      this.lineTo(x + w, y + h);
      this.lineTo(x, y + h);
      this.lineTo(x, y);
    }

    var canvas = _root.createEmptyMovieClip("example", 999);
    canvas.lineStyle( 8, 0x000066, 100 );
    canvas.drawRect( 100, 100, 300, 200 );
    </pre>
  </slide>  


  <slide>
    <title>The Good Stuff</title>
    <h1>Custom Drawing Methods</h1>
    <h2>You can add your own methods to MovieClip object</h2>
    <pre>
    var canvas = _root.createEmptyMovieClip("example", 999);
    canvas.lineStyle( 8, 0x000066, 100 );
    canvas.drawRect( 100, 100, 300, 200 );
    </pre>
    <object swf="example5.swf" />
  </slide>  


  <slide>
    <title>Go Nuts</title>
    <h1>So, time to do cool stuff.</h1>
  </slide>

  <slide>
    <title>Go Nuts</title>
    <h1>So, time to do cool stuff.</h1>
    <object swf="circle_stroke.swf" />
  </slide>

  <slide>
    <title>Go Nuts</title>
    <h1>So, time to do cool stuff.</h1>
    <object swf="harmonograph.swf" />
  </slide>

  <slide>
    <title>Go Nuts</title>
    <h1>So, time to do cool stuff.</h1>
    <object swf="snowflakes.swf" />
  </slide>

  <slide>
    <title>Go Nuts</title>
    <h1>So, time to do cool stuff.</h1>
    <object swf="spiral_illusion.swf" />
  </slide>
  
  <slide>
    <title>The End</title>
    <h1>Game Over</h1>
    <img src="theend.gif" class="baby" />
  </slide>
  
  <slide>
    <title>The End</title>
    <h1>Game Over</h1>
    <h2>Thanks, see you next time!</h2>
    <pre>
      Marc Majcher

      flashfanatic@majcher.com

      http://www.majcher.com/shock/

      http://www.majcher.com/blabla/
      </pre>
  </slide>
  
</presentation>

