Is it possible to dynamically determine what methods an MC is using?

I want to be able to ask a MC what methods it is currently using. Is there some sort of Flash method that returns a list existing methods of an MC?

Here's the deal I want to be able to check the methods of an MC that has various button methods added to it in AS.

I want to be able to save those methods as vars or objects, delete them for a time, then add them back. Sort of like this:

//get the _parent button method onRelease and enabled state then delete the onRelease method:

this[this._name+"_startAudio"].parentFunc = this._parent.onRelease;
this[this._name+"_startAudio"].parentEnabled = this._parent.enabled;
this[this._name+"_startAudio"].parent = this._parent;
delete this._parent.onRelease;

//when the child button is released, add the method back to the parent and set the enabled state to the previous state
this[this._name+"_startAudio"].onRelease = function(){
      this.enabled = false;
      //this._visible = false;
      this.parent.onRelease = this.parentFunc;
      this.parent.enabled = this.parentEnabled;
This is working in my code, but I want to be able to cycle through all the "button" methods in an MC and save and delete then add them back later. I realize I could just create an array of all the possible "button" methods and then cycle through that way, but is there another way?

Thanks in advance!
Who is Participating?
for (var i in mc) {
    if (typeof(mc[i]) == "function") {
        //save method to variable.

out of interest, what is your reason for wanting to delete methods? would a simple mc.enabled = false not do?
MontoyaProcess Improvement MgrCommented:
Well, you could do that by using addproperty or prototyping the mc.

The basic logic is that you will create the properties for the movie clip. Then, you will assign values to those properties when you cal the method/function/whatever...

Finally, you can trace the property of the mc to see its value.

Make sense?

acekzAuthor Commented:
I don't want to add properties to the MC, I just want to retrieve any methods that have been added to it...I may not have control over putting properties into it. I need to be able to detect if these methods exist without having created the clip myself so I wouldn't really know what methods to look for...I think i'll just create an array of "button" methods...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.