Update of /cvsroot/dynapi/dynapi/examples
In directory usw-pr-cvs1:/tmp/cvs-serv21789

Added Files:
        dynapi.api.leak.html 
Log Message:
An example meant for memory usage testing

--- NEW FILE ---
<html>
<head>
<title>DynAPI Distribution: Create Example</title>
<script language="Javascript" src="../src/dynapi.js"></script>
<script language="Javascript">
DynAPI.setLibraryPath('../src/lib/');
DynAPI.include('dynapi.api.*');
DynAPI.include('dynapi.event.listeners')
DynAPI.include('dynapi.event.mouse')
</script>
<script language="Javascript">

DynAPI.onLoad = function() {

        myLayer = new DynLayer()
        myLayer.setSize(100,100)
        myLayer.setBgColor('#c0c0c0')
        myLayer.moveTo(100,100)

        myChild = new DynLayer(null,25,25,50,50,'#ffffff')
        myLayer.addChild(myChild)

        DynAPI.document.addChild(myLayer)
        
        myListener = new EventListener(DynAPI.document)
                myListener.onmouseover=function(e) {
                        myLayer.setBgColor('#ffc000')
                }
                myListener.onmousemove=function(e) {
                        myLayer.setBgColor('#ffc000')
                }
                myListener.onmouseout=function(e) {
                        myLayer.setBgColor('#c0c0c0')
                }
                myListener.onmousedown=function(e) {
                        myLayer.setBgColor('#0000c0')
                }
                myListener.onmouseup=function(e) {
                        myLayer.setBgColor('#ffc000')
                }
                myListener.onrtmouseup=function(e) {
                        myLayer.setBgColor('#ffcc00')
                }
                myListener.onrtmousedown=function(e) {
                        myLayer.setBgColor('#00cc00')
                }
                myListener.onmdmousedown=function(e) {
                        myLayer.setBgColor('#11cc00')
                }
                myListener.onmdmouseup=function(e) {
                        myLayer.setBgColor('#ffcc00')
                }
                myListener.ondblclick=function(e) {
                        alert('double-click')
                }
                myListener.onmove = function(e) {
                        var f = e.getSource()
                        window.status = f.x+' '+f.y
                }
                

        myLayer.addEventListener(myListener)


        dd = null
}

DynAPI.onUnload = function() {
        if(dd) { clearInterval(dd); delete dd; }
}

var inc=5
function mv() {
        myLayer.moveBy(inc,0)
        if(myLayer.getX()<30 || myLayer.getX()>(DynAPI.document.getWidth()-140)) 
inc=-inc;
}

start = function() {
        if(!dd) dd = setInterval("mv()",50)
}

clear = function() {
        if(dd) { clearInterval(dd); delete dd; dd = null;  }
}
</script>
</head>

<body bgcolor="#ffffff">
This example features a simple setInterval, which causes IE's memory to leak. Use any 
memory peeking utility to see if it happens.
<br>
<a href=javascript:start()>Start animation (setInterval)</a><br>
<a href=javascript:clear()>Stop animation (clearInterval)</a><br>

</body>
</html>


_______________________________________________
Dynapi-CVS mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-cvs

Reply via email to