Amgen Tour of California bike race and Flash Platform

Although I am an European, and thus Tour de France is the “only” tour for me, I must say that Amgen Tour is quite unique. And why’s that? Because this is the third year that they have used the Flash Platform to make the race available over Internet. The race started on February 14th, and you can see all the details here.

You can see the race live at that address, and if you wonder about the technologies used, then here is the answer: Flex, LiveCycle, and Adobe AIR.

My friend Duane Nickull created an online petition here, to convince the organizers of Tour de France to use a similar solution. This would be sweet :) Tell your friends, parents to sign the petition.

mindomo.com – Flash and AIR mind mapping tool

Ryan Stewart wrote this week about an online mind mapping tool created with Flex: MindManager Web. And this post reminded me about a small Romanian company that visited Adobe’s Bucharest office in the spring of 2007, to share with the Romanian Flex Builder team their thoughts about Flex and Flex Builder.

I was at that time a Flex Builder engineer, and I must say I was amazed by these guys. Their passion and sheer will to use the Flash platform to create an online version of their desktop product was astonishing. They created a Flash mind mapping tool for web and a desktop client using Adobe AIR. They offer both free accounts, and premium accounts. So you can use it for free and see if it works for you.

Some cool things about the tool: they implemented the Microsoft ribbon in Flash, and I must say it looks very slick and cool. Also, they optimized the code, so it can handle lots and lots of nodes. You can find more about them and their offer here: http://mindomo.com/.

On March 14th we will organize the first FlexCamp in Timisoara, so I will have the opportunity to visit them on their home turf and talk more about their experience in working with our technology. I can’t wait!

How to add a scrollbar to Text Layout Framework

Last month I wrote an article about using the Text Layout Framework in Flex 3.2 or AIR 1.5. The article was an introductory one, in which I explained the architecture and showed some basic code to use some of the main features of the framework. Some of you asked how one can add a scrollbar to scroll the text from a container that has more text than can be shown in the current viewport.

To tell you the truth, I was curious about how hard it would be, so today I just played a little bit and I managed to add a scrollbar to control the text.

You can test the code here.

scrollbar

