?View Code AS3import com.deviouswork.ui.MagnifyingGlass;
/*
* Supply the Constructor with your own colormap for the DisplacementMapFilter
* or pass null and the radius of the magnifyer and let the class create one for you.
*/
var magnifyer:MagnifyingGlass = new MagnifyingGlass(null, 90);
magnifyer.addMagnifyer(image);
Category Archives: Labs
Magnifying Glass 0
CircleLayout snippet 0
?View Code AS3package com.deviouswork.layout {
import flash.geom.Point;
public class CircleLayout {
public static function findAngle(target:Point, center:Point):Number {
var dx:Number = target.x – center.x;
var dy:Number = target.y – center.y;
return Math.atan2(dy,dx);
}
public static function calculateLayout(radius:Number, target:Point, center:Point):Point {
var radians:Number = CircleLayout.findAngle(target, center);
var pt:Point = Point.polar(radius, radians);
return new Point(pt.x + center.x, pt.y + center.y);
}
}
}
URLShortener package 0
Services included at the moment:
Bit.ly (BitlyService)
J.mp (JmpService)
Is.gd (IsgdService)
Tr.im (TrimService);
?View Code AS3
import com.deviouswork.http.url.*;
var us:URLShortener = new URLShortener(BitlyService);
//Only needed for Bit.ly and J.mp
us.service.version = ‘2.0.1′;
us.service.login = ‘bitlyapidemo’;
us.service.key = ‘R_0da49e0a9118ff35f52f629d2d71bf07′;
//End Bit.ly/J.mp part
us.shorten(’http://www.deviouswork.com/labs/’);
us.addEventListener(Event.COMPLETE, complete, false, 0, true);
function complete(event:Event):void {
us.removeEventListener(Event.COMPLETE, complete);
trace(us.shortURL);
}
Update
Moved the package over to Github
http://github.com/deviouswork/URLshortener
Tagged: Bit.ly, Is.gd, J.mp, Tr.im, URL-shorteners
Slotmachine effect 0
Dependencies – TweenLite
Example:
?View Code AS3var sm:SlotMachine = new SlotMachine(’€15533′, font, 35, ‘0123456789€’);
addChild(sm);
sm.addEventListener(Event.COMPLETE, _complete);
sm.render();
function _complete(aEvent:Event):void {
trace("SlotMachine COMPLETE");
}
Categories: AS3, Feature, Flash, Labs
Tagged: AS3, Effect, One Armed Bandit, Slotmachine
Ordered Lists in TextField.htmlText 2
One thing thats kept bugging me with TextField.htmlText was the lack of support for ordered list (<ol><li></li></ol>) in a textfield with htmlText applied to it. I decided to write a simple class that strips a html string from the (<ol><li></li></ol>) and arrange the list(s) in numerical order with tabs instead. I know this isn’t the [...]
CountDown class 1
I was asked to create a countdown to a specific date and time for a project, with no time at all to do it, I went looking across the web to find a good class that i could use.
Jim Isaacs has written a really nice class that does a fine job indeed, but it doesn’t [...]
Categories: AS3, Feature, Flash, Labs
Tagged: AS3
Parsing and rendering PDFs inside AIR with Flash 0
A while back i did a prototype that needed the functionality of parsing and rendering PDFs inside an AIR application, oh the joy…
Cleverly enough Adobe did include an HTMLLoader class with the AIR bundle, which also allows you to
load a PDF inside, just as it would in a normal browser. Tadaa! Simple aint it.