EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 77

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
About data types 77
The second example creates a movie clip called square_mc that uses the Drawing API to draw
a rectangle. Event handlers and the
startDrag() and stopDrag() methods of the MovieClip
class are added to make the rectangle draggable.
this.createEmptyMovieClip("square_mc", 1);
square_mc.lineStyle(1, 0x000000, 100);
square_mc.beginFill(0xFF0000, 100);
square_mc.moveTo(100, 100);
square_mc.lineTo(200, 100);
square_mc.lineTo(200, 200);
square_mc.lineTo(100, 200);
square_mc.lineTo(100, 100);
square_mc.endFill();
square_mc.onPress = function() {
this.startDrag();
};
square_mc.onRelease = function() {
this.stopDrag();
};
For more information, see Chapter 11, “Working with Movie Clips,” on page 351 and the
MovieClip entry in the ActionScript 2.0 Language Reference.
null data type
The null data type has only one value, null. This value means no value—that is, a lack of
data. You can assign the
null value in a variety of situations to indicate that a property or
variable does not yet have a value assigned to it. For example, you can assign the
null value in
the following situations:
To indicate that a variable exists but has not yet received a value
To indicate that a variable exists but no longer contains a value
As the return value of a function, to indicate that no value was available to be returned by
the function
As a parameter to a function, to indicate that a parameter is being omitted
Several methods and functions return null if no value has been set. The following example
demonstrates how you can use
null to test if form fields currently have form focus:
if (Selection.getFocus() == null) {
trace("no selection");
}

Table of Contents

Related product manuals