import 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); |
Magnifying Glass
CircleLayout snippet
package 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
Services included at the moment:
Bit.ly (BitlyService)
J.mp (JmpService)
Is.gd (IsgdService)
Tr.im (TrimService);
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
Dependencies – TweenLite
Example:
var 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"); } |
Tagged: AS3, Effect, One Armed Bandit, Slotmachine
Ordered Lists in TextField.htmlText
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 prettiest, but hey it works. Read More
CountDown class
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 have the abbility to use a specific start date.
Tagged: AS3
Parsing and rendering PDFs inside AIR with Flash
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.