Archive for the ‘Free Downloads’ Category
Freeware Screen Ruler
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:
AS3 + JavaScript = Resizable SWF in HTML
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:
- I wrote a simple JavaScript file that allows resizing of elements in an animated fashion.
- I embedded the swf in the HTML file in a <div> container with the style attribute “overflow:hidden;” and an id called “swf_container”.
- To ensure the desired effect I added stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT;
- 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
A simple Magnifying Class for AS3
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.
To include the class in your own project all you need to is:
- unzip bjornson.zip into the same directory your FLA-file is in
- write code similar to this in your actions dialogue of your FLA (this is the very minimum you need):
- import bjornson.Magnify.Magnify;
var m:Magnify = new Magnify(”a.jpg”); //this should be a relative path to a .jpg or .png
addChild(m); - Publish the file, done!
- scr:String - this is the relative path to your image
- w:Number - this is the maximum width of the preview image
- h:Number - this is the maximum height of the preview image (it will be adjusted automatically to fit while keeping the correct aspect ratio)
- s:Boolean - this is to switch from a rectangular magnifier to a round magnifier
- r:Number - this is the radius of a round magnifier or the height of a rectangular magnifier
- rw:Number - this is the width of a rectangular magnifier
- m:Boolean - this defines if the Mouse-Pointer is visible when it moves over the image or not




