This tutorial was written for the Flash Designer software, which allows you to create flash animations in a much easier way than by using Macromedia Flash. You may get Flash Designer here.
The following tutorial illustrates how to handle onMouseMove, onMouseDown, onMounseUp events.
NOTE: Minimum Flash Designer version 5.0.17
1.
Launch Flash Designer and choose "Blank document" from the startup screen.
2.
Choose "Edit Field tool" and draw a rectangle to create edit text object. Edit field should appear as "Edit1".
3.
Choose "Text Tool", click on the frame, type the text "CLICK!"
and click OK to create text object. Choose "Edit" > "Convert to
Sprite", the text should appear as "Sprite3".
4.
Choose "Item" > "Placement Properties" and check
"ActionScript Target" (for Sprite3 object), click OK. (This step is
necessary to access Sprite3 in ActionScript code, for example
Sprite3._visible = false)
5.
Choose "Frame" > "Frame Delay", check "Stop" and click OK.
6.
Choose "Frame" > "ActionScript", type the following code and click OK:
onMouseMove =
function()
{
// fill Edit1 with current x and y position
Edit1 = "x: " + _xmouse + " y: " + _ymouse;
};
onMouseDown =
function()
{
Sprite3._visible = true;
// show "click!" text
};
onMouseUp =
function()
{
Sprite3._visible = false;
// hide "click!" text
};
Sprite3._visible= false;
// init Sprite3 invisible
Press F9 to preview in Flash player.
Hit "Esc" to quit preview.
To export Flash file choose "File" > "Export SWF File". Type
the file name and click OK. To insert Flash in your web page choose
"File" > "View HTML Code". Select entire HTML code, right click
mouse button and choose "Copy" from the popup menu. Click Close. Paste
the code to your HTML page.