Category Archives: Flash

General Adobe flash development

Welcome to the AppleNet

Your addiction to shiny new consumer electronics will fund Apple in it’s mission to erode your freedom to consume the content you want through the channel you want at the price you want.

You will not be allowed to access some content on Apple devices regardless of its merit. Apple will apply this content censorship at a hardware level based on nothing more than the format content is published in. This censorship will include the music, videos, games, books and applications that you consume, use and own now and those you may want to access in the future.

You will pay whatever Apple tells you to pay for Apple sanctioned content, but will only be able to purchase it through an Apple sanctioned mechanism. You will put up with this because Apple says it’s going to be better that way, easier, it will just work.

This will all be fine, because the content that is deemed worthy will all be based on ‘open’ standards and technology.

Welcome to the AppleNet.

Steve.

Memory Management in Flash Lite and ActionScript 2 using ASUnit

In my new position the team I have joined and me are carying out some in depth testing of an Action Script 2 code base for Flash Lite 3 using, among other things, ASUnit based unit and acceptance tests. The early stage of development means it is too soon to leverage the new automated testing features of Adobe Device Central CS4. One of the most important aspects of our testing has been to check memory use over the lifetime of the applications we are developing. We are interested in tracking any memory leaks in our code and also any memory space fragmentation as the Flash Lite player creates or destroys objects and classes.

This memory information is viewable from Adobe Device Central in the Memory Panel, where device central provides a graph showing memory usage over time, separating Static Heap and Dynamic Heap consumption of the player as your Flash Lite application runs.

MemoryPanel.png

Testing for memory use, loss and leaks is currently not present as standard in ASUnit for ActionScript 2. In order to include this form of testing at a basic level we have employed a trick I picked up at Max San Francisco this year (If you are the person that explained the trick, please leave a comment so I can credit you). The technique makes use of the FlashLite SharedObject as a way of measuring the file size of objects and classes before and after you think you have destroyed them in your code.

The premiss is a simple one. In your test as part of the test setup create a local SharedObject create an empty data property and save the SharedObject to disk, then call the SharedObject.getSize() method and store the size of your empty SharedObject. The code should look something like this.

// size variation threshold for the SharedObject
private static var SIZEVARIANCE:Number = 5;
private var iS:SharedObject;
private var iSSize:Number;
// standard ASUnit test setup
private function setUp():Void
{
instance = new TestableClassObject();
iS = SharedObject.getLocal("iS");
iS.clear();
iS.data.iS = undefined;
iS.flush();
iSSize = iS.getSize();
}

Some things to keep in mind are the following. The length of the SharedObject name and the length of the data property name will have an impact on the result of SharedObject.getSize(). In the above example I have limited both these values to 2 characters (‘iS’). All that remains is to link the value obtained from this setup function into a standard ASUnit test which looks something like this:

public function testDestroy():Void
{
instance.destroy();
iS.data.iS = instance;
assertTrue("testDestroy : test that the TestableClassObject 'instance' is destroyed successfully by checking size variation (" + SIZEVARIANCE + ") in SharedObject", ((iS.getSize() - iSSize) < SIZEVARIANCE));
}

In this test I am simply calling the target class instance’s destroy method, which should manage the removal of any stored references, arrays and object present in the class. I then save the locally stored instance back to the existing shared object, re-call SharedObject.getSize() and compare the size difference to the value of our initial empty SharedObject (iSSize) from the test setup method.

If the file size of the SharedObject is greater than the SIZEVARIANCE threshold then the test will fail. If that is the case then you have the ability to inspect the shared object using a SharedObject viewer (I use the free Solve by Darron Schall). In the viewer you will be able to see what items are not being properly removed from your class instance oronject. A common issue I have seen is the failure to destroy arrays that are prpperties of my classes for example. Some time over the holiday break I will put together a full example for download.

Free Flash Lite Components Bonanza!

I you are a Flash developer producing mobile content for Flash Lite then this week end you really hit pay dirt. First Nokia announced a set of Components for Flash Lite 2. Next Adobe also release a set of Components, for use with Flash Lite 1 and also Flash Lite 2, courtesy of Mark Doherty. Finally Scott Janousek resurrected the google code links for Shuriken, a set of open source Flash Lite2 components from last year.

So with all these ‘new’ flash lite components available what can you expect from each component set?

Nokia Flash Lite 2 Components
Nokia have provided their Flash Lite 2 Component set as an MXP file for simple installation into Flash CS3, the components are easily accessible from the components panel once the MXP has been installed. Included in the zip file you download is a full readme.txt explaining how to install the MXP file through Adobe Extension Manager. The components also include full usage instructions in the form of flash help files and usage examples. Flash Lite Components that are included in the distribution are:

  • Signal Level display, including network generation.
  • Battery level display.
  • Dynamic List Component.

