Copy link to clipboard
Copied
Hi, Hopefully someone can give me a simple solution to this. Any help appreciated.
I've got 2 functions that I've placed within my <script> portion of the HTML document that Adobe Animate generates with JS. What are the paths that I need to make the stage play and the nested movieclip mc_greenball play?
function goMainTimeline() {
//path.play(); ?
}
function goSymbolTimeline() {
//path.play(); ?
}
Here's the relevant Adobe Generated code:
// symbols:
(lib.mc_greenball = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
// timeline functions:
this.frame_0 = function() {
this.stop();
}
this.frame_1 = function() {
this.stop();
}
// actions tween:
this.timeline.addTween(cjs.Tween.get(this).call(this.frame_0).wait(1).call(this.frame_1).wait(1));
// Layer_1
this.shape = new cjs.Shape();
this.shape.graphics.f("#990000").s().p("AipCiQhGhCAAhgQAAhfBGhDQBGhDBjAAQBkAABGBDQBGBDAABfQAABghGBCQhGBEhkAAQhjAAhGhEg");
this.shape.setTransform(24,23);
this.shape_1 = new cjs.Shape();
this.shape_1.graphics.f("#00F310").s().p("AipCiQhGhCAAhgQAAhfBGhDQBGhDBjAAQBkAABGBDQBGBDAABfQAABghGBCQhGBEhkAAQhjAAhGhEg");
this.shape_1.setTransform(24,23);
this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.shape}]}).to({state:[{t:this.shape_1}]},1).wait(1));
}).prototype = p = new cjs.MovieClip();
p.nominalBounds = new cjs.Rectangle(0,0,48,46);
// stage content:
(lib.test = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
// timeline functions:
this.frame_0 = function() {
this.stop();
}
this.frame_29 = function() {
this.stop();
}
// actions tween:
this.timeline.addTween(cjs.Tween.get(this).call(this.frame_0).wait(29).call(this.frame_29).wait(1));
// Layer_1
this.ball = new lib.mc_greenball();
this.ball.name = "ball";
this.ball.parent = this;
this.ball.setTransform(152,169,1,1,0,0,0,24,23);
this.timeline.addTween(cjs.Tween.get(this.ball).to({x:329},29).wait(1));
}).prototype = p = new cjs.MovieClip();
p.nominalBounds = new cjs.Rectangle(403,346,48,46);
// library properties:
lib.properties = {
id: 'EE82ACCD3BECE44EAA1818B6BD5F6AA4',
width: 550,
height: 400,
fps: 30,
color: "#FFFFFF",
opacity: 1.00,
manifest: [],
preloads: []
};
Here's the Fla if you need it: test.fla - Google Drive
Never post the generated Animate code. It's not helpful and just makes your post huge.
Animate automatically creates a global variable called exportRoot when you publish that points to the root timeline. So any code that you'd write on the root timeline within Animate as this.bla bla bla, in an external function you'd write as exportRoot.bla bla bla.
Copy link to clipboard
Copied
Never post the generated Animate code. It's not helpful and just makes your post huge.
Animate automatically creates a global variable called exportRoot when you publish that points to the root timeline. So any code that you'd write on the root timeline within Animate as this.bla bla bla, in an external function you'd write as exportRoot.bla bla bla.
Copy link to clipboard
Copied
Hi ClayUUID,
My apologies on posting code. ( 1st post here- I won't do that again.)
and
Thank you VERY much for showing me how to control the root timeline. *whew, But is there some other trick to point to the symbol mc that exists on the main timeline?
Copy link to clipboard
Copied
rickh92058085 wrote
Thank you VERY much for showing me how to control the root timeline. *whew, But is there some other trick to point to the symbol mc that exists on the main timeline?
Uhh... there is no trick. You just do it like you would normally from within Animate. You know, this.mc_greenball.play(); But using exportRoot instead of this.
Copy link to clipboard
Copied
Ah, Thanks ClayUUID, You've been most helpful!
Copy link to clipboard
Copied
I personaly do not use exportRoot. I just make the inner movie clips available on frame1 of main timeline and code everything there
var insideClip = this.1stmovieclip.clipinside1stmovieclip;
So now you can access this movies clip from anywhere.
I know it is probably unorthodox but it works for me.
Copy link to clipboard
Copied
and of course:
insideClip .gotoAndPlay("alabelorframenumber");
or
insideClip .play();
Copy link to clipboard
Copied
Well yes, if you don't mind polluting your global namespace with piles of extra variables.
Copy link to clipboard
Copied
Wow!
Copy link to clipboard
Copied
Calm yourself. That's what it's called:
Copy link to clipboard
Copied
Thanks Resdesign, I appreciate your handy solution and help as well!
Copy link to clipboard
Copied
NP. Even if ClayUUID​ dispproves in no uncertain words, it works and in small fla the polution is minimal!