Dec 13 2005

MTASC and ANT : error running mtasc compiler

Category: Development,flash,open sourceMartin @ 1:04 pm

If you are trying to run MTASC from ant and are seeing the message ‘error running mtasc compiler’ this means that ant cant find the mtasc executable. There are 2 ways to remedy this.
The first is to add the folder with MTASC in to your system path. The second is to use the ‘mtasc’ attribute of Simon Wackers mtasc ant task to point it at mtasc.

If your mtasc executable is in D:\dev\tools\ then you will need to define the task something like this :

<mtasc mtasc=”D:\Dev\Tools\mtasc.exe” …./>

I’ve written a more in depth guide to using ASDT and MTASC with ant over at osflash.org

Tags: , ,


Dec 02 2005

Java and zip files

Category: Development,JavaMartin @ 7:17 pm

I’ve just spent a day debugging what at first appeared to be a permissions problem. Im using the jakarta commons file upload with a tomcat / spring setup to allow users to upload zip files, which are then unpacked and the contents are processed into a database. Obviously using a zip should make it easier to upload multiple files and directory structures.

What was happening is that the directory entries I expected to be in the zip werent being created, so none of the files could be written when it was unpacked. Eventually i discovered that the problem was related to how different tools create zip files. I use winrar, which creates a seperate entry for a directory, as luck would have it the tool my client was using doesnt.

So, if you are writing java code to unpack zip files you will be better off doing something like this :

Enumeration entries = zip.entries();

    while (entries.hasMoreElements())
    {
        ZipEntry zipEntry = (ZipEntry) entries.nextElement();
        File file = new File(outputDirectory, zipEntry.getName());

        // check the parent of this entry to see if it exists
        if(!file.getParentFile().exists())
        {
            file.getParentFile().mkdir();
        }

	InputStream is = zip.getInputStream(zipEntry);
        FileOutputStream fos = new FileOutputStream(file);

	while (is.available() > 0)
        {
            fos.write(is.read());
        }

	fos.close();
	is.close();
}

rather than just checking if zipEntry.isDirectory() and then doing a mkdir.

Of course its wise to do both, because the zip may contain empty directories and you might rely on them being present later on.

Tags: , , , ,


Nov 19 2005

last.fm recent tracks in flash

Category: Development,Other Places,flash,open sourceMartin @ 3:52 pm

If you’ve been wondering when the code was going to return, well, here it is. Its a little app to show you your [tag]recently played tracks[/tag] from Last.fm. [tag]Last.fm[/tag] is a great site if you like music, and who doesnt like music? So whats it all about?

As they say ‘You get your own online music profile that you can fill up with the music you like. This information is used to create a personal [tag]radio[/tag] station and to find users who are similar to you’

One really nice feature is that a lot of the data is freely available from the audioscrobbler.net site in a variety of formats. This has prompted some people to create handy little scripts that generate sigs which show what you have just been listening to. Most of them have been made using php and GD to generate a graphic, or just plain ol html. So i thought this would be a perfect opportunity to do the same in [tag]Flash[/tag], but using only open source tools and libraries (You dont need the flash IDE installed to build it..)

You can download a zip of the code from here.

To build it you will need swfmill and MTASC, and to make your life easier i’ve included an ant build file.
The build file requires the as2 [tag]ant[/tag] tasks created by Simon Wacker which you can grab from here.

Also included in the zip is a lovely font created by the nice people at orgdot and a little php script that will cache the response from last.fm so you dont hammer their servers (they ask that you dont make more than 1 request a second..)

For now the implementation is very basic, im sure theres plenty of improvements and extras that can (and should) be added. Drop me a comment if you do something interesting with it.

and if you want to see it in action you can go here

Tags: , , ,


Oct 24 2005

SWT and Flash

Category: Development,Java,flashMartin @ 10:38 pm

I’ve been thinking about ways in which to use flash within eclipse and had considered using XML Sockets, but after reading the API docs for the SWT Browser I noticed that you can execute javascript functions by calling the execute method (funnily enough), and I already knew about the Flash / Javascript Integration Kit. So I knew i could send messages from java into flash, but how could i get information the other way?

Fortunately I noticed that the SWT browser allows you to listen for changes in the status text, so as a proof of concept I made a little project. Its nothing too exciting, but it shows how you communicate both ways and with a bit more work and some clever serialization I should be able to pass some rudimentary data types back and forth.

If you want to have a play you can download a zip file of the eclipse project here.

You’ll need to make sure the SWT library is on your build path to get it to compile. I’d be interested to hear if anyone has any problems using this, or if anyone makes any interesting additions to the code so we can do more complex java and flash communication within SWT.

Tags: , ,


Oct 03 2005

Source code searcher

Category: Development,JavaMartin @ 9:34 pm

Im writing my first RCP application at the moment and with any new programming challenge im having to do a lot of searching through help files and on the net. As you all know, sometimes an example is worth a 1000 articles, so finding the Koders site has been a real blessing. They even have an eclipse plugin so you dont have to leave home to find out how others are using IWorkbenchWindowActionDelegate. :)

