kelvinluck.com

a stroke of luck

Flash 8 enhanced stroke bug

Update:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

When Flash 8 came out I jumped straight on the bandwagon and started using the IDE at work. Unfortunately I quickly encountered a bug which effects you when creating an swf for an earlier version of the Flash Player. At the time I was surprised that no one else seemed to be having problems with it but I quickly forgot about it when I started working on some Flash 8 projects…

Then, the other day, Scott Fegette from Adobe posted about the problem and I suddenly remembered. And as luck would have it the next day I was working on a little Flash 6 swf and ran into the problem again. Luckily this time I saved a simple file that reproduces the problem and I’ve sent this over to Scott. He has confirmed that he can replicate the problem and forwarded it on to the product team at Adobe. In the meantime I thought that I would post here so that other people who run into the problem can find the workaround.

The Problem
The designers I work with use Illustrator. We’ve found that generally the best way to get graphic assets from Illustrator to Flash is to choose “Export” in the Illustrator file and choose swf as the format. You can then import the generated swf into Flash (and clean it up a bit).

This has always worked fine for me. Until I started using the Flash 8 IDE…

One of the new features of Flash 8 is Enhanced strokes. These are only available if you export as Flash 8. Unfortunately, there is a bug in the IDE where it will add these enhanced strokes to your project when you import an swf (even if your publish settings are already set at flash 6).

So you create a new fla and set the publish settings to Flash 6 (following best practices as outlined by Scott). You then import your Illustrator swf. Now press Ctrl-Enter to test your movie. “Enhanced stroke is not supported in this player”. D’OH!

Note that the problem is not with the swf created by Illustrator. As we shall see, you can import the same swf into an earlier version of the Flash IDE without any problems… The problem is with the import process in the Flash 8 IDE.

If you want to see this in action then you can download my simple Illustrator file and try it out.

The workaround
I have only managed to find one workaround for this problem so far. It is simple but a little annoying. Basically, you can import the Illustrator into a previous version of the Flash IDE (I still have MX2004 installed luckily). You can then save it as an fla which you can open from Flash 8 and do what you like with. No enhanced strokes. Yay!

Hopefully MacromAdobe will fix this bug in a point release – in the meantime I hope the workaround helps someone. If anyone knows any other ways of avoiding the problem then I am all ears!



Flashr 0.5 under construction

Update 2:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update:

For the latest up to date information about Flashr please check out the new Flashr microsite

After a lot of discussion on the Flashr mailing list I have decided to make some pretty extensive changes to Flashr for the 0.5 release.

This will involve breaking backward compatibility in some cases but the rewards will be a cleaner API and the addition of a bunch of cool new features like a priority ordered request queue, request caching, and request timeouts…

It also means that until 0.5 is released the trunk of the Flashr repository will contain unstable code. If you want the latest and greatest copy of 0.4 (with a few improvements from the zipped 0.4) then please grab it via subversion from the 0.4 branch. I think I changed all the relevant links on the site but thought I’d give this headsup just in case…

In the meantime you might want to check my latest experiment which is something that will benefit greatly from queueing system in the upcoming version of Flashr and so which can act as a kind of benchmark for it :)



2005 – an interesting year on flickr

Update 2:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update:

For the latest up to date information about Flashr please check out the new Flashr microsite

With the release of a new method on the Flickr API it is now possible for us to find the most interesting photos on a given day. I’ve combined this with the excuse that it’s a new year and put together a little toy which lets you look back over the most interesting photos of 2005…

The toy shows you the 15 most interesting photos from this date a year ago… You can click on a photo to find out more about it or you can drag the little slider at the bottom to choose a different day… Quite a cool way to discover some of the amazing photos on flickr!

Update

I carried on playing around with the idea and made a new version. In this version you can see the top 3 most interesting photos for five consecutive days. I thought that you would end up with the same photo staying at the top for a few days but I guess flickr’s interestingness algorithm stops that happening… Interesting, ey?



Flashr gets more interesting

Update 2:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update:

For the latest up to date information about Flashr please check out the new Flashr microsite

