views:

38

answers:

3

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...

+1  A: 

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.

grapefrukt
Good thought, but this will not work in my case. The code base is large, and this object is used all over the place, so all of the code is expecting a 'Movieclip' object, not a 'Proxy' object.
SP
A: 

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());
 }
}
Patrick
A: 

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 ...

greetz

back2dos

back2dos
check out my edit
SP