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");