Friday, August 26, 2005

Flash communication server

Just started a little project that involves online gaming. One of the most important aspect of online gaming of course is message broadcast among clients. Quite frankly, flash itself have no facilities for doing that. It can do sendandload, xml stuff, but when it comes to server side, flash have absolutely nothing. That's when FCS comes in. You can get flash to connect to it whenever the apps start. It's done using shared object. Whenever the value of a "data" in the SO changes, its value will be broadcasted to all that is connected. Quite nifty. And don't need much codes !!


_root.client_nc.connect("rtmp:/myapps/");
users_so = SharedObject.getRemote("users_so", _root.client_nc.uri, false);
users_so.connect(_root.client_nc);
users_so.onSync = function(userList) {
response.text = _root.users_so.data.x;
}


That's all!!!

If you make users_so global, you can change it anywhere in the apps, and all apps that is connected to FCS will be notified by the onSync function. IAW, users_so is like a local copy of the remote SO.

Kenneth

Wednesday, August 24, 2005

Another flash blog - htmltext

Another one of those things that i've found out how to do before, but completely forgot how to do 6 months after. Since flash have no way to set color to individual words in a textfield, i had to use htmltext to format my text.

To do htmltext, two steps:

1. set the textfield to be "render text as html"
2. when setting text to textfield, use "txt.htmlText", NOT just regular .text.

Now to color text, this would not work (altough they work in html, rendered in ie anyway)


<font color=0xFFCE00>asdf</font> nor
<font color=FFCE00>asdf</font> NOR
<font color='FFCE00'>asdf</font>



flash is very picky. It needs to be <font color='#FFCE00'>asdf</font>

Thursday, August 04, 2005

First flash log..

As this will be more of a techy blog site, let's start with some flashy findings.

One of my recent flash projects require a dynamically colored background. As some of you always know, there is no way to change the background color (as easy as the html javascript way). One of the hack you can pull is to create a layer(bottommost), put a movieclip in it, fill it with color, and dynamically fill the background by resizing it.

Code:

var color_bg:Color = new Color(_root.bg);
color_bg.setRGB(c_bg);


So the make a color object from the mc, and set its rgb, which conveniently, can be hex(ff0000) or decimal(255).

My first blog entry

After a super long proscatination on creating a blog, i've finally decided to go with a blog provider (blogger, as you can see), instead of hosting it on my own machine. The only thing i worry about, is space issue.. since pictures worth (a) million words, most of our postings will at least have a couple of images. As times go on, it might be a problem.

But what dah hey.. it's a start. At least there's a spot for Jin (my wife) and I to post any stuff about us, or happened around us. And hey, there's even room for people to leave their comments. WHAT A GREAT CONCEPT :)

Anyway, i think it's gonna be a great start! :)