Accommodating the new reality for the FileReference class in existing projects

This morning I read about the new rules regarding how to properly use FileReference.download() and FileReference.browse() in Flash Player 10 and quickly realised that this is going to impact one of my current projects.  Adobe has heightened security around how these are used.  Now they can only be called directly by a user interaction such as a button click.

I wasn't too sure what the ramifications were going to be for my project so I decided to test it by viewing it in Internet Explorer with Flash Player 10 installed.  The project is a few years old and written in Actionscript 2 and I recently had to add save and load functionality to it (the budget didn't stretch to a complete upgrade).

Here are my observations:

asfunction:
FileReference.download() and FileReference.browse() doesn't seem to work when called using asfunction in a link defined within html text in a dynamic textfield.  I think this is just a bug in the pre-release player and I've filed a bug report here: https://bugs.adobe.com/jira/browse/FP-569.   This is not a problem when calling the same code from a movieclip's 'onRelease' handler.  It is also worth noting that the equivalent feature in AS3 (TextEvent.LINK) does work with the FileReference class.

My save feature is broken:
My application's save feature allows users to save the data that they have generated to their local machine.  It works by the user clicking the 'save' button, a server-side script then adds the data to a row in a database and returns a unique id for that row.  A custom event called 'dataOnServer' is triggered and this launches FileReference.browse() .  The browse dialog does not open in Flash Player 10 and I am interpreting this to be caused by the fact that I am indirectly calling FileReference.browse() as a result of a user interaction (instead of directly calling it).

The next course of action:

Well, I've already reported the asfunction/filereference bug but in the meantime I'll have to use movieclip instances as buttons.

The broken save feature is going to have to be divided into a two-step process I think.  The first step will be to save the file on the server side and the second step will begin with a user interaction to save the file locally.  So far the best option that I've come up with is to save the file to the database when the user clicks the save button (as before).
However, this time an intermediary dialog pops up in the guise of a confirmation dialog (as in 'are you sure you want to save this file?').  This dialog is not selectable until the 'dataOnServer' event has been triggered.  Once selectable, the user can save the file locally by directly calling FileReference.browse() or choose not to.  This approach will hopefully mask a two-step process as a single operation.  Not as pretty as the original behaviour of the application but what are my options?

Any other suggestions are welcome

Posted by admin on August 20th, 2008 No Comments

A thought on the options available in Flash Publishing settings

I was reading some online documentation on Adobe Labs last night about how to target Flash Player 10 Beta with Flex SDK 3.0.x.  It struck me that the approach to configuring the compiler in Flex Builder 3 could not be more disparate to how things are done in Flash CS3.  The most significant thing for me is that my version of Flex Builder 3 is future proofed (to an extent) through its ability to work with future SDK releases.

In contrast, if I want to publish my flash files to Flash Player 10 or later I will have to buy the latest version of the Flash Authoring environment.  This has always been the case with the Flash Authoring environment but wouldn’t it be great if CS3 had an equivalent feature that could be availed of when Player 10 is released?  Surely what’s good enough for developers using Flex Builder is also good enough for users of the Flash IDE or maybe I’m missing some obvious reason why the option of downloading a patch (or equivalent) doesn’t exist.

Actionscript compiler options in Flex Builder 3

- Flex Builder 3 lets you add extra Flex SDKS to the compiler options.

Posted by admin on July 16th, 2008 No Comments

Queueloader class for AS2

