you are on theright track - a function is a method of a particular object if it is defined within the scope of that object - for movieclips think of defining the function on the movieclip's timeline...so if you were to double-click on a clip to go into it's timeline, open the actions panel and type:
ActionScript Code:
function sayHi() {
trace("hi!");
}
then you could call myClip.sayHi();
the other way to do it (which works fine in f5) is to define it from the main timeline, by going:
ActionScript Code:
myClip.sayHi = function () {
trace("hi!");
}
which has the same effect....or you could add this method to every movieclip in the movie by adding to the movieclip prototype:
ActionScript Code:
movieclip.prototype.sayMyName = function () {
trace(this._name);
}
the bit that mx adds on to this is that you can define event handlers (onpress etc) like any other function, from any scope, and remove them too. there is a really good intro to oop in flash which covers timelines and scope at
robin debreiul's site