|
From: | Huub Schaeks |
Subject: | RE: [Swftools-common] _x and _y move everything? (bug?) |
Date: | Mon, 14 Apr 2008 22:01:53 +0200 |
Hello Jon I'm no actionscript expert myself, but my guess is that if you put the ".filled person" on the stage like you did, it's just a shape, not a movieclip. Only movieclips have onEnterFrame events and shapes don't have onLoad events either, so I think that when you specify handlers for those events the way you did these handlers get assigned to those events for the stage , which is a movieclip. So the _x and _y refer to the position of the whole stage. The code below works as I think you intended. What I did was put the ".filled person" into a sprite first (renaming it to person_shape) and put that sprite onto the stage. I assigned the handlers explicitly to the 'stage'-events and specified that the "person" sprite was to be moved. Regards, Huub .flash name="persondemo.swf" bbox=1000x1000 background="" compress .outline person_outline: M 35 1.65625 C 21.2 1.65625 9.9999996 12.856249 10 26.65625 C 10 34.834223 13.923281 42.094201 20 46.65625 L 1.4375 46.65625 L 1.4375 118.78125 L 67.15625 118.78125 L 67.15625 46.65625 L 50 46.65625 C 56.076719 42.094201 60 34.834222 60 26.65625 C 60 12.85625 48.8 1.65625 35 1.65625 .end .filled person_shape outline="person_outline" color=black fill=blue line=7 .sprite person .put person_shape .end .box b1 100 100 color=black fill=black .put b1 x=200 y=200 .put person x=0 y=0 .action: this. {walkSpeed = 5;}; this. { if (Key.isDown(Key.UP)) { person._y-=walkSpeed; } if (Key.isDown(key.RIGHT)) { person._x+=walkSpeed; } if (Key.isDown(key.LEFT)) { person._x-=walkSpeed; } if (Key.isDown(key.DOWN)) { person._y+=walkSpeed; } }; .end .end
Chat met al je vrienden. Voeg ze nu allemaal toe aan Messenger! |
[Prev in Thread] | Current Thread | [Next in Thread] |