Leaves - UPDATED

1848 days ago

I managed to get round to updating the Leaves animation I did last summer with a few bits and pieces. The Actionscript is not particularly pretty, as it was, like these little forays into the unknown are, akin to reaching around in a pitch black room for correct-coloured pieces of lego.

I’m very new to Actionscript, my knowledge consisting of some lynda.com videos (which I would highly recommend) and a bit of curiosity of the animation class library.

The way the lynda videos are structured means that you can use them as a sequential series of videos that help you understand from the ground up, or you can dip in and out using them as a reference. Very useful.

The key problem with the first version of this animation was the stalling of motion, which occurred at any time, but particularly when there are lots of instances of the animated figure on stage. The solution was actually found in the comments at the bottom of the Tween class descriptor .

The issue was caused by Flash trying to tidy up midway through the animation, and stopping the tween function midway through. This was defeated by putting all elements into a garbage collection array(of type dictionary) when they’re created, which is declared prior to the animation function. This system then transfers control to the developer. Each Tween function has an appended listener to check if the Tween has finished, and calls a function that clears out that Tween from the array.

Sweet. You can now add upwards of 100 leaves to the stage(though your CPU might not thank you) at once without it throwing any kind of wobbly.

Leaves with amount selector

I’ve structured the first version so that the user can define how many leaves they want to dynamically add to the stage. Enter a number and click add.

Leaves timed

The second version uses the flash timer class, in particular the utils.Timer and events.TimerEvent classes, to add a small amount of leaves(1-5) to the stage every 2 seconds.

Let me know if you want the source code. simon “at” robertsportfolio.com

Simon Roberts




Airport Connection Timeout - solved?

1852 days ago

I have had an ongoing issue with my macbook regarding the airport and the seemingly out-of-the-blue stone-walling of my requests. It’ll drop my ‘home’ airport connection, and when I try and reconnect, it says “connection timeout”. Rinse, repeat, rinse, repeat, ad naseum.

All my other computers/iPhone are still able to connect to my router via wired and wireless means, so this is a macbook only (hopefully) software issue.

But tonight, and after hours of googling it (tethering my iPhone connection to my macbook – sssshhhh!!), and there are SO many people who have this or a similar problem that I hope that at least 50% of my money for snow leopard is being spent on airport refinements, I think I finally got it. Or at least, it’s a suggestion for people who may stumble upon this to try.

Turn off Little Snitch – just to connect, then you can turn it back on.

I don’t know how many people use this app, but I do as I want to know what software is making remote connections to what server, and then deem them necessary/surplus to my requirements by a stringent process of looking the server name up and down looking for the words like “hax” or “gonnatakeyouronlinebankingdetails.net/sendstuff”, etc.

Anyway, I came to this juncture when I realised that when I looked at my “Network” system configurations on my lil mac mini that my mum uses, that the preferences for the connection are constantly changing. All the time. I don’t know how that occurs, but my reckoning was that because the airport on my macbook was hooked up to little snitch and it was trying to monitor it, and due to it not making a proper connection, settings were being changed on the network whenever little snitch was scanning.

That, I realise….is a terrible explanation, and if anyone could set me straight, I’d love to know. Cheers.

If you’re having Airport problems, here are few suggestions that seem to have worked for me in the past.


  • Reset your router/modem
  • com.apple.systempreferences – move it out of the folder to see if it helps you at all. It’s in your HD/Library/Preferences root, so try that. Can’t hurt to try anything with “Airport” in the name too. Then restart your computer and go from square one.
  • Reset your router/modem
  • Renew your DHCP lease. Worked a few times
  • Reset your router/modem
  • Alter your router security system (Generally, although more convenient-and more secure – WPA is more troublesome than WEP)
  • Reset your router/modem
  • Delete your “Preferred Networks” in Advanced preferences
  • Reset your router/modem
  • Complain to apple

Frankly, this kind of seemingly prevalent issue is tarnishing the great opinion the public has of apple products in general, and getting down and dirty with settings/console commands/whatever doesn’t fit with the efficient, straight-edge performance of almost every product they care to release.

UPDATE So…2 days after the post, apple release new OS version with supposed airport reliability improvements. If it works(and I hope it does) then the issue is resolved! Yay(potentially…)

Simon Roberts




iPhone slow synching

1972 days ago

This one really annoys me, as it appears to happen for no reason. Here’s a few tips that I’ve picked up after just about 6 months use:

  • Use ‘Restore to Factory Settings’ often – This is a clean sweep of your iPhone and helps it trim down on the trash it accumulates (an Apple product?! trash?! – unbelievable ;-)). I try to do it monthly and am always glad I do. I try and not use the backup that I’ve just discarded too, this kind of defeats the object.
  • Clear Crash Reporter – Googled this a wee bit, and I found a few forum entries saying that every time your phone crashes, it saves a bit of data about the issue to the phone, which it then syncs to your hard drive and when you’re syncing and have an active Internet Connection, it’s sending this updated info to Apple, meaning you have to wait for this to transfer. Not good times. My folder had 63 files/folders in it(including a folder called, rather worringly, ‘Panics’)

Here’s a quick preview of my folder,

To clear it, navigate to the following path

Then delete anything under the directory ‘MobileDevice’

  • Consider changing your backup preferences – When you sync, by default, you backup too, if this is not desirable, here’s a link to change the way you manage the data (just don’t cry when you lose something important!)
  • Leave some free space! – This one is really important. Your iPhone doesn’t really like being full to the brim (just like your standard hard drive, it’s a good plan to have a portion of it permanently free). So give it a break, and trim down your Music and Photos. I use Smart Playlists with specified max sizes to make sure I don’t put too much stuff on there (eg. Only 2 Gigabytes of music I haven’t listened to yet, ordered by date OR only allow files of under 10 mb into this playlist to prevent the long ‘secret track album closers’) Old Applications can go too, I think this’ll help your sanity too when you see how much neater you can make your iPhone OS GUI (Am I the only one who needs to keep his apps in multiples of 4? :-| – “Hi, my name’s Simon, and I’m a Nerd with OCD”)

Aside from that, I can only recommend you update to the latest version of the software frequently (though iTunes handles this pretty well for you).

Please comment if you know of any other genius tips to help other iPhone users stuck inside whilst their git of a phone works some shizzle out!

Simon Roberts





2012 days ago

The idea behind this demonstration was to discover the random and realistic movements that Flash is capable of with Action Script 3.

Using some of the set AS3 methods I was able to successfully render 3 leaves falling completely randomly each time the page is refreshed.

I created a simple random number generator that combined with the fl.transitions library meant I was able to get the leaves to fall at random times, with varying “sways” in the X and Y directions.

Another point of note is that not only is the movement random and realistic (to a point :-S) the CPU isn’t put under a vast amount of pressure, owing to there being only a small amount of code, and AS3 being very frugal with it’s processor use.


  • Occasional snags in the movement mean that the leaf will stop falling. This seems to happen in the CS3 interface a lot more than it happens in browsers. I really don’t know why this happens, so wouldn’t know where to start with the debugging :-S
  • A reset button, obviously
  • A “number of leaves selector”
  • I would love to incorporate scripted sequences with set movement alongside random generated events to create a unique experience for each user (even if they didn’t know it!) For example, an autumnal scene where there are lots and lots of events occurring, but some events are completely unique. This would take quite a bit more time, and university looms large at the moment!

Hope you like it, and email me at simon“at“robertsportfolio.com for the source code

Simon Roberts