As just announced on the flickr mailing list, the guys at flickr have just released a new API method – flickr.interestingness.getList.

This cool new method lets you get a list of the most interesting photos for any given date… So I went straight ahead and added the method into the subversion repo for Flashr. You can see the exact changes here.

I’m not going to package up another release so soon after 0.4 but if you are interested in using this new method then grab the source from subversion and enjoy :) I certainly like the new method – I just stuck together a little example using it :)



Flashr 0.4 released

Update 2:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update:

For the latest up to date information about Flashr please check out the new Flashr microsite

I have just released version 0.4 of Flashr. This is just a bunch of changes which have been sitting in the subversion repositry for a while along with newly generated docs.

The changes since the last release can be seen in detail on the trac site or you can look at the changelog.txt for a more concise rundown.

Any comments on the changes or on Flashr in general please direct to the mailing list.



Made with Flashr

Update 2:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update:

For the latest up to date information about Flashr please check out the new Flashr microsite

Over the last few weeks lots of people have suddenly released cool new experiments using Flashr to connect to flickr.com. It’s great to see people making cool stuff and finding a use for Flashr – now I need to get round to finishing and releasing some of my own experiments with it! Anyway – here’s some little descriptions of the new stuff…

Flickeur by Mario Klingemann.
Really cool program which “retrieves random images from Flickr.com and creates a stream-of-consciousness type of video clip”. Mario has created incredible transitions between different images using Flash 8′s BitmapData Object and (I imagine) lots of really clever maths and who knows what else! The end result is a film which looks professionally put together even though it is in fact randomly generated by your computer!

Flappr by Buck DeFore
In the words of it’s maker, “Flapper is a Flash 8 interface for Flickr. Its goal is to provide a more explorative way of browsing the best repository of publicly shared photographs on the Internet”.
Basically it lets you search for photos, browse and view them. It builds a history of user’s whose photos you have looked at and you can easily navigate to any of their tags or groups. You can also see and link straight through to related tags for any tag you are looking at.
Another feature which I have just discovered is that it keeps a history of the photos you have looked at (try rolling off the right hand side of a photo when looking at it – it should shrink down and show you all the previous photos and let you click through to them) – cool :) Buck is still developing it so stand by for more cool features!

Findr by Doug Marttila
Findr again allows you to browse through photos on flickr.com by typing in a start tag. The clever twist here is that you can then “drill down” in your search by choosing another tag from the current tag’s related tags. And you see photos which match all the tags you have selected so far. Try it – it makes a lot more sense when you do it than my explanation does!

Flickr Wing by Iiley Chen
A demo of the ASWing open source component framework for Flash and an interface to Flickr. Allows you to search for photos on Flickr and browse through the search results.

So – some really cool stuff as you can see! Great work everyone :) If you have made anything with Flashr then please let me know – either through the mailing list or by leaving a comment below…



Actionscript 3: part 3!

Update 2:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update:

These examples were created with the very first beta of actionscript 3 and run on the very first beta of the flash player 8.5. Unfortunately they don’t work on any release version of the player because of changes Macromedia/ Adobe made.

The evolution of my ActionScript 3 project has continued. Here is the current swf (remember you will need the Flash Player 8.5 to view it):


As you can see, it’s a whole heap more exciting now… It still creates the mosaic tiles from the original jpeg in the same way as the previous examples but now each tile also listens for an EventType.ENTER_FRAME event. This is basically the same as having a MovieClip.onEnterFrame event handler in older versions of Flash. Each tile is repulsed by the mouse using Barslund Repulsion (thanks to a script I grabbed from Solid Ether).

Here is the code for the example in it’s entirety:

Fairly simple really… And if anything it seems way more efficient and responsive than my attempt at bounce tweening in the last example…

Comments or suggestions for improvements appreciated :)



Second steps with ActionScript 3

Update 3:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update 2:

These examples were created with the very first beta of actionscript 3 and run on the very first beta of the flash player 8.5. Unfortunately they don’t work on any release version of the player because of changes Macromedia/ Adobe made.

Update:

Check out part 3 of this series on my experiences with ActionScript 3.

