/ Published in: ActionScript 3
å¯ä»¥é€šè¿‡ç‰¹å®šçš„按键触å‘彩蛋
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//color egg function colorEgg() { stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed); stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased); stage.addEventListener(Event.DEACTIVATE, clearKeys); } colorEgg(); var keyDowns = ''; function keyPressed(evt) { //Tracer.debug(evt.keyCode); keyDowns += evt.keyCode.toString(); } function keyReleased(evt) { if(keyDowns == '76908989') { var txt:TextField = new TextField(); txt.htmlText = '<font color="#ff6600" size="20" face="verdana"><b>YY , Have a Nice day :) - From LZ</b></font>'; txt.x = stage.stageWidth - txt.textWidth; txt.y = stage.stageHeight - txt.textHeight; txt.width = txt.textWidth+10; txt.selectable = false; addChild(txt); } } function clearKeys(evt) { keyDowns = ''; }