AsWing modifications

It’s a bit since I started using AsWing. It’s really a complete ui framework for flash with many useful components.

But as usual, when using a component set there’s always something missing. For this reason I just added to aswing these 2 components: JMultipleSlider and JLabelSlider. The first one is just a slider with the possibility to add multiple thumbs while the second one has a similar behavior to the Adobe’s label slider added in the last CS5 applications.

Amethyst Actionscript editor

amethyst screenshotIt’s since the first time I used Eclipse that I’m waiting for an actionscript editor non eclipse based!

I never like eclipse and hated all its problems.
Unfortunately Adobe decided to implement its editor over eclipse and also other nice editors, like fdt, used the eclipse framework to build their own editors.
I used Visual Studio for a while but that was enough to make me fall in love with it.
Visual Studio is indeed the best editor at all, without doubts!
Finally I discovered an interesting project for editing actionscript projects integrated into Visual Studio.
Amethyst is still in beta and probably too premature to be used in large production environment, but it’s a great news for me.
I hope they’ll continue in the development and create a serious competitor for Flash Builder.
For more info visit their product page: http://www.sapphiresteel.com/Amethyst-Product-Page

ZaaIL adds support for 40+ image format to Flash

Zaalabs yesterday announced the release of an opensource ( under MIT license ) library, written using Alchemy, which will allow swf to load at runtime more than 40 different image formats ( you will have access to the bitmapdata of the loaded file ).

This is indeed a great news ( I’m thinking in particular to the benefits it can have for us at Aviary )!
This actionscript library is a porting of the DevIL library. And in fact reading at the features list of the DevIL library you can see that a lot of image formats are currently supported:
  • Windows Bitmap – .bmp
  • Dr. Halo – .cut
  • Multi-PCX – .dcx
  • Dicom – .dicom, .dcm
  • DirectDraw Surface – .dds
  • OpenEXR – .exr
  • Flexible Image Transport System – .fits, .fit
  • Heavy Metal: FAKK 2 – .ftx
  • Radiance High Dynamic – .hdr
  • Macintosh icon – .icns
  • Windows icon/cursor – .ico, .cur
  • Interchange File Format – .iff
  • Infinity Ward Image – .iwi
  • Graphics Interchange Format – .gif
  • Jpeg – .jpg, .jpe, .jpeg
  • Jpeg 2000 – .jp2
  • Interlaced Bitmap – .lbm
  • Homeworld texture – .lif
  • Half-Life Model – .mdl
  • MPEG-1 Audio Layer 3 – .mp3
  • Palette – .pal
  • Kodak PhotoCD – .pcd
  • ZSoft PCX – .pcx
  • Softimage PIC – .pic
  • Portable Network Graphics – .png
  • Portable Anymap – .pbm, .pgm, .pnm, .pnm
  • Alias | Wavefront – .pix
  • Adobe PhotoShop – .psd
  • PaintShop Pro – .psp
  • Pixar – .pxr
  • Raw data – .raw
  • Homeworld 2 Texture – .rot
  • Silicon Graphics – .sgi, .bw, .rgb, .rgba
  • Creative Assembly Texture – .texture
  • Truevision Targa – .tga
  • Tagged Image File Format – .tif
  • Gamecube Texture – .tpl
  • Unreal Texture – .utx
  • Quake 2 Texture – .wal
  • Valve Texture Format – .vtf
  • HD Photo – .wdp, .hdp
  • X Pixel Map – .xpm
  • Doom graphics

Flex sdk 3.5.0 problem with ternary operators

I’ve got problems to isolate the problem into a very big project with many linked sources. After hours inspecting and commenting lines of code trying to figure out the reason why flex gave me an “internal error” I found the problem.
This very simple script was crashing the flex compiler if using the 3.5.0 sdk ( revision 3.5.0.12683 ).
Fortunately the 4.0.0 compiler works fine. At the end it seems to be the combination of “+” and “-” and the ternary operator.
package
{
   import flash.display.Sprite;
   public class ternary_test extends Sprite
   {
      public function ternary_test()
      {
         var n: Number = 0;
         var d: int = 3;
         var k: int = 5;
         var j: int = 10;
         n = 1 + ( -( d == 0 ? k : j ) );
         trace( "n=" + n );
      }
   }
}

