Hey all,
I've got a main menu and a game which loads as a separate swf from that menu. So far when the player enters their name at the start on the main menu I can get this name to post to Twitter. Also when the player completes the game I get post their time onto Twitter.
The problem is that I want to take the name posted from the main menu and dispatch it and only when the player completed the game post their time and name to Twitter.
Code in main menu to dispatch name:
Code:
var NameTextField:TextField = new TextField();
var MyFormat:TextFormat = new TextFormat();
addChild(NameTextField);
SubmitButton.addEventListener(MouseEvent.CLICK, SubmitClicked);
function SubmitClicked(e:MouseEvent)
{
dispatchEvent(new Event(NameTextField.text, true));
trace (NameTextField.text);
NameTextField.selectable = false;
}
Code in game to receive name and post time to twitter.
Code:
navigateToURL(new URLRequest('http://twitter.com/home?status='+encodeURIComponent(+NameTextField.text+" completed Game"+' in a time of '+HourText.text+':'+MinuteText.text+':'+SecondText.text+'')),'_blank');