如何使用 Flash 中的按钮组件修复此潜在错误?
我需要使用 Flash IDE 中 UI 组件面板中的 Button 组件,并将切换属性设置为 true。
如果我将它与时间线脚本一起使用,效果会很好。
如果我在类(文档类)中使用,则所选属性会反转 (当它没有切换时我就明白了,反之亦然)。
另外,如果我在属性检查器中将切换设置为 false,然后在文档类中将切换设置为 true,它仍然会显示为 false。如果我无效,我会将跟踪切换为 true,但是 所选属性始终跟踪 false。
时间轴代码就这么简单:
bold_b.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void {
trace(event.currentTarget.selected);
}
文档类也很简单:
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class ButtonTester extends MovieClip
{
public function ButtonTester()
{
//in timeline works fine, in class it's the other way around
bold_b.addEventListener(MouseEvent.CLICK, onClick);
bold_b.toggle = true;
bold_b.invalidate('toggle',true);
bold_b.drawNow();
stage.invalidate();
trace('bold_b.toggle: ' + bold_b.toggle);
function onClick(event:MouseEvent):void {
trace(event.currentTarget.selected);
}
}
}
}
目前我正在使用 Flash CS3。我已经安装了 Flash Player 10。不知道组件的“构建”版本,但它们是在 2007 年在 Flash Player 9.0.28.0 下编写的
有谁知道如何解决这个问题?
I need to use the Button component from the UI Components Panel in the Flash IDE, with the toggle property set to true.
If I use it with a timeline script it works great.
If I use within a class(a Document Class), the selected property is reversed
(I get true when it's not toggled and vice versa).
Also if I set toggle to false in the Property Inspector, then set toggle to true in the document class, it still traces out as false. If I invalidate, I toggle traces true, but
the selected property always traces false.
Timeline code is as simple as this:
bold_b.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void {
trace(event.currentTarget.selected);
}
Document class is simple as well:
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class ButtonTester extends MovieClip
{
public function ButtonTester()
{
//in timeline works fine, in class it's the other way around
bold_b.addEventListener(MouseEvent.CLICK, onClick);
bold_b.toggle = true;
bold_b.invalidate('toggle',true);
bold_b.drawNow();
stage.invalidate();
trace('bold_b.toggle: ' + bold_b.toggle);
function onClick(event:MouseEvent):void {
trace(event.currentTarget.selected);
}
}
}
}
Currently I'm using Flash CS3. I've got Flash Player 10 installed. Don't know the components 'build' version, but they were written in 2007 under Flash Player 9.0.28.0
Does anyone know how to get around this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那这个呢?
and what about this?