petefs
12-13-2004, 06:18 AM
I'm working on a wizard for a component and I'm having problems clearing a parameter of type array. I've just started learning JSFL tonight, so it could certainly be a misunderstanding of the DOM : )
Here's the code that doesn't work:
fl.outputPanel.clear();
var timeline = fl.getDocumentDOM().getTimeline();
var currentLayer = timeline.currentLayer;
var currentFrame = timeline.currentFrame;
// get the instance of the RoboRect class
function getClassItem(className)
{
var elements_array = timeline.layers[currentLayer].frames[currentFrame].elements;
var i = elements_array.length;
while(i--)
{
var item = elements_array[i];
if(item.libraryItem.linkageClassName == className) {
var classItem = item;
}
}
return classItem;
}
var RoboRect = getClassItem("Jstest");
var drawArray = RoboRect.parameters[0];
drawArray.insertItem(0, "fills", [5,10,20], "Array");
drawArray.removeItem(0);
It adds just fine -- but the remove doesn't work. If I start blank and run the script, it inserts the array. It should be removed immediately thereafter. Any hints? ^_^
Here's the code that doesn't work:
fl.outputPanel.clear();
var timeline = fl.getDocumentDOM().getTimeline();
var currentLayer = timeline.currentLayer;
var currentFrame = timeline.currentFrame;
// get the instance of the RoboRect class
function getClassItem(className)
{
var elements_array = timeline.layers[currentLayer].frames[currentFrame].elements;
var i = elements_array.length;
while(i--)
{
var item = elements_array[i];
if(item.libraryItem.linkageClassName == className) {
var classItem = item;
}
}
return classItem;
}
var RoboRect = getClassItem("Jstest");
var drawArray = RoboRect.parameters[0];
drawArray.insertItem(0, "fills", [5,10,20], "Array");
drawArray.removeItem(0);
It adds just fine -- but the remove doesn't work. If I start blank and run the script, it inserts the array. It should be removed immediately thereafter. Any hints? ^_^