• Home
  • Free Tutorials
  • Free Video Tutorials

Adobe Photoshop
Autodesk 3ds Max
CSS
Flash
Help Center Live
iPhone
Joomla
Make Money Online!
Mambo
mIRC
Outlook Express
SEO / SEM
Simple Machine Forum
Target Explorer

Drawing API

Category : Flash Views : 17021
Version : 8 Rating : 
2.6/5 (47 votes)
  • Currently 2.62/5
  • 1
  • 2
  • 3
  • 4
  • 5
Type : Text Source File: drawing-api.zip
Result: See the result


Previous | 1 | 2 | Next

The drawing API is used to draw using only lines of code.

In the drawing API we have the following functions:
lineStyle(thickness,rgb, alpha)
The first thing you need to do before drawing is choosing your pencil.
You can choose the thickness, rgb(color) and alpha(transparency).

moveTo(x, y)
In the real life you have to move the pencil to the place where you are going to draw, this function is for that, we move the "pencil" to a desired x and y position.

lineTo(x, y)
After choosing a starting place we tell the "pencil" to draw a line to an x and y position.

curveTo(controlX, controlY, anchorX, anchorY)
This function is to draw a curve, anchorX and anchorY are the position of the end of the curve. And controlX and controlY tell to which direction the curve is going to be draw.

beginFill(rgb, alpha) || endFill()
When we are drawing an object that we want to fill with a color we call the function beginFill() before moving the "pencil" and after the last lineTo() we call endFill().
You are going to understand this when we go on examples.

clear()
This function is our virtual eraser, if we want to erase what we did and call clear().

Let’s draw a square:
_root.createEmptyMovieClip("dBoard",1);
First we create a Movie Clip to draw on, we will call it "dBoard" and it will have 1 as its depth.

dBoard.lineStyle(1,0,100);
Define which "pencil" we are using. In this case the thickness is 1, the color is 0(black) and it has no transparency (100).

dBoard.moveTo(30, 30)
Here we move the "pencil" to the place we want as the start.

dBoard.lineTo(60,30);
Free Flash Tutorials, Actionscript, Drawing API

dBoard.lineTo(60,60);
Free Flash Tutorials, Actionscript, Drawing API

dBoard.lineTo(30,60);
Free Flash Tutorials, Actionscript, Drawing API

dBoard.lineTo(30,30);
Free Flash Tutorials, Actionscript, Drawing API


del.icio.us digg it Reddit Stumble Upon Technorati

Previous | 1 | 2 | Next
How to Video Tutorials on software by Helpvids.com

Video tutorial: Forex trading



Sponsors



Advertisement









Studio | Advertisement | About Webzo | Contact Webzo | Terms of Use | Free Video Tutorials by Helpivds

Copyright © 2007 NR Concepts Ltd. All rights reserved.