Definitely worth adding to your toolkit.

Tags: ,


Aug 28 2005

Spring 1.2.4 released and Spring IDE

Category: Development,JavaMartin @ 8:49 pm

Its a good week for Spring users. A new version of the framework was released, its now 1.2.4. As always its worth reading through the changelog (or is only me that finds these interesting?)
Also for Eclipse users theres a new version of the Spring IDE which features a preview of the Beans XML editor, built on top of the Eclipse Web Tools Project or WTP to add another acronym to the never ending list.
I’ve installed the WTP from the complete bundle rather than dumping the plugins into my current setup. Im just finishing a big project at the moment so I didnt want some pre V1 tool to clart my nice working setup and leave my crying over my keyboard. I havent spent much time with it yet, but its looking good and will hopefully stop the never ending search for a good and free jsp editing plugin, among other things.

Full integration of the beans xml editor file with Eclipse will be a great brain saver from switching back and forth between the code and the config file. You cant beat a bit of auto-complete. If life came with CTRL-Space (and some nice templates) it’d be a damn sight easier.

What would really sort out my server development is that kind of integration for the openamf configuration file. I’ve considered some way of using xDoclet to generate the configuration, and may well experiment with that this week. Maybe by using a combination of xDoclet and the j2as project started by Ralf Bokelberg and the whole process of keeping the value / transfer object code in sync between java and actionscript will become fully automatic. Oh, and generating the advanced gateway definition from the service facade along with an actionscript interface would be damn handy. One thing that bothers me about using remoting as it comes (i.e. without a wrapper around the service object) is that you dont get any compile time type checking on your service method calls. If i can generate the service interface in actionscript that will save a lot of flicking back and forth between the java and as code. nice.

If anyone makes one before me, please let me know.

thanks.


Aug 25 2005

ASDT – FDT

Category: Development,flashMartin @ 12:34 am

At last I got off my arse and joined the ASDT project…well, of course I sent them an email and I stayed sitting in my chair as i do far too much, although i am making a regular habit of going outside for a walk or two every day.
I’ve just moved to Skopje (thats in Macedonia which you can find out about here) after living in London for far too long. So its also a good opportunity to learn my way around and try to remember that cars drive on the right hand side of the road, when im crossing the street.
Anyway, I think the release of FDT will spur myself and hopefully many more on to make ASDT the best option for developing flash. Dont get me wrong, im happy for them to release FDT as a commercial product and make money. We all have to eat :)

But, if you are like me and appreciate good quality open source tools and you want to see things happen with ASDT, keep bugging me and the other developers, or better yet, join up and start coding.


Aug 22 2005

All flash and no bang

Category: Development,flashMartin @ 11:08 pm

Flash 8 is announced, everyone is getting very excited about the new toys and tricks that are available, but, again it seems as though we are all deaf. (NOTE : I am writing this before i know for sure *exactly* what is in the new player, but from reading this it certainly looks like its all visual stuff)

Ok, so there are now 32 channels of sound in the new player (well, thats what it says here and there is a demo) BUT, oh, thats 32 mono channels, so 16 stereo channels.

Well, thats an improvement, but what can i do with those channels? anything new? theres all these fandangled bitmap filters and effects, why not the same for audio? Why do i have to be stuck with using mp3′s if i want some nice sound.
I want ogg’s and i want to access the sound buffer.
It doesnt even have to be real time, just let me write some numbers into an array, say here little sound object, eat this and loop it please. If i can update it at least some of the time, that would be cool, maybe play it back at different speeds. Im not asking for time stretching or anything.
Even some pre-defined filters would go a long way, just yer standard low pass / band pass / high pass would be great.

Oh well, maybe next time. At least i can do some motion detection with the camera and pass some data from that off via OSC (using flosc) to something nice, like plogue bidule

Tags: , ,


Aug 22 2005

Automated Swf Publishing

Category: Development,flashMartin @ 11:05 pm

Today i was faced with the pleasant task of publishing over 100 .fla’s into swfs. Not something i would ever do manually if i could avoid it.

Handily i remember reading this from grant skinner just the other day which is a great start, but im not going to hand write the compile schema (aka list of files to be published). In my case there arent any special deployment requirements, i can just stick the output files all in 1 directory. (Although if the jsfl file api thingy had a directory selector and a way to iterate through a directory contents then i wouldnt need any of this…)

Someone wrote a nice comment about using the dir command and a .bat file on windoze to generate the schema, handy but pretty dirty. So instead of that i knocked up a quick ruby script to generate a simple schema file, which is probably a good start if you need a more interesting layout, at least you dont have to write it all by hand.

It was also a good excuse to actually write some ruby code rather than just read about it. So here it is ‘my first ruby program’

enhancements and modifications are welcome.

the code is here

Tags: , ,


« Previous Page