Ready state of default Frame from Animate

In this part of the code:

// ZIM SHIM for ADOBE ANIMATE - V.2
S = stage = new zim.Stage(canvas);
S.enableMouseOver();
createjs.Touch.enable(S);
S.width = W = stageW = canvas.width;
S.height = H = stageH = canvas.height;
S.setBounds(0,0,W,H);
F = frame = new zim.Frame({ready, shim:{stage:S, canvas:canvas}});

is it possible to inject (like I did) ready function? It's obviously not working and it has implication that I can't read basic info of movieclips created in Animate like width or bounds, because I don't know exact "readiness" of default frame created in Animate.
Or should I follow along this tutorial of yours: https://youtu.be/zI8cZyhGJ_o?si=bwGzQRpd2sIDQywR ?

Ok, digging deeper I suppose that any object that I make in Animate needs to set manually width & height. I can make with setBounds() or in zimify(). That could be solution, am I right? Then I don't need to rely on default frame readyness.

:wink:

It is a little tricky this stuff. The traditional ready function is needed to make sure the html tags are loaded, the canvas is made, etc. But with SHIM, Adobe is handling this so there was no need for a ready. If you want a callback, it is the main timeline script.

zimify(obj, a,b,c,d) where a,b could be width and height or a,b,c,d could be x,y,width,height of bounds is expected to be used on animate objects.

What specifically are you looking for or trying to do?

Ok, I'll try to explain.
I have simple MovieClip (named "rectMC") in Animate on TimeLine, that contains simple rectangle 250x207px.
On timeline, when I write zog("rect",this.rectMC.width); it gives me 250 - great.
But when I want to write my code externally - in Notepad++ and do the same thing - it gives me undefined value.

class Main
{
	constructor(lib)
	{
	function initExternal(lib){
		var _main = exportRoot;
                const mc = _main.rectMC;
                zog(mc.width); //gives undefined

But now I think the correct steps are:

const mc = _main.rectMC;
zimify(mc);
zog(mc.width); //gives 254 : width + stroke

Okay - interesting. You will probably want to zimify anyway? Or perhaps add a ready function in your code and call it from a main timeline script.

Yes, zimify is a must anyway. And yes, Main function is called from Timeline so I have 2 lines of code on Timeline (beside this.stop(); ). It works that way :slight_smile:

1 Like