1import gfx.io.GameDelegate;
2
3sendInviteButton.addEventListener("click", this, "Friends_SendInvite");
4function Friends_SendInvite()
5{
6	GameDelegate.call("f2c_Friends_SendInvite", [usernameTextInput.text], this);
7}
8
9GameDelegate.addCallBack("c2f_Friends_SendInvite", this, "c2f_Friends_SendInvite");
10function c2f_Friends_SendInvite(resultCode:String, userHandle:String):Void
11{
12	if (resultCode=="L2RC_SUCCESS")
13	{
14		trace("c2f_Friends_SendInvite success, " + userHandle);
15	}
16	else
17	{
18		// L2RC_Friends_SendInvite_UNKNOWN_TARGET_HANDLE
19		// L2RC_Friends_SendInvite_CANNOT_PERFORM_ON_SELF
20		// L2RC_DATABASE_CONSTRAINT_FAILURE
21		// L2RC_Friends_SendInvite_ALREADY_SENT_INVITE
22		// L2RC_Friends_SendInvite_ALREADY_FRIENDS
23
24
25		trace(resultCode);
26	}
27}
28
29removeButton.addEventListener("click", this, "Friends_Remove");
30function Friends_Remove()
31{
32	GameDelegate.call("f2c_Friends_Remove", [usernameTextInput.text], this);
33}
34
35GameDelegate.addCallBack("c2f_Friends_Remove", this, "c2f_Friends_Remove");
36function c2f_Friends_Remove(resultCode:String, targetHandle:String):Void
37{
38	if (resultCode=="L2RC_SUCCESS")
39	{
40		trace("c2f_Friends_Remove success, " + targetHandle);
41	}
42	else
43	{
44		// L2RC_Friends_Remove_UNKNOWN_TARGET_HANDLE
45		// L2RC_Friends_Remove_CANNOT_PERFORM_ON_SELF
46		// L2RC_DATABASE_CONSTRAINT_FAILURE
47		// L2RC_Friends_Remove_NOT_FRIENDS
48
49		trace(resultCode);
50	}
51}
52
53acceptInviteButton.addEventListener("click", this, "Friends_AcceptInvite");
54function Friends_AcceptInvite( )
55{
56	GameDelegate.call("f2c_Friends_AcceptInvite", [usernameTextInput.text], this);
57}
58
59GameDelegate.addCallBack("c2f_Friends_AcceptInvite", this, "c2f_Friends_AcceptInvite");
60function c2f_Friends_AcceptInvite(resultCode:String, userHandle:String, onlineStatusSetToVisible:Boolean, loggedInTitle:String, status:String):Void
61{
62	if (resultCode=="L2RC_SUCCESS")
63	{
64		trace("c2f_Friends_AcceptInvite success, " + userHandle + ", " + onlineStatusSetToVisible + ", " + loggedInTitle + ", " + status);
65	}
66	else
67	{
68		// L2RC_Friends_AcceptInvite_UNKNOWN_TARGET_HANDLE
69		// L2RC_Friends_AcceptInvite_CANNOT_PERFORM_ON_SELF
70		// L2RC_DATABASE_CONSTRAINT_FAILURE
71		// L2RC_Friends_AcceptInvite_NO_INVITE
72
73		trace(resultCode);
74	}
75}
76
77rejectInviteButton.addEventListener("click", this, "Friends_RejectInvite");
78function Friends_RejectInvite()
79{
80	GameDelegate.call("f2c_Friends_RejectInvite", [usernameTextInput.text], this);
81}
82
83GameDelegate.addCallBack("c2f_Friends_RejectInvite", this, "c2f_Friends_RejectInvite");
84function c2f_Friends_RejectInvite(resultCode:String, targetHandle:String):Void
85{
86	if (resultCode=="L2RC_SUCCESS")
87	{
88		trace("c2f_Friends_RejectInvite success, " + targetHandle);
89	}
90	else
91	{
92		// L2RC_Friends_RejectInvite_UNKNOWN_TARGET_HANDLE
93		// L2RC_Friends_RejectInvite_CANNOT_PERFORM_ON_SELF
94		// L2RC_DATABASE_CONSTRAINT_FAILURE
95		// L2RC_Friends_RejectInvite_NO_INVITE
96
97		trace(resultCode);
98	}
99}
100
101backButton.addEventListener("click", this, "BackToLobby");
102function BackToLobby()
103{
104	gotoAndStop("Lobby");
105}
106
107stop();
108