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();
You could also place
function.
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
For information on writing code using Script Assist, see
ActionScript" on page
on page 331
and the ActionScript:Use Script Assist Mode tutorial (which begins with
"Open the starter document" on page
210
Functions and Methods
on any frame that is after the frame that contains the
myWidth()
"Writing named functions" on page
328,
"Creating a startDrag/stopDrag event using Script Assist"
213).
207.
"Using Script Assist to write
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?