will cause the compiler to crash with the following stack trace:

compile:

    [mxmlc] Loading configuration file /Applications/Adobe Flash Builder 4 Plug-in/sdks/3.5.0/frameworks/flex-config.xml

    [mxmlc] Error: null

    [mxmlc] java.lang.NullPointerException

    [mxmlc] 	at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:1290)

    [mxmlc] 	at macromedia.asc.parser.UnaryExpressionNode.evaluate(UnaryExpressionNode.java:51)

    [mxmlc] 	at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2153)

    [mxmlc] 	at macromedia.asc.parser.ListNode.evaluate(ListNode.java:44)

    [mxmlc] 	at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:1497)

    [mxmlc] 	at macromedia.asc.parser.BinaryExpressionNode.evaluate(BinaryExpressionNode.java:56)

    [mxmlc] 	at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2124)

    [mxmlc] 	at macromedia.asc.parser.ArgumentListNode.evaluate(ArgumentListNode.java:45)...

Vector.splice bug

Usually people complain about opensource projects because they lack of documentation ( that’s true most of the times.. ), but this doens’t happen only there…

Today I’ve spent a lot of time trying to understand why I was so stupid because I wasn’t able to concatenate 2 vectors of int using splice.
But for what you can read from the *official* Adobe documentation, which says (about the third parameter for the splice method):

… items — An optional list of one or more comma-separated values, **or a Vector**, to insert into the Vector at the position specified in the startIndex parameter.

Ok, that’s why I didn’t know why I couldn’t manage to make it work! This simple code gives wrong results:


var v1: Vector. = new Vector.();
v1.push(1);
v1.push(2);
v1.push(3);
v1.push(4);

var v2: Vector. = new Vector.();
v2.push(100);
v2.push(200);
v1.splice( 1, 1, v2 );

// Expected result: [1,100,200,3,4]
// Actual result: [1,0,3,4]

It seems that the third parameter is being casted into int and so only ‘0’ has been inserted into the first Vector!

I tried to look into Adobe jira bugbase and what I’ve found there is that it was a known bug since long time and it has been also moved to the tamarin bugbase.

The problem is that at the end they simply closed the bug as invalid bug because the documentation was wrong!

Funny

Alchemy installation problems under OSX

I’m writing this little issue I discovered today in the alchemy installation under OSX, in case someone else is having the same problem…

In fact, today I decided to makes a little swc library for an actionscript project using alchemy ( because of the lacks of union in flash ), so I downloaded the alchemy toolkit for OSX.


I spent a couple of hours trying to make it working on my Snow Leopard and because I’m not a shell and perl expert I finally moved to the linux toolkit under ubuntu ( even if on linux the Flex builder is really far to be usable!)
Anyway, this evening I decided to spend some more time trying to understand why when I was trying to execute the alchemy “gcc” script ( the ones inside the achacks folder, which is a perl script) nothing happened.
After long time with old style “print” debugging strategy, at the end I discovered an error in the “config” script in the main alchemy installation folder.
At this line (line 33):
if echo $MACHTYPE | grep darwin &> /dev/null; then
I had to modify it into:
if echo $MACHTYPE | grep -i darwin &> /dev/null; then
because the command “echo $MACHTYPE” outputs “x86_64-Apple-Darwin“, with the uppercase “D”.
In fact, after that modification everything finally worked!

Thoughts about flash on the iPhone

I didn’t have the chance yet to try out Flash CS5, but I’m still a bit concerned about the new feature that makes users able to compile their own application into valid iPhone apps.