Let me explain very quickly how I did it (if you want to see the details, click view source or scroll down this article for the code):

  1. I display the text using a single container; the size of this container is about 200 x 300 pixels.
  2. I added a mx:VScrollBar component to the page, setting the same height as the text container.
  3. When the TextFlow composes its text for displaying, a CompositionCompletionEvent.COMPOSITION_COMPLETE event is thrown. By listening for this event, I am able to determine if the text will actually flow outside of the text container.
  4. In the listener for CompositionCompletionEvent.COMPOSITION_COMPLETE, I get the total height of the composed text using _controller.calculateHeight() (this method returns the height in pixels. This is the height that the text needs in order to be shown entirely. If the height is bigger than the text container, then I set the max scroll value for the vertical scroll bar to that difference.
  5. I registered a listener for the scroll event on the vertical scroll bar. And next whenever the scroll bar moves, I use the current position of the scroll bar to set the DisplayObjectContainerController’s (this is the object that wraps the text container and it is used by TextFlow for displaying the text) verticalScrollPosition property (the value for this property is in pixels): _controller.verticalScrollPosition = event.position;
    This did half of the job: when the user moves the scroll bar, the text moves. Next, I had to synchronize the scroll bar when someone scrolls the text directly too.
  6. To do that, I registered another listener for the scroll event on the TextFlow it self. And whenever the users scrolls the text from the text container directly (for example by selecting a piece of text, holding the left mouse button, and moving it downward or upward), I use the current position of the DisplayObjectContainerController’s  verticalScrollPostion to set the scroll bar scrollPosition: scroll.scrollPosition = Math.ceil(_controller.verticalScrollPosition);
    You have to use ceil() on the value because the verticalScrollPosition returns a Number, not an Integer.
  7. And that’s it!
   1: <?xml version="1.0" encoding="utf-8"?>
   2: <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()" viewSourceURL="srcview/index.html">
   3: <mx:Script>
   4:     <![CDATA[
   5:         import flashx.textLayout.events.ScrollEvent;
   6:         import mx.events.ScrollEvent;
   7:         import mx.events.MoveEvent;
   8:         import flashx.textLayout.container.IContainerController;
   9:         import flashx.textLayout.events.CompositionCompletionEvent;
  10:         import flashx.textLayout.edit.UndoManager;
  11:         import flashx.textLayout.edit.EditManager;
  12:         import flashx.textLayout.events.StatusChangeEvent;
  13:         import flashx.textLayout.elements.InlineGraphicElement;
  14:         import flashx.textLayout.container.DisplayObjectContainerController;
  15:         import flashx.textLayout.conversion.TextFilter;
  16:         import flashx.textLayout.elements.TextFlow;
  17:
  18:         [Embed(source="air.png")]
  19:         [Bindable]
  20:         static public var _imgClass:Class;
  21:
  22:         private var _textContainer:Sprite = null;
  23:
  24:         private static const _textInput:XML = <TextFlow xmlns="http://ns.adobe.com/textLayout/2008">
  25: <div>
  26:     <p>
  27:         <img source="./air.png"/>
  28:         <span>Flex is a highly productive, free open source framework for building and maintaining expressive web applications that deploy consistently on all major browsers, desktops, and operating systems. While Flex applications can be built using only the free Flex SDK, developers can use Adobe® Flex® Builder™ 3 software to dramatically accelerate development. Try Flex Builder 3 free for 60 days. Try ILOG Elixir to enhance data display in your Flex applications.</span>
  29:         <br/>
  30:     </p>
  31: </div>
  32: </TextFlow>;
  33:
  34:         private var _textFlow:TextFlow;
  35:         private var _controller:IContainerController;
  36:
  37:         private function init():void {
  38:             _textContainer = new Sprite();
  39:             canvas.rawChildren.addChild(_textContainer);
  40:             _controller = new DisplayObjectContainerController(_textContainer, canvas.width, canvas.height);
  41:
  42:             _textFlow = TextFilter.importToFlow(_textInput, TextFilter.TEXT_LAYOUT_FORMAT);
  43:             _textFlow.flowComposer.addController(_controller);
  44:             _textFlow.addEventListener(StatusChangeEvent.INLINE_GRAPHIC_STATUS_CHANGED, picLoaded);
  45:             _textFlow.addEventListener(CompositionCompletionEvent.COMPOSITION_COMPLETE, composeListener);
  46:             _textFlow.addEventListener(flashx.textLayout.events.ScrollEvent.SCROLL, scrollTextFlow);
  47:             //adding Select/Edit/Copy/Paste/Undo features
  48:             _textFlow.interactionManager = new EditManager(new UndoManager());
  49:             // initialize with a selection before the first character
  50:             _textFlow.interactionManager.setSelection(0,0);
  51:
  52:             _textFlow.flowComposer.updateAllContainers();
  53:         }
  54:
  55:         /**
  56:          * the composing of the text was finished;
  57:          * now I can see if I my text overflow the container
  58:          */
  59:         private function composeListener(event:CompositionCompletionEvent):void {
  60:             var textHeight:int = Math.ceil(_controller.calculateHeight());
  61:             if (textHeight < _controller.compositionHeight) {
  62:                 scroll.enabled = false;
  63:             } else {
  64:                 scroll.enabled = true;
  65:                 scroll.minScrollPosition = 0;
  66:                 scroll.maxScrollPosition = textHeight - _controller.compositionHeight;
  67:             }
  68:             _controller.verticalScrollPosition = 0;
  69:         }
  70:
  71:         /**
  72:          * listener for the picture load event; 
  73:          * it is time to update the flowComposer to display the picture
  74:          */
  75:         private function picLoaded(event:StatusChangeEvent):void {
  76:             var image:InlineGraphicElement = event.element as InlineGraphicElement;
  77:             _textFlow.flowComposer.updateAllContainers();
  78:         }
  79:
  80:         /**
  81:          * listener for the scroll event of the scrollbar
  82:          */
  83:         private function scrollListener(event:mx.events.ScrollEvent):void {
  84:             _textFlow.removeEventListener(flashx.textLayout.events.ScrollEvent.SCROLL, scrollTextFlow);
  85:             _controller.verticalScrollPosition = event.position;
  86:             _textFlow.addEventListener(flashx.textLayout.events.ScrollEvent.SCROLL, scrollTextFlow);
  87:         }
  88:
  89:         /**
  90:          * listener for the scroll event of the text flow container
  91:          */
  92:         private function scrollTextFlow(event:flashx.textLayout.events.ScrollEvent):void {
  93:             scroll.removeEventListener(mx.events.ScrollEvent.SCROLL, scrollListener);
  94:             scroll.scrollPosition = Math.ceil(_controller.verticalScrollPosition);
  95:             scroll.addEventListener(mx.events.ScrollEvent.SCROLL, scrollListener);
  96:         }
  97:     ]]>
  98: </mx:Script>
  99:
 100: <mx:HBox x="20" y="20">
 101:     <mx:Canvas id="canvas" width="200" height="300"  backgroundColor="#ffffff"/>
 102:     <mx:VScrollBar id="scroll" height="300" scroll="scrollListener(event)"/>
 103: </mx:HBox>
 104:
 105: </mx:Application>

I hope you enjoyed this!

The new AIR Marketplace is out

We’ve just launched a new version of AIR Marketplace. You can access it through this URL: http://airmarketplace.adobe.com/

And here are some of the new features:

· Easily search and download applications. Users can rate, review, comment and flag an application to provide valuable feedback. They can share applications with colleagues and friends, and also subscribe to RSS feeds from the Marketplace.
· A self-service web interface enables developers to manage their profiles and applications.  Developers can also view download statistics, ratings and reviews through a new application dashboard
· If developers want to sell their application, they can submit the app to the Marketplace. In this case the Marketplace will not enable e-commerce transactions, but the users will be taken to the developers website to conduct the transaction.

LATER UPDATE: you can read here about what is marketplace.

New features on Adobe Groups – Jobs, Calendar, Messaging

Last year we launched Adobe Groups, a platform to support the activities of Adobe User Groups and to help divelopers find communities near them. Proving a successful project, we naturally continue to add new features. So this way Jobs (a global job board, any job posted by an User Group appears in the jobs category), Calendar (a global calendar of community events, so you can keep an eye on all upcoming events), and Messaging (inbox on your profile and user to user messaging; all the posts you write are tied to your profile) appeared.

If you don’t have an Adobe User Group in your region, but you know there are people who work with our technology, maybe it is time to start one.

Norway and Denmark trip

This week I traveled to Norway and Denmark to give sessions at two events. The first event was Monday, the first Flex Camp in Norway. About 60 people showed up, and I must say it was one of the most advanced Camp I’ve seen from the level of topics. All the people knew about Flex and AIR, and they were either Flash developers or Flex developers. I did the keynote and a session on Flex and PHP, and the rest of the sessions were about unit testing in Flex, creating scripts for automatic builds, 3D ActionScript engines, and Flash Catalyst.

Øystein did an excellent job organizing this event; the location was nice, and the pizza excellent. After the event most of the people stayed in the student pub near the venue for more talks. And some of us went for a second beer session in another pub. Thank you Peter, Ruben, Martin, Ole, and Jens for that evening. And thank you to Knut, the PHP user group manager for support too.

I can only hope that this event is the first one in a series :)

