Creating Skins
Skin Properties
The following properties can be used to assign new skins to a single
advancedTree instance. The value of the property needs to be an identifier for an exported movie clip symbol, created in the method described in the section following the table. Those properties flagged with an asterisk (*) are icons in the tree. These do not need to be resizable and should instead be created in the method detailed in the
Specifying Icons section.
| Property |
Description |
| branchGraphic* |
The icon used for nodes that have children. |
| branchEmptyGraphic* |
The icon used for nodes that have been set to be branches but do not have children. |
| leafGraphic* |
The icon used for nodes with no children. |
| nodeFieldGraphic |
The rectangle behind individual nodes' labels. |
| openCloseGraphic* |
The icon to the left of branches to denote open/close state. |
| scrollArrowGraphic* |
The icon used for the arrow on the horizontal and vertical scrollbars. |
| scrollButtonGraphic |
The rectangle used for the buttons on the scrollbar. |
| scrollpaneInnerGraphic |
The rectangle behind the tree in the scrollpane, drawn within the boundaries of the scrollbars. |
| scrollpaneOuterGraphic |
The rectangle behind the entire scrollpane, including scrollbars. |
| scrollSliderGraphic |
The rectangle used for the slider in the scrollbars. |
| scrollWellGraphic |
The rectangle used for the well between the buttons in the scrollbar, defining the slider's movement range. |
Resizable skins need to be created in a certain way for them to work with the
advancedTree component. However, not all of the skins need to be resizable. In fact, the only skins that are required to be resizable are the scrollbar slider and the nodes' field graphic (but in the latter case, only if this is visible and the nodes are not locked to a fixed size). In all other cases, the skins are not resized at runtime and so can be made a single size in the IDE, without having to follow the slice method and naming convention detailed below.
Using the Built-in Skins
The
advancedTree component comes with three built-in skins, "Flashloaded Block graphic" (which is used by default), "Flashloaded Block rounded graphic" (which has a slight round at the corners of the rectangle) and "Flashloaded invisible graphic" (which is invisible and so allows for graphics to be placed below the component). To use any of these built-in skins, use the names listed in the previous sentence to assign to the component's skins properties. If the first of these two skins are used, then styles may be applied using the methods described in
Creating Styles.
Creating a Resizable Widget
To create a resizable skin that can be used with the
advancedTree, you need to follow a certain structure and naming convention. Resizable skins should be able to scale both vertically and horizontally, and this is done in the standard convention of slicing a graphic into nine distinct pieces and making each one into a separate movie clip. The steps, which are elaborated upon in the tutorial at the end of this section, are:
- Create a new movie clip symbol with a unique identifier.
- Draw a graphic in the symbol using the symbol registration as the top left corner.
- Slice the image (this can be accomplished with the Line tool) into nine pieces, three columns by three rows. The center column/middle row will be scaled both horizontally and vertically. The center column/top row and the center column/bottom row will be scaled horizontally. The left column/middle row and the right column/middle row will be scaled vertically. The four corners will not scale.
- Convert each slice into a movie clip symbol. Name all instances on the top row "top", those in the middle "middle", and those on the bottom row "bottom".
- Select the three slices in the left column and convert them into a movie clip. Name the instance "left".
- Select the three slices in the center column and convert them into a movie clip. Name the instance "center".
- Select the three slices in the right column and convert them into a movie clip. Name the instance "right".
At this point, using the naming convention detailed above, the skin can be used in the
advancedTree and will automatically resize.
Creating a Skin with States
The
advancedTree component supports skins with multiple states for the scrollbar buttons. To create a skin with states, follow the following steps:
- If you wish to have the buttons be resizable, follow the steps directly above, then skip to step 4.
- The buttons do not have to be resizable if you are certain of the size required. For instance, if the scrollerwidth of the tree is 15, then you can simply create a 15x15 button (the scrollbar buttons are always calculated to have a width and height that are equal to the scrollwidth). In this case, create a new movie clip symbol with a unique identifier.
- In the first frame of the symbol, draw a graphic to represent the up state of the button.
- Create two new layers in the symbol, naming them "code" and "labels". Rename the default layer "graphics".
- Add a stop(); action to the code layer in the first frame.
- Give the first frame the label "_Up" in the labels layer using the Properties panel.
- Add a new keyframe in the labels and graphics layers. Give the label layer's new keyframe the label "_Over".
- In the new keyframe of the graphics layer, draw a graphic to represent the button's over state.
- Add another new keyframe in the labels and graphics layers. Give the label layer's new keyframe the label "_Down".
- In the new keyframe of the graphics layer, draw a graphic to represent the button's down state.
The skin is now ready to be used in the
advancedTree component.
Special Case with Scrollbars
Scrollbars are unique in that they require both vertical and horizontal skins to be created in the library. If the value of the
scrollSliderGraphic is "scroller graphic", then the
advancedTree will look in the library for "scroller graphic horizontal" and "scroller graphic vertical". Such is the case with all the scrollbar skin properties (
scrollSliderGraphic,
scrollWellGraphic and
scrollButtonGraphic). Because of this separation, obviously different graphics can be used for the vertical and horizontal scrollbars instead of requiring a single graphic that is rotated. The only caveat is that whatever value the skin properties have for a component instance, there needs to be two symbols exported from the library with that value, plus " horizontal" and " vertical" appended. As another example, if the
scrollButtonGraphic property has a value of "scrollbutton", then the component will look for "scrollbutton horizontal" and "scrollbutton vertical" in the library.
The icons for the scrollbars also require a special naming convention. In the case of icons, there should exist in the library four symbols exported with the same name with " up", " down", " right" or " left" appended, respectively. Therefore, if the
scrollArrowGraphic property has a value of "newArrow", then the component will look to attach "newArrow up", "newArrow down", "newArrow right" and "newArrow left".