Archive for the ‘coding’ Category
Midi into Flash
As part of some Sancho Plan development i’ve build an app that will send MIDI into Flash. The app, which has the catchy title of MidiRemote, sends note on, note off and controller data to Flash via Local Connection. All the flash movie needs to do is create a Local Connection object with id ‘midi_swf’ and listen for ‘onMidiTrigger’, ‘onMidiTriggerOff’ and ‘onMidiController’ messages (with channel, note and velocity parameters).
In our tests the latency isn’t too bad, but if there are too many hits at the same time then the local connection buffer gets a bit clogged up and a delay appears while it processes all of the messages (so it probably won’t be much good running against a gabba track
).
Download the Mac app here, Windows exe here and an example flash file here
Keys, Flash and Director
I’ve just found an interesting quirk/bug with flash embedded in director when the flash is looking for key presses (using Key.addListener). The flash needs to have a dynamic textfield within it otherwise it doesn’t get the key messages!
I don’t know if the textfield has to be across the whole timeline or just at the beginning (the flash file i was working on was small so it was across the whole timeline), but it threw me for a while before i figured out how to get it working.
Spark Europe
I’ve just got back from Spark Europe, where I saw some fantastic presentations and learnt about some very cool things.
Top on my list is definitely XRay, which allows one to take snapshots of swf files. I do a reasonable amount of debugging and fixing of other peoples code, so this could be incredibly useful for finding out what is actually going on in a swf. It requires a component to be added to the content (it can be in a loaded in mc apparently), which talks over localconnection, so there could be issues with content on safari which already uses a lot of localconnections (I understand that there is a limit of 8 or so).
I also stumbled across pixlib, which is a pretty complete framework for developing games etc. There is all kinds of useful stuff in there like an extended version of Mike Chamber’s Delegate, and implementations of various design patterns.
I learnt about ScreenWeaver, which is a kinda replacement for Director to make excutable files from Flash. At the moment it’s only just gone opensource, and the current version (3) is windows only. Version 4 will be supporting Mac, so that’s one on my list to keep an eye out for. I hope it’ll be able to get MIDI inputs (somehow).
I went to lots of the presentations covering the new Bitmap manipulations. This seems to have gained the buzzword ‘expression’.
Andre Michelle gave a very inspiring presentation, where he showed off some of the techniques he’s managed to achieve (including nintendo mode 7 emulation!).
Mario Klinneman of Quasimondo’s presentation continued the theme, ending up with showing off his very cool algorhythmic VJ tool (I hope I can get to play with that at somepoint (it’s still being developed).
Craig Swann (of crash!media) got me excited about the possibilities of live webcam input and flash (I really must get a webcam, cos I started looking at webcam stuff a year or so ago, but on Ed’s computer).
Grant Skinner’s marathon 3 hour run through of Flash 8s new features was very good, breezing through some of the BitmapData features, scale9grid, and lots of other features.
Veronique Brossier gave a good presentation which covered some colour theory, and showed off some JSFL commands/panels she’s developed to help designers implement this in Flash.
Debugging Shockwave movies on Mac OS X
The official macromedia documentation on where to put ‘shockwave.ini’ on Mac OS X points to the wrong place. The file is actually located within a .bundle file (a bunch of folders that look like a single file (very similar to .app files eg iPhoto)).
Here is a recipe for installing ‘shockwave.ini’ on Mac OS X (for Shockwave 10).
1) Make a file called ‘shockwave.ini’
2) Make sure it has the following in it
[Lingo]
DisplayFullLingoErrorText=1
MessageWindow=1
3) Save it to the Desktop
4) open Terminal
5) type the following (watch out for line breaks):
cp ~/Desktop/shockwave.ini "/Library/Application Support/Macromedia/Shockwave 10/Shockwave.bundle/Contents/MacOS/shockwave.ini"
You will now get decent error messages and be able to debug director files in shockwave on a mac!
With the advent of Adobe’s Shockwave 11, step 5 is now:
cp ~/Desktop/shockwave.ini "/Library/Application Support/Adobe/Shockwave 11/DirectorShockwave.bundle/Contents/shockwave.ini"
Actionscript – Tweens
There are some very cool classes that come with Flash MX 2004. One of them is the Tween class, which allows you to use one line of code to tween a property of an object from one value to another. Even cooler is that you can use easing functions to make the movement seem more natural. The most obvious thing to tween is the postion of a movieclip, but it will tween any property of an object, so the possibilities are endless. The built in tween class is built on the tween class created by Robert Penner.