flash animation video tutorials

 

 

 

START LEARNING
FLASH NOW

Get instant access to over
45 minutes of FREE Flash tutorials on video
 and our newsletter.

Name:
E-Mail:
Phone:
Describe

.

.

.

 
Web video-animation.com

.

.

flash tutorials flash tutorials flash tutorials flash tutorials

Creating A Component in Flash 8

Create a new Fla. Open the StandardComponent.fla from the C:/Program FilesMacromedia/Flash 8/enConfiguration/ComponentFLA folder. Drag the UIComponent from the StandardComponent.fla library to your new fla library. Its in the Base Classes/FUIComponent Subclasses folder.

Create new empty MovieClip. name it widget. Give it the linkage identifier of widget. In the Class box , name the class, Widget. Make sure it is exported for Actionscript and do not tick export in first frame. Open the Component Definitio window and specify the Class name, Widget. In the widget movieclip, create a new frame , call it actions and put the code

Flash Tutorials in Video Format - Watch them now at LearnFlash.com  

stop();

on it.
Create a new layer and put a bounding box on it in frame 1. call it boundingBox_mc. Make sure the position of it is (0,0). The bounding box sets the renderable area that the component can use. It needs to be there at authoring time, or else the component cant draw to the stage. Create a layer called assets. Create a second keyframe on that layer only. Drag the UIComponent from the libray onto the stage at frame 2 on the Assets layer. This is because it allows the base classes to be exported when we package them. But the timeline never reaches them.

Now we create our Widget class. Go, New - ActionScript File. The AS text editor will open. Start creating your class. init method is used to initialize the component. The bounding box is made invisible and size set to 0. If you are extending the MovieClip class, and not the UIComponent superclass, then you may need to initialize an EventDispatcher instance.

createChildren() method attaches and creates objects.
draw() method draws and resizes objects within the component.
To add parameters to the Component Inspector Panel, then use the [Inspectable] metatag before setter and getter methods.

import mx.core.UIComponent;

class Widget extends UIComponent{
	// static variables required for createClassObject()
	static var symbolName:String = "Widget";
	static var symbolOwner:String = "Widget";
	// declare a bounding Box
	private var boundingBox_mx:MovieClip;
	// declare a class variable
	private var myLabel:String;
	// Constructor
	function Widget(){}
		// overwrite the superclass UIComponent init method
	private function init():Void{
		// call superclass init method
		super.init();
		// hide bounding box and make it size 0
		boundingBox_mc._visible = false;
		boundingBox_mc._width = 0;
		boundingBox_mc._height = 0;			
	}
	// used to attach  movieclips, overwrites super method, only used once.
	private function createChildren():Void{
	}
	// called every time component is invalidated
	private function draw():Void{
		// change layout, sizes etc	
	}
	// to resize our component, invalidates and calls draw method
	private function size():Void{
		invalidate();	
	}
	// getters and setters. 
	// Inspectable metatag allows properties to be accessed via the components Property Inspector
	[Inspectable]
	function set label(text:String):Void{
		myLabel = text;	
	}
	function get label():String{
		return myLabel;	
	}
}

That is only the very basic outline of a standard class for a component. Add to it for your own component.

Flash 8 Resources

Hollywood 2D Digital Animation: The New Flash Production Revolution - Digital animation using Flash, is primed to take Hollywood and TeleVision by storm with two feature films and three television shows underway. This book describes why Flash is the future of broadcast animation. As the future of 2D animation, the knowledge provided to the reader by this book will be a necessity for animators.

flash 8
.