Diaspar Was Not Always Thus

Extending MovieClip Symbols [Flash CS3/AS3]

Scenario:

You would like to create the visual portion of a GUI object in the Flash IDE, because it’s easier to draw with the tools provide than it is to “draw” with code. How do you then make this item functional? Extend it with a custom class, of course!

  1. Draw a rectangle with the rectangle tool.
  2. Convert the rectangle to a MovieClip symbol.
  3. Name it RectangleMC.
  4. Set the Class to RectangleMC (same as the name).
  5. Set the Base Class to your new custom class (i.e. com.miketmoore.gui.Rectangle).
  6. That’s it!
June 16 2009 0 Comments

Switch Class

Here is a super-basic class that virtualizes the action of a two-position switch. If you create a two-frame MovieClip and add Switch as it’s class in the properties panel, then clicking the MC will move it to the first and second frames, respectively.

package Switch {

	import flash.display.MovieClip;
	import flash.events.MouseEvent;

	public class Switch extends MovieClip {

		private var _currentState:Boolean = false;

		public function Switch():void {
			addEventListener(MouseEvent.CLICK, switchClicked);
		}

		private function switchClicked($event:MouseEvent):void {
			if(_currentState) {
				_currentState = false;
				gotoAndStop(1);
			} else {
				_currentState = true;
				gotoAndStop(2);
			}
		}

		public function get currentState():Boolean {
			return _currentState;
		}

	}
}
June 11 2009 0 Comments

New Flash Image Gallery

Check out the new image gallery I have developed in Flash and ActionScript 3.0. It is installed on my main portfolio web site. You can also download it here:

new_gallery_1

June 4 2009 0 Comments
  Copyright © Michael Moore, 2009.
  Powered by Wordpress. Theme by Michael Moore.
  Optimized for Mozilla Firefox 3+.
  Background pattern by Travis Beckham.