Notepad Web Development

Feed icon

Posts Tagged ‘AS3’

AS3 Singleton workaround example

package
{
	public class YourSingletonClass
	{
		private static var _instance : YourSingletonClass;

		public function YourSingletonClass(pvt:PrivateClass) { }

		public static function getInstance():YourSingletonClass
		{
			if (YourSingletonClass._instance == null) {
				YourSingletonClass._instance = new YourSingletonClass(new PrivateClass());
			} else {
				trace("No can do - already gots me an instance of this class");
			}
			return YourSingletonClass._instance;
		}
	}
}
// Workaround to enable Singleton pattern, because private
// class declarations are unsupported within AS3
class PrivateClass
{
	public function PrivateClass() { }
}

Personality types mini-app


[Click image to view application]

A mini-application created for Imperial Tobacco.

A basic AS3 custom event template

package  {
	import flash.events.Event;
	import YourClass;

	public class YourClassEvent extends Event
	{
		public static const SOMETHING:String = "something";
		private var _object:YourClass;

		public function YourClassEvent (type:String, object:YourClass)
		{
			super(type);
			_object	= object;
		}

		public function get object():YourClass
		{
           return _object;
		}

		override public function clone():Event
		{
           return new YourClassEvent(type, _object);
		}
	}
}

Lamppost Gallery

http://www.lamppostgallery.co.uk

(more…)

AS3 Flashing EQs



Created as part of Rizla UK’s 2010 Invisible Players pages.
(more…)

Save The DJ

View full in browser

(more…)

Flickr Faves

http://www.notepadwebdevelopment.com/flickrfaves/

(more…)

Punk My Peg

http://apps.facebook.com/followalex/
(more…)

Analogue timezone clocks

Created for the dashboard as part of the Rizla International website. (more…)

Dynamic resizing full bleed background image

This was a quick mock-up done in Flash CS3 for a pitch for a new site for Harrogate Ladies college. The background images rotate thorugh a slideshow and will dynamically resize as you change the size of your browser window. In order to see this working you will need to view the swf in it’s own window… here’s the link

The code for the resizing the image on resize is pretty straight forward, just don’t forget to add smoothing to your source images.

resizeHandler(null);

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align 	= StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, resizeHandler);

function resizeHandler(e:Event):void {

	// get largest dimension scaling
	var w	= stage.stageWidth / 1022;
	var h	= stage.stageHeight / 687;

	var newWidth, newHeight;

	if ( w > h ) {
		newWidth	= stage.stageWidth;
		newHeight	= 687 * w;
	} else {
		newHeight	= stage.stageHeight;
		newWidth	= 1022 * h;
	}

	backgrounds.width 	= newWidth;
	backgrounds.height 	= newHeight;
}

Space Invaders

http://notepadwebdevelopment.com/spaceinvaders/
(more…)

MTV channels – twitter feed

http://notepadwebdevelopment.com/mtv/

Created for a pitch at MTV. This is a reworking of the True Colours of Twitter piece with some functionality changes. (more…)

True Colours of Twitter

http://www.sense.co.uk/truecolorsoftwitter/
(more…)