zoukankan      html  css  js  c++  java
  • 解决PDFToFlex源程序的小BUG——页面控制的最后两页无法正常切换问题

     在解析Igor Costa(http://www.igorcosta.org/)源程序(详看我的http://www.cnblogs.com/wuhenke/archive/2009/11/12/1601535.html)的基础上,解决了左边页面控制中,MovieClip最后两帧无法正常互切换的问题。饮水思源,下面是我对他的反馈交流:

    “Hi Igor,
         Thank you for your great work of solve loading the pdf's swf file. After learning and running your programn,I find a small bug exists in face control.      The bug is that you can't switch the last two frames from each other correctly.The currentFrame property of MovieClip can't equal with  this MovieClip.totalFrames forever. Of course maybe it's Flash bug。I spent much time in removing this bug.Last i used  a skill avoiding the bug.
         what you need do is  add "Application.application.libMC.gotoAndStop(e.currentTarget.pageNumber-2);" into the first line of function dispatchPage of Pages.mxml . Such as:
    private function dispatchPage(e:MouseEvent):void { 
       //此处用到小技巧,解决最后两页切换的无法转换的问题
       Application.application.libMC.gotoAndStop(e.currentTarget.pageNumber-2);
       Application.application.libMC.gotoAndStop(e.currentTarget.pageNumber);
       }
            Maybe you can make your work more perfect!Thank you for you prework!

    出现上面的原因:

    MovieClip的currentFrame属性最大值只能为totalFrames-1即倒数第二帧,无法为totalFrames。但是从倒数第二帧到最后一帧用gotoAndStop切换可以的,但是反过来切换就失效了。我查了很多资料,也没有相关的问题的解决方案。我感觉是MovieClip自身的Bug。

    解决方法:

    只需要修改 Pages.mxml中的dispatchPage函数,添加   Application.application.libMC.gotoAndStop(e.currentTarget.pageNumber-2);这里是小技巧,是解决最后两帧不能正常切换的问题。技巧思路是:先切换到目标帧的后面的两帧,然后再跳转到目标帧。

  • 相关阅读:
    记录PHP的执行时间
    Mysql数据字典导出
    PHP用post来进行Soap请求
    laravel(lumen)配置读写分离后,强制读主(写)库数据库,解决主从延迟问题
    使用vagrant构建你们团队的开发环境
    Lumen框架使用Redis与框架Cache压测比较
    使用php-cs-fixer格式化你的代码
    Javascript下拉导航
    jsf2.0视频
    jsf2入门视频 教程
  • 原文地址:https://www.cnblogs.com/wuhenke/p/1603687.html
Copyright © 2011-2022 走看看