|
||||||
|
||||||
Create a Whiteboard or Blackboard
Free
Flash Tutorial
Step Two: ActionScript - Timeline
You need to place the following ActionScript in the Timeline. I will explain what the ActionScript means later.
Frame 1 selected.
Important Note: Make sure that you can see Actions - Frame at the top of the Actions Panel:
![]()
The Actions Panel has Actions - Frame in the top corner.
Note: To see if Script Assist is on or off go to the Action Panel's Side Menu Button:
![]()
Script Assist is On when ticked:
(remove the tick)
Cross Ref: If you are not sure what Script Assist is or how to switch it on and off see the short Tutorial: Actions Panel
Note: ActionScript is Case Sensitive so make sure that the Capitals / lower case are exactly as above.
Note: If all your typing is accurate and the Actions panel says Actions - Frame then you should not get errors.
Be aware that just because you do not have any syntax (ActionScript grammar) errors does not mean the your ActionScript will do what you expect. But if there are errors you can be sure that your script will not work correctly!
Actions - Frame 1.
You should be able to see a small letter 'a' in the Timeline depicting that you have some code in Frame 1:
The small letter 'a' in the Timeline shows
Note: You should be able to draw when the mouse is held down. If you cannot you have made a typing error. Go back and check it.
Draw in the Test Window.
Explanation of ActionScript - Timeline
Alas the ActionScript is not easy to understand but thankfully it is not essential to understand to be able to use it and edit it:
_root.createEmptyMovieClip("myLine",
0);
This creates a blank Movie Clip.
_root.onMouseDown = function() {
A function which is activated every time you click the mouse. For info
on Functions click here
myLine.moveTo(_xmouse,
_ymouse);
Makes the line start at the current location of the mouse.
myLine.lineStyle(2, 0xff0000,
100);
Creates the line style:
2 is
the line width
0xff0000 is
the hexadecimal colour.
100 is the
Alpha. 0 is completely transparent and 100 is a solid colour.
Note: For a blackboard you would need to change the chalk colour to white: 0xffffff
To change your whiteboard marker colour to black: 0x000000
Cross Ref: To look at a full Hexadecimal colour chart: click here
_root.onMouseMove = function()
{
A function within a function created when the first function is active
and then the mouse moves.
myLine.lineTo(_xmouse,
_ymouse);
When the mouse moves the line follows it's position.
}
Closes the Mouse Move function
}
Closes the Mouse Down function
_root.onMouseUp = function()
{
New function activated on mouse up.
_root.onMouseMove = noLine;
Clears the line.
}
Closes the Mouse Up function.
|
Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates
•
20624 visitors to this page since 20 Sept 0604 |
|
|
All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.
|