1. Show working .swf
2. Go through all assets needed
- Drawing area
- Controls
- Actions
3. Assign code to assets - explain
// If mouse button is pressed, set line style, start drawing.
_root.onMouseDown = function () {
_root.actions.pendown = true;
with(_root.drawingPlane){
lineStyle( _root.actions.thickness, _root.actions.HEXcolor, _root.actions.cA);
moveTo(_root.actions.lastX, _root.actions.lastY);
}
}
// If mouse button is released, stop drawing.
_root.onMouseUp = function () {
_root.actions.pendown = false;
}
stop();
onClipEvent(load){
// Load default variables
pendown = false;
setting = false;
thickness = 2;
cR = 0;
cG = 0;
cB = 0;
cA = 100;
var HEXcolor;
myColor = new Color(_root.cBlock);
}
onClipEvent(enterFrame){
lastX = x;
lastY = y;
X = _root._xmouse;
Y = _root._ymouse;
HEXcolor = (cR << 16 | cG << 8 | cB);
if(pendown && !setting){
_root.drawingPlane.lineTo(X,Y);
}
myColor.setRGB(HEXcolor);
_root.cBlock._alpha = cA;
}
on(release){
_root.drawingPlane.clear();
}
onClipEvent(enterFrame){
_root.actions.thickness = Math.floor(((_x - 96)*20.999)/80);
}
onClipEvent(enterFrame){
_root.actions.cA = Math.floor(((_x - 96)*100.999)/80);
}
onClipEvent(enterFrame){
_root.actions.cR = Math.floor(((_x - 236)*255.999)/80);
}
4. Explain cursor change
- On drawing area sized button
on (rollOver) {
Mouse.hide(); startDrag("cursor", true);
}
on (rollOut) {
Mouse.show(); startDrag("blank", true);
}
5. Wrap up