Sven Dens

deserialize me

Archive for the ‘Flex’ Category

Aced my ACE: Adobe Certified Expert Flex 3 with AIR

with 2 comments

Just a quick brag post :-)
This morning I passed the ACE Exam “Flex 3 with AIR”.  Feels good to have that one in the bank :-)

To be well prepared for the exam, I read the Flex 3 documentation and the Adobe AIR 1.5 documentation, especially the documents “Developing Adobe AIR 1.5 Applications with ADOBE FLEX 3″ and the “Adobe Flex 3 Developer Guide”, both available free of charge from Adobe.  I also downloaded Attest, an Adobe AIR application that was developed by the lovely people over at PXL Designs which you can download for free, and ran all the practice exams multiple times.  Unfortunately I must say, this effort was virtually worthless for what the exam was concerned.  Not a single question from the practice exams appeared on the real exam, nor did the “toughness” of the real questions reflect those in the practice exams.

To be honest, I must say that I found the exam quite hard.  After all, it’s been more than 3 years since I’ve been developing in Flex, and I would have expected the exam to be rather easy for a trained developer.  However, out of the 50 questions/problems I got, I would have to digg deep and long to find 20 of those that I’ve actually ever used in real-world application development.
So, reading through those PDF’s sure wasn’t a luxury to be able to pass this exam, not for me at least.

I know there are many possible questions out of which you’re presented 50 at the exam, so maybe I just got unlucky in the selection that I was presented with.
Anyway, if you’re looking to become certified too, make sure you’re well-prepared and good luck to you!

Sven

Written by Sven Dens

September 22nd, 2009 at 11:32 am

Posted in Adobe AIR, Flex

SOAP headers in Flex and WS-Security

with 28 comments

UPDATE (06-16-2009): The problem with generating a correct nonce has been fixed!
It turned out to be a problem in the WSSEUsernameToken class in the com.adobe.crypto package in as3corelib.
A VERY big thank you goes to Tom from FlexibleFactory for pointing me to the solution and to Koen Weyn for fixing the bugs!

Dear readers,

I just spent 2 entire days trying to figure out how to consume a SOAP Webservice that requires a SOAP-header and WS-Security in Flex. Hopefully this post will help you out if you’re looking to do the same thing.

Download demo files here.

Let me start off by saying that the Import Web Service (WSDL) wizard in Flex 3 doesn’t work as it should!
The generated classes return invalid XML to the SOAP-request, and adding headers to your request is completely neglected.
But I did get it to work using the classical <mx:Webservice> tag and some hand-coding.

Here’s how to do it:

Read the rest of this entry »

Written by Sven Dens

February 21st, 2008 at 5:00 pm

Posted in Flash, Flex, Java

FlexBook in Flex3 running in Adobe AIR

with 3 comments

Dear readers,

Sorry for the long silence, it’s been extremely busy at work for the past weeks.
I’ve also been making a website for my wedding next month, and for that I wanted to use the magnificent FlexBook component written by Elijah Greenfield. I struggled a little getting it to work on my MacBook Pro without FlexBuilder installed, but finally managed to get it to work and I’d love to share it with you as the tutorials for this component on the web seem to be non-existing.

To take it one step further, I also got it working in Flex 3 (which has been released on Adobe Labs) and running in Adobe AIR (formerly Apollo), which I thought was pretty cool :-)
You can download the sources here.

To make it extremely cool, I wondered if I could get it to work in Remoting also using AMFPHP 1.9, Flex3 and running in AIR. And so I did:-)
The sources for a simple “Hello World” demo and for the AMFPHP demo are also included in the same ZIP-file.

As always, everything was built using only Open Source software (in my case in Eclipse using the free Flex2/Flex3 SDK, the AIR SDK and the FlexBook component, and AMFPHP 1.9), it can run on any platform at no cost.

If you don’t have the Flex3 SDK or Adobe AIR SDK yet, head over to Adobe Labs first to download them.
Included in the ZIP-file is everything you need to make it run.
Simply unzip the contents of the ZIP-file to a directory on your PC/Mac, create a new project in Eclipse and import the files.
You’ll notice the build.properties file. It is set up to compile the FlexBook demo by default. However, all that is needed to compile the HelloWorld demo and the AMFPHP demo is also set-up. All you need to do to compileone of those is comment out the appropriate lines in the build.properties file, and comment the ones you don’t need anymore.

