Flex2 and namespaces extending components

I took 2 hours to find a solution for that and I decided to blog it..
I was creating my new Flex2 component extending the UIComponent class and I need to define new custom styles for my own component…
Ok, i opened the “create and extend components” PDF guide and found that I need to put this code to accomplish it:
private static function classConstruct():Boolean
{
if (!StyleManager.getStyleDeclaration("ResizeManager"))
{
var newStyleDeclaration:CSSStyleDeclaration = new CSSStyleDeclaration();
newStyleDeclaration.setStyle("boxSize", 4);
StyleManager.setStyleDeclaration("ResizeManager", newStyleDeclaration, true);
}
return true;
}

That’s all, but at this time the compiler die with that error message “1000: Riferimento ambiguo a setStyle”, which in english should be: “1000: Ambiguous reference to setStyle“.
I google for some time but without finding a solution, then I discovered the problem. I was using in my component the mx_internal namespace, that was the problem. Once changed namespace everything was ok.

Flex2 again: CheckBox 3state

I continue with Flex2 experiments and still fighting again the documentation..

Ok, does someone know where I can find an exhaustive documentation of all the compc command line arguments? I looked around but I had no luck.. only few words about them.
Second, I haven’t found anything really complete about create Flex2 components, styles and skins, setting default styles, embedding stc.. I had to search in many places and looking at the code of someone else already did.. fortunately I’ve found an example from Peter Ent.

Ok, this I created a checkbox which allows a ‘3rd state’ selection. Flex2 checkboxe allows only selected/unselected state, so I added the possibility to set a “middle” state.

Here a couple of example about it:

[kml_flashembed publishmethod=”static” fversion=”9.0.0″ movie=”http://blog.sephiroth.it/wp-content/uploads/2006/09/example.swf” width=”300″ height=”150″ targetclass=”flashmovie”]

Get Adobe Flash player

[/kml_flashembed]

Download the source code here:

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

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/

Flash Player 9, Flex 2, ActionScript 3.0: A Survey of the New Landscape

Colin has posted an interesting article on flash9, flex2, actionscript3.
Why ActionScript 2 coders should start learning ActionScript3 as soon as possible and why timeline coders and flash designers shouldn’t…
Colin underlined a significant aspect of this new flash release: the free flex2 command line compiler. (I asked for it since so much time!)

Read the full entry here:
http://www.moock.org/blog/archives/000189.html

Flash 9 Preview & Flex 2

On Adobe Labs (http://labs.adobe.com) it’s finally available a preview version of Flash 9. described as “A preview of the next release of the Flash authoring tool, scheduled for release in 2007, extends the capabilities of Flash Professional 8 to include support for the new ActionScript 3.0 language in Flash Player 9.”

To download the preview it’s necessary an Adobe account (you can create one, it’s free) while the installation needs a licensed copy of Flash Professional 8 or Studio 8, because a serial number will be asked during the software setup.
Finally, after Flex 2 Betas, we’ll try also the new Flash IDE!

By the way, Flex 2 seems available at http://www.adobe.com/products/flex/ !
As promised the Flex 2 SDK is available for free:
Download Flex 2 SDK

Macromedia Labs

Macromedia launched “Macromedia ” with these words:
“Macromedia MAX 2005 – Anaheim, CA – October 17, 2005 – Macromedia, Inc. today announced Macromedia Labs, a new site on macromedia.com for developers to download early versions of Macromedia technologies, share feedback and insight, and help shape the direction of new products and technologies. Beginning today on Macromedia Labs, developers can download the public alphas of Macromedia Flash Player 8.5 and Macromedia Flex Builder 2, part of the Macromedia Flex 2 product line announced earlier this month. The Flex 2 product line and Flash Player 8.5 are the foundation for building effective rich Internet applications that blend the responsiveness of desktop software, the cross-platform reach of the web, and the breathtaking expressiveness of the Flash Platform.”
Actually on Macromedia Labs we can find info and download about Flex 2 Alpha, Flash Player 8.5 Alpha, and Actionscript 3 Alpha. It’s the first time that Macromedia reveal its future software and features this way, and I think that’s very useful for developers, because in this way the can read and try new features/languages and so migrate to them step by step!
http://labs.macromedia.com

Actionscript 3 ?

Recently Macromedia release some news about Flex 2…and what we can find in one page (you can see it here) ?
“With ActionScript 3.0, we have achieved more than simple compliance with the ECMAScript standard; Macromedia now chairs the ECMAScript committee and helps drive its evolution. ActionScript 3.0 features a compilation mode for stronger compile-time type checking that provides the benefits of languages such as Java or C#. It supports new features to streamline data manipulation, including the E4X (ECMAScript for XML) standard, which extends the language and adds XML as a native data type allowing developers to more naturally interact with and manipulate XML. It adds regular expressions support for better text parsing and processing. It sheds some of the ad hoc event handling schemes in the old virtual machine in favor of a unified model based on the W3C DOM Events standard. And it has significantly updated APIs aimed at the application developer audience.
For a complete overview of the new capabilities, stay tuned as we release an overview of ActionScript 3.0 and the Flash Player 8.5 alpha.”

It seems that on 17th October we’ll have a public preview of Flash Player 8.5…I’m curious a lot!
http://www.macromedia.com/devnet/…/flex2_intro.html