Navigation
Tags

Entries in flash (9)

Wednesday
Sep212011

Starling Framework Released

Today Starling was released. It's a new open source Flash framework for running 2D content on the GPU. It's Adobe supported and tries to mimic Flash's native display list. It's great news for game developers for whom it is obviously geared towards.

I've recently being doing some work with ND2D which is a similar framework so I decided to write a few tests to compare performance. They all run an animation on 2000 sprites. You will need Flash Player 11 installed to run these.

On my computer I get the above framerates which suprised me a bit. Starlight seems to be quite a bit slower. I tried everything to speed it up including disabling error checking, anti aliasing and image smoothing. Here is the source.

The interesting thing about Starling is that it tries to mimic the native display list as much as possible. It contains its own version of native classes such as Sprite, DisplayObject, Stage, TextField, and even Event and EventDispatcher, all with the same name. This makes working with it slightly difficult as you always have to be sure that you're importing the right class and it gets even harder when dealing with the custom event bubbling infrastructure that doesn't support native events.

Looking at this, a reasonable question to ask is why doesn't Adobe work into building this right into the runtime where all native display objects are running on the GPU instead of making people use an external framework that uses the same API anyway. It could be the case that Adobe is already working on this. They see all these 2D frameworks based off Stage3D popping up with varying API's and decide that they'll release one that behaves very much like the display list - one that developers will get behind so that when the functionality arrives in the native run time the effort required for developers to transition will be minimal. Adobe has already made advances to leveraging the GPU in Flash Player 10 with wmode=gpu that composits on the GPU and rendermode=gpu for mobile that renders vectors on the GPU. Doing this automatically across the whole display list though is very difficult.

I think a less interesting but much more likely reason for the similar architecture is simply that that is how Sparrow is architected, which Starling is a port of. Sparrow was inspired by Flash so when it gets ported back to Flash the similarities become obvious. In Sparrow however class names are prepended with SP, why is it different here?  

Wednesday
Sep072011

How to use Flash Player 11 and Stage 3D in Flash Builder

Stage 3D is only available in the Flash Player 11 beta at the moment and there a few steps to get it working correctly. A few of the last ones tripped me up so I thought I'd list them here for anyone else who is having trouble.

  1. Download and install Flash Player 11 beta
  2. Download at least Flex 4.5 and unpack anwhere
  3. Install Flash Player 11 playerglobal.swc:
    • Download playerglobal.swc (bottom of page)
    • Rename downloaded swc to 'playerglobal.swc'
    • Place playerglobal.swc into Flex SDK folder under /frameworks/libs/player/11.0
  4. Install Flex SDK in Preferences -> Flash Builder -> Installed Flex SDKS -> navigate to adobe Flex SDK
  5. Create a web based Actionscript or Flex Project in Flash Builder with the above Flex SDK 
  6. Go into the project properties -> compiler settings
    • Set User specific version to 11.0.0
    • Add compiler argument -swf-version=13
    • Make sure generate HTML wrapper file is checked
  7. Open html-template/index.template.html and add params.wmode = "direct"; at line 49
  8. Make sure your video card drivers are up to date and are newer than 2009
  9. Lastly right click on any flash content and go to settings and make sure 'Enable hardware acceleration' is ticked.

All those steps except the last 3 are required to compile with Flash Player 11. Setting the wmode to direct, having up to date video card drivers and making sure hardware acceleration is enabled are required for Stage 3D to work. 

Hope this helps.

Wednesday
Sep072011

Native Extensions in Adobe AIR 3

Adobe have just posted a new release candidate for AIR 3, which includes support for the new Native Extensions feature.

This will allow people to create extensions that use a combination of native code and Actionscript that lets applications written in AIR leverage the native system capabilities of wherever it is deployed, in effect extending the AIR runtime.

This capability will allow AIR to:

  • Achieve deeper integration with target devices
  • Incorporate legacy native code in applications
  • Take andvantage of multiple cpu cores
  • Offload calculations to the GPU
  • Achieve maximum performance for critical code

Adobe have also posted a detailed article detailing the specifics which is a really good read.

I think this really helps Adobe's aim for Flash to be the go to platform for creating applications across different systems and devices. It was already pretty good but this takes it to a whole new level. It can now compete with the likes of HaXe which has really been gaining ground recently. And with the inclusion of Stage3D (which is also in AIR 3.0) Flash is also becoming a truly powerful platform for games. All in all it gives me high hopes for the future of Flash.

I'm really excited to start playing with this, and to see what extensions the community is going to build. 

Thursday
Jun162011

Flash Builder custom metadata for Parsley and FlexXB

Flash Builder 4.5 added code completion for metadata tags. Adding support for custom metadata tags however requires building a swc containing a metadata.xml file outlined in hard to find documentation. They could have just added a preferences panel but this is a good way for developers to include custom metadata info right in their library swcs.

Two libraries I use quite often and leverage metadata tags heavily are Parsley and FlexXB. Neither of them have included this metadata.xml file in their latest releases so I have created 2 extra swcs containing just the metadata info using xml files found here and here respectively. I'm sharing them here in case anyone else wants to use them.

Note that they just contain the metadata info not the rest of the library. I could have bundled it in, but if the library recieves an update that still doesn't include the metadata file it will need to be integrated again.

Tuesday
May242011

Braavio and Cricket Australia

Work continues on the aforementioned Wunderkind BVR, which in the meantime has been rebranded as Braavio. More information can be found on the new website braavio.com.