For more detailed instructions on how to set up your Eclipse environment and use the ANT-templates, check out my other post: “Build and compile AS3, Flex2 and Apollo applications in Eclipse using Mac OS X”.

Basically, to use the FlexBook component, you only need to include the namespaces xmlns:controls=”qs.controls.*” and xmlns:effects=”qs.effects.*” in your mxml file. Make sure you use the right classpath, including it like this presumes the folder “qs” is on the same level in the hierarchy as your MXML-file. If you unzipped the contents of my download it should be in the right place.

Next, you can use the FlexBook component as such:

<controls:FlexBook id="book" y="70" width="580" height="435" horizontalCenter="0"
    animateCurrentPageIndex="true"
    animatePagesOnTurn="true"
    activeGrabArea="corner"
    edgeAndCornerSize="50">

    <!--create the cover page in the book-->
    <controls:cover>
        <mx:Label text="FlexBook AIR example" fontSize="18" horizontalCenter="0" verticalCenter="0" width="100%" textAlign="center"/>
    </controls:cover>

    <!--create the back cover page-->
    <controls:backCover>
        <mx:Label text="And now, go study and have fun :-)" fontSize="12" horizontalCenter="0" verticalCenter="0" width="100%" textAlign="center"/>
    </controls:backCover>
   
    <mx:Image source="@Embed('assets/ss1.jpg')" />
    <mx:Image source="@Embed('assets/ss2.jpg')" />
    <mx:Image source="@Embed('assets/ss3.jpg')" />
    <mx:Image source="@Embed('assets/ss4.jpg')" />
    <mx:Image source="@Embed('assets/ss5.jpg')" />
    <mx:Image source="@Embed('assets/ss6.jpg')" />
</controls:FlexBook>

The “controls” namespace is known because you referenced it in your Application tag. To compile, the compiler also needs to know where to find the AS3 sources for the component. That is handled by the build.xml file which serves the right source path to the compiler (qs.*).
Next, you need to provide a front- and back-cover. Between these tags you can use any Flex component you like, like a mx:Label, mx:Text, mx:Image and so on.

Following the </controls:backCover> tag you start creating the pages of your FlexBook. Each component you use represents a new page in the FlexBook. In the demo I just used 6 <mx:Image> tags with embedded images to create 6 photo-pages. Feel free to replace them with your own content, or to use entirely different stuff. You can embed webpages, video, text, htmlText, images, … or your own components.

To compile them for Adobe AIR, you need 1 more XML file that describes your AIR Application. There are 3 files included in the ZIP-archive, one for each demo.

If the compiler gives you cr@p about compile-time constants, edit the flex-config.xml and set the “strict”-option to false. Then you should have no more trouble compiling the sources.

Use it, have fun with it, study it, and let me know what you think!

(P.S.: I’ll be posting more demo’s on Flex2/3, AIR and combining them with AMFPHP this weekend. One of them will be an Flex3/AMFPHP example of how to create a guestbook once I’ve written that for my wedding website. If you speak Dutch or are just curious, go and have a look :-) -> http://www.pinnemuts.be And let me know what you think about it.)

Sven

Written by Sven Dens

June 22nd, 2007 at 11:25 pm

Posted in Flex

Build and compile AS3, Flex2 and Apollo applications in Eclipse on Mac OS X

with 2 comments

So today I wanted to compile a simple “Hello World” app and package it as an .air-file for installation in Adobe Apollo on my Mac…

This can already be done in FlashDevelop – a great editor, but it only runs on Windows – but I couldn’t yet find a source telling me how to do it from Eclipse or any other editor that runs on OS X. So it was time to roll-up my sleeves and figure out a way to do it.
Didn’t turn out to be hard at all, using ANT and starting off from the nice Apollo ANT-template for FlashDevelop built by Ryan Taylor.

Read the rest of this entry »

Written by Sven Dens

May 22nd, 2007 at 12:42 pm

Posted in Adobe AIR, Flex