<bdo id='GBNrb'></bdo><ul id='GBNrb'></ul>

      1. <legend id='GBNrb'><style id='GBNrb'><dir id='GBNrb'><q id='GBNrb'></q></dir></style></legend>

        <tfoot id='GBNrb'></tfoot>

        <small id='GBNrb'></small><noframes id='GBNrb'>

        <i id='GBNrb'><tr id='GBNrb'><dt id='GBNrb'><q id='GBNrb'><span id='GBNrb'><b id='GBNrb'><form id='GBNrb'><ins id='GBNrb'></ins><ul id='GBNrb'></ul><sub id='GBNrb'></sub></form><legend id='GBNrb'></legend><bdo id='GBNrb'><pre id='GBNrb'><center id='GBNrb'></center></pre></bdo></b><th id='GBNrb'></th></span></q></dt></tr></i><div id='GBNrb'><tfoot id='GBNrb'></tfoot><dl id='GBNrb'><fieldset id='GBNrb'></fieldset></dl></div>

        如何使用 createjs 定位 MovieClip

        how to target a MovieClip with createjs(如何使用 createjs 定位 MovieClip)

          <tfoot id='IpC0F'></tfoot>

        1. <legend id='IpC0F'><style id='IpC0F'><dir id='IpC0F'><q id='IpC0F'></q></dir></style></legend>

                <bdo id='IpC0F'></bdo><ul id='IpC0F'></ul>

                <small id='IpC0F'></small><noframes id='IpC0F'>

                • <i id='IpC0F'><tr id='IpC0F'><dt id='IpC0F'><q id='IpC0F'><span id='IpC0F'><b id='IpC0F'><form id='IpC0F'><ins id='IpC0F'></ins><ul id='IpC0F'></ul><sub id='IpC0F'></sub></form><legend id='IpC0F'></legend><bdo id='IpC0F'><pre id='IpC0F'><center id='IpC0F'></center></pre></bdo></b><th id='IpC0F'></th></span></q></dt></tr></i><div id='IpC0F'><tfoot id='IpC0F'></tfoot><dl id='IpC0F'><fieldset id='IpC0F'></fieldset></dl></div>
                    <tbody id='IpC0F'></tbody>
                  本文介绍了如何使用 createjs 定位 MovieClip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试导出在 Flash 中可以正常工作但在 html5 画布中导出时无法正常工作的合影动画.

                  Im trying to export an group photo animation that works fine in flash but not when exported in html5 canvas.

                  诀窍很简单":每张照片都是一个按钮,当您将鼠标悬停在某人的照片上时,他的职称就会出现.

                  The trick is "simple" : each photo is a button and when you roll your mouse over the picture of someone, his jobtitle appears.

                  我无法使用 createjs 实现它!

                  Ican't make it happen with createjs !

                  我的舞台上有一个名为jobs_cont"的 MovieClip 实例,它的时间线具有不同的关键帧和每个人的工作标题的标签.

                  I have a MovieClip instance on my stage named "jobs_cont" whose timeline has different keyframes and labels for everyone's jobtitles.

                  问题是当按钮悬停时,我没有成功定位jobs_cont"并在其时间轴中使用 gotoAndPlay 特定帧或标签.

                  The thing is i'm not successfull with targeting "jobs_cont" and using gotoAndPlay a specific frame or label in its timeline when a button is hovered.

                  仅识别警报指令",但不识别jobs_cont.gotoAndPlay":

                  the "alert instruction" alone is recognised but not the "jobs_cont.gotoAndPlay":

                  var frequency = 3;
                  stage.enableMouseOver(frequency);
                  this.mybutton.addEventListener("mouseover", fl_MouseOverHandler);
                  function fl_MouseOverHandler(){ 
                      this.jobs_cont.gotoAndPlay("mylabel");
                      alert("hovered by mouse");
                      // end of your personalized code
                  }
                  

                  我想我一定错过了一些在 createjs 中针对jobs_cont"的东西,但我是 javascript 的新手,尽管我进行了一天的研究,但还是无法弄清楚.如果有人可以给出提示.谢谢.

                  I think i must miss something targeting "jobs_cont" in createjs but i'm newbie in javascript and can't figure it out despite my day of researches. If someone could give a hint. Thank you.

                  推荐答案

                  您正在处理范围问题.如果您使用上述语法在时间轴上定义函数,则该函数没有范围,因此 this 变为 Window.

                  You are dealing with scope issues. If you define a function on your timeline using the above syntax, the function doesn't have a scope, so this becomes Window.

                  您可以更改要在当前对象上定义的函数语法:

                  You can change the function syntax to be defined on the current object:

                  this.fl_MouseOverHandler = function(){ 
                      this.jobs_cont.gotoAndPlay("mylabel");
                      alert("hovered by mouse");
                      // end of your personalized code
                  }
                  

                  最后,JavaScript 不会自动为事件侦听器提供函数范围(还没有!),因此您必须自己设置函数范围.如果你有 EaselJS 0.7.0 或更高版本,你可以使用 on 方法代替 addEventListener (docs).请注意,您也必须使用 this.fl_MouseOverHandler.

                  Lastly, JavaScript doesn't automatically provide function scope for event listeners (yet!) so you have to scope the function yourself. If you have a version 0.7.0 or later of EaselJS, you can use the on method instead of addEventListener (docs). Note that you have to use this.fl_MouseOverHandler as well.

                  this.mybutton.on("mouseover", this.fl_MouseOverHandler, this);
                  

                  您还可以使用诸如 Function.prototype.bind() (docs):

                  You can also scope the function using a utility method such as Function.prototype.bind() (docs):

                  this.mybutton.addEventListener("mouseover", this.fl_MouseOverHandler.bind(this));
                  

                  希望有帮助!

                  这篇关于如何使用 createjs 定位 MovieClip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  quot;Status Code:200 OK (from ServiceWorker)quot; in Chrome Network DevTools?(“状态码:200 OK(来自 ServiceWorker)在 Chrome 网络开发工具中?)
                  How to set a header for a HTTP GET request, and trigger file download?(如何为 HTTP GET 请求设置标头并触发文件下载?)
                  Adding custom HTTP headers using JavaScript(使用 JavaScript 添加自定义 HTTP 标头)
                  What is quot;X-Content-Type-Options=nosniffquot;?(什么是“X-Content-Type-Options=nosniff?)
                  SQL Query DocumentDB in Azure Functions by an integer not working(通过整数在 Azure Functions 中 SQL 查询 DocumentDB 不起作用)
                  Azure Functions [JavaScript / Node.js] - HTTP call, good practices(Azure Functions [JavaScript/Node.js] - HTTP 调用,良好实践)
                • <legend id='6P3Qc'><style id='6P3Qc'><dir id='6P3Qc'><q id='6P3Qc'></q></dir></style></legend>
                • <i id='6P3Qc'><tr id='6P3Qc'><dt id='6P3Qc'><q id='6P3Qc'><span id='6P3Qc'><b id='6P3Qc'><form id='6P3Qc'><ins id='6P3Qc'></ins><ul id='6P3Qc'></ul><sub id='6P3Qc'></sub></form><legend id='6P3Qc'></legend><bdo id='6P3Qc'><pre id='6P3Qc'><center id='6P3Qc'></center></pre></bdo></b><th id='6P3Qc'></th></span></q></dt></tr></i><div id='6P3Qc'><tfoot id='6P3Qc'></tfoot><dl id='6P3Qc'><fieldset id='6P3Qc'></fieldset></dl></div>
                      <tbody id='6P3Qc'></tbody>
                      <bdo id='6P3Qc'></bdo><ul id='6P3Qc'></ul>

                      <tfoot id='6P3Qc'></tfoot>

                      <small id='6P3Qc'></small><noframes id='6P3Qc'>