Flash camp on the beach (Rimini)

The new Flash camp will be in Italy, Rimini, and will take place on 5th of September. Participation is free!

Order your ticket via eventbrite.
The meeting will take place at Hotel Sporting Viale Vespucci, 20 47900 Rimini (Italy).
As a camp everybody can join us as a speaker, today we have a great group of speakers already confirmed:
  • Jaco Pixeldump (www.pixeldump.org)
  • John Lindquist (http://pv3d.org, http://flex4.org)
  • Joost Nuijten
  • Eros Marcon (actionscript.it)
  • Simon Slooten (www.simonslooten.com)
  • Matteo Lanzi (aka Gallo_Teo flex-developers.org)
  • Adam Flater
  • Michael Labriola (http://blogs.digitalprimates.net/codeSlinger/)
  • Rich Tretola (http://blog.everythingflex.com)
  • Gabriele Farina (www.sephiroth.it)
  • Alessandro Crugnola (www.sephiroth.it)
  • Michael Plank (www.powerflasher.de)
  • Rich Tretola
  • Matt Chotin
  • Giorgio Natili (flex-developers.org)
What’s New in Flex 4 (Matt Chotin) 9:00 – 9:45
Most of us have heard that the Flash Platform tools are getting a major upgrade with Flex 4.  We’ll give a high-level overview of what’s coming in the three major components: Flash Catalyst, Flash Builder, and the Flex Framework.
Concepting Rich Internet Applications (Joost Nuijten) 9:50 – 10:35
The pitfall of Flex applications is to thrown in a bunch of buttons of fields, the Flex skin looks nice, and the say: “There we have another Rich Internet Application”. To my opinion it is much more than that. It’s about creating the ultimate user experience by mixing interaction design, emotion and common sense.
“One key element of a good ergonomic web application, or at least a sign that it works ergonomically, is that you want to stay there — like a big old comfortable chair that wraps you up and you just don’t want to leave it, ever… (well, at least, maybe, for a little while more…)”
(SyMetric Sciences, Inc., 1999)
Flex 4 in 3D: The UI of the Future is Now! (John Lindquist) 10:40 – 11:25
Ok, the title might be a bit over-the-top, but the new 3D features of Flash Player 10 do allow us to pull off some pretty cool tricks. This session will cover step-by-step how to take advantage of the the 3D api. We’ll start by creating our own custom and reusable 3D layouts and work our way to creating 3D components. Once we’ve brought everything together into a full 3D application, we’ll end with a  discussion of the advantages and disadvantages of using 3D in user interfaces.
TESTING WITH FLEX AND FLASH BUILDER (Michael Labriola) 11:30 – 12:15
Unit testing in Flex is taking a giant leap forward. First learn about the latest technologies, their integration into the Flex developers workflow and the promises offered by these advancements. Then learn how to write tests using these new methods, how those tests can be used effectively and the theory behind their use. Finally, learn about the extension points and how numerous testing projects can now converge to offer solutions now and into the future of Flex.
FDT – Pure Coding Comfort (Michael Plank) 12:20 – 13:00
You want to improve your ActionScript/Flex development workflow and boost your programming
efficiency? Michael demonstrates how the coding flow completely changes with FDT by using
features like Quick Fixes and Auto Completion. FDT is an Eclipse based IDE for ActionScript
and MXML development that provides pure coding comfort.
Not only professionals prefer working with FDT, the tool is also appropriate for beginners
because of supporting features like e. g. live error highlighting. A short speed coding example
on stage illustrates how fast the coding workflow can be with FDT.
Mate – The beauty of a simple framework (Simon Slooten) 13:30 – 14:15
Mate is a Flex framework that is simple, elegant, scalable and simply beautiful. In this session you will get an introduction to Mate, as well as look at a Flex Application that uses Mate
ByteArray:  extend your swf apps with extra features (Marco Fusetti aka Jaco) 14:20 – 15:05
ByteArray is a great flash player feature that let you load/treat/save binary data.
Let’s look into some techniques and examples on adding features such swf black box, sound data, external swf inspection and more.
Using Merapi (Adam Flater) 15:10 – 15:55
An introduction to native hardware and software integration in Flash
Flex sdk (Matteo Lanzi aka Gallo Teo) 16:00 – 16:45
How to patch it to solve common architectural problems and improve performance
Flash Catalyst/Flash Builder 4 ˆ Designer/developer Workflow (Eros Marcon) 16:50 – 17:35
How to design and optimize an artwork for FC, importing design in FC, adding interaction, working with states and transitions, wiring FC interactive UI with real data in Flash Builder 4
Extending flash applications (Alessandro Crugnola aka Septhiroth and Gabriele Farina) 17:40 – 18:25
A quick walkthrough from static plugins to dynamic scripting
Java, Flex and Model View Presenter (Giorgio Natili) 18:30 – 19:05
Flex loves Java applications that expose API deployed under Blaze DS, follow us in a complete tour that shows the process to define good API for a Flex / Air application that follow Model View Presenter design pattern and get the key points of GUI Architectures for responsive applications.
Flex image uploading and manipulation via Pixel Bender (Rich Tretola) 19:10 – 19:40
Flash Player 10 introduced some new features including the ability to write a file to the users file system as well as the usage of Pixel Bender filters. In this session you will see how to upload an image within a Flex application,  filter the image with a Pixel Bender filter, and then use the JPEGEncoder class to encode the filter image to a ByteArray.

[Bindable]? No, thanks

Working on huge projects sometimes let you take long optimization sessions.
During one of these sessions I was trying to find a way to optimize a bunch of code which was taking too long time to process.
The big big bottleneck I discovered, and I didn’t know before (my fault), was the **[Bindable]** attribute of one of the classes included in the process.
This process was creating something like 1 million instances of this class during its life. After a first optimization in which I created an object pooling, thus reducing the total execution time from 16 seconds to 13, I found this incredible trick which reduced the total execution time to **1 second!!**

Let’s say you have a class like this:

package it.sepy.test

public class RGB
private var _blue: int;
private var _green: int;
private var _red: int;

public function RGB()

public function get blue(): int
return _blue;

public function set blue( v: int ): void
_blue = v;

public function get green(): int
return _green;

public function set green( v: int ): void
_green = v;

public function get red(): int
return _red;

public function set red( v: int ): void
_red = v;

and a simple script which create 100000 instances of this class (my script wasn’t like this, but for simplicity I’m doing this example):

import flash.display.Sprite;
import flash.system.System;
import it.sepy.test.Pool;
import it.sepy.test.RGB;

public class test extends Sprite
public function test()

private function startTest(): void
var t1: Number = new Date().getTime();
for ( var i: int = 0; i < 100000; i++ ) { var rgb: RGB = new RGB(); rgb.red = i % 255; rgb.green = i % 255; rgb.blue = i % 255; } var t2: Number = new Date().getTime(); trace( 'total execution time:', ( t2 - t1 ), 'ms' ); trace( 'memory usage:', System.totalMemory / 1024, 'kb' ); } } }