The Signal and Battery indicator components react to softkey placement/screen orientation. All three of the components have easily accessible skin components in the library, and also allow limited visual control from the properties panel. Mark Doherty noted that the components appear to be quite memory hungry. The Signal and Battery Indicators seem to use in the region of 600k according to Adobe Device Central, the Dynamic List Example reports around 800k although the actual memory usage of the list without a demo data set is closer to 700k.

Download the Nokia Flash Lite 2 Components

Adobe Flash Lite 1 & 2 Components and UI Examples
Over at flashmobileblog Mark Doherty has released some UI components as well. These are provided for both Flash Lite 1 and Flash Lite 2 projects. There is limited documentations for the examples, the Flash Lite 2 examples look like they should be easy to integrate as long as you intend to use them ‘as is’ in this case they would simply require the addition of key listeners to control them. If you needed the components to be used in a more dynamic fashion, there would probably be some work to do. Included in the Flash Lite 2 component examples are:

  • List, this offers similar functionality to the Dynamic list in the Nokia Component set.
  • Slider, This offers a horizontally scrolling icon menu.
  • Gapper, This is a vertical variation of the slider.
  • TileGrid, Shows a gridded icon menu with scrolling screen control.
  • NavModel, this demonstrates a full application screen control system, also included are working Signal and Battery indicators and a list components.

The examples in this file are certainly easy on the memory, all of them use less than 500k, this is particularly impressive of the Nav Model example given the amount of interactivity and feedback that is demonstrated.

As with any Flash Lite 1 work, making use of the earlier versions will be a little more fiddly than the Flash Lite 2 counter parts. But the code in each of the examples is clearly identified and if you know your way around ActionScript 1 you should find incorporating the ‘components’ easy enough. Included in the examples are the following Flash Lite 1.1 components.

  • Carousel, A full screen horizontal slider.
  • Displays, demonstrates the various device stats you can access from Flash Lite 1, also included are battery and signal indicators.
  • IconMenu, offers a FlashLite 1 version of the Slider component in the Flash Lite 2 set, this is similar to the functionality produced in the tutorial here.
  • Menu, actually seems to be a Flash Lite 2 example, an alternative dynamic list example.
  • Story, This is an example of scrolling text in flash Lite 1, similar to the scrolling text component I have released.

Agin the Flash Lite 11 components are very efficient when it comes to memory usage. None used more than 400k when published, and most were below 300k. The trade of with both these example sets from Adobe seem to be the slight increase in the amount of work you would need to do to integrate them. The other thing to note, is that these examples do offer examples of far more compelling UI methods than simple lists.

Download the Adobe Flash Lite 1 & 2 Components and UI Examples