Jens explaining about his trip in Romania Peter making fun of us

Ole making a funny face Peter Motzfeldt

The venue Peter and Flash Catalyst

Discussing MVC and others late in night Ruben & Martin

The next day I took a plane to Copenhagen, Denmark. The PHP user group manager was kind enough to set up a meeting for the group’s members to learn about our Flash Platform. About 13 people showed up, one of them was actually a Microsoft evangelist. Unfortunately he couldn’t stay up until the end, so I don’t know if he enjoyed the session. Many thanks to Troels and to the people from Peytz & Co. who let us use their office for this meeting (they had an amazing working space, lots of room and very unconventional.

_DSC4753 _DSC4754

_DSC4755

After the meeting, with the help of Peter (yes the same Peter from Norway’s Flex Camp, because he actually is Danish), I discovered some local pubs and local beer, and we had more talks on technology. Actually I recorded a very short interview with him about what he thinks about Flash Catalyst (I will post the video soon).

Hamburg, Flex & AIR with PHP

February 20, 2009

February 2oth I will give a session about working with Flex / AIR and PHP in Hamburg, Adobe’s office. If you have interest in this session, just send me an email and I will give you intructions on how to register.

London PHP Conference

February 26, 2009toFebruary 28, 2009

I will be in London to attend London PHP Conference, and to give a session about Flex and PHP, how to use Flex Builder and Zend Studio for creating Flex and PHP app, how to bring data from PHP to Flex.

Denmark, Flex & AIR for PHP programmers

February 3, 2009toFebruary 4, 2009

I will give a session about Flex and AIR for PHP programmers to the Danish PHP UG.

Norway, Oslo – Flex & AIR for PHP programmers

February 2, 2009

I will give a session to the Norwegian PHP UG about Flex and AIR

← Previous Page

Switch to our mobile site