Game Development Reference
In-Depth Information
To create our own version of FriendDisplay (MyFriendDisplay), we override the
method in MyFriendsDisplay as shown:
public override function
createNewFriendsDisplay(av:GameAvatarClient):FriendDisplay {
return new MyFriendDisplay(av);
}
If we explored the PlayerDisplay, we will find that the little circle sprite registers for
a mouse-click event that handles the request to make friends with the corresponding
avatar associated with the PlayerDisplay instance.
protected function makeFriend(event:MouseEvent):void {
var gc:GameClient;
gc = PulseGame.getInstance().getGameClient();
gc.makeFriend(m_av.getName());
}
Similarly, when a friend relation is broken by clicking on the little square sprite on
the Friend Display object, a request is sent to the server in code as shown below:
protected function breakFriend(event:MouseEvent):void {
var gc:GameClient;
gc = PulseGame.getInstance().getGameClient();
gc.breakFriend(m_av.getName());
}
 
Search WWH ::




Custom Search