Shuriken Open Source Flash Lite 2 Components
The last set of Flash Lite components are those that

  • Scott mentioned, the Shuriken Components. I stumbled upon these components some time ago, I am not sure if the project is still live or has fallen dormant. The project offers a fairly comprehensive attempt at providing a full component framework to Flash Lite 2 developers. Included in the distribution zip are source class files, and example .fla’s for each component in the library.
    • Button
    • Calendar
    • CheckBox
    • ComboBox
    • DateEditor
    • LinkButton
    • List
    • Loader
    • NumericStepper
    • RadioButton
    • RadioButtonGroup
    • ScrollableList
    • SimpleButton
    • TextArea

    While the examples are good they do seem to be quite heavy in terms of memory usage, and they are not without issues. The scrolling list example for instance takes around 700k to display, but more concerning is that this memory usage raises during operation, implying the component has a memory leak somewhere. The complexity of this initiative while making development easier, may be its problem. Complex class structures in Flash Lite tend to give rise to cross references and memory leaks quite quickly.

    Download the Shuriken Open Source Flash Lite 2 Components

    So there we have it 3 sets of components, all certainly have there advantages and disadvantages. The Nokia Flash Lite components are great for Plug and Play development, I would say the Adobe UI examples are great for producing engaging canned demos as they stand, but with a bit of work could be converted for very memory efficient project use, and the shuriken component frame work may be a little heavy at the moment, but keep a watch on them, they could certainly offer a great, familiar framework for Flash Lite development, when they can solve the memory issues.

    Also worth a note is that Mark Doherty has put a shout out at the end of his post regarding a shelved component framework that he could release from Adobe if interest is great enough. Mark has asked the FlashLite comunity to provide some support if it were released, to document and update the project, but this could offer a great opertunity to unify the current state of disperate component solutions emerging.

    Credit where its due:

  • RIA + OSP = RAA || REA && And how to detect an Open Screen Device

    Keeping with the algebraic/code functions as titles from my Last post I thought I would put some thoughts down regarding the news from Adobe earlier this week of their Open Screen Project (OSP). Anyone working in the Web/Internet industry at the moment will be well aware of the Rich Internet/Interactive Application (RIA) moniker. What Adobe is committing to is much larger though this is about true cross platform convergence. Its about Rich Anywhere Applications (RAA) or Rich Everywhere Applications (REA) if you will. You see what I did there 😉 .

    Interestingly this is a concept I began to scratched the surface of with my presentation at Flash On the Beach Last Year, and over the last few months has been a subject I have continued to keep close to hand both in my day job and my personal development projects. At the moment the Flash Player Fragmentation offers a considerable challenge to any developer wanting to design and or develop for multiple devices and multiple screens.

    Articles like the one posted over at ADC on adaptive screen layouts offer a great foot up. But before we get to visual display we need to know what player version we are targeting. And to do that, we have to hit the time machine button and roll back all the way to Flash 4…..

    Continue reading RIA + OSP = RAA || REA && And how to detect an Open Screen Device

    Adobe CEO: We’re bringing Flash to the iPhone!

    This just popped into my news reader from ZDNet.

    Well, you really believe that Flash is synonymous with the internet and frankly, anybody who wants to browse the web and experience the web’s glory really needs Flash support. We were very excited about the announcement from Windows Mobile, adoption of Flash on their devices and the fact that we’ve shipped 0.5 billion devices now, non-PC devices. So we are also committed to bringing the Flash experience to the iPhone and we will work with Apple. We’ve evaluated the SDK, we can now start to develop the Flash player ourselves and we think it benefits our joint customers. So we want to work with Apple to bring that capability to the device.

    If the mountain wont move to you..

    Go Adobe!

    Read the full ZDnet article here
    Read the SeekingAlpha transcript here

    Creating a scrolling text component in Adobe FlashLite 1.1

    Recently I have been heavily involved in an on going FlashLite 1.1 based project. Some thing I know my development peers have been extremely jealous of as they bang their heads against the hellish development processes of Flex, Air, ActionScript 3 and Flash 9, not!

    One of the most enjoyable features of FlashLite 1.1 is its (lack of) ability to measure the height, width or any metric of text once it is displayed on the screen of your shiny new Nokia N95. This makes efficient text scrolling a particular joy to produce. To this end I have produced a simple example of a fairly flexible scrolling text component for FlashLite 1.1.

    Below is a comprehensive (hopefully) tutorial describing how to create such a component.

    Continue reading Creating a scrolling text component in Adobe FlashLite 1.1

    Nokia N830 WiMAX Tablet Leaked

    Another week and another Nokia device makes its way onto the information super highway, this time courtesy of a BestBuy sales flyer. The rumor mill has begun speculating whether the black internet tablet pictured is the new Nokia N830 the WiMax equipped version of the N810 internet tablet. The N810 you will recall is the Linux based internet tablet that comes pre-installed with the Adobe® Flash® 9 player to support video and audio streaming, among other things :D, you can see the specs of the N810 here.

    Credit where its due:
    Into Mobile
    Internet Tablet Talk
    Tablet Blog

    Flash on the Beach 07 Presentation Files

    FOTB 07. What can I say. Incredible. First off let me say a very big thank you to John Davey. John did a great job, I can only guess the amount of organization involved in Flash on the beach, the speaker list and session line up were brilliant, and the shwag was top draw, both for attendees and speakers. It was a pleasure and an honor to have the chance to be involved in a presenting capacity. Thank you for inviting me John.

    At the event I presented a session that discussed the issues of Localisation, and to a lesser extent my new love, Mobilisation. This was my first time presenting at a larger event like this. Certainly I was nervous, and I am sure that there were tell tale cracks in my voice a few times as I went through my slides. As I got in to the flow of the presentation I think I settled in a little.

    I did have a slight issue with timing, which meant I rushed the last few slides, unfortunately, as a result I had to drop one of the examples. It also meant that I missed the opportunity to ask questions of the people that attended if they had any. So my apologies there.

    Any way below is the link to my speakers notes, and also the examples from my session on Localisation.

    Flash on the Beach 07 Localisation Presentation Files

    On a related note I have uploaded to Flickr a few of the images my little lomo camera captured of the event. You can see them over on my Flickr stream

    FlashLite 3 update availible for Flash CS3 & FlashLite 3 update for Device Central

    Following the press release announcing FlashLite 3 I proceeded to do some more digging. Wondering how I can start producing this new fangled FlashLite 3 Content, I followed some links through from the new Nokia Mobile Developers Site mentioned in the previous post and found new downloads for updates to Flash CS3 and Device Central at the Adobe Developer Connection Web Site

    FlashLite 3.0 Update for Device Central

    Flash Lite 3.0 Update for Flash CS3

    Interestingly the download for Flash CS3 is rather cryptically called “RobRoy_9_0_0_d156_patch.dmg“? or “RobRoy_9_0_0_d156_patch.exe” for windows?