Tag Archive | "Custom Class"

Mac OS X Mousewheel Support in AS3

Mac OS X Mousewheel Support in AS3

If you develop Flash on a Mac, then you probably already know the pitfalls of mouse-scrolling within your Flash projects on a Mac – it simply does not work.  The great thing about stuff not working is there is always someone out there looking to create a fix for it.

Gabriel created an AS3 solution to the mousewheel functionality on Mac OS X.  SWFMacMouseWheel integrates well with deconcept’s SWFObject and integrating this within your existing and future projects is rather painless.  Enjoy!

Additional Resources:

Posted in Custom Classes, Flash ToolsComments (0)

Create An Apple Style Preloader Using A Custon Class

Create An Apple Style Preloader Using A Custon Class

Steven sacks just posted custom class that creates an Apple style preloader.  It’s a simple class that uses the Flash Drawing API which makes it light and efficient. Check it out below.

package net.stevensacks.preloaders
{
	package net.stevensacks.preloaders
	{
		import flash.events.TimerEvent;
		import flash.display.Sprite;
		import flash.display.Shape;
		import flash.utils.Timer;

		public class CircleSlicePreloader extends Sprite
		{
			private var timer:Timer = new Timer(65);
			private static const SLICE_COUNT:int = 12;
			private static const RADIUS:int = 6;

			public function CircleSlicePreloader()
			{
				super();
				draw();
				timer.addEventListener(TimerEvent.TIMER, onTimer, false, 0, true);
				timer.start();
			}

			private function onTimer(event:TimerEvent):void
			{
				rotation = (rotation + (360 / SLICE_COUNT)) % 360;
			}

			private function draw():void
			{
				var i:int = SLICE_COUNT;
				var degrees:int = 360 / SLICE_COUNT;
				while (i--)
				{
					var slice:Shape = getSlice();
					slice.alpha = Math.max(0.2, 1 - (0.1 * i));
					var radianAngle:Number = (degrees * i) * Math.PI / 180;
					slice.rotation = -degrees * i;
					slice.x = Math.sin(radianAngle) * RADIUS;
					slice.y = Math.cos(radianAngle) * RADIUS;
					addChild(slice);
				}
			}

			private function getSlice():Shape
			{
				var slice:Shape = new Shape();
				slice.graphics.beginFill(0x666666);
				slice.graphics.drawRoundRect(-1, 0, 2, 6, 12, 12);
				slice.graphics.endFill();
				return slice;
			}
		}
	}
}

Additional Resources:

Posted in Custom Classes, Industry News, Latest Adobe Flash News, Latest Adobe Flex NewsComments (0)

Page 1 of 11