Flash/AS3 Classes

gpShapes - Drop Shadow

The following example displays the gpShapes Class with the Drop Shadow options. To create the default drop shadow, just add the option dropShadow="true". You can alternatively add specific values found here.

In the example below, the configuration file is loaded with the gpUrlLoader Class. The gpConfig class is used to retrieve the specific XMLList and convert it to an object.

    import flash.events.*;
    import com.grasshopper.utils.*;
	
	var config:gpConfig;
	
	var ldr:gpUrlLoader = new gpUrlLoader();
	ldr.addEventListener(Event.COMPLETE, xmlLoaded);
	ldr.addEventListener(gpUrlLoader.LOADERROR, ioError);
	ldr.init('config.xml', 'xml');

	function xmlLoaded(event:Event):void {
		var xl:XML = ldr.getXML();
		config = new gpConfig(xl);
		var configItem:Object = config.getChildByAttributeObject('pLayout', 'pStyles', 'cType', 'shape1');
		var myShape:gpShapes = new gpShapes();
		myShape.createShape(configItem);
		addChild(myShape);
		myShape.x = 100;
		myShape.y = 100; 
	}	
	
	function ioError(e:Event):void {
		trace('Error loading file');
	}	

For documentation about the gpShapes AS3 Class, view the blog post.