4.
In the Actions panel, enter the following code:
this.createEmptyMovieClip("canvas_mc", 999);
var isDrawing:Boolean = false;
//
clear_btn.onRelease = function() {
canvas_mc.clear();
};
//
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
canvas_mc.lineStyle(5, 0xFF0000, 100);
canvas_mc.moveTo(_xmouse, _ymouse);
isDrawing = true;
};
mouseListener.onMouseMove = function() {
if (isDrawing) {
canvas_mc.lineTo(_xmouse, _ymouse);
updateAfterEvent();
}
};
mouseListener.onMouseUp = function() {
isDrawing = false;
};
Mouse.addListener(mouseListener);
5.
Select Control > Test Movie to test the document.
6.
Drag your pointer to draw a line on the Stage.
7.
Click the button to erase what you've drawn.
Creating runtime data bindings using
ActionScript
If you use components to create applications, it's often necessary to add bindings between
those components so that you can interact with data or have components interact with each
other. Interaction between components is necessary for creating usable forms or interfaces that
your users can interact with. You can use the Bindings tab in the Component inspector to add
bindings between components on the Stage. You can use the Bindings tab in the Component
inspector to bind data between components on the Stage.
For more information on using the Bindings tab, see
tab (Flash Professional only)" on page 403
information in the following online articles:
Data Binding in Macromedia Flash MX Professional 2004,
Application with Macromedia Flash MX
"Working with bindings in the Bindings
in Using Flash. You can also find additional
Building a Tip of the day Application (Part
and
Professional.
Creating runtime data bindings using ActionScript
Building a Google Search
2),
579
Need help?
Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?