Help with layers

  • I'm trying to automate in javascript the setting of one layer visible and the rest invisible. I can't seem to wrap my mind around how to accomplish this. Please tell me what I'm doing wrong. Here is the runtime function:

    Acts.prototype.SetVisible = function (visibles, begin)

         {

              var layernow;

               for (var i; i = begin; i<= begin+100)

               {

              layernow = this.runtime.getLayerByNumber(i);

              layernow.visible = true;

                   this.runtime.redraw = true;

               }     

         };

    And the edittime settings:

    "name":               "Contact Wizard Pro",                    // as appears in 'insert object' dialog, can be changed as long as "id" stays the same

              "id":               "ContactWizarPro",                    // this is used to identify this plugin and is saved to the project; never change it

              "version":          "1.0",                         // (float in x.y format) Plugin version - C2 shows compatibility warnings based on this

              "description":     "<functions built for Contact Wizard Pro>",

              "author":          "<your name/organisation>",

              "help url":          "<your website or a manual entry on Scirra.com>",

              "category":          "General",                    // Prefer to re-use existing categories, but you can set anything here

              "type":               "object",                    // either "world" (appears in layout and is drawn), else "object"

              "rotatable":     false,                         // only used when "type" is "world". Enables an angle property on the object.

              "flags":          pf_singleglobal | pf_appearance_aces | pf_predraw,

    And the action in edit time:

    AddNumberParam("Layer", "Layer to make active" ,0);

    AddNumberParam("Starting Layer", "Start layer search on this layer" ,0);

    AddAction(1, af_none, "Set Visible Layer", "Layers", "Set {0} to visible", "Set the working layer visible!", "SetVisible");

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I understand the for loop isn't formed to set the layer visible. I had it set properly but couldn't get it to work, so now I'm just trying to get any of them to be visible because it's so frustrating.

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