Releases: BlazeDS & Flex Builder 3 Beta 3

Today is a good day for announcements!
I’ve just read the Adobe plans to release, as opensource (LGPL 3?), on labs its Remoting and Messages technologies under the codename BlazeDS.
Moreover Adobe published AMF binary data protocol specifications ( the technology on which the BlazeDS remoting implementation is based).
The source code will be available for download in early 2008

Second announcement is the release on labs of Adobe Flex Builder 3 Beta 3 (M4). Cool, I’m working almost all the time with flex!.. but why only mac and pc downloads are available? The Linux version is still the alpha released on 12 October!

Actually I almost switched to ubuntu, moreover the fact that there is Flex Builder also for Linux allowed me to spend more and more time on my ubuntu partition and I really feel satisfied. Flex Builder for linux is more and more stable than all the other Flex betas for Windows or Mac ( even if the more I use eclipse and the more I hate it… ), so why give us only that candy?

Flex Frameworks

Luke Bayes and Ali Mills of PatternPark made a presentation for the Silicon Valley Flex Users Group (SilvaFUG) of 9 different frameworks and toolkits for creating Flex applications: Cairngorm, PureMVC, ARP, MVCS, Flest, Model-Glue: Flex, ServerBox Foundry, Guasax, and Slide.

Watch the presentation: http://adobechats.adobe.acrobat.com/p12266504/
See the slides: http://www.asserttrue.com/files/ApplicationFrameworks/index.html

Their Conclusion?
PureMVC by Cliff Hall beats out the alternatives
“.

  • Composition over inheritence
  • Liberal use of Interfaces
  • Indirection is used but not overwhelming
  • Instance members hide singleton references from application code
  • MXML views can be extremely thin
  • Benefits of Cairngorm, with few of the disadvantages.

I must admit I never used PureMVC, the only framework I’m currently using is Cairngorm, even if I bookmarked the pureMVC page long time ago promising myself to watch it more in deep. Now it’s time to keep the promise.

Adobe Image Foundation

Everyone already knows about the new Flash player 10 (Astro) features that adobe presented at MAX, and above all the new image processing language (Hydra) that it will support in the future.

Today I finally found a couple of hours to play with AIF, even if no more because of my limitations knowledge of image processing algorithms 🙂
In fact I was able to broke different times my video card driver (with a panic black screen)!

Anyway after all I did just a couple of experiments trying to convert a couple of scripts I already did using the old flash 9 bitmapdata filters..


kernel Snn
{
parameter float size
< minValue: 0.0; maxValue: 8.0; defaultValue: 2.0; >;
parameter int step
< minValue: 1; maxValue: 10; defaultValue: 1; >;
void evaluatePixel(in image4 src, out pixel4 result)
{
pixel2 coord = outCoord();
pixel4 valueC = sampleLinear(src, coord);
float theStep = float(step);
float2 point = float2(0.0,0.0);
float x = 0.0;
float y = 0.0;
float count = 0.0;
pixel4 sum = pixel4(0.0, 0.0, 0.0, 0.0);
pixel4 valueA;
pixel4 valueB;
for( x = - size; x < size; x+= theStep)
{
for(y = -size; y < size; y+= theStep)
{
valueA = sampleLinear(src, pixel2(coord.x + x, coord.y + y));
valueB = sampleLinear(src, pixel2(coord.x - x, coord.y - y));
if ( any(lessThan(abs(valueC - valueA), abs(valueC - valueB))))
{
sum = sum + valueA;
} else {
sum = sum + valueB;
}
count = count + 1.0;
}
}
result = sum/count;
}
}


kernel Websafe
{
parameter float value
< minValue: 0.0; maxValue: 500.0; defaultValue: 10.0; >;
void evaluatePixel( in image4 src, out pixel4 result)
{
result = sampleLinear(src, outCoord());
result = (floor((result*255.0)/51.0) * 51.0)/255.0;
}
}

