Tuesday
12Jan2010

Nexus One UK Price

Happy New Year to you all,

As I’m sure you’ve all seen, Google is now selling the gorgeous Nexus One android phone with its stunning AMOLED screen and 1GHz Snapdragon processor.

Needless to say - I desperately want one - but how much will it cost in total to get one shipped to the UK? On the Google site they say taxes will apply but they don’t say how much, so here is a calculator I made in Google Docs that should give you a pretty accurate total price based on Google Finance’s exchange rate at the time you visited this page:

 

£420 (at time of writing) isn’t bad for an unlocked Smartphone with those specs considering the iPhone 3GS is around the £800 mark.

Now all you have to do is decide what network to go with, I’m looking at Orange and O2 currently, let me know what you decide if you buy one in the comments,

-Ben

Sunday
27Dec2009

Merry Christmas and all that

Hi everyone, hope you had a good Christmas!

I had a great one, got lots of nice presents and now that I’m working  its really good to be able to buy presents for others too.

So what’s new with me?

My Chrome Extension has seen over 2,000 downloads which I’m well happy about! Going to push some more updates out for that soon.

I’ve started using DropBox which is pretty awesome.

I got myself and my Mrs a new Samsung Q320 laptop and we are loving it – its so nice to have a laptop with actual battery life and without a screen that’s falling off.

Played Super Mario Bros Wii, its not the most groundbreaking or innovative game you’ll ever play but it’s damned funny – strongly suggest you get it and play at least 2 player at all times.

The Steam Holiday sale has started, GTA IV for £4.99!! Awesome.

My Dad got a Kindle 2 for Christmas and I had the luxury of playing with it setting it up for him. Its such a cool gadget, I want one just because its so cool. If I had some money to spare and perhaps some more free time I’d probably get one and read a lot more as a result. The podcast/audio book support is great too, definitely recommend it.

My Mrs and I have been looking at holidays for the summertime, we want somewhere warm and islandy, not too basic but not overrun by tourists, its hard to find that balance. We also want to get married abroad so we’re kinda looking at potential wedding/honeymooning worthy destinations too as we might as well enquire whilst we’re there.

So yeah, I think that's everything for now, have a great New Year if I don’t speak to you before ;)

-Ben

Sunday
29Nov2009

Chrome Extension: Resolution Test

Evenin,

I was just thinking about creating a background for my Twitter page when I thought it would be useful if there was a chrome extension that would resize your window to mimic different display resolutions. I did a search but I couldn't find one, so I thought I'd have a go at creating one myself.

I haven't done a lot of javascript before and its still very rusty, but if you're running chrome on the dev branch you can install the extension here.

Enjoy :)

-Ben

[Thanks to famfamfam for the icons]

Sunday
29Nov2009

Tweet Cloud

Just generated a tweet cloud for my last year of tweets at http://tweetcloud.icodeforlove.com.

Some of the sentences it makes are pretty funny; "watch people mate windows", "facebook home looking pretty"

Top three words: lmao, time, awesome - http://w33.us/10jv

I think that sums me up pretty well,

-Ben

Wednesday
25Nov2009

Creating Buttons Quickly and Easily with Actionscript 3

Hey guys, hope you’re all well.

As you know I’ve been working on a flash game recently that is due out soon (I’ll keep you posted) and one of the things I’ve found most over-complicated and time consuming is creating and managing buttons. For example, if we want to create a simple button that runs a function we’d have to write something like this:

   1:  button.addEventListener(MouseEvent.CLICK, someFunction);
   2:  button.buttonMode = true;
   3:  button.mousechildren = false;
   4:   
   5:  function someFunction (e:MouseEvent)
   6:  {
   7:      //button function here
   8:  }


That’s quite a lot for just a simple button, and what if we want a mouse over animation? Then it looks something like this (using Tweener):

   1:  button.addEventListener(MouseEvent.CLICK, someFunction);
   2:  button.buttonMode = true;
   3:  button.mousechildren = false;
   4:   
   5:  button.addEventListener(MouseEvent.MOUSE_OVER, overFunction);
   6:  button.addEventListener(MouseEvent.MOUSE_OUT, outFunction);
   7:   
   8:  function someFunction(e:MouseEvent)
   9:  {
  10:      //button function here
  11:  }
  12:   
  13:  function  overFunction(e:MouseEvent)
  14:  {
  15:      Tweener.addTween(e.currentTarget, {_brightness: 1, time: 0.3, transition: "easeInOutSine"});
  16:  }
  17:   
  18:  function  outFunction(e:MouseEvent)
  19:  {
  20:      Tweener.addTween(e.currentTarget, {_brightness: 0, time: 0.3, transition: "easeInOutSine"});
  21:  }


That’s a lot more already, and this is just for one button with a simple animation!

Then we have the issue of removing event listeners when we don’t need/want them anymore. In AS3 we need to write something like this:

   1:  button.removeEventListener(MouseEvent.CLICK, someFunction);


That might look like a relatively simple one line operation, but baring in mind we have to do this for every listener the button has (click, mouse over, mouse out etc) and we have to already know what listeners are attached and what function they perform, the whole process becomes far too time consuming for something that really shouldn’t be.

I’m not having a go at adobe for making the process convoluted, I agree with the methods used and I wouldn’t want it changed, but to save time I wrote a QuickButtons class to do all this stuff quickly and easily.

To setup the class initially you just put this variable definition:

   1:  public var qb:QuickButtons = new QuickButtons();


Then whenever we want to add a function button anywhere in your code we can just write:

   1:  qb.setupFunctionButton(button, someFunction, true);


Where ‘button’ is the movie clip you want turned into a button, ‘someFunction’ is the function you want it to run and ‘true’ means it will add the default over/out animations (this can be defined at the bottom of the class file).

So that’s nice and simple, but what if we want to do a custom animation for this button? Then we have this:

   1:  qb.setupCustomButton(button, overFunction, outFunction, someFunction, true);


Where ‘button’ is the movie clip you want turned into a button, ‘overFunction’ and ‘outFunction’ are the over/out animation functions, ‘someFunction’ is the function you want it to run and ‘true’ means it will use the hand cursor.

If we want to setup a button that opens a URL we can use:

   1:  qb.setupURLButton(button, "http://someURL.com", "_blank", true);


Where ‘button’ is the movie clip you want turned into a button, the first string is the url you want to link to, the second string is the target frame and ‘true’ means it will add the default over/out animations.

I also wrote a function for text that automatically places a catchment box behind it, it looks similar to the above:

   1:  qb.setupTextURLButton(button, "http://someURL.com", "_blank", true);


There is some more in there too but you can find them in the class once you’ve downloaded it.

We still have one more issue however, what about removing listeners? Unfortunately we don’t have a magical ‘removeAllEventListeners’ function built into flash, but I have written my own one that will work only with events added to buttons by my class. We simply put:

   1:  qb.removeListeners(button);


If you want to see how this works just have a look in the class. In a nutshell it stores all the added events in and array on the button’s movie clip and then removes them one by one.

So, there we have it, the first version of my QuickButtons class. I’ll add to it as I work perhaps but its good enough to save you a lot of time as it is now. You can use it and edit it for anything as much as you like, so long as you keep my name at the top I don’t mind :) Let me know if you need any help with it in the comments, you can download the class here.

Enjoy!

-Ben