Things look really good if you look at the examples and if you talk with the people that already had the chance to try this feature out. But I must remember that usually the excitement for a new – and let’s say outstanding – feature usually cannot guarantee the final result to be acceptable. I fear that this feature might evolve the same – bad – way as Alchemy did: they started with a promising project that then felt down to a side project because many users shown that it was possible to achieve the same or better results by just using plain AS.

A few weeks ago I started spending my free time on experimenting with generating a valid iPhone app from a SWF file. I didn’t know anything about the fact that the Adobe would have put the same feature in Flash CS5.
My approach wasn’t too sophisticated: basically, as long as I didn’t have so much time to spend on writing a full binary converter, I was parsing the SWF and then generating static Objective-C/C++ (well mostly C++ and I’ve used Objective-C as glue where strictly required) code that then was compiled by Xcode to a working iPhone application.

I stopped once I figured out that Adobe was going to promote a similar thing (even if their approach is better and probably more powerful), but I had time to figure out a few issues that they may encounter (or maybe they already encountered):

  • Generated applications are really big in size, mostly because there is a lot of glue code generated and because you need to replicate the FPL API in C++ to be able to easilly convert the SWF into an iPhone app;
  • ActionScript is a dynamic language, and this dynamicity must be taken into account when generating binary code (or source code in my situation). Even if using LLVM probably helped with this, you will always need to generate additional dynamic checks that slow down a lot the execution;
  • The FPL doesn’t support (yet) threading API, nor the AIR version does. So, if they want to preserve the portability of a flash game so it can be run with AIR or on the iPhone without any change, they are limiting the developers on building just quite simple games;
  • The same can be said for all the other native APIs. AIR for instance has multitouch API, which are however at a lower level then the ones provided by the iPhone;
  • The other big issue is rendering performance. When I was working on my project, I’ve tried many different approaches to figure out which one was the best to render decent vector graphics with a good framerate on the iPhone. Core Graphics is not an option, as long as it is as slow as hell. Using OpenGL to render the graphics increases a lot the performances, but adds a few limits to the rendering quality. The best approach I found was to mix caching and OpenGL rendering together, but that was not working fine with rapidly changing graphics. But I must say I didn’t have the same knowledge as the FPL developers on this topic and I didn’t have months to work on that too …
  • iPhone developers must take special care for memory and resource management; probably having a huge bootstrapping code and transition structures won’t help.

What I fear most actually is that they’ll be able sooner or later to solve all the issues and create a good product, but probably that product won’t be suitable for complex applications, that will be always developed directly using XCode.

That said, I think that probably a better approach would have been to figure out a way for Adobe to include the Flash Player on the iPhone. It’s already ready and I really can’t understand why they don’t release it (it must be Apple, and probably because having a Virtual Machine on the system will break the basis the App Store has been built over).
Having the FPL on the iPhone will still limit us, but it will open up a brighter future for AS developers who want to release apps that runs on the iPhone too (Did you ever heard about compile once, run everywhere?).

So let’s wait and see what happens. What I’ve seen so far on the app store are really simple games that don’t use so much resources, so I can’t really say yet if they did a great job or not …

Flash for iPhone!

Well, it’s not true at all, but it’s something like that ( they enabled this by using the Low Level Virtual Machine (LLVM) compiler infrastructure).

With the upcoming Flash CS5 we will able to create iPhone applications using Actionscript 3 and the Flash IDE (Flash CS5)!
It also seems that in the future it will be possible to compile iPhone apps using the free flash compiler.
We won’t have flash iphone apps, but native iphone applications:


iPhone applications built with Flash Platform tools are compiled into standard, native iPhone executable packages and there is no runtime interpreter that could be used to run Flash byte-code within the application.

Most of the Flash Player 10 and AIR 2.0 APIs will be available, so for instance: pixel Bender filters and also dynamically loading SWFs that contain ActionScript (but the Actionscript will be ignored since there’s no flash VM in the iphone).


The Cons.

We won’t be able to test our apps using the Mac iPhone simulator.  And we cannot use the iPhone controls with actionscript.

Read original entry here:
Read the developers’ FAQ: