<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<title>Andrew Rayne</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/arayne/" />
<modified>2007-12-17T19:12:58Z</modified>
<tagline></tagline>
<id>tag:weblogs.macromedia.com,2007:/arayne/60</id>
<generator url="http://www.movabletype.org/" version="3.16">Movable Type</generator>
<copyright>Copyright (c) 2007, arayne</copyright>
<entry>
<title>Cairngormstore source</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/arayne/archives/2007/12/cairngormstore_1.cfm" />
<modified>2007-12-17T19:12:58Z</modified>
<issued>2007-12-17T19:09:28Z</issued>
<id>tag:weblogs.macromedia.com,2007:/arayne/60.14578</id>
<created>2007-12-17T19:09:28Z</created>
<summary type="text/plain">Hi, Getting a lot of questions on the blog about where to get the cairngorm store. If you follow the link on Adobe labs it will lead you to www.cairngormdocs.org This site has a newer version of the store on...</summary>
<author>
<name>arayne</name>

<email>arayne@adobe.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/arayne/">
<![CDATA[<p>Hi,</p>

<p>Getting a lot of questions on the blog about where to get the cairngorm store. If you follow the link on Adobe labs it will lead you to <a href="http://www.cairngormdocs.org">www.cairngormdocs.org</a> This site has a newer version of the store on it. Hope this helps.</p>]]>

</content>
</entry>
<entry>
<title>CairngormStore for Flex 2</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/arayne/archives/2006/08/cairngormstore.cfm" />
<modified>2006-09-05T10:50:29Z</modified>
<issued>2006-08-31T12:17:42Z</issued>
<id>tag:weblogs.macromedia.com,2006:/arayne/60.11818</id>
<created>2006-08-31T12:17:42Z</created>
<summary type="text/plain">Hi, over the last while I have been working on overhauling the CairngormStore for Flex 2. The aim is to get it up on Adobe Labs as soon as we can. However in the interests of making it available as...</summary>
<author>
<name>arayne</name>

<email>arayne@adobe.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/arayne/">
<![CDATA[<p>Hi, over the last while I have been working on overhauling the CairngormStore for Flex 2. The aim is to get it up on Adobe Labs as soon as we can. However in the interests of making it available as soon as possible and getting feedback I will put it up here on my blog.</p>]]>
<![CDATA[<p>You can download the code from <a href="http://www.iterationtwo.com/cairngormstore/CairngormStoreWeb.war">here</a>. </p>

<p>Some of the things I have changed are to remove the dependency on HSQLDB. There were more questions generated by trying to configure HSQLDB than anything else and we felt that it was detracting from the main purpose of the app as an example of using Cairngorm. </p>

<p>As far as other changes to the store are concerned you can see that we have moved away from the ViewHelper pattern. This is not because we think that it is not useful but rather that it had tended to be over used. I have seen more than one Flex application where the ViewHelpers had taken on the role being a home for all of the client-side logic. </p>

<p>Other things that have changed are that we have moved away from using the mx:Model tag too. This was due to the fact that we found some problems with this while working on larger forms in projects. Under the covers the Model is just an untyped object. We have replaced this with custom model objects to allow us to type the objects. </p>

<p>There is currently a lot of work being done in Adobe Consulting around the direction to take the Cairngorm framework in the future. We look forward to sharing the fruits of this labour with you soon.</p>]]>
</content>
</entry>
<entry>
<title>Internationalised Applications</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/arayne/archives/2006/08/internationalis.cfm" />
<modified>2006-08-18T15:05:41Z</modified>
<issued>2006-08-18T14:25:14Z</issued>
<id>tag:weblogs.macromedia.com,2006:/arayne/60.11723</id>
<created>2006-08-18T14:25:14Z</created>
<summary type="text/plain">Hi, today I would like to talk about one method of Internationalising applications. On a recent project that I have worked on the client required that the application support multiple languages.</summary>
<author>
<name>arayne</name>

