Saturday, January 8, 2011

SmartFoxServer Tutorial: Multi-Colored Chat Bubbles

Hello again everyone.

In this tutorial, I'm going to teach you how to make multi-colored chat bubbles. One example of what I mean by this is below.

Let's say the creator of a virtual world wants to be known in his virtual world for being the creator of the game. Everytime he says something publicly, we can indicate his chat bubble to be blue, instead of white, like the SmartFoxServer example file's default color.

So, with that being said, let's get started.

The first thing I'm going to do is open the Flash library and edit the avatar movieclip inside the _GUI and _Avatars folders. I'm now going to double click on the bubble movieclip to edit the avatar's chat bubble.

At this point, I'm going to add a new keyframe on each layer. In the new keyframe, I made the chat bubble blue and put some static text on top of the bubble which says "Creator."


I'm also going to name the one of the second frames "creator" as an easier way to go to that frame.

Now after that's done, it's time to code it into the avatarChat file. The coding for this will go inside the chat frame inside the onPublicMessage handler. This is what I added in my Flash file:

if (user.getName() == "nameHere") {
mc.bubble.gotoAndStop("creator");
}
Here is a picture of where I added the coding to in my file:


Also, you are going to have to edit the part of coding that says 'nameHere' to a username you want. After you do that, the user's chat bubble should be at the creator frame whenever the user says something publicly.

So, that's really all for this tutorial.

As usual, if you have any questions or comments, don't hesitate to make a comment on this post!

Source File: None

5 comments:

  1. this doesn't work?... almost nothing is working for me. I have tried everything!

    ReplyDelete
  2. Tree Line 1: On this topic, I don't know what the problem could be for you as my file worked fine.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. when i do this, i set it so if a user is named wowox, their bubble is red. that works perfectly. but when i am a user besides "wowox", it flashes back and forth between red and white. can someone please tell me how to fix this?

    ReplyDelete
    Replies
    1. Please read the update to the newest post! Specify SFS2X or SFS1X!

      Delete