210
Functions and Methods
Similarly, the following code placed on any frame does not work:
myWidth();
var myWidth:Function = function () {
trace(my_mc._width);
};
However, this code works properly:
var myWidth:Function = function () {
trace(my_mc._width);
};
myWidth();
When defining a named function, calling it in a frame script works, even though the
equivalent code with an anonymous function does not work:
// the following does work because you are calling a named function:
myWidth();
function myWidth() {
trace("foo");
}
// the following does not work because you are calling an anonymous
function:
myWidth();
var myWidth:Function = function () {
trace("foo");
};
For more information, see
“Writing named functions” on page 207
.
NO
T
E
You could also place
myWidth()
on any frame that is after the frame that contains the
myWidth
function.
NO
T
E
For information on writing code using Script Assist, see
“Using Script Assist to write
ActionScript” on page 328
,
“Creating a startDrag/stopDrag event using Script Assist”
on page 331
and the ActionScript:Use Script Assist Mode tutorial (which begins with
“Open the starter document” on page 213
).
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...