Передать массив из js в as3
I have 3 symbol movie clips (Ant 11, Ant 20, Ant 30). They have to appear on stage. Instances of 3 symbols are written in an array. If the array is written to AS, then everything works well. If the array is written to JS, then the array in AS is transmitted incorrectly and the movie clip scene (And 11, And 20, And 30) does not appear. How to fix it? The array must always be in the JS file. I hope I explained it clearly, I attach the source code and a video demonstrating the problem
JS Code:
function callMyPanel(panelName, arg)
{
if (fl.swfPanels.length > 0)
{
for (i = 0; i < fl.swfPanels.length; i++)
{
if (fl.swfPanels[i].name == panelName)
{
fl.swfPanels[i].call("callSWF", arg);
break;
}
}
}
else
fl.trace("no panels");
}
images = ['Ant11', 'Ant20', 'Ant30'];
callMyPanel("ABCD", images.join(", "));
AS Code:
stage.scaleMode = StageScaleMode.NO_SCALE
function fromJSFL(arg: String): void {
/*var images:Array = [Ant11, Ant20, Ant30];*/
var images:Array = arg.split(",");
makeGrid();
function makeGrid():void {
var gridContainer:Sprite = new Sprite();
// numObjects is the number of objects in the array
var numObjects:int = images.length;
var numCols:int = 5;
var column:int = 0;
var row:int = 0;
var gap:Number = 2;
var cell:DisplayObject;
for (var i:int = 0; i < numObjects; i++) {
column = i % numCols;
row = int(i / numCols);
// get corresponding object from the array
cell = images[i];
cell.x = (cell.width + gap) * column;
cell.y = (cell.height + gap) * row;
gridContainer.addChild(cell);
trace(i, "\tcolumn =", column, "row =", row);
}
gridContainer.x = gridContainer.y = 20;
addChild(gridContainer);
}
}
ExternalInterface.addCallback('callSWF', fromJSFL);
MMExecute('fl.runScript(fl.configURI + "/WindowSWF/ABCD.jsfl");');
Video demonstrating the problem:
https://drive.google.com/file/d/1rjlKbxSwpJptQlmgF4hz2e4sTP0Uu67s/view?usp=sharing
Source file:
https://drive.google.com/file/d/1ivwrsV2DLnqaNCUSHsxj9FEEcVv6FSuV/view?usp=sharing

