Err, just what exactly is PixelBender?

13 02 2009

 Pixel BenderBeen trying to work this out and it seems it’s basically a way of delegating computationally expensive tasks to a hybrid of GPU & CPU so you can take advantage of the local machines hardware better to extend how hardcore you can make client side computations in Flash Player/AIR runtime.

These slides did a better job of explaining than most: http://llvm.org/devmtg/2008-08/Rose_AdobePixelBender.pdf

Main things I’ve discovered:

- What isn’t apparent from the name is that is not restricted to graphics/video processing – you can do any Maths process with this for example manipulating audio live in real time in ways you can’t currently do e.g. proper DSP operations with float4 low level datatypes

- Creating a new PixelBenderJob via AS3 actually creates a new processor thread (confirmed to me at Flash On The Beach by Lee Brimelow) so effectively FP10 is capable of multithreaded applications in the same way Java is, it’s just that noone has got it working yet as far as I know…

I wonder how long it takes the ridiculously clever folks over at Hobnox, Alternativa, Papervision, Flint, Away3D etc to grab this or whether some other PJB wizard will create some next gen tools in this that may supercede their work in the 3D/Particle and audio DSP spaces where GPU’s are at their most useful?

I haven’t got any spare time as I’ve too many research projects on at the mo already (good times) but hopefully will get a chance to nose further at this soon…

Good links in the meantime:

Good weekend all

[code lang="actionscript"]EDIT[/code]

Just spotted this from the guys at BigSpaceship http://labs.bigspaceship.com/2009/02/12/3s-vs-3d/ top stats and a very interesting comment from UnitZeroOne regarding the future of Papervision :)



Flash Thunderbolt & Firebug = best debugger ever

23 10 2008

The Thunderbolt tool is absolutely amazing for runtime debugging of AS2 and AS3 from Flash or Flex and the memory snapshot thing is too cool for school. I love that uses Firebug too as I’ve been using that for DHTML stuff for ages.

Flash Thunderbolt

There is an AIR app version too, although it doesn’t sound very Windows friendly… for more info check this out

http://www.websector.de/blog/2008/06/15/10-tips-and-tricks-using-thunderbolt-as3/



AS3 Drag & Drop (Missing equivalent of onReleaseOutside -> stopDrag)

16 10 2008

AS3 Drag & Drop example Here’s a little AS3 draggable Joystick that bounces back into position with Tweener

Something so basic in AS2 can lead you on a merry little dance in AS3 and I thought I ‘d share some code, there are loads of basic AS3 D&D examples online like this of how to set up dragging on a movieclip but by applying startDrag on MOUSE_UP and stopDrag on MOUSE_DOWN to the same clip, you’ll fall over when your MOUSE_UP event doesnt occur over that clip (e.g. off stage or the equivalent of the deprecated AS2 onReleaseOutside)

The only explanation I could find online of where onReleaseOutside is implemented in AS3 was in the Flex 2 migration doc and is cryptic to say the least. Given the target audience for this info little better explanation wouldn’t go amiss dudes ;)

So anyway the obvious thing to do is add the listener for MOUSE_UP to the stage and not the object so I did that but the following line:

[code lang="actionscript"]

stage.addEventListener(MouseEvent.MOUSE_UP, mouseReleased);

[/code]

Threw the folowing error:

TypeError: Error #1009: Cannot access a property or method of a null object reference

When I moved this into the document class it was fine; this was only occuring when it was in a movieclip added to stage. Turns out this is related to the display list, the sequencing of the call to addChild() and the availability of the stage object.

Here’s my constructor that was causing the issue

[code lang="actionscript"]

public function Joystick(){

init();
}
[/code]

Once I change it to the code below the problem went away and my call to stage.addListener was valid i.e my problem had been that the stage object had not yet been defined (#1009). This is because my call in the parent (document class) to addChild(joystick) added the joystick to the display list but the constructor for the Joystick instance fired before that so it did not know what stage was a refererence to at that moment.

[code lang="actionscript"]

public function Joystick(){
if (stage) {
init();
}
else addEventListener(Event.ADDED_TO_STAGE, init);
}

[/code]

Heres my commented init function from the document class init function which explains matters better:

AS3 code

I have added an FLA, FlashDevelop Project and associated files for This Example so fill your boots and link me if it’s useful

Download FLA



Awesome tools for Flash & Web Development

24 09 2008

A quick note to whom it may concern on my favourite tools for web development, primarily in AS2 & AS3:

Flash Develop

I just had one of this “Oh my god how did I ever write scripts without this tool” epiphanies. Flash Develop rocks.  A lightweight framework that supports multiple instances (brilliant when you’re working on two or three complex builds) and I find, is just as good as Flex 3 for code completion.

SE|PY

SE|PY is a pleasure to use; I will still continue to use it for legacy AS2 projects as it’s a great tool, especially the XML parser which has been a long time favourite. This one of many goodies from Alessandro Crugnola including the amazing Flash Tracer and Flash Switcher Firefox add ons that are unbelievably useful thanks to http://www.sephiroth.it/

Charles Web debugging HTTP proxyWhat would I do without Charles? It’s saved me a million times, especially debugging Flash stuff that talks to the server from Macs and PC’s. If you’re doing any sort of web development you should get this. Great stuff.



Flash 3D Anaglyph examples (goggles at the ready)

27 08 2008

Found some really cool stuff on 3D Papervision recently, I’ve always loved the effect you get with these and the blend of analogue & digital you need. Obviously distribution of the goggles themselves is an issue as not many people have a pair on their desk although I do! :)

Papervison 3D AnaglyphTest

More details on this and source code can be found here.

There’s another semi-3d anaglyph project over on Paul Neave’s blog http://www.neave.com/anaglyph/



Flash Textfield : @ key giving ” with US keyboards

27 08 2008

Some blogs claim this was w-mode related but I was getting issues even in the Standalone player. There is a quick easy solution to this with Key.getAscii() :

http://flashmonk.blogspot.com/2007/08/wmode-key-flash-bug.html

Cheers dudes



Method for using Visual Diff on FLA’s in Subversion SVN

7 08 2008

 SVN is incredibly useful but as a Flash Developer,  the large binary files I am checking in stop me using the full functionality of the visual diff’s between files. That’s why I really like this concept by Pavel Simakov & extended by Alex Hart which uses JSFL to parse the DOM model of the FLA and export it as XML. You can then use Visual diff on the xml text doc and it will give you useful information about what has changed across the two version including in FLA scripts and MovieClip names:

 http://www.softwaresecretweapons.com/jspwiki/howtotrackchangesinflashmoviesusingjsfl

I’m sure it’s possible to automate this into the compile process in the same manner in which Flash generates .txt reports from the bandwidth profiler for optimization so that every project would have an associated XML DOM doc in case you needed to track such changes. Hope this is useful to someone and nice one to the authors :)



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…



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 ;)