Archive for the ‘Releases’ Category
Flex 4.6 – BlueChips demo
To celebrate the best ever release of Flex SDK marked with 4.6 version number I decided to publish source code of my little tablet demo app called BlueChips. The video below demonstrates BlueChips in action together with an overview of new Flex 4.6 components that target tablet development. You can go ahead and download the source code from github and do whatever you want with it
If you prefer vimeo over youtube you can watch the same recording here.
Bundling AIR 3 runtime in AIR desktop applications
At the beginning of this week a beta 2 version of the AIR 3 SDK was released. The AIR 3 SDK and AIR 3 runtime will be a major release that will bring a lot of really cool features. One of the features that I’m really excited about is Captive Runtime, which lets you package your applications with a bundled AIR runtime. This is something that was available for the iOS platform from day one, and now it is also supported for both Android devices and desktops.
I think this is a really important feature for AIR. I heard many times from our customers and the community that we need a solution that enables users to install AIR applications without administrator rights. This is a common scenario especially in the enterprise environments where users don’t have full privileges. Also in some other cases it may improve user experience as there is no need to ask the user to install an additional runtime. It will also help when you need to distribute your application on a CD or other media that doesn’t let you use the browser-based badge installer.
Now how do you package your app for both Windows and Mac? It’s really simple. First thing what you need to do is to download and unzip the new SDK from Adobe Labs. Next compile your application either with the command line mxmlc compiler or using Flash Builder. To do it in Flash Builder, right-click your AIR application project, select Export… -> Flash Builder -> Release Build, and complete just the first step of this wizard without finishing it. This will create a bin-release-temp folder under your project directory with a compiled SWF and app descriptor file. Now go to the command line and invoke following adt command from your project/bin-release-temp folder.
On Windows:
c:\path\to\air3sdk\bin\adt.bat -package -storetype pkcs12 -keystore c:\path\to\certificate.p12 -target bundle myapp.exe myapp-app.xml -C . myapp.swf
On Mac:
/path/to/air3sdk/bin/adt -package -storetype pkcs12 -keystore /path/to/certificate.p12 -target bundle myapp.app myapp-app.xml -C . myapp.swf
You will receive slightly different results depending on your platform. On Mac your application is packaged into myapp.app, which is a single Mac package file. You can just double-click it to run the app. Also if you want to introspect its content you can right-click it and select the Show Package Contents option. On Windows you will get myapp.exe folder that has all the runtime files and the executable myapp.exe file in it. Now you can use your favorite installer builder to build a setup package for your application.
Generated folders structure on Windows:
Generated package structure on Mac:
For Android options check out this blog post by my new fellow evangelist Andy Trice.
as3viewnavigator 2.0.0 RC1 released!
I’m proud to announce a new release of the as3viewnavigator library. This new release is labeled with a 2.0.0 RC1 version number. Since the previous release the source code has been almost entirely rewritten to provide a host of new features, many bug-fixes and increased extensibility. The changes have likely also introduced some new bugs, so that is why this is an RC1 (Release Candidate 1) even though I think it is feature complete. Before it goes final I want to test it myself in battle and also have others provide input and bug reports. If you used previous versions I’m certain it will break your existing code (for your reference, the previous version is still available in github under the 1.0.0 tag.
So what is new:
- You can use
ViewNavigatorfor Flex (desktop) projects! At least until ViewNavigator from Flex Hero will not be available for desktop projects
ViewNavigatorhas become a container (based on the Sprite class for AS3 projects and theUIComponentfor Flex) now. Its default behavior in AS3 projects when added to the stage is that it takes 100% of the stage area and it auto-resizes itself. You also have an option to controlViewNavigatorwidth and height values explicitly. When using Flex you can lay it out anywhere in your MXML declaration like any other Flex component.- Default implementations of the
IViewinterface calledVieware provided for both AS3 (based onSprite) and Flex (based onSkinnableContainer) projects. - When performing actions on
ViewNavigator(like pop, push, etc.) aViewNavigatorEvent.VIEW_CHANGINGevent is dispatched. This event is cancelable so application logic can prevent the view change. Also the event has additional properties likeoldViewandnewViewwhich enable access to the instances of exchanged views. - It is now possible to add custom view transitions. This can be done by implementing the
IViewTransitioninterface and setting its implementation instance to theViewNavigatorobject’sdefaultTransitionproperty or by passing it to theViewNavigatorobject’s action functions. - View instances managed by
ViewNavigatorcan be destructed when they are no longer on the top of the stack. This can be controlled with a new property inIViewinterface nameddestructionPolicy. This property has two possible valuesautoandneverthat are also available in theViewDestructionPolicyenum class. DefaultIViewimplementations have this property set toauto.
Using it with Flex (desktop) projects:
Actually this is the feature I’m most excited about. You may wonder why this is since Flex already comes with the ViewStack component and ViewNavigator available in Flex Hero mobile projects. The reason is that the ViewStack doesn’t allow two views to be visible at the same time so this type of nice slide transition is not possible (at least the transition in which two views slide in at the same time, I will blog about this in my next post). And as I mentioned already the Flex Hero ViewNavigator is not available for desktop projects, at least not yet. Of course there is a third option, using state transitions, but it doesn’t come with an API as well thought through as the one in ViewNavigator.
Below you can see it working with Flex (right-click to access the example source code):
In the Main MXML document you can see that ViewNavigator can be treated like any other Flex component. It also has the set of properties that set up the first view and register the ViewNavigatorEvent.VIEW_CHANGING event handler. In the snippet below SampleView is registered as firstView and the viewNumber property of the first view instance is set to 1.
// Main.mxml <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:vn="http://ns.riaspace.com/as3viewnavigator" width="350" height="350" viewSourceURL="http://riaspace.com/examples/as3viewnavigator/flex/srcview/index.html"> <fx:Script> <![CDATA[ import com.riaspace.as3viewnavigator.demo.SampleView; import com.riaspace.as3viewnavigator.events.ViewNavigatorEvent; protected function navigator_viewChangingHandler(event:ViewNavigatorEvent):void { txtTrace.appendText( "action: " + event.action + ", oldView: " + event.oldView + " newView: " + event.newView + "\n" ); } ]]> </fx:Script> <s:VGroup left="5" top="5" right="5" bottom="5"> <vn:ViewNavigator id="navigator" firstView="{SampleView}" firstViewProps="{{viewNumber : 1}}" viewChanging="navigator_viewChangingHandler(event)" width="100%" height="70%" /> <s:Label id="lblTrace" text="Navigator events:" /> <s:TextArea id="txtTrace" width="100%" height="30%" /> </s:VGroup> </s:Application>
The SampleView MXML document extends the View class that comes with as3viewnavigator for Flex. Within the SampleView there are five buttons declared that let you play with ViewNavigator action functions. The code also declares the public viewNumber property that is set by the view that pushed the current view to the top of the stack. The value of the viewNumber property is 1 more than the viewNumber property from the previous view.
// com/riaspace/as3viewnavigator/demo/SampleView.as <?xml version="1.0" encoding="utf-8"?> <vn:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:vn="http://ns.riaspace.com/as3viewnavigator"> <fx:Script> <![CDATA[ import mx.utils.NameUtil; override public function toString():String { return NameUtil.createUniqueName(this); } ]]> </fx:Script> <fx:Declarations> <fx:Number id="viewNumber" /> </fx:Declarations> <s:Rect width="100%" height="100%"> <s:fill> <s:SolidColor color="#f0f0f0" /> </s:fill> </s:Rect> <s:Label id="lblViewNumber" text="{viewNumber}" fontSize="55" top="10" horizontalCenter="0" /> <s:VGroup bottom="10" horizontalCenter="0"> <s:Button id="btnPushView" label="push view" width="100" click="navigator.pushView(SampleView, {viewNumber : (viewNumber + 1)})" /> <s:Button id="btnPopView" label="pop view" width="100" click="navigator.popView()" /> <s:Button id="btnPopAll" label="pop all" width="100" click="navigator.popAll()" /> <s:Button id="btnPopToFirst" label="pop to first" width="100" click="navigator.popToFirstView()" /> <s:Button id="btnReplace" label="replace" width="100" click="navigator.replaceView(SampleView, {viewNumber : (viewNumber + 1)})" /> </s:VGroup> </vn:View>
Using it with AS3 projects:
The example below shows the AS3 version in action. You can also right-click it to access the full source code.
In this example, the ViewNavigator is instantiated and added as a child of the Main class (the Main class listing is below this paragraph). The ViewNavigator constructor receives two parameters: the class type of the first view (SampleView) to display and an Object with view properties to be set (in this case, this is my custom viewNumber property, which will be displayed in the view label). Before ViewNavigator is added as a child to the Main class it also registers a ViewNavigatorEvent.VIEW_CHANGING event handler that traces out info about ViewNavigator actions. Another thing to note here is that the ViewNavigator size is set explicitly in the layoutComponents function using setSize function. It is important to understand that in this situation ViewNavigator will not auto-size itself anymore to the size of the stage. That is why layoutComponents function is also called by stage Event.RESIZE event handler.
// Main.as package { import com.adobe.viewsource.ViewSource; import com.riaspace.as3viewnavigator.ViewNavigator; import com.riaspace.as3viewnavigator.demo.SampleView; import com.riaspace.as3viewnavigator.events.ViewNavigatorEvent; import fl.controls.TextArea; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; [SWF(width="350", height="350", frameRate="30")] public class Main extends Sprite { private var navigator:ViewNavigator; private var txtTrace:TextArea; public function Main() { // Adding source code view ViewSource.addMenuItem(this, "http://riaspace.com/examples/as3viewnavigator/as3/srcview/index.html"); stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; // Adding trace area txtTrace = new TextArea; // Creating instance of ViewNavigator navigator = new ViewNavigator(SampleView, {viewNumber : 1}); // Registering view navigator event handler navigator.addEventListener(ViewNavigatorEvent.VIEW_CHANGING, navigator_viewChangingHandler); // Setting components dimenstions and positions layoutComponents(); // Adding txtTrace component addChild(txtTrace); // Adding navigator to the current sprite addChild(navigator); // Adding resize handler to handle components layout stage.addEventListener(Event.RESIZE, function(event:Event):void { layoutComponents() }); } protected function layoutComponents():void { // Resizing txtTrace component txtTrace.width = stage.stageWidth; // Setting fixed height of txtTrace component txtTrace.height = 60; // Positioning txtTrace component below navigator txtTrace.y = stage.stageHeight - txtTrace.height; // Setting navigator size to be over txtTrace component navigator.setSize(stage.stageWidth, stage.stageHeight - txtTrace.height); } protected function navigator_viewChangingHandler(event:ViewNavigatorEvent):void { txtTrace.appendText( "action: " + event.action + ", oldView: " + event.oldView + " newView: " + event.newView + "\n" ); } } }
The SampleView class extends View, which is a default implementation of the IView interface. Because the View class extends Sprite you can add/remove child DisplayObjects to/from it and work with it as with a standard Sprite. Worth mentioning here is overridden function resize. Doing so allows to scale and layout child elements of the view whenever the owning ViewNavigator size changes.
// com/riaspace/as3viewnavigator/demo/SampleView.as ... override public function resize():void { for (var element:Object in _elements) { var coordinates:Object = _elements[element]; position(DisplayObject(element), coordinates.horizontalCenter, coordinates.verticalCenter); } } ...
NativeApplicationUpdater 0.5.0 released
Today I published a new version (0.5.0) of the NativeApplicationUpdater library to the Google Code project.
- Configuring proper XML settings when parsing plist in the HdiutilHelper class (based on contribution from a Erik Pettersson)
- The update file is downloaded into a temporary folder with its name parsed out of the download url
- If cmd.exe is found it is used to run the update file (based on the contribution from Jeff Pace)
You can also find out more about NativeApplicationUpdater here.
as3viewnavigator – ViewNavigator for as3/flash projects
I’m currently working on an application for the BlackBerry PlayBook tablet. The API that comes with the PlayBook SDK is based on pure AS3. Of course I could use Flex Hero for the job but I wanted to try out the “native” stuff that it comes with. My impression so far is really positive and the only thing that I’ve found missing so far was the concept of Views and ViewNavigator that comes with Flex Hero for mobile devices.
That is why I took a bit of time today to create library heavily inspired by ViewNavigator from Flex Hero that I could use for my pure as3/flash projects. The library is available for download here. Also checkout the video below for the details on how to use it.
Just for the reference, to tween the view transitions I used Tweener library that is also used internally by PlayBook API.
Below is the snippet of code that implements the example from the video above, you can also download the project source from here.
package { import com.riaspace.as3viewnavigator.ViewNavigator; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.MouseEvent; import flash.text.TextFormat; import flash.text.TextFormatAlign; import qnx.ui.buttons.LabelButton; import qnx.ui.core.Container; import qnx.ui.core.ContainerAlign; import qnx.ui.core.ContainerFlow; import qnx.ui.core.SizeMode; import qnx.ui.core.Spacer; import qnx.ui.text.Label; [SWF(width="600", height="1024", backgroundColor="#FFFFFF", frameRate="30")] public class Main extends Sprite { private var navigator:ViewNavigator; private var viewNumber:int = 0; public function Main() { initializeUI(); } private function initializeUI():void { stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; // Creating instance of ViewNavigator navigator = new ViewNavigator(this); // Pushing first view to the navigator navigator.pushView(createView()); } private function createView():Container { var view:Container = new Container; view.flow = ContainerFlow.VERTICAL; view.align = ContainerAlign.MID; // Incrementing view number viewNumber++; // 20% spacer from the top view.addChild(new Spacer(20)); // Adding label with view number var numLabel:Label = new Label; numLabel.text = viewNumber.toString(); var format:TextFormat = new TextFormat; format.size = 70; format.bold = true; format.align = TextFormatAlign.CENTER; numLabel.format = format; numLabel.size = 100; numLabel.sizeMode = SizeMode.BOTH; view.addChild(numLabel); // 15% spacer between label above and buttons view.addChild(new Spacer(15)); // Adding "push view" button var btn:LabelButton = new LabelButton; btn.label = "push view"; btn.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void { navigator.pushView(createView()); }); view.addChild(btn); // Adding "pop view" button btn = new LabelButton; btn.label = "pop view"; btn.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void { navigator.popView(); }); view.addChild(btn); // Adding "pop all" button btn = new LabelButton; btn.label = "pop all"; btn.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void { navigator.popAll(); }); view.addChild(btn); // Adding "pop to first button" button btn = new LabelButton; btn.label = "pop to first"; btn.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void { navigator.popToFirstView(); }); view.addChild(btn); // Adding "replace" button btn = new LabelButton; btn.label = "replace"; btn.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void { navigator.replaceView(createView()); }); view.addChild(btn); return view; } } }
Toaster Lite – HTTP/AMF monitoring tool
My little pet project called Toaster Lite has finally reached the point at which I can share it with the world. In its current state it is just a simple HTTP/AMF monitoring tool that lets you introspect your client-server traffic when doing your Flash/Flex development.
You may wonder why I built it. Well first of all I thought that it would be a cool example of what you can do with the ServerSocket API that came with AIR 2. Secondly I wanted to get better understanding of AMF (Action Message Format) structure. And, last and not least I have further plans for it and what I would like to achieve at some stage is functionality similar to soapUI but for AMF. (BTW: did you know that soapUI has some basic support for AMF but obviously not enough for me
)
So what I’m planning for the next release is the ability to create test suites and test cases based on monitored requests and being able to replay these accordingly. At some point I would like to be able to perform load/stress testing of AMF services with it. I know this is something that would require threading support but maybe the Flash Player team will solve this somehow. If not, I may endup using Java to do this part of the job and integrate it with the UI using Flerry.
When building Toaster I managed to extract part of it into a separate as3 library called amf-message-deserializer, which can deserialize AMF requests received through the ServerSocket. The library project is available here in GitHub. I want to credit my fellow evangelist James Ward for his JSAMF project, which was a great help and a starting point. Other good resources to really understand AMF0 and AMF3 are their open specs available through this site.
To install Toaster Lite just use the badge below:
UPDATED 2011.01.13 – recorded a screencast with Toaster Lite tour:
Resicon – icons batch resizing tool
Last night when I was working on my pet project (very soon to be released
) I finally got annoyed enough to take 15 minutes off to create this simple utility tool called Resicon. It is an icon batch resizing utility application. It allows you to resize icon images into a predefined set of sizes like: 16×16, 32×32, 36×36, 48×48, 72×72 and 128×128 or use a custom one.
This is a very handy tool because whenever you build an AIR application either a desktop or a mobile one you have to specify a set of its icons in different sizes. Usually this is done by downscaling a single high resolution image to the required sizes. This repetitive task is really annoying and that is why Resicon was brought to life.
Below is an install badge for the Resicon application, the source code is available in GitHub here.
BTW: Resicon icon was created with the very cool Icon Generator Pro app.
Adobe Evangelist Blogroll released with seasonal theme
Before I go to my family for Christmas Eve I just wanted to share with everyone that I released a new version of the Adobe Evangelists Blogroll application that comes with a nice seasonal theme
Also I created this simplistic microsite for the AEB app so that you can easily navigate to Android Market or use QR Code to get it downloaded. So I wish you Happy Holidays and a Happy New Year!
Adobe Evangelists Blogroll preview
Today I’m officially announcing my new mobile application called Adobe Evangelists Blogroll. This is a simple RSS reader type of application that aggregates blog feeds from my fellow Adobe Evangelists. I’ve developed it with a preview release of Flex Hero SDK and it works on all Android devices that can handle AIR runtime. The app is available in Android Market if you look for “Adobe Evangelists Blogroll“.
What I’m also really excited about is that I managed to repackage it into a bar file and run it on BlackBerry PlayBook emulator without doing even single change to the codebase. In the video below you can see it in action running on different devices and also on PlayBook emulator.
As I already mentioned it was built with preview release of Flex SDK and also the app itself is in beta so it may have some quirks here and there. If you have any suggestions, comments or found some bugs you can contact me through this form.
Few screens of the application (running in landscape & portrait orientation and on playbook):
UnFramework – or how to work without any frameworks
Those who know me or at least subscribe to my blog know that I’m a big fan of Flex/AS3 frameworks. At this year’s Adobe MAX conference I even had my own session where I covered five major DI frameworks. Usually these frameworks provide a lot of productivity features and helpers like: IoC/DI, Event/Messaging bus, implementation of some architectural or design patterns (MVC, Command…), and many others. But what happens if we can’t or don’t want to use any of these frameworks?









