Flash Pro CS6 发布的swc在外部代码调swc内的位图不显示的BUG解...
本帖最后由 破晓 于 2018-3-12 16:43 编辑 <br /><br />之前一直没有遇到过这样的问题,也许是Flash Pro的版本的BUG问题;<br/>美术提供的一些素材,在.fla的库里或是场景,都可以正常编辑,正常显示;<br/>但,把该.fla导成.swc再到:flash builder引用该.swc,再代码时新建位图,添加到舞台;结果没有显示;<br/><br/>如:<br/>aaa.fla,库里有一个位图,我设置了链接名为:BagPanelModule.GridBgBmdUI<br/><br/>在Flash Builder新建一纯as3项目;<div class="dp-highlighter bg_javascript" style="box-sizing: border-box; padding-top: 1px; position: relative; overflow-y: hidden; overflow-x: auto; font-family: Consolas, "Courier New", Courier, mono, serif; font-size: 12px; background-color: rgb(231, 229, 220); width: 851.391px; color: rgb(69, 69, 69); margin-top: 18px !important; margin-bottom: 18px !important;"><div class="bar" style="box-sizing: border-box; padding-left: 45px;"><div class="tools" style="box-sizing: border-box; padding: 3px 8px 10px 10px; font-stretch: normal; font-size: 9px; line-height: normal; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: rgb(248, 248, 248); border-left: 3px solid rgb(108, 226, 108); border-right: 1px solid rgb(231, 229, 220);"><b style="box-sizing: border-box;"></b> <a href="http://blog.csdn.net/linjf520/article/details/17759053#" class="ViewSource" title="view plain" style="box-sizing: border-box; background-image: url("../images/ico_plain.gif"); background-position: left top; background-size: initial; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; color: rgb(160, 160, 160); text-decoration: none; margin-right: 10px; padding: 1px; outline: 0px; border: none; font-size: 9px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px;">view plain</a><span class="tracking-ad" data-mod="popu_168" style="box-sizing: border-box;"> <a href="http://blog.csdn.net/linjf520/article/details/17759053#" class="CopyToClipboard" title="copy" style="box-sizing: border-box; background-image: url("../images/ico_copy.gif"); background-position: left top; background-size: initial; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; color: rgb(160, 160, 160); text-decoration: none; margin-right: 10px; padding: 1px; outline: 0px; border: none; font-size: 9px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px;">copy</a><div style="box-sizing: border-box; position: absolute; left: 534px; top: 414px; width: 16px; height: 16px; z-index: 99;"></div></span><span class="tracking-ad" data-mod="popu_169" style="box-sizing: border-box;"></span></div></div><ol start="1" class="dp-c" style="box-sizing: border-box; list-style-position: initial; list-style-image: initial; border-top: none; border-right: 1px solid rgb(231, 229, 220); border-bottom: none; border-left: none; border-image: initial; background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); margin-bottom: 1px !important; margin-left: 45px !important;"><li class="alt" style="box-sizing: border-box; margin-left: 40px; list-style-position: initial; list-style-image: initial; border-top: none; border-right: none; border-bottom: none; border-left: 3px solid rgb(108, 226, 108); border-image: initial; color: inherit; line-height: 18px; padding-right: 3px !important; padding-left: 10px !important;"><span style="box-sizing: border-box; border: none; color: rgb(0, 0, 0); background-color: inherit;"><span class="keyword" style="box-sizing: border-box; font-weight: 700; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; color: rgb(0, 102, 153); font-size: 14px; border-radius: 2px; word-wrap: normal; border: none;">import</span><span style="box-sizing: border-box; border: none; background-color: inherit;"> BagPanelModule.GridBgBmdUI; </span></span></li><li class="" style="box-sizing: border-box; margin-left: 40px; list-style-position: initial; list-style-image: initial; border-top: none; border-right: none; border-bottom: none; border-left: 3px solid rgb(108, 226, 108); border-image: initial; background-color: rgb(248, 248, 248); line-height: 18px; padding-right: 3px !important; padding-left: 10px !important;"><span style="box-sizing: border-box; border: none; color: rgb(0, 0, 0); background-color: inherit;"> </span></li><li class="alt" style="box-sizing: border-box; margin-left: 40px; list-style-position: initial; list-style-image: initial; border-top: none; border-right: none; border-bottom: none; border-left: 3px solid rgb(108, 226, 108); border-image: initial; color: inherit; line-height: 18px; padding-right: 3px !important; padding-left: 10px !important;"><span style="box-sizing: border-box; border: none; color: rgb(0, 0, 0); background-color: inherit;"><span class="keyword" style="box-sizing: border-box; font-weight: 700; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; color: rgb(0, 102, 153); font-size: 14px; border-radius: 2px; word-wrap: normal; border: none;">public</span><span style="box-sizing: border-box; border: none; background-color: inherit;"> </span><span class="keyword" style="box-sizing: border-box; font-weight: 700; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; color: rgb(0, 102, 153); font-size: 14px; border-radius: 2px; word-wrap: normal; border: none;">class</span><span style="box-sizing: border-box; border: none; background-color: inherit;"> MyTest </span><span class="keyword" style="box-sizing: border-box; font-weight: 700; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; color: rgb(0, 102, 153); font-size: 14px; border-radius: 2px; word-wrap: normal; border: none;">extends</span><span style="box-sizing: border-box; border: none; background-color: inherit;"> Sprite </span></span></li><li class="" style="box-sizing: border-box; margin-left: 40px; list-style-position: initial; list-style-image: initial; border-top: none; border-right: none; border-bottom: none; border-left: 3px solid rgb(108, 226, 108); border-image: initial; background-color: rgb(248, 248, 248); line-height: 18px; padding-right: 3px !important; padding-left: 10px !important;"><span style="box-sizing: border-box; border: none; color: rgb(0, 0, 0); background-color: inherit;">{ </span></li><li class="alt" style="box-sizing: border-box; margin-left: 40px; list-style-position: initial; list-style-image: initial; border-top: none; border-right: none; border-bottom: none; border-left: 3px solid rgb(108, 226, 108); border-image: initial; color: inherit; line-height: 18px; padding-right: 3px !important; padding-left: 10px !important;"><span style="box-sizing: border-box; border: none; color: rgb(0, 0, 0); background-color: inherit;"> <span class="keyword" style="box-sizing: border-box; font-weight: 700; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; color: rgb(0, 102, 153); font-size: 14px; border-radius: 2px; word-wrap: normal; border: none;">public</span><span style="box-sizing: border-box; border: none; background-color: inherit;"> </span><span class="keyword" style="box-sizing: border-box; font-weight: 700; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; color: rgb(0, 102, 153); font-size: 14px; border-radius: 2px; word-wrap: normal; border: none;">function</span><span style="box-sizing: border-box; border: none; background-color: inherit;"> MyTest() </span></span></li><li class="" style="box-sizing: border-box; margin-left: 40px; list-style-position: initial; list-style-image: initial; border-top: none; border-right: none; border-bottom: none; border-left: 3px solid rgb(108, 226, 108); border-image: initial; background-color: rgb(248, 248, 248); line-height: 18px; padding-right: 3px !important; padding-left: 10px !important;"><span style="box-sizing: border-box; border: none; color: rgb(0, 0, 0); background-color: inherit;"> { </span></li><li class="alt" style="box-sizing: border-box; margin-left: 40px; list-style-position: initial; list-style-image: initial; border-top: none; border-right: none; border-bottom: none; border-left: 3px solid rgb(108, 226, 108); border-image: initial; color: inherit; line-height: 18px; padding-right: 3px !important; padding-left: 10px !important;"><span style="box-sizing: border-box; border: none; color: rgb(0, 0, 0); background-color: inherit;"> <span class="keyword" style="box-sizing: border-box; font-weight: 700; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; color: rgb(0, 102, 153); font-size: 14px; border-radius: 2px; word-wrap: normal; border: none;">var</span><span style="box-sizing: border-box; border: none; background-color: inherit;"> gridBgBmd:BitmapData = </span><span class="keyword" style="box-sizing: border-box; font-weight: 700; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; color: rgb(0, 102, 153); font-size: 14px; border-radius: 2px; word-wrap: normal; border: none;">new</span><span style="box-sizing: border-box; border: none; background-color: inherit;"> BagPanelModule.GridBgBmdUI(); </span></span></li><li class="" style="box-sizing: border-box; margin-left: 40px; list-style-position: initial; list-style-image: initial; border-top: none; border-right: none; border-bottom: none; border-left: 3px solid rgb(108, 226, 108); border-image: initial; background-color: rgb(248, 248, 248); line-height: 18px; padding-right: 3px !important; padding-left: 10px !important;"><span style="box-sizing: border-box; border: none; color: rgb(0, 0, 0); background-color: inherit;"> addChild(<span class="keyword" style="box-sizing: border-box; font-weight: 700; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; color: rgb(0, 102, 153); font-size: 14px; border-radius: 2px; word-wrap: normal; border: none;">new</span><span style="box-sizing: border-box; border: none; background-color: inherit;"> Bitmap(gridBgBmd)); </span><span class="comment" style="box-sizing: border-box; border: none; color: rgb(0, 130, 0); background-color: inherit;">// 运行,结果看不到位图</span><span style="box-sizing: border-box; border: none; background-color: inherit;"> </span></span></li><li class="alt" style="box-sizing: border-box; margin-left: 40px; list-style-position: initial; list-style-image: initial; border-top: none; border-right: none; border-bottom: none; border-left: 3px solid rgb(108, 226, 108); border-image: initial; color: inherit; line-height: 18px; padding-right: 3px !important; padding-left: 10px !important;"><span style="box-sizing: border-box; border: none; color: rgb(0, 0, 0); background-color: inherit;"> } </span></li><li class="" style="box-sizing: border-box; margin-left: 40px; list-style-position: initial; list-style-image: initial; border-top: none; border-right: none; border-bottom: none; border-left: 3px solid rgb(108, 226, 108); border-image: initial; background-color: rgb(248, 248, 248); line-height: 18px; padding-right: 3px !important; padding-left: 10px !important;"><span style="box-sizing: border-box; border: none; color: rgb(0, 0, 0); background-color: inherit;">} </span></li></ol></div><br/><strong style="box-sizing: border-box;">解决方法:把对应不能显示的位图,在.fla库里找到对应的位图,设置压缩属性为:无损,或是100;(双击位图,或是右键->属性...->压缩质量:自定义:100,或是选择:无损)</strong><br/>这样,以上的代码,就可以把位图显示出来了;<br/><br/>出现这个BUG,只是部份位图会这样;不是所有位图;这个我也不清楚是什么问题;<br/>但在.fla内写脚本,类似以上的代码,把位图添加到舞台,是可以显示的;说明内部使用是没有问题的;而外部调用打包后的.swc即有问题;<br/>所以可以肯定的是:<br/><strong style="box-sizing: border-box;">Flash Pro 对.swc的资源打包是有问题的;但不一定100%出现;</strong><br/><br/><br/><strong style="box-sizing: border-box;">来源:</strong></span></p><p style="box-sizing: border-box; word-break: normal;"><span style="box-sizing: border-box;"><span style="box-sizing: border-box; font-size: 16px;"><font color="#ff0000" face="PingFang SC, Microsoft YaHei, SimHei, Arial, SimSun"><b>http://blog.csdn.net/linjf520/article/details/17759053</b></font></span></span></p><p></p>
页:
[1]