HTML5 Canvas / Flash. How to access children movie clip and make it gotoAndPlay?

白昼怎懂夜的黑 提交于 2019-12-14 01:43:45

问题


In Flash I have 2 frames in the main-timeline. The first one is to select a language and the second one contains a navigation-bar. this navigation-bar is a movieclip, which contains items (movieclips). Those "item-movieclips" contain 2 frames: one for each language.

Inside the navigation-bar-movieclip I want to control all children movieclips and set them to the correct frame (depending on which language the user has chosen).

I'm using this code (inside the timeline of the navigation-bar-movieclip):

this.item.gotoAndStop("en");

But this does not work, which is stupid!

What is the best solution to get this work? (I'm not afraid to write the code outside flash, but I don't know how!)

Any suggestions?

Sometimes maybe I want to go deeper and use … this.navbar.item.child-item.gotoAndPlay("blob");

(BTW, I'm using those "toolkit for createjs" or "flash cc html5 canvas" technique.)


回答1:


ok, guys. I found the solution:

I found out that you can have access to movieclip children inside events. so I go for "tick".

var self = this;

this.on("tick", function()
{
   self.myChildren_mc.childrensChildren_mc.gotoAndStop(3); // W O R K S !!!
}, null, true); //if true, it's only fired once!

in some cases you have to remove the listener before.



来源:https://stackoverflow.com/questions/20871538/html5-canvas-flash-how-to-access-children-movie-clip-and-make-it-gotoandplay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!