找出内置类型的属性何时更改为某个值的最简单方法是什么?

发布于 2024-08-19 05:11:42 字数 725 浏览 7 评论 0原文

我在将 Swf 中的 Movieclips 大小调整为错误尺寸时遇到问题。我目前每半秒跟踪一次有问题的剪辑的宽度,并且我可以在记录的输出中以某个间隔看到该值更改为不正确的大小。我真的很想看看什么代码正在改变宽度。我的计划是扩展 Movieclip,覆盖设置的宽度属性,并在设置的值太低时转储堆栈跟踪。然而这并不是那么简单。 Flash 抱怨对 Movieclip fla 上的 UI 组件的未定义引用。

有没有一种简单的方法可以找出该值何时/为何发生变化?我无法使用调试器。

编辑:

我不能扩展 MovieClip 的原因是因为我在使用 Loader 后从 Event.currentTarget.content 获取我的 Movieclip 对象。我无法将我的 Test (extends MovieClip) 对象指向此返回值,因为这样做是非法的。

我会进一步解释这个问题,也许有人会有另一个想法。我有一个有很多不同窗口的应用程序。它们的打开尺寸均约为 750x570。这些窗口之一包含 FusionChart。当我加载它时,根据我的跟踪,我使用的背景 Swf 的尺寸更改为大约 2712x1930。这对我来说没有意义,因为它看起来与以前的尺寸相同,并且在这些尺寸下它甚至无法接近适合我的屏幕。如果我然后关闭窗口并打开另一个窗口,新窗口很小,但表示它的尺寸与原始窗口相同(750x570)。

几乎就好像窗口缩放到巨大的 2712x1930 而不显示大小变化,然后将下一个窗口 (750x570) 显示为相对于巨大窗口的外观的大小。如果这有道理的话...

I'm having an issue with Movieclips inside my Swf resizing to the wrong dimensions. I'm currently tracing the width of the offending clip every half second, and I can see the value change to an incorrect size at some interval in the logged output. I really want to see what code is changing the width. My plan was to extend Movieclip, override the set width property, and dump a stack trace when the value set is too low. This isn't so simple however. Flash is complaining about undefined reference to UI components that are on the Movieclip fla.

Is there a simple way to find out when/why this value changes? I cannot use a debugger.

edit:

The reason I cannot just extend MovieClip is because I am getting my Movieclip object from Event.currentTarget.content after using a Loader. I cannot point my Test (extends MovieClip) object at this return value because it is illegal to do so.

I'll explain the problem a little more and maybe someone will have another idea. I have an app with lots of different windows. They all open to a size of around 750x570. One of these windows contains a FusionChart. when I load this, according to my trace, the background Swf I am using changes to a dimension of about 2712x1930. This doesn't make sense to me because it looks the same size as before and at those dimensions it wouldn't even come close to fitting on my screen. If I then close the window and open another, the new window is tiny, but says it has the same dimensions as the original windows (750x570).

It is almost as if the window is scaling to the huge 2712x1930 without showing a change in size, and then showing the next window (750x570) as a size relative to what the huge window would look like. If that makes sense...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

决绝 2024-08-26 05:11:42

也许使用代理

Proxy 类允许您覆盖对象上 ActionScript 操作(例如检索和修改属性)的默认行为。

Maybe using a Proxy?

The Proxy class lets you override the default behavior of ActionScript operations (such as retrieving and modifying properties) on an object.

梦回梦里 2024-08-26 05:11:42

如果您可以看到正在执行的跟踪并使用 Flash 播放器的调试版本,请尝试覆盖您要检查的属性并跟踪 错误对象:

public class Test extends Sprite() {
 // property to watch
 override public function set x(value:Number):void{
  super.x=value;
  // trace the calling stack work only in the flash debug player
  trace((new Error()).getStackTrace());
 }
}

If you can see the trace you are doing and use a debug version of the flash player, try to override the property you want to check and trace the calling stack stack within the Error object:

public class Test extends Sprite() {
 // property to watch
 override public function set x(value:Number):void{
  super.x=value;
  // trace the calling stack work only in the flash debug player
  trace((new Error()).getStackTrace());
 }
}
深居我梦 2024-08-26 05:11:42

“Flash 抱怨对 Movieclip fla 上的 UI 组件的未定义引用。”是什么意思?

一般来说,你的想法绝对是正确的解决方案...假设属性在运行时内不会改变(这种情况很少见,除非计算这些属性)...

当涉及到宽度和高度时,它们是最差的两个Flash Player API 中的属性...为了读取,它们是根据父坐标空间中 DisplayObject 所需的空间计算的(如果旋转 DisplayObject,这些属性会发生变化)。为了写作,他们实际上转发到scaleX和scaleY......

what do you mean by "Flash is complaining about undefined reference to UI components that are on the Movieclip fla."?

your idea is absolutely the right solution in general... assuming the property doesn't change from within the runtime (which is rare, unless those properties are calculated) ...

when it comes to width and height, they are the two worst properties in the flash player API ... for reading, they are calculated by the space needed by a DisplayObject in parent coordinate space (if you rotate a DisplayObject, than these properties change). for writing, they actually forward to scaleX and scaleY ...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文