
Код AS1/AS2:
import flash.external.ExternalInterface;
function resizeInHTML(width, height) {
_global.__jsId = Math.random();
if (!_root.__getJsId) {
_root.__getJsId = function() {
return _global.__jsId;
};
ExternalInterface.addCallback("__getJsId",_root, _root.__getJsId);
}
var callFunction = "function(needId,width,height){";
callFunction += "var elements = document.getElementsByTagName('object');";
callFunction += "for(var k = 0 ; k < elements.length; k ++){";
callFunction += "var element = elements[k];";
callFunction += "if(element.__getJsId != undefined){";
callFunction += "if(needId == element.__getJsId()){";
callFunction += "element.style.width = width;";
callFunction += "element.style.height = height;";
callFunction += "return;";
callFunction += "};";
callFunction += "}";
callFunction += "}";
callFunction += "}";
ExternalInterface.call(callFunction,_global.__jsId,width,height);
}
// Test:
this.onMouseDown = function() {
resizeInHTML(100 + Math.floor(Math.random() * 100) + "px",100 + Math.floor(Math.random() * 100) + "px");
};
Не ручаюсь, что будет хорошо работать во всех браузерах.
P.S. Тестировать
не локально.