Archive for the 'Flash' Category

Benchmark time

Saturday, March 31st, 2007

I’ve stumbled upon a good Flash 9/8/7/Javascript speed test.
Its interesting how Flash 7 was somewhat quicker than 8.

Another useful test is this one from Ted Patrick.
I’ve ever wondered if with Flash 9, Firefox was still so much slower than IE: seems not (with Firefox 2 and IE 7).

The hype is over: Apollo

Monday, March 19th, 2007

Finally, Apollo is out:
grab it from the Adobe Lab

To start with it:
Building your first Flex-based Apollo application

Flash socket server + MiceTalk

Sunday, March 18th, 2007

How promised, here my little perl Flash socket server.

This is a simple prototype that I've made to explore the power of non-blocking sockets.
I've tested it with a thousand connections and it should handle some more.
This can be used for a multiplayer flash game or a community chat, but since it isn't "production ready", use it at your own risk :)
It can be also useful to who want to implement his own server.

Features:

  • >=1000 connections
  • anonymous nick, free nick (free to choose you own) and registered nick with mysql/postgre/sqlite/dbo compatible
  • Can run in some web hosts like Dreamhost Update: It violates their policy

Download: Perl Flash socket server

To run:

CODE:
  1. ./creaTestDb.pl
  2. ./flashserve.pl

Here are also a bunch of AS classes to interact with the server and an example application like the "mouse chat" in my website. Update: my hosting (Dreamhost) doesn't allow FlashServe, the party is over
Sadly, since these was made 4 years ago with an italian friend, all the comments are in italian, if someone is interested, I can translate it.

Download: MiceTalk socket server example + Classes

You can use my server at dev.madarco.net:7777 but only in the Flash IDE (no crossdomain.xml)

Red Agency - ff0000.com

Friday, March 9th, 2007

Red Agency Universe

Flash buzz-site of the moment:
Red Universe is an interactive avatar chat in Flash, where you can explore the good-looking world while talking with others.

Little advertisement:
If you'd like to do something similar, look at www.madarco.net. If there aren't other users connected (likely), open it in two tabs and move the mouse to interact, type to talk.
I'll release my quick-and-dirty flash socketserver soon, it is written in perl and run on every Dreamhost hosting.

I have a website

Thursday, February 22nd, 2007

Finally!
Since I'm looking for a job I realized that I need a personal website, so I've quickly made a simple one.
Nothing special, apart that you can see the mouse of the others guests and talk with them (just write, then press enter).
Enjoy!

Bruce Eckel on Flash

Sunday, February 18th, 2007

Here a great post of Bruce Eckel (author of "Thinking in..." books) on Java, Ajax and surprisingly: Flash.

So here’s my question. Allow for a moment the possibility that, after 10 years, Java is not going to take over the world of RIAs. Further allow that Ajax is just “how JavaScript was supposed to work in the first place,” but that the limitations imposed by browsers, HTML and CSS committees seem unlikely to let it expand beyond its current bounds. What are we going to use to build RIAs? [...] The only obvious solution is Flash.

Simon Brocklehurst pointed out that there are more ugly Flash interfaces than good ones, although I think he is talking about the old do-all-by-yourself hackery of Flash 7-8 since there isn't many Flex 2 web apps out there yet. I wonder if he saw Picnik.

Eckel highlight a really interesting point: to use Flash as a domain specific language. Do in Flash the interface for your Java/Python/C application. We are waiting for you, Apollo.

Plick time tracker

Sunday, February 11th, 2007

Since I was looking for a way to organize my tasks, I've made:
Plick - Time tracker, a tool that help to keep track of what to do and the time spent on doing that.

The main features are the simplicity and that it help to stay in the schedule.

Using Plick is simple:
just specify a task and the time you think will be required to do that (eg: "clean room 15" = clean the room in 15 minutes)
then, when you are doing that, just click on it and the timer will start.
Plick will keep track of the time spent on each task, in this way you can see if you spent much time than you expected, helping you to make better previsions.

plick.jpg

Memory leaks playing Shoutcast/Icecast streams in Flash

Saturday, February 3rd, 2007

