Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all articles
Browse latest Browse all 2143

Clone a method for my custom object.

$
0
0

Hi!

 

We have a method:

 

comp.saveFrameToPng(compTime, fileObj);

 

I have my custom object block.

 

Is it possible to clone "saveFrameToPng" method for my custom object?

 

I've tried:

 

Function.prototype.clone = function() {

    var that = this;

    var temp = function temporary() { return that.apply(this, arguments); };

    for(var key in this) {

        if (this.hasOwnProperty(key)) {

            temp[key] = this[key];

        }

    }

    return temp;

};

 

And then in my custom object:

 

function block (comp)

{

this.saveFrame = comp.saveFrameToPng.clone();

}

 

But thin won't work properly

 

Help me please if this possible.

 

Thank you in advance!


Viewing all articles
Browse latest Browse all 2143

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>