From: Joop Q. <jq...@ho...> - 2004-10-12 15:47:57
|
Hello, last weekend I tried to do some animation with the Dynapi3. I have an animated character on the screen which can be controlled with the arrow-keys on the keyboard. That works perfectly. But when I want to control the character by clicking on (and holding down) North, East, South and West arrow pictures on the screen, it only calls the subroutine once and the character only moves a couple of pixels to the desired direction. I have to release the mousebutton and click again to trigger another event. Code: evn = {}; evn.onmousedown= function(e) { var o = e.getOrigin(); if (o=="DynObject.all.south"){ character.setLocation(character.x,character.y+5); character.setFrame(7) character.playAnimation(true,'8>7,7<8,8<7') } Then I tried triggering slide-animations with mousedown events, and stopping them with mouseup, which also worked. But then I couldn't get the actual X and Y positions of the moved character, it always started at the original slide-animation coords.. I used this code in listener.onpathstop or listener.onpathstart to update the coords, but like I said it didn't work: xx=o.getX(); yy=o.getY(); character.setX(xx); character.setY(yy); character.setPosition(xx,yy) I read some stuff about events, tried to use invokeEvent('mouseup') but that also didn't work when the mousebutton is still pressed. Can it be done, or would you recommend using the keyboard for controlling animation? Btw, I use WinXP with Mozilla 1.7, Firefox 0.9 and IExplorer 6.0 with the Dynapi3 beta. Thanks! Joop Btw I really hope there will be more Dynapi3 activity, it's a great toolkit! |