As you can see it’s nothing new, they’re just my first steps in this new language.. don’t spend much time on these example, look at the coolest examples shown in the Hydra gallery instead!

SharedObject reader plugin for FD3

In the past week I was working on the SharedObject plugin for FlashDevelop 3.
First I just made a port of my previous sepy sharedobject reader python code into C#, but then for the new AMF3 sharedobject encoding I found this java class very useful.
By the way, after coding and coding.. I finally managed to create a good solution (ok, I have to test it a lot again…).
You can find the plugin here: http://code.google.com/p/fdplugins

But the interesting thing I found was another!
Flash does not read the sharedojects correctly (at least the amf0 ones)!

To reproduce this bug follow these steps:

Create a new document (flash8 / as2)
– Add this code in the timeline:
var so:SharedObject = SharedObject.getLocal("flash8", "/");
so.clear();
so.data.obj1 = new XML("");
so.data.obj2 = new Date();
so.data.obj3 = so.data.obj2;
so.data.obj4 = {a:1, b:so.data.obj1, c:[1,2,3], d:so.data.obj2};
so.data.obj5 = so.data.obj4.c;
so.flush();

you will see this in the debug view variables:
Variabile _level0.so = [oggetto #1, classe 'SharedObject'] {
data:[oggetto #2, classe 'Object'] {
obj1:[oggetto #3] {
;
},
obj2:[oggetto #4, classe 'Date'] {Sat Sep 22 19:31:31 GMT+0200 2007},
obj3:[oggetto #4, classe 'Date'],
obj4:[oggetto #5, classe 'Object'] {
d:[oggetto #4, classe 'Date'],
c:[oggetto #6, classe 'Array'] [
0:1,
1:2,
2:3
],
b:[oggetto #3],
a:1
},
obj5:[oggetto #6, classe 'Array']
}
}

ok, now remove all the code you just written and leave just this line:
var so:SharedObject = SharedObject.getLocal("flash8", "/");
and see the variables list again, you will see this:
Variabile _level0.so = [oggetto #1, classe 'SharedObject'] {
data:[oggetto #2, classe 'Object'] {
obj1:[oggetto #3] {
;
},
obj2:[oggetto #4, classe 'Date'] {Sat Sep 22 19:31:31 GMT+0200 2007},
obj3:[oggetto #5, classe 'Date'] {Sat Sep 22 19:31:31 GMT+0200 2007},
obj4:[oggetto #6, classe 'Object'] {
d:[oggetto #7, classe 'Date'] {Sat Sep 22 19:31:31 GMT+0200 2007},
c:[oggetto #8, classe 'Array'] [
0:1,
1:2,
2:3
],
b:[oggetto #6, classe 'Object'],
a:1
},
obj5:non definito
}
}

they are different! (both data.obj5 and data.obj4.b changed)

For what I understand during my experiments it seems that flash does not write into its internal references table the XML objects while reading back the file and so next time it open the sharedobject all the references after the xml are broken or just they point to a different object.

FDTracer

Click to see a preview
Andrew has just posted on his blog FDTracer, a FlashDevelop plugin which does more or less the same of my Firefox FlashTracer plugin.
Once you’ve installed the .dll plugin remember to change the plugin settings and insert the correct path of your flash player log path. ( Read more here )

Remember also that you need, like for FlashTracer Firefox addon, a debug version of flash player. It can be downloaded here


					

FlashDevelop 3, unsorted plugins

Last week I started a new Flash project, and unluckily it was an ActionScript 2 project!…
Oh, It was so long time since I last wrote as2 code… I didn’t remember it’s so boring and poor . Actionscript 3 it’s a complete different world compared to as2, now I can understand this better. BTW, I decided to use for this project FlashDevelop 3. I still remember the days when they first announced the birth of this project (those days when I still was writing sepy…), but I never really try it in depth.
After 2 days using it I was fully satisfied of my choice, this is really an awesome project!

But.. because I’m too curious, I wanted to take a look also at the source code.. just to a look. Also because I never coded in C#.
Anyway, after a couple of days I found that making plugins wasn’t so hard, even if for a c# newbie like me (and also thanks to some tip from Philippe), and so I wrote down some testing plugins. they’re not killer plugins at all, just simple program addons.

1. SourceOptions: this is the very first I did and in fact it doesn’t do anything special. In AS2 and AS3 files it adds to the scintilla contextual menu three more options: “organize imports” (similar to the  one in flex), “add getter/setter method” and “add accessor method” (when you click on a class variable)

2.  Bookmarks panel: This create a docking panel displaying all the current opened files and keep updated their bookmarks.

3. Flash API panel: Similar to the one included in the Flash IDE. Just give (in the plugin settings) the path (one or more) of the xml included in the ActionsPanel flash directory and it will display the full list of all the language available actions/methods/classes. Double click on an item will insert the command in the document text giving also the description of the selected command in a tooltip.

Tip: those xml file can be found in a directory like this:

C:\Users\sephiroth\AppData\Local\Adobe\Flash CS3\en\Configuration\ActionsPanel\ActionScript_3\ActionsPanel_3.xml

4.  ASClassWizard: It overrides the “New Class” project menu command and displays a wizard dialog for creating a new ActionScript 2/3 class. Give the package, the classname, super class, implementing interfaces and it will create your class.

Note: Remember that those plugins work only with the last 1769 FlashDevelop 3 build, available here:

http://www.flashdevelop.org/community/viewtopic.php?t=1734

Project Home at http://code.google.com/p/fdplugins with all the latest versions of these plugins and more plugins

FontReader, convert TrueType fonts in graphics with Flex

In the last period I was trying to find a way to convert a TrueType font character into graphics for a new Flex project.
First I found a way using TTX which can convert a font file into an XML with all the Glyph informations needed to recreate the font outline.

But this process requires that all the .ttf files should be converted using TTX before thay can be used in Flash.
So I investigated a bit more and I found a really useful and really well done java project: TypeCast.
What I’ve done next was just to do a porting of the available java code into Actionscript 3 and it works like a charm! It can read a .ttf file and extracts all the font informations, including all the glyph outlines.

See a demonstration of thie Flex application.

Here you can download the source code:
[attachments docid=1026 force_saveas=”1″ logged_users=”0″]

senocular.com TransformTool modification

Recently I used the great senocular Transform Tool for a Flex2 project.
We just needed to made a little modification to the way the scale transformation worked. Something like the Photoshop’s Transform tool, where the registration point only affects rotation, while all the scale controls are independent from the registration point.
For this reason I modified a bit the TransformTool code to allow this feature to be set on/off (I called this scaleWithRegistration)

Hold down SHIFT key while rotating or scaling to constrain transformation
Double click to complete transformation.

[kml_flashembed publishmethod=”static” fversion=”10.0.22″ movie=”http://blog.sephiroth.it/wp-content/uploads/2007/07/test_transformation.swf” width=”400″ height=”300″ targetclass=”flashmovie” bgColor=”#cccccc”]

Get Adobe Flash player

[/kml_flashembed]

This is the code used in the mxml Application file:

< ?xml version="1.0" encoding="utf-8"?>



< ![CDATA[ import com.senocular.display.TransformTool; [Bindable] private var tool:TransformTool; private function init():void { } private function onImageComplete(event:Event):void { var timer:Timer = new Timer(1000,1); timer.addEventListener(TimerEvent.TIMER, function(evt:TimerEvent):void { createTool(null); }); timer.start(); image.addEventListener(MouseEvent.CLICK, createTool); } private function onDoubleClick(event:MouseEvent):void { removeChild(tool); tool = null; } private function createTool(event:MouseEvent):void { if(!tool) { tool = new TransformTool(); tool.addEventListener(MouseEvent.DOUBLE_CLICK, onDoubleClick); tool.target = image; tool.scaleWithRegistration = scale_registration.selected; addChild(tool); } } ]]>



[attachments docid=1018 force_saveas=”1″ logged_users=”0″]