<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>lufylegend</title> <script type="text/javascript" src="lufylegend-1.7.6.js"></script> </head> <body> <div id="mylegend">loading...</div> <script type="text/javascript"> init(50, ‘mylegend‘, 500, 350, main); var field; function main() { var layer = new LSprite(); layer.graphics.drawRect(1,‘#cccccc‘,[0,0,300,300],true,‘#cccccc‘); addChild(layer); field = new LTextField(); field.text = ‘Wait Click!‘; layer.addChild(field); layer.addEventListener(LMouseEvent.MOUSE_DOWN,downshow); layer.addEventListener(LMouseEvent.MOUSE_UP,upshow); } function downshow (event) { field.text = ‘Mouse Down‘; } function upshow (event) { field.text = ‘Mouse Up‘; } </script> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>lufylegend</title> <script type="text/javascript" src="lufylegend-1.7.6.js"></script> </head> <body> <div id="mylegend">loading...</div> <script type="text/javascript"> init(50, ‘mylegend‘, 500, 350, main); var field; function main() { var layer = new LSprite(); layer.graphics.drawRect(1, ‘#cccccc‘, [0, 0, 300, 300], true, ‘#cccccc‘); addChild(layer); field = new LTextField(); field.text = ‘0‘; layer.addChild(field); layer.addEventListener(LEvent.ENTER_FRAME, onframe); } function onframe(event) { field.text = parseInt(field.text) + 1; } </script> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>lufylegend</title> <script type="text/javascript" src="lufylegend-1.7.6.js"></script> </head> <body> <div id="mylegend">loading...</div> <script type="text/javascript"> init(50, ‘mylegend‘, 500, 350, main); var field; function main() { var layer = new LSprite(); layer.graphics.drawRect(1, ‘#cccccc‘, [0, 0, 300, 300], true, ‘#cccccc‘); addChild(layer); field = new LTextField(); field.text = ‘Wait ‘; layer.addChild(field); LEvent.addEventListener(LGlobal.window,LKeyboardEvent.KEY_DOWN,downshow); LEvent.addEventListener(LGlobal.window,LKeyboardEvent.KEY_UP,upshow); } function downshow (event) { field.text = event.keyCode + ‘ Down!‘; } function upshow (event) { field.text = event.keyCode + ‘ Up!‘; } </script> </body> </html>
时间: 2024-10-03 19:45:07