0 Favourites

Javascript Plugin private methods

  • Hi

    I�m exploring the plugins SDK, and have hit a roadblock.

    I managed to get my plugin running. I�ve managed to create new Actions; like this one:

    <font face="Courier New, Courier, mono">

    Acts.prototype.DoSomething = function (text_value, X, Y)

         {

              var i,j;

              for (i=1; i < X; i++)

              {

                   for (j=1; j < Y; j++)

                   {

                       testFunction(i,j);

                   }

              }

         };

    </font>     

    But I can�t figure out how to do functons. In this example, testfucntion (i,j).

    I made it like this:

    <font face="Courier New, Courier, mono">

         this.testFunction = function (x,y)

         {

              //do stuff

         };

    </font>

    But it doesn�t work. How can I white a function,or aprivate method, or some code that the Acts.prototype.DoSomething can use?

    Thanks.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Apparently, I had to declare the function like this:

    instanceProto.testFunction = function (x,y)

         {

              //do stuff

         };

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)