I've written a helper class for loading and monitoring resources which is based upon an AS3 library called Queueloader located at Google Code.  My version is written in AS2 and has the following features:

  • Individual monitoring
  • Overall queue monitoring
  • Image loading
  • SWF loading
  • MP3 loading
  • I've tried to keep the syntax as close to the AS3 version as I could:

     
    import com.fboyle.load.QueueLoader;
    import com.fboyle.load.QueueLoaderEvent; 
     
    var queue:QueueLoader = new QueueLoader();   
     
    var infoOb:Object = new Object();
    infoOb.id = "123456";   
     
    queue.addItemAt("sample1.swf", _root.tmp, infoOb);
    queue.addItemAt("sample2.swf", _root.tmp2, null);   
     
    queue.execute();   
     
    queue.addEventListener(QueueLoaderEvent.ITEM_PROGRESS, itemProgress);
    queue.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, itemComplete);
    queue.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, queueComplete);   
     
    function itemProgress(ev:Object):Void {
         trace(ev.file + ": " + ev.percent + "%");
    }   
     
    function itemComplete(ev:Object):Void {
         trace(ev.file+ " is loaded! (id - "+ ev.id + ")");
    }   
     
    function queueComplete(ev:Object):Void {
         trace("queue is complete----------");
    }

    The classes files are available here: com.fboyle.load.*

    Update:

    After reading some comments over on Actionscriptclasses.com I've added QueueLoaderEvent.QUEUE_PROGRESS so that the entire queue progress can be monitored with the aid of a percent property:

     
    queue.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, queueProgress);
     
    function queueProgress(ev:Object):Void
    {
    	trace("Overall progress: " + ev.percent + " %");
    }

    Posted by admin on July 8th, 2008 1 Comment

    Blender shortcuts for common tasks

    I've had to deviate from Flash a little over the last few weeks and return to creating some visual work for a project I'm involved in at present.  The change has been very welcome because it's given me an opportunity to play around with Blender in the workplace.
     
    Blender is an open source 3d creation suite that I've been dabbling around with from time to time over the last few years mainly as a hobby.  I am very interested in the world of 3d and, after some research a few years back, I thought I'd invest some free time into learning Blender.  After seeing it's rate of development over several releases and experiencing the community ethos that Blender is synonymous with, I feel vindicated for choosing Blender as my focus for all things 3D as opposed to the more obvious commercial alternatives.

    Great features:

    It’s been a while (version 2.37) since I tried to produce anything in Blender and I have found that there are lots of new modelling and texturing features that have made life a lot easier;

    • Vertex snapping is a great aid for positioning meshes.  This used to be a real chore because the only real mechanism for arranging objects precisely (besides the transform properties pane) used to be the options on the Snap menu and this was based around positioning of the 3d cursor.
    • The modifier system totally changes workflow and allows you to non-destructively manage objects.  This has got to be one of the most important developments!  I found myself using the array modifier a lot when modelling an ancient temple!  The cast modifier also proved useful when I wanted to get acanthus leaves to better fit around a Corinthian capital.
      The bevel modifier and the bevel tool help to add realism to objects in seconds - a slight bevel can make a world of difference to a final render.  I completed an AutoCAD class a few years ago and was bevelling everything back then :-).   
    • The UV unwrapping toolset makes unwrapping meshes in preparation for texturing almost pleasurable.
    • Render layers has proved very useful in managing what actually gets rendered without having to hide layers in the 3d viewport.

    Look what I made!

    temple_of_athena

    This is a screenshot of the Temple of Athena that I’ve made for an education project.  I'm reasonably pleased with it but I'm even happier with what I've learned in the process of creating it.

    Where to start

    Blender can seem insurmountable when launching it for the first time but the same can be said for any application that is so feature-rich and capable. I resorted to a document I wrote a couple of years ago to help me get back up and running with it.  The document is a compilation of the keyboard shortcuts that I needed to learn in order to complete common tasks and I jotted them down as they were encountered.  I've also updated it to reflect the latest release.  Feel free to download it.  Please note that this document covers, for the most part, only shortcuts for basic operations.  Go to the online documentation for a more comprehensive guide (http://wiki.blender.org/index.php/Manual).

    Blender shortcuts document

    Posted by admin on May 29th, 2008 No Comments

    Scotch onAir, Dublin, 11th April

    This is to let interested parties know who are based in or around the Dublin area (or beyond) that Scotch onAir is taking place this Friday.  Organised chiefly by Kev McCabe, it's the official replacement event for the Dublin leg of the Adobe onAir Tour, which was subsequently cancelled.

    It's shaping up to be a really worthwhile event to attend if you're interested in learning about or considering using Adobe-related technologies. 

    Here's the schedule:
    12:00 - Lunch in the Bar
    13:00 - Ted Patrick (Flex 101)
    14:00 - 10 Minute Break
    14:10 - Kev McCabe (ColdFusion & Flex)
    15:10 - 10 Minute Break
    15:20 - Ryan Stewart (AIR 101)
    16:20 - 10 Minute Break
    16:30 - RIA Open Debate (One & All)
    17:30 - Raffle, Close & Thank

    You can Register here for FREE.

    Posted by admin on April 7th, 2008 No Comments