Skip to main content
Inspiring
January 28, 2017
Answered

how to extend class from animate (canvas)

  • January 28, 2017
  • 1 reply
  • 506 views

I have a FLA file that export to canvas, I add a linkage movieClip that call OpenScreen_mc.

i try to extend the OpenScreen_mc

i try this code:

(function (window) {

  function OpenScreen() {

     // this.Container_constructor();

  }

  var p = createjs.extend(OpenScreen, lib.OpenScreen_mc);

  window.OpenScreen = createjs.promote(OpenScreen, "lib.OpenScreen_mc");

}(window));

and call to the "class" like this:

var  openScreen_mc = new OpenScreen()

stage.addChild(openScreen_mc);

but i don't see the OpenScreen on the stage.

i try to call the this.Container_constructor(); but i get overFlow.

How can i extend it?

    This topic has been closed for replies.
    Correct answer kglad

    i don't know if this is what you want, but it works to do:

    function OpenScreen() {

        var mc =  new lib.OpenScreen_mc();

        mc.newProperty = whatever;

        mc.newMethod = function(){

            do whatever

        }

        return mc;

    }

    var os = new OpenScreen();

    1 reply

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    January 29, 2017

    i don't know if this is what you want, but it works to do:

    function OpenScreen() {

        var mc =  new lib.OpenScreen_mc();

        mc.newProperty = whatever;

        mc.newMethod = function(){

            do whatever

        }

        return mc;

    }

    var os = new OpenScreen();