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

Find programming documentation

I found two very useful reference sites which aggregate various documentation within an ajax suggestion search textbox (like google suggest).

QuickRef.org [view]
Very fast an easy, includes C, C++, CSS, HTML, HTML DOM, Java, JavaScript, MySQL, Perl, PHP, Python, and Ruby references. Unfortunely it does not include ActionScript reference. It has also a “add to google” button, to add a widget in your google homepage.

Fast API Search [view]
This includes ActionScript reference too! It allows to select which references to be used in the live search (such as  HTML, CSS, CSS2, Javascript, Google code, XML, XSL, XPath, XSD, PHP, Ruby, Perl, AS, ColdFusion, C, C++, MySQL, PostgreSQL, Oracle, Java…). Unfortunately this one does not include Python and it seems to be slower than quickref.org

Anyway, I think a couple of useful bookmark links.

Flex2 crazyness

After the interesting actionscript.it conference I decided to give more of my free time to Flex2 and expecially to components creation.
I must admit that ActionScript 3.0 documentation is probably the best documentation I ever seen about flash, but I can’t say the same thing about Flex developement.
Once I had to look for advanced features of Flex components, advanced compiler options etc.. I began to slam against a wall. The developer compoents guide is incomplete and does not cover all the aspects and it has some errors probably due to incorrect revision after the beta program.
So I had to search in the livedocs, but here there are missing links (many links still point to the beta version and they’ve benn removed) and the informations are spread in completely different pages…

Anyway, this is my first test with Flex2 components.. I just made a porting of my color picker as2 component.. that’s because the builtin flex2 picker is too poor.

The problem with the compiled SWC file is that Flex displays also all the other classes used in the component as they are different UI components and I didn’t find anywhere how to compile with compc an swc file which exposes just the UIComponent I want. The documentation says about “-include-component” compiler option, but it’s an error because the compiler does not allow that option!
This is the script I’m using for compiling it:
compc -source-path="." -namespace http://www.sephiroth.it/2006/mxml mxml-manifest.xml -if assets.swf images\assets.swf -if CPicker.png CPicker.png -include-namespaces http://www.sephiroth.it/2006/mxml -output "C:\Program Files\Adobe\Flex Builder 2\Flex SDK 2\frameworks\libs\sephiroth\CPicker.swc"

http://labs.sephiroth.it/flex_colorpicker/