lufylegend库 LButton
lufylegend库 LButton
<!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 loader, bitmapup, bitmapover, field; function main() { loader = new LLoader(); loader.addEventListener(LEvent.COMPLETE,loadUp); loader.load('up.png','bitmapData'); } function loadUp(event){ bitmapup = new LBitmap(new LBitmapData(loader.content)); loader = new LLoader(); loader.addEventListener(LEvent.COMPLETE,loadOver); loader.load('over.png','bitmapData'); } function loadOver () { bitmapover = new LBitmap(new LBitmapData(loader.content)); var layer = new LSprite(); addChild(layer); field = new LTextField(); field.text='Wait Click'; layer.addChild(field); var testButton = new LButton(bitmapup,bitmapover); testButton.y = 50; layer.addChild(testButton); testButton.addEventListener(LMouseEvent.MOUSE_DOWN,downshow); } function downshow (event) { field.text = 'testButton Click !'; } </script> </body> </html>