> Hi,
> 
> I have a problem getting a layer to move smoothly on a mousemove event:
> it's stuttering and gives an 'appwait' cursor while moving...
> 
> Following is the code I use:
> 
> <!-- snip -->
> <script language="JavaScript" src="../shared/dynapi.js"></script>
> <script language="Javascript">
> 
> DynAPI.setLibraryPath('../shared/lib/');
> DynAPI.include('dynapi.api.browser.js');
> DynAPI.include('dynapi.api.dynlayer.js');
> DynAPI.include('dynapi.api.dyndocument.js');
> DynAPI.include('dynapi.event.*');
>       
> DynAPI.onLoad = function() {
>       // layers
>       var menu_bck=this.document.addChild(new DynLayer(null,0,70,796,32))
> //background
>       var menu_btn=menu_bck.addChild(new DynLayer(null,0,0,80,32,null,
> false)) //highlight button
>       var menu_txt=menu_bck.addChild(new DynLayer(null,230,0,556,32))
> //menu text
> 
>       // events
>       myListener = new EventListener(DynAPI.document)
>       myListener.onmouseover=function(e) {
>               menu_btn.setVisible(true)
>       }
>       myListener.onmousemove=function(e) {
>               mX = e.getX();
>               if (mX < 270) { // restrict movement
>                       x = 230
>               } else if (mX >= 756) { // restrict movement
>                       x = 716
>               } else { // free movement
>                       x = mX-40
>               }
>               menu_btn.moveTo(x, 0)
>       }
>       myListener.onmouseout=function(e) {
>               menu_btn.setVisible(false)
>       }
>       menu_bck.addEventListener(myListener)
> 
>       // layers content
>       menu_btn.setBgImage('../gfx/button.gif')
>       menu_txt.setHTML('<a href=""><img src="../gfx/btn_contact.gif"
> border="0"></a>')
>               
> }
>       
> </script>
> <!-- end snip -->
> 
> The problem is clear to see on http://www.diggie.nl/test/
> 
> Can anybody please give me an example how to fix this? It must be
> possible, because I've seen smooth movements, but I'm too new to dynapi to
> rip the source from it ;-)
> 
> 
> Thanks in advance,
> 
> Paul

<<attachment: winmail.dat>>

Reply via email to