<email>arayne@adobe.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/arayne/">
<![CDATA[<p>Hi, today I would like to talk about one method of Internationalising applications. On a recent project that I have worked on the client required that the application support multiple languages. In addition to this that the user should have the ability to switch languages at runtime and it should be reflected right throughout the application, in everything from labels to tooltips. Finally they wanted the application to allow for flexible addition of language support moving forwards. <br />
</p>]]>
<![CDATA[<p><br />
Working in Europe I can imagine that this is going to be a common type of requirement in the future. Therefore I thought it might be worth sharing the approach taken in implementing this.</p>

<p>The built in localisation support in Flex didn’t quite give us what we were looking for in this instance. With the built in support you can read resource strings into the application from resource bundles at compile time. This allows you to compile a separate SWF for each language you wish to support. </p>

<p>The reason that wasn’t useful for this project is that in order to have changed the language with this approach the user would have had to load another SWF and this would not have been the seamless experience that we were aiming for. </p>

<p>In order to create what we wanted, we load the languages all at start up. This gives the client the data that it requires in order to quickly change the languages. An alternative here would be only to load the list of language names and a default language bundle at application start up. This would minimise on the amount of data we were loading on start up. The reason I chose not to do this here was that the amount of data being brought over the wire was not enough to cause a performance problem. Therefore going by the agile adage, this was “The simplest thing that could possibly work”.</p>

<p>The implementation of this is achieved by calling a server-side service. The example app is built on Cairngorm. I guess you could argue that with an app of this size I don’t really need Cairngorm as it’s too much overhead. That is true, however this isn’t meant to be production strength and I’m so used to using Cairngorm for larger apps that it seemed appropriate to show how the multi language functionality would fit in. </p>

<p>So, on start-up we dispatch a GetLanguagesEvent. This calls the GetLanguagesCommand which goes through the delegate to the service and eventually calls the server side LanguageService. The Service returns an ArrayCollection of languageBundles. These are set on the ModelLocator from the Command. At this stage we also set the locale on the LanguageHelper but more about that in a minute.</p>

<p>In the view component of the application, in this case the MultiLanguageSupport.mxml, we declare a LanguageHelper in the mxml and bind the languageBundles in the model to it.</p>

<p>In the LanguageHelper the languages being set causes a dictionary object to be created this holds the languageBundle objects and keys them on the locale code. Setting the languages will cause the languageChange event to be dispatched which will in turn cause all the bindings to the getString method to fire. </p>

<p>In order to change the language now all you have to do is set the locale on the LanguageHelper and it will change the current language and dispatch the languageChange event which will cause the bindings to getString to fire.</p>

<p>This approach has the benefit of being fully extensible. As long as you ensure that the server side language bundles are populated and your client-side label or tooltip binds to the getString method with the right key, you should be able to add further languages without changing any of the client-side code. Although it was done here you shouldn’t   store the server-side resources in the code. These could easily be fetched from configuration files or a database allowing you to content manage your apps multilingual support easily.</p>

<p>In following posts I will share how we went about internationalising the numbers and dates in the application.</p>

<p><a href="http://weblogs.macromedia.com/arayne/code/multilanguagecode.zip">The code for the application can be found here.</a></p>]]>
</content>
</entry>
<entry>
<title>Scribble Board</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/arayne/archives/2006/04/scribble_board.cfm" />
<modified>2006-08-18T15:06:30Z</modified>
<issued>2006-04-20T22:55:18Z</issued>
<id>tag:weblogs.macromedia.com,2006:/arayne/60.10771</id>
<created>2006-04-20T22:55:18Z</created>
<summary type="text/plain">Hi thought I would start off my blog with something that was a bit of fun. One of the things I was asked to do recently, was to show how a user could manipulate images through the Flash Player, by...</summary>
<author>
<name>arayne</name>

<email>arayne@adobe.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/arayne/">
<![CDATA[<p>Hi thought I would start off my blog with something that was a bit of fun. One of the things I was asked to do recently, was to show how a user could manipulate images through the Flash Player, by loading an external image, allowing someone to manipulate that image, and then save that as a new image.  This was an opportunity to leverage the Drawing API and Bitmap features from Flex 2.0<br />
</p>]]>
<![CDATA[<p><br />
The swf can be viewed <a href="http://weblogs.macromedia.com/arayne/demo/Scribble.swf">here.</a></p>

<p></p>

<p>In this example I have hard coded the background photo for simplicity, although if you wanted to use flickr it has its own simple <a href="http://www.flickr.com/services/api/">api</a> for downloading photos. One of the applications of this that occurred to me would be to also integrate the Flex Data Service to have a collaborative whiteboard. </p>

<p>Here is the code for how it was done. Basically you have a canvas which has the original image on it. Then set to the same size as the image you have another canvas directly on top. You set the top canvas's alpha to 0. </p>

<p>To this top canvas you add some mouseListeners to capture the movement of the users mouse as they drag it across the screen. In the set up, we clear the canvas's graphics property. Then when the mouseDown event is captured we set the graphics properties moveTo method to so it knows where the mouse is. When the mouseMove event is captured we call the lineStyle method where we can set the colour and thickness of the line then we call the lineTo method which draws our line for us.</p>

<p>That is it. I have included the captureBitmap method in case anyone wants to use this and persist the newly "scribbled" image. This creates a bitmapData object from the background canvas. This should capture the data from the background image and the "scribbles" on the top canvas. </p>

<p>In order to create a byteArray from this to pass over to the server I have used a piece of code posted by <a href="http://weblogs.macromedia.com/mchotin/">Matt Chotin</a> on flexcoders called the <a href="http://www.mail-archive.com/flexcoders@yahoogroups.com/msg24056.html">PNGEncoder</a>. </p>

<p>And that, as they say, is that. I don't forsee this threatening PhotoShop anytime soon however it was an enjoyable exercise. The code for this is <a href="http://weblogs.macromedia.com/arayne/demo/Scribble.mxml">here</a>.</p>]]>
</content>
</entry>
<entry>
<title>Hello</title>
<link rel="alternate" type="text/html" href="http://weblogs.macromedia.com/arayne/archives/2006/04/hello.cfm" />
<modified>2006-04-20T16:53:53Z</modified>
<issued>2006-04-20T13:47:56Z</issued>
<id>tag:weblogs.macromedia.com,2006:/arayne/60.10764</id>
<created>2006-04-20T13:47:56Z</created>
<summary type="text/plain">Hi This is just a quick introductory message. To those of you who don&apos;t know me I hope to be blogging here some of the cool and hopefully useful things we develop in AC EMEA. As well as this I...</summary>
<author>
<name>arayne</name>

<email>arayne@adobe.com</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.macromedia.com/arayne/">
<![CDATA[<p>Hi This is just a quick introductory message. To those of you who don't know me I hope to be blogging here some of the cool and hopefully useful things we develop in AC EMEA. As well as this I will post any articles that I think will have a positive impact on what people are doing. Speak to you all soon.</p>]]>

</content>
</entry>

</feed>