bjornson’s blog

this blog is very young, come again to watch it grow

Archive for the ‘Free Downloads’ Category

My First Android Game: Koala Bubble Shooter

without comments

Within the last year I switched my focus on native Java programming for Android. Surprisingly most of my programming skills from ActionScript 3 programming were quite useful and could be applied to this new area. Except I had to fight with fragmentation, one of the reasons I preferred Flash over HTML+CSS back in the days. Anyways, my first game that came out at the beginning of this year was a simple match-three bubble shooter: Koala Bubble Shooter
It has 44.000 downloads and is still going strong. I just added advertising to it, because the in-game-purchases were not really what I expected. I guess I won’t retire anytime soon. But is a really nice learning experience. Keep coming back to hear about my next games.

Written by bjornson

June 20th, 2013 at 9:18 pm

Freeware Screen Ruler

with one comment

Because I could not find a screen ruler that did exactly what I wanted (and for fun of playing with Adobe Air) I wrote my own. And of course I felt like sharing it with the community, so here is the download:

bjornsons screen ruler (500KB Air Application)

I built in some options that I felt were quite useful:

  • option to set the background alpha: so now you can place the ruler on top of your screen or next to the object to be measured, just the way you like
  • option to set the background color: in combination with the alpha you can always make your ruler appear in contrast to the measured object without distracting too much
  • resising by dragging the corners: you can easily resize the ruler simply by dragging any corner in the desired direction
  • hide to dock: hide the ruler to the docking station by choosing “hide” from the menu or simply clicking ESC on your keyboard
  • move/resize single pixels: you can move the ruler with the arrow keys on your keyboard, and resize it with the arrow keys while holding down STRG (or the equivalent for your system)

But as we all know, a picture says a lot more than a few words, and a few pictures… well you get what i mean, so here are some screenshots of the tool:

Written by bjornson

June 9th, 2010 at 7:11 pm

AS3 + JavaScript = Resizable SWF in HTML

with 8 comments


I recently needed to resize an swf dynamically within an HTML document and could decided to combine JavaScript with AS3. So here is my solution in three simple steps:

  1. I wrote a simple JavaScript file that allows resizing of elements in an animated fashion.
  2. I embedded the swf in the HTML file in a <div> container with the style attribute “overflow:hidden;” and an id called “swf_container”.
  3. To ensure the desired effect I added stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT;
  4. Now I added a button in the Flash file that caused navigateToURL(new URLRequest(“JavaScript:sizeById(‘swf_container’,500,150,5)”), “_self”); and with this calling the JavaScript function and resizing itself.

If you want to try this yourself you can download the JavaScript file sizebyid.js and recreate what I did with it or download the whole sample.zip including the -.Fla, the -.swf, the -.js and the -.html file.

Of course you can try it out first:

Click the arrow in the top left corner to toggle sizes of the sample.

You can also use the following html form that calls the same JavaScript function

px width
px height
steps (fewer steps=faster)

Written by bjornson

November 5th, 2008 at 7:41 pm

A simple Magnifying Class for AS3

with 6 comments

It has been a while that I first programmed a magnifier glass in Actionscrtip 2. But since several friends asked over time how to do it I rewrote it in AS 3.

You can download the entire class for free here: magnify.as

There are no license attachments whatsoever. So you can modify it, reuse it, sell it, whatever you like. But of course I would like to receive some feedback. You can also place links in the comments here to your site if you used this class.

The main important part is the following calculation:

_mc_mask.x=mouseX;
_mc_mask.y=mouseY;
_loaderMc.x=(-_loaderMc2.mouseX)+_loaderMc2.mouseX/_scaleRatio;
_loaderMc.y=(-_loaderMc2.mouseY)+_loaderMc2.mouseY/_scaleRatio;

First the image is loaded twice and then it positions the image that is only partially visible in the right spot over the smaller image so that it seems to be the same image.

This movie requires Flash Player 9

To include the class in your own project all you need to is:

  1. unzip bjornson.zip into the same directory your FLA-file is in
  2. write code similar to this in your actions dialogue of your FLA (this is the very minimum you need):
  3. import bjornson.Magnify.Magnify;
    var m:Magnify = new Magnify(“a.jpg”); //this should be a relative path to a .jpg or .png
    addChild(m);
  4. Publish the file, done!
You can also specify more to customise the magnifier:
the variables are
  1. scr:String – this is the relative path to your image
  2. w:Number – this is the maximum width of the preview image
  3. h:Number – this is the maximum height of the preview image (it will be adjusted automatically to fit while keeping the correct aspect ratio)
  4. s:Boolean – this is to switch from a rectangular magnifier to a round magnifier
  5. r:Number – this is the radius of a round magnifier or the height of a rectangular magnifier
  6. rw:Number – this is the width of a┬árectangular magnifier
  7. m:Boolean – this defines if the Mouse-Pointer is visible when it moves over the image or not
So you could use it with the maximum amount of customisation like this:
var m:Magnify = new Magnify(“a.jpg”,600,400,false,50,50,false);
and it would create a preview picture from a.jpg with the maximum dimensions of 600×400 with a rectangular magnifying glass of 50×50 pixels and the mouse would not be visible when it moves over the image.
before adding it to the stage or any MovieClip on the stage you can position it more like this:
m.x=50;
m.y=100;
//and then add it:
addChild(m);
This would add the magnifier to the stage at x:y 50:100.

Written by bjornson

September 11th, 2008 at 6:05 pm