now launch the script and in the output I have this result
total execution time: 2381 ms
memory usage: 5924 kb

NOW. Remove the **[Bindable]** property from the RGB class and launch again the test script. See at the output console and the new results are:
total execution time: 236 ms
memory usage: 2720 kb

So, I know that bindable were not created for this kind of jobs, but if using it make 10 time slower my scripts, then I don't see any valid reason to use it anywhere.

Multiple objects using Senocular TransformTool

Senocular TransformTool is one of the best and most used components around the net. It is really useful for those (include me) who don’t want to fight against Matrix, concatenation of Matrix and all those painful stuff…

The only ‘lack’ of that component is that it does not support multiple objects as target. If you want to transform n array of elements at the same time you should have all those elements in the same parent DisplayObjectContainer and then set that parent as target of TransformTool.

But maybe sometimes this is not possible due to various reason and you want to use different items with different parents as dataprovider.

This is the solution I actually use for that particular situation (Remember that I’m using a modified version of the TransformTool)

This is the final result: ( Ctrl+click on the tree leaves to multiple selection )

Live Demo of the Trasform Tool using multiple objects

( Here you can download download the source files ).

In few words the solution I found is this:

Create a temporary layer which will be the TransformTool target.
For every item in the selection Array create a temporary shape with the size of the getBounds() of the real object. Store this shape into the temporary layer, assigning to it the concatenated matrix of the real object.

Once there’s a transformation of the temporary layer get every shape transform matrix and assign back to the original object.

Probably there are many and better solutions to do the same, this is just the one I found, maybe someone has better approach to this problem (and he is welcome here!)

A long journey through chunked transfer and file uploading

It has been a while since I wrote the last post … I know, I’ve still quite a lot of stuff left opened but sooner or later you’ll get it. Don’t worry 😉

During the last days I’ve been working on improving some server side API for a client I’m working for.

