Something Wrong with the System

A Flash/Actionscript blog

Making AS3 components is harder than I’d imagined…

UPDATE
I’ve updated the Flash Pie Chart, made it more awesome and put it up for sale on ActiveDen as a Flash component and Flex Class!
Check it out! It’s pretty rad!

So as I wrote earlier I’m working on transforming my 3D Pie Chart into a proper AS3 component.  Holy crap, it’s harder than I thought!

By far the most useful resource I’ve found is this one written by Jeff Kamerer from Adobe.  The document is divided into 9 parts (it’s a small book!) and covers:

I’ve trudged my way through the first 3 parts and… GREAT SUCCESS!  I’ve got my Pie Chart publishing from a component inspector window (shown on the left).

The bit of code that caused me the most grief is the section that pertains to the dataProvider.  It seems that if I want custom parameters in my Component Inspector I need to create my own DataProvider classes.

[Collection(collectionClass="ca.organa.Data.Collect", collectionItem="ca.organa.Data.ComponentInfo", identifier="sliceLabel", name="Pie Chart Data")]
 public function set dataProvider(value:Collection):void {
 if (_dataProvider != null) {
  _dataProvider.removeEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange);
 }
  _dataProvider = value;
  _dataProvider.addEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange, false, 0, true);
  invalidate();
 }

Jeff covers the topic here.

I’ll post about components again once I’ve gone further into this stuff.  My next challenges are going to be getting live preview working, and getting a proper colour picker in the component inspector (is that even possible?). Read the rest of this entry »

September 8th, 2009 by Peter Organa
Posted in AS3, Flash Components, Programming, Source Code | Comments Off

My AS3 3D Pie Chart

UPDATE
I’ve updated the Flash Pie Chart, made it more awesome and put it up for sale on ActiveDen as a Flash component and Flex Class!
Check it out! It’s pretty rad!

First an FYI, this is a showing off post.  I’m not sharing the source for this as I’d like to explore the idea of selling the Pie Chart as a Flash Component.

Recently at work I’ve been doing on a bunch of charts (mostly analytics style lines graphs).  When I was finished, I thought to myself: “Well I haven’t done a Pie Chart yet”.
Ultimately, it took me 5 times longer than I would have ever expected, but I did create a fully functional 3D Pie Chart!

  • This is a true 3D Pie Chart with rotation.
  • This is done completely with Flash’s draw API, I don’t make use of Flash10 3D features or Papervision
  • The Pie chart is resizable and all the data/colours are externally configuarable.  You can even change the view angle.

Read the rest of this entry »

September 4th, 2009 by Peter Organa