Just read on Aral's blog that flash is going open source, this is great news!
As Adobe will be opening up the AMF and the porting APIs for the flash player. This means that we'll see flash in even more platforms and flavors, and will give projects like haXe a great boost!
Some reference links:
http://flashmobileblog.com/?p=91
http://aralbalkan.com/1332
This week a friend of mine was making me questions about the binary sockets in flash, so I remember to post an example about it. I have been using a lot of XmlSockets for the last 2 years with the latest versions of flash, so it was really easy to implement binary socket because they are very similar. Binary sockets are really a great improvement in flash. I have seen a lot of implements like joysticks servers, connections to mail servers and so on; there are some examples on byteArray.org.
This example is a simple chat, it have a C sharp server and a flash client. Just click on socketServer.exe to start the server it will be listening on port 8000, then start client.exe and hit connect button. The server will accept multiple connections, so you can start more than one client, if you are testing it in different machines, just check IP address of the server and write it on the client Ip text Field and hit connect button.
The source code for client and server are on the example zip, it was done using Visual c# express 2008 and Adobe Flash 9.
First of all I don’t really use flex to do flex stuff and I’m not a big fan of flex. But in my latest project I had to build with flex an interface witch would be always diferent (a dynamic interface). In the beginning we thought in parsing some type of XML, but if we are in flex why not parse MXML? I took a look over the internet and I only found MXMLLoader component v0.01, witch didn’t compile on flex builder 3 and was really in the beginning. So there it is, as XMMLLoader class for flex builder 3. You just have to instantiate the class with the mxml :
Loading the swf is easy; you can make a normal loader and load it. And now the tricky part, if the swf is a swf flash file you can call the function you want, but in flex, because it have 2 frames, (first frame is just for loading), you need to wait until frame 2 is available, you can’t also access directly to a swf, you have to refer application before, so there’s the code:
you can also add Event Listener's to myClip.application , like myClip.addEventLIstener(“ON_CHANGE”,function), so by this way you can embed flex swf into an flash application and communicate with him by calling function and receiving events.
A time ago I had I little problem, I was doing an application and it had some severed changes, at some point I hasn’t capable of detect some mouse down events because I had a lot of sprites inside of sprites inside of movieClips with lots of event listeners and so on. So I and Hugo found this solution. Basically you put a generic mouse down event on stage and pass an array of objects with the name of the display object you want to catch the event and the name of the function you want to call. One good thing is that you can catch more than one event at the same time even if the displayObjects are in front of another displayObjects.
Note: this is really bad programming, if you can don’t use it, use only in severe cases.
This function can be used to test a hit between a displayObject with an amount of displaysObjects (Array). It will return the displayObject where the biggest contact area occurred. Note: it uses the bounding boxes.
How many times do we have an XML that comes from a webservice or from a source
that we don't know. In these times getting that xml to a file can be cumbersome (imagine that you have authentication). So how about a nice little way to see all the node and attribute names in that xml, here's how:
For this file we'd get something like:
NODE NAME: Mouse
NODE NAME: ScreenSaver
ATTRIBUTE OF ScreenSaver NAME: desc
NODE CHILD OF ScreenSaver NAME: Active
ATTRIBUTE OF Active NAME: desc
NODE CHILD OF ScreenSaver NAME: File
ATTRIBUTE OF File NAME: desc
NODE CHILD OF ScreenSaver NAME: Time
ATTRIBUTE OF Time NAME: desc
ATTRIBUTE OF Time NAME: min
ATTRIBUTE OF Time NAME: max
ATTRIBUTE OF Time NAME: unit
To solve the problem of the image sequence I already know the solution, some time ago me and Pedro did something like this. This time I made two different versions, a class version (project in flex 3) and a component to flash cs3. With this solution, you can keep your images outside the project and manipulate them like a movieClip.
Arguments and Parameters
folder -> images folder.
filename -> first part of filename (ex: image1.jpg ), it should be "image".
type -> extension of the filename (jpg,png).
startImageNum-> first image number.
endImageNum->last Image numer.
For the class (ImageSequencer.as) version use:
For the component version:
Run “ImageSequencer.xmp” to install component. Run flash cs3, go to Windows > Components > Standard Components, drag ImageSequencer to the stage and fill the Parameters.
Last month I had to run one image sequence with 100 images, so I create a new movie in flash, put every image in every frame, image1 to frame1, image2 to frame2, etc. It ran ok in flash but when I exported it to flex (SWC format) the problem began. Every time I did some modifications to one of the SWC files in the project it started to delay 15 minutes to build. So be careful with the number of images inside a SWC file, it can be very boring.
Today our good friend Gabor announced his new baby: Decorator.
Decorator is an Image Generator that exports/print postscript from it. Which means you can print your images a large as you want, without any pixel.
It generates lovely outputs and I can already see the potential to this awsome tool, my living room will love this new way of wallpaper, and the best about it's always unique due to a random seed generator.
I've had the opportunity to try the closed beta, and I must say that I was impressed with the outcome of just a little fiddling with the engine.