Friday, 25 April 2014

Working Processes: Finalising The Game - Adding reset and tweet button to end of the game.

Upon completing the game, I decided it would be a good idea if the user would be able to restart the game and play it again.

I also wanted to make it so that the user would be able to tweet out their time to their friends.

I used the following code for the buttons:

// ---------Buttons---------
//Reset Button
reset_btn.addEventListener(MouseEvent.CLICK,resetListener);
function resetListener(ev:MouseEvent):void {
    gotoAndStop("enterName");
}
//Tweet Button
tweet_btn.addEventListener(MouseEvent.CLICK,tweetListener);
function tweetListener(ev:MouseEvent):void {
    navigateToURL(new URLRequest("http://twitter.com/home?status= I just completed The Waiting Room in "+fl_MinutesElapsed + " Minutes and " + fl_SecondsElapsed +" Seconds!! BEAT THAT! http://tinyurl.com/mflhvk4"),'_blank');
}



I am happy with the results.

Something important to mention is that the Tweet button will not work on the SWF or HTML file due to the security of ones SWF settings. The Tweet button will however work on files uploaded to the internet or directly in the FLA.

You can test this on an internet uploaded version here:
http://www.newgrounds.com/dump/item/fd0ee4a166a9a3018e4c096b3744a3b6

No comments:

Post a Comment

Note: only a member of this blog may post a comment.