Cricket Australia is the next big client to utilise Braavio in their efforts to find new Participation Growth Leaders for the sport. Along with their campaign launch we are rolling out our new Admin site which allows admins to manage submitted applications and get an overview of their campaign. This will be enhanced over the next few months to allow clients to fully set up, customise and manage every part of their campaigns and related roles themselves including: creating interactive forms for applicants to fill out, customise branding with colours and logos, creating video questions, and customising all text content and call to actions.

In the meantime we have also completed the Shortlist site, which is the next stop for favoured applications in the recruitment process after they have been approved in Admin. It allows managers, HR, recruiters and otherwise interested parties to view, vote, comment and otherwise decide on suitable applicants for the required roles.

If you are looking to be Cricket Australia's next Participation Growth Leader head on over to their Braavio powered recruitment campaign at cricket-aus-careers.com.au. Applications open on the 30th of May.

Those interested in utilising Braavio for their own recruitment needs, please note that we are still in private beta at this time, but please register your interest at braavio.com.

Tuesday
Oct192010

Water Simulation

Following on from the previous water experiment here's another one but from the side this time.

This one uses Flint for a lot of the particles, displacement maps, masks, and some custom code for the waves. I would post the source files but it's a bit messy at the moment.

In addition to the falling objects, I'd like to add some with buoyancy that would interact with the waves.

Click to read more ...

Monday
Oct112010

Water Ripples

Updated on Wednesday, December 15, 2010 at 12:28PM by Registered CommenterYonas

I've always found water simulations fascinating. Recently I've been playing around in as3 trying to recreate some of this liquidy goodness. Here's a demo showing some of that early experimentation.

This was created using perlin noise, displacement maps, masks, simple shape drawing and a convolution filter. The basis for the mouse ripples came from Der Schmale

Let it sit or mouse over the water to create ripples.

Click to read more ...

Sunday
Sep192010

XML parsing with FlexXB

One of the necessary evils of working with xml in Flash is the mundane task of writing xml parsers. I've written countless xml to object and object to xml functions over the years. That is until I came across FlexXB.

FlexXB is a library for handling automatic xml (de)serialisation within Flash. There are a few xml serializers out there including the XML to Object Mapper that's built into Spicelib which is the core of Parsley (my new favourite application framework). Most of these libraries however require you to write quite verbose actionscript to utilize their most basic functions. They end up being hard to write, read and maintain in my opinion. FlexXB can create mappings this way too, but utilizing it within Flex is where it really comes into its own. There you can easily decorate your classes with simple as3 metadata tags that define the mappings automagically.

Here is an example taken from the documentation:  

This is a simple example on using xml annotations. Only fields that have been decorated with an annotation will be taken into account in the (de)serialization process. Notice the idField attribute. It specifies that this object supports a compact method of defining it in xml, by only specifying the id. The id will be rendered as element or attribute in the owner xml.

        [XmlClass(alias="Mock2Replacement", idField="id")]
       
public class Mock3
       
{
               
[XmlAttribute]
               
public var id : Number = 3;
               
[XmlAttribute]
               
public var attribute : Boolean;
               
[XmlElement(alias="objectVersion")]
               
public var version : Number;
               
               
public function Mock3()
               
{
                       
super();
               
}
       
}

The object has been built as:

        var target : Mock3 = new Mock3();
        target
.attribute = true;
        target
.id = 5;
        target
.version = 33;

The resulting XML is:

        <Mock2Replacement attribute="true" id="5">
         
<objectVersion>33</objectVersion>
        </Mock2Replacement>

This makes it so easy to use as classes can be configured inline and most of the time all you need is a simple [XmlElement] tag before a property and you're good to go. If there is ever a whole lot of logic to how an object is (de)serialised all you have to do is implement the XMLSerializer interface and you can do your work in the encode and decode functions. The options at your disposal within the tags gives you lots of power though with support for attributes, elements, array handling, class names, namespaces, virtual xml paths, id referencing, object caching and more. As well as creating mappings for custom objects you can create Convertors for simple objects like Dates that (de)serialize to/from strings.

There are some rare cases where you don't have access to the classes you want to (de)serialize (such as from a swc) which means you can't annotate them. But FlexXB has you covered with an easy to use api for programatically configuring your mappings. There are a few other features of the library such as classes for communicating with web services and object persistence, but I won't go into those here.

The developer recently announced details about an upcoming version (1.7) which will include more robust caching support including a feature I asked for only recently. He has also talked about adding support for xml versioning, which would allow for different xml mappings based on the version specified.

All I can say is this library has saved me hours and hours of time and recommend it highly. I have yet to see something that handles the mundane problem of xml (de)serialization so elegantly.

Sunday
Sep192010

Wunderkind BVR

For the past couple of months I've been working on a product called Wunderkind BVR.

    

The BVR stands for branded video recruitment and allows for clients to create campaigns and jobs which applicatants can apply for via customised forms, file uploads and video responses through a customisable branded interface.


Our first client is Malibu and they have just launched their campaign to find a Malibu Brand Ambassador using Wunderkind BVR.


malibu-rum-aus-careers.com.au

Expect more updates about this product in the coming months. At the moment only the public facing campaign site has been launched, but there is also an admin site where clients can set up their campaigns, and a shortlist site where stakeholders can vote on potential candidates which is being released within the next few weeks. Once this has all come together it will be open for all potential clients via an automatic signup process.

The application framework for the frontend has come together quite nicely. I think it's one of the nicest frameworks I've ever developed in. It's a combination of Parsley, FlexXB, the Cairngorm Navigation Library, and a bunch of custom code. I might write more about that in a future post.