Actually they’re using a mix of AMF and HTTP based API but, as long as the AMF implementation is unfortunately a bit unstable, they want to move to a full HTTP based API … that sounded quite easy: take a bit of HTTP, dress it with POST and maybe XML (or whatever other ingredient you like most) and you’ll have a good base to start porting the API.

But I’ve ignored a small particular that turned out to be really painful to manage by using just HTTP: sending efficently to the server big chunks of binary data.

Those were the requirements I had to fulfill:

  1. I have potentially really big binary files to be sent quickly to the server;
  2. I have to track upload progress somehow;
  3. I must be able to trigger the upload without the user interaction;
  4. I should rely on HTTP only;

And here the solutions I’ve tried to implement, and the conclusions I’ve achieved (well, I didn’t try all the options because I already knew that a few of them were not suitable for my situation, but they might be useful to someone and so I’m reporting them anyway).

Continue reading

Silverlight 3.0 beta

Today I discovered this page about the upcoming Silverlight 3.0 and I was really surprised about the ton of new features they are adding in this new release. In fact, reading at the features list it confusing me… it seems to me like I was reading a page with the flash player capabilities.. more or less.

If SIlverlight 2.0 was comparable, more or less to flash 5, I believe ( but I should test it before ) that this new version has quite all the features of flash 10.

  • Support for Higher Quality
  • Live and on-demand true HD
  • Perspective 3D Graphics
  • Pixel Shader effects
  • Bitmap Caching
  • New Bitmap API
  • Themed application support
  • Improved text rendering & font support
  • Deep Linking
  • Search Engine Optimization (SEO)
  • Element to Element binding
  • Application library caching
  • Binary XML allows communication
  • Local Connection
  • Out of Browser Capabilities

Moreover, dont forget, Silverlight has a couple of advantages above flash: a more powerful vector rendering engine and threads capabilities.

Read the full article here: http://silverlight.net/themes/silverlight/getstarted/sl3beta.aspx?AspxAutoDetectCookieSupport=1#whatsnew

P.S. …just because I continued following links around MS pages I also came across a new feature microsoft will add to C#, one of those features I always envy to python: the named arguments. I really find it useful, instead of writing twenty null arguments ( like when you create a textformat… ) you simply call arguments by name.

Aviary at 5th Avenue Apple Store

Wednesday January 28th at 4pm Aviary will be presented in New York at the Fifth Avenue Apple Store.
Raven, the vector editor I’m currently working on for Aviary, will make its first public appearance.

“If you haven’t seen it in action yet, you will have the opportunity to test drive it before we released it to the public.”
All attendees will receive a one year Free Pro account!”

If you are planning on stopping by, please RSVP on Facebook, space is limited.

AsYacc – first alpha release

Before going further with discussing how to add runtime scripting support to a Flash applications, I’d like to share with you the source code of a porting of Yacc I did a while ago. I did some simple modification to make Yacc able to generate ActionScript 3.0 source code instead of C. It works quite well and supports a lot standard Yacc features. There might be some issues – report them to me and I’ll try to fix them 🙂

You can easilly find documentation about Yacc searching Google (you can start here for example).

Usually Yacc is used in conjunction with a Scanner generator (like Lex/Flex), but I didn’t to any porting of commonly used Scanner generators yet.

Here you can download the sources. The source code should be portable and compilable on all the most common platform, but I didn’t tested it on Windows yet. To compile the source code on Mac or Linux, cd to the source code directory and type use:

gcc *.c -o AsYacc

Once you have the compiled binary file, you can run the Parser generator using:

./AsYacc -Hpackage=it.sephiroth.test grammar.y

Where grammar.y is a text file that contains the grammar of a language defined using the proper syntax (see the docs online for all the detailed information you may need).

Here you can download a simple calculator example that uses the RegexLexer described previously to implement the Scanner. For the ones who might be interested, here is the grammar used:
/* Infix notation calculator. */
%token NUM
%left '-' '+'
%left '*' '/'
%left NEG
%right '^' /* exponentiation */
exp { trace( $1 ); }
NUM { $$ = $1; }
| exp '+' exp { $$ = $1 + $3; }
| exp '-' exp { $$ = $1 - $3; }
| exp '*' exp { $$ = $1 * $3; }
| exp '/' exp { $$ = $1 / $3; }
| '-' exp %prec NEG { $$ = -$2; }
| exp '^' exp { $$ = Math.pow( $1, $3 ); }
| '(' exp ')' { $$ = $2; }