Thursday, September 24, 2009

Koolmove Component Class Documentation and Manipulation

I finally came to understand something in Koolmoves with the help of one of the developers of the Koolmoves Components.  You see, Koolmoves ships with a great set of custom made components that you can drag onto the stage and assign certain properties via the properties panel. These components are all built with ActionScript and saved as Koolmove classes. I know this will sound confusing to anyone not familiar with the product.  Hang in there.

Now in Flash 9 or 10 mode you have to use ActionScript to assign different properties. You can go to the Documention of the Components to find out what properties, methods and functions can be used with each component. However, the Documentation only goes so far.

"The KoolMoves docs stop whenever an intrinsic flash player class is reached."
So there are other properties that can be used that may not be listed in the Koolmoves Documentation by virtue of the fact that these components inherit properties and methods from their parent classes. An example might be in order. This came form a question on the Koolmoves forum at Flashkit.

If you drag a Contentpane onto the stage and access it properties via the propeties dialog you will notice that you can "hide scrollbars" in Flash 8 which uses ActionScript 1 but you cannot in Flash 9 or 10 which uses ActionScript 3. So how does one accomplish this? By writing ActionScript 3 code in the ActionScript panel.

Now if you look in the Documentation for the Contenetpane you will scratch your head (or your hump) like me and wonder what to do. Assuming your Contentpane is named "contentpane1" you might get this far:

contentpane1.hScrollBar. ???
Here we are trying to get to the horizontal ScrollBar in the contentpane and do someting with it.  But when we consult the Koolmoves documentation we can't find anything like "Hide" or "getRidOf".  But we will find that the hScrollBar is an instance of ScrollBar. Still nothing. But we have a clue!  Now if we look at the add syntax menu indicated by the "+" symbol in the ActionScript panel and look at the properties of ScrollBar we will see visible. Now we are getting somewhere and can write:

contentpane1.hScrollBar.visible ???
Now we don't have any information on how to use this visible property in the Koolmoves program because the documentation stops at the intrinsic flash player class which in this case is Sprite, which has as one of it's properties visible.  Sprite got visible from the class DisplayObject which is the source of the visible property.  Think of visible as a genetic trait that is passed down through children. The geneology(so to speak) of this visible property is this:


ScrollBar > UIComponent > Sprite > DisplayObjectContainer > InteractiveObject > DisplayObject
Now to find out how to use visible we need to consult the ActionScript 3 Language Reference found at Adobe and we see that visible calls for a Boolean which is true or false. We could then write it like this:

contentpane1.hScrollBar.visible = false;

When we go to test our movie we will have a contentpane with the Horizontal Scroll Bar hidden.





This begins to show how the components shipped with Koolmoves can be manipulated for individual use, how to track down code applicable to the component in question, and demonstartes at least in part the inheritance aspect of AS3.


No comments:

Post a Comment