How to use JS to get the movieclip in the Web?

Hello

Look at this code example:

JS of the canvas:

(function (lib, img, cjs, ss) {
var p; // shortcut to reference prototypes
// library properties:
lib.properties = {
width: 550,
height: 400,
fps: 24,
color: "#FFFFFF",
opacity: 1.00,
manifest: []
};
lib.ssMetadata = [];
// symbols:
(lib.mc = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
// ss 1
this.shape = new cjs.Shape();
this.shape.graphics.f().s("#FFFFFF").ss(1,1,1).p("ApwmjIThAAIAANHIzhAAg");
this.shape.setTransform(62.5,42);
this.shape_1 = new cjs.Shape();
this.shape_1.graphics.f("#FF0000").s().p("ApwGjIAAtGIThAAIAANGg");
this.shape_1.setTransform(62.5,42);
this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.shape_1},{t:this.shape}]}).wait(1));
}).prototype = p = new cjs.MovieClip();
p.nominalBounds = new cjs.Rectangle(-1,-1,127,86);

// stage content:
(lib.mymc = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
// mc
this.mc = new lib.mc();
this.mc.setTransform(215.5,167.1,1,1,0,0,0,62.5,42);
this.timeline.addTween(cjs.Tween.get(this.mc).wait(1));
}).prototype = p = new cjs.MovieClip();
p.nominalBounds = new cjs.Rectangle(427.5,324.6,126,85);
})(lib = lib||{}, images = images||{}, createjs = createjs||{}, ss = ss||{});
var lib, images, createjs, ss;

HTML:

<body>
<canvas id='canvas'></canvas>
</body>
<script>
alert('lib.properties.fps')
</script>

My question:

the canvas has a movieclip named "mc".

How can I alert the 'mc' as alert the 'lib.properties.fps '?

alert('lib.mymc')//success
alert('lib.mc')//success,but it is library ,Not in the scene
alert('lib.mymc.mc')//undefined,how do it?

Thank you very much!!

Hi, ClayUUID

Thank you help!

the JS of the Web is published, we can change it. I want to play the film of the canvas from the html file, so I get the film name or ID Witch of the Web.

NOW I can solve this issue to share with everyone.we:

Set a global variable to store the name of the instance you want, you can easily find it.

Tags: Adobe Animate

Similar Questions

Maybe you are looking for