Update: For those interested in an easy streaming solution, try haxeVideo.

Trying to play music on the Wii, I've encountered a problem in the flash Sound object.

While you listen to an mp3 in streaming mode: snd.loadSound(url, true), flash will keep in memory the music played.
A Shoutcast/Icecast stream like an Internet radio, is like a never ending mp3, witch take a large amount of memory, and eventually make the player crash. In the Wii this happen after few minutes.

After some googling, I've found that the only solution is to reload the stream after some time, freeing the buffer.
On a pc this can be made every 30 minutes, but on the Wii every 2 minutes.

To avoid the pause when flash reload the stream, is possible to preload in the background another Sound object, and then crossfade the two. In this way there is only an imperceptible glitch due to the lack of synchronization of the two streams.

So here how to do a radio player in flash without the memory leak:

  1. In a Sound object snd1 load the stream
  2. After some time (2 minutes on the Wii, depending on the bitrate), start loading another Sound object, snd2
  3. After a "buffer time" (depending on the connection, 10 second should be fine) fade the two Sound
  4. Free the fist sound snd1 = null
  5. Repeat from step 2

Remember that you have to pass a movieclip to the Sound object:

Actionscript:
  1. var snd1 = new Sound(_root.sndMc1);

And when you free the object you have to wait a frame for the garbage collector to free the memory:

Actionscript:
  1. snd1 = null;
  2. //next frame..
  3. snd1 = new Sound(_root.sndMc1);

Update: You can reload the same stream in another Sound object in this way:

Actionscript:
  1. snd2.loadSound("http://server:8000/;"+Math.random());

Without the ";"+Math.random() Flash will reuse the same connection

Here the source code of a proof-of-concept player:
Internet radio flash player

Listening to music on the Wii

Saturday, February 3rd, 2007

Update: Now it's needed only a shoutcast server, I'm working on removing the web server too

Wii I own a Wii!
And I'm playing more with the opera browser+flash than with Zelda...
My first experiment is to stream music from the pc to the Wii.

So here a quick how to:

Note: I've encountered some problems because of a weird bug in the flash Sound object, witch I'll explain in the next post. Update: here the post.
There are still some imperceptible "glitches" every two minutes, but the overall quality is good.

Notice that the player hasn't any interface yet and its required to run three(!) servers. In the next days I'll try to improve those things.

Requirements

You need:

It is possible to swap every item in the list with a Mac/Linux alternative, I'll leave it to google.

The server(s)

Download and install the SHOUTcast server.

In sc_serv.ini change the password and make it private:

CODE:
  1. Password=changeme
  2. PublicServer=never

Now start the server.

This has to run on the same machine of the webserver due to the security restrictions of the flash player.
We need two servers because flash refuse to open another connection to the same server. (And we need to do that to avoid memory leaks)

Stream

Download and install the Shoutcast winamp plugin.

Start winamp.

Select Options->Preferences->DSP/Effect->Nullsoft SHOUTcast Source DSP
and put the new password and the server port (8000 by default)

Shoutcat plugin settings
Now the music you listen will be streamed to the shoutcast servers.

The player

Now, get the swf player:
Shoutcast stream flash player

It hasn't any interface yet, I'll do that in the next days.

Put the swf in your web server and pass your ip as a flashVar in wiinamp.html:

HTML:
  1. <param name="movie" value="stream.swf" />
  2. <param NAME=FlashVars VALUE="stream1=http://192.168.1.33:8000/" />
  3. <embed src="stream.swf" FlashVars="stream1=http://192.168.1.33:8000/" />
  4. </object>

8000 and 8002 are the ports of 8000 is the port of the stream servers.

Listen

In the Wii Internet Channel open http://*yourip*/wiinamp.html and relax :)

To Do

  • An interface for the player
  • try Icecast to get rid of the second server and the webserver (for now it made flash unstable)

Landcraft

Wednesday, December 27th, 2006

Landcraft landscape generator

This is a STUNNING landscape generator in Flash.
I've thought about doing something like this so many times, but I didn't know from where to start :) I wonder how many games can be made with it.

Visit: Landcraft - landscape generator in Flash