Flash 8 Actionscript 2.0 FileReference Upload issues

28 04 2008

I’ve had several problems with this that only affect the Mac version of the Flash Player – so frustrating – the joy of the Flash Platform is supposed to be that you don’t have disparate platforms to test! :( Anyhow if you’re struggling with this…

Add an extra output from the server to trigger onComplete on a Mac as outlined in Abdul Qabiz’s lovely post here:
http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/workaround_file_1.php

Our ASP.NET backend had no trouble with this and even though the onComplete function was not the one throwing the error in my AS – fixing this seemed to have a domino effect of pleasurable error freeness. One point of note; contrary to many posts I have read; this deos not appear to be fixed in Flash Player 9 for Mac so do it anyway (can’t hurt)

Also maybe try:

- Making sure the FileReference Object never drops out of scope/gets removed too early

- Making sure you have a handler for onCancel (good for debugging)

- Using Delegate.create to specify the instance to handle:

this.referenceListener.onSelect = Delegate.create(this, refOnSelect);

Also be aware that you basically can’t send data back with the onComplete event:

http://www.mehtanirav.com/2006/04/29/filereference-on-mac-type-is-not-available/#comment-1252

We created a getUploadStatus Web Service that we called aftewards with the same UID we’d posted alomg with the upload to get around this.

P.S There is a FileReference.onUploadCompleteData event but it only works in Flash 9.0.28 and up…



Dalston Oxfam weekly tape rips

15 04 2008

Totally off technological topic but found an excellent blog of a guy who digitizes obscure cassettes from Dalston Oxfam…

Oxfam Tunes

Good work mate, that’s ace :)



Copy to clipboard from Flash (a lesson)

14 04 2008

You may well have appeared at my humble blog hunting for a method of copying data to the clipboard directly from Flash as I have had one of these posted for a while. The method I wrote uses Actionscript to call a JavaScript that writes the content you wish to copy into an HTML text input field in a hidden div via the DOM model and then uses JavaScript to copy it to the System clip. I have been using this method on production sites for ~6 months and it works great but as it turns is totally unnecessary ;) The following barely documented function could have saved me (and you) the whole run around…

[code lang="actionscript"]

this.createTextField("in_txt", this.getNextHighestDepth(), 10, 10, 160, 120);
in_txt.text = "lorum ipsum...";
System.setClipboard(in_txt.text);

[/code]

I guess sometimes as a Developer you just have to accept that you did things in the wrong way (although in my defence it works) but rather than hush it up I figured this is a lesson learned that I may as well share ;)

Who knows, someone may find my massively over the top JS Dom Model access version useful for something one day in circumstances where JS can do something Flash can’t?…



Firefix “Transferring data from www.somesite.com”

9 04 2008

Annoyed by the Firefox loading bar message “Transferring data from www.somesite.com” appearing in your flash sites when you know you’re not in the process of transferring data?

Loading from domain screenshot

Me too – Make sure you are not using null references to clear Levels/MovieClips like this…

[code lang="actionscript"]

loadMovie(null);

[/code]

and instead use a swf you’ve published with nothing in so that the HTTP request returns a 200 like so…

[code lang="actionscript"]

var assetNULL = "http://www.robmccardle.com/glue/bman/v6/null.swf";
loadMovie(_global.assetNULL);

[/code]

as it’s HTTP requests from within the Flash plug in that do not resolve which cause this to happen ;)



Script Generate on Stage Filters with JSFL

3 04 2008

Found a great JSFL tool to automatically convert any Fireworks style filters applied within Flash to AS… http://durej.com/?p=29

Script Generated Filters

Could be very useful so thought I’d share. Was originally looking for 9-slice scaling stuff and found this excellent resource page with a nice way of scaling PNG’s to 9 slice for buttons/UI elements. The AS2 version is at http://durej.com/?p=59

The AS3 one can be found with our friends over at Byte Array http://www.bytearray.org/?p=118