DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Construction Of Two-person Game

07.08.2011
| 1123 views |
  • submit to reddit
        var file:FileReference = new FileReference();
stage.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
function onClick(evt:MouseEvent):void {
file.save("some text.\nsome more text", "actionsnippet.txt");
}


function showMsg(msg:String):void {
    trace(msg);
}
showMsg("Claire");

stage.addEventListener(MouseEvent.CLICK, showMsg, false, 0, true);
function showMsg(evt:MouseEvent):void {
    trace("hello");
}


Example of two-person games; <a href="http://www.freemanagementgames.com/play/tank-trouble.html">Tank Trouble</a>

stage.addEventListener(MouseEvent.CLICK, showMsg, "hello",
                       false, 0, true);
function showMsg(evt:MouseEvent, msg:String):void {
    trace(msg);
}