flash - How can I get the dynamic created movieclip size in createjs? -
i've created dynamic movieclip in flash canvas animation project(cc2015), couldn't size, return null. i've enabled multiframebounds in publish setting, still gets nothing.
ps: if there's textfield in slide, can bounds of textfield, not whole size.
code below:
var root = this; root.name = "root"; (function(){ var maxmcnum = 4; var wrapper = new createjs.movieclip(); for(var i=1; i<=maxmcnum; i++){ eval("var slide"+ +"=new lib.mc"+ +"()"); eval("wrapper.addchild(slide"+ +")"); eval("slide"+ +".y = "+ (i-1) +"*slide"+ +".nominalbounds.height"); } root.addchild(wrapper); stage.on("click", function(){ //alert(wrapper.framebounds[wrapper.currentframe]); alert(wrapper.getbounds()); }); })();
this issue how flash exports single frame movieclip symbols. attempts optimize output subclassing container
instead of movieclip
. result, not output framebounds
symbol, instances fall on trying calculate bounds @ runtime. lanny mentioned, runtime bounds not include vector graphics, getting "null" unless add other content (like text box).
i've reported issue adobe, can work around putting code on first frame of single frame mcs (ie. slides). example, putting null;
in first frame actions force flash export symbol movieclip, , include framebounds
.
your wrapper
(i'm not totally sure why using mc instead of container here), use run time bounds, should work fine, query child elements , return aggregate transformed bounds return.
Comments
Post a Comment