I have taken my first attempt at ActionScript 3 and refined it a little… The first attempt was a very simple mosaic tool which created a mosaic from a jpeg. In this version I have improved it in a number of ways:

I now first blur each section of the image to get more of an average colour for each tile. This was a good excuse to use one of the flash.filters.* in AS and also gives a slightly better looking result. It still isn’t perfect but I spent quite a while searching the web and couldn’t find any good algorithms to find the average colour of a given bitmap (I’m sure they exist though – if you know one please leave some info in the comments).

I also decided to make the example a little bit more exciting by adding some movement to it. I initally did this by using the mx.effects classes but then I realised that these were adding 210KB to my file (unless I missed a “SimpleTween” class somewhere?). I presume that is because they depend on the whole Flex Framework but in this case (where my swf does pretty much what I want at 2KB) it seemed like some unnecessary overhead.

So I wrote a very simple little Tween class based on the new flash.util.Timer class and borrowed one of Robert Penner’s easing equations

So here is the resulting swf (note that you will need the flash player 8.5 to view it and that the movement happens when the swf loads so you may have to refresh the page to see it move):

And here is the ActionScript to make that swf:

If you compare it to my previous effort you will see that it is pretty similar… The additions are the BlurFilter and the new Tween class… They should be clear enough… The Tween class is very quickly knocked together and isn’t meant to be a proper generic replacement for the Macromedia ones but I think that such a beast may be necessary if the Macromedia ones are going to create such big files… Hopefully the next version of the zigo tween kit from Moses Supposes will include support for AS3…

Anyway – any comments on the code or suggestions for improvement appreciated :)



First actionscript 3 example

Update 3:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update 2:

These examples were created with the very first beta of actionscript 3 and run on the very first beta of the flash player 8.5. Unfortunately they don’t work on any release version of the player because of changes Macromedia/ Adobe made.

Update:

Check out part 2 and part 3 of this series on my experiences with ActionScript 3.

Macromedia have just released the Flex 2 Product Line which includes the Flash Player 8.5 and ActionScript 3. It’s only an alpha but it’s a good chance to start playing around with the next generation of the Flash Platform.

Below is my first little experiment. It’s currently very simple and doesn’t do anything that you couldn’t do with Flash 8 but I think coming up with simple little projects like this and making them is a good way to learn the new syntax.

First up, here is the swf (note that you will need the flash player 8.5 to view it):

And here is the code that generated the swf:

As you can see, we load a jpeg in and then loop over it getting the colour every TILE_SIZE pixels. We then create a new Sprite which we draw a bunch of Shape’s (in this case squares) onto. The result is a mosaic like effect (I remember doing this in the early days of Flash 5 – a much more complicated process involving using PHP to analyse the image data).

Obviously a lot of room for improvement (getting the average pixel colour for a tile, having the image be dynamic rather than programmed into the AS etc etc) but not bad for the first couple of hours with a new language.

Any questions or suggestions for better ways I could have done things please use the comments :)



Flashr Auth demo

Update 3:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update 2:

This example will no longer work as-is – you will need to update your Flashr files as described here.

Update:

For the latest up to date information about Flashr please check out the new Flashr microsite

I’ve just stuck together a simple demo which shows how to authenticate against flickr.com using Flashr and the new authentication API.

This seems to be one of the more confusing aspects of the Flickr API (it definitely was to me until I implemented it the first time). This demo basically shows the process of authenticating and also shows how you can store the authentication token in a SharedObject so that a returning user doesn’t need to log in again.

Note: you don’t need to authenticate against flickr.com to use most methods of the API. You only need to do it if you want to access a user’s private photos or to add / update information. The api docs tell you when authenication is necessary (I didn’t necessarily port all this information across into the flashr docs).

Right, here is the demo in action:

And here is the source code. To use the source code just download it and unzip it. Edit the file to put your API Key and secret in. Make sure you have the core of Flashr in your class path and compile the class with these MTASC flags (on top of your normal ones for -cp and -swf):


-header 400:250:25 -main com/kelvinluck/flickr/example/FlashrAuthDemo.as

If you have any problems with the demo then please ask questions on the Flashr mailing list.