|Create a piece of ItemColor furniture.|
|Adobe Flash CS3, Whirled SDK|
Using ItemColor Furniture
To change the color of an ItemColor Furniture piece, click on the furniture. An outer ring will open up displaying the base color:
Click on any color of the outer ring to show the inner ring and then click one of the colors on the inner ring to change the object's color:
Only an owner of a room can change the color of an object.
If there are multiple objects that are ItemColor-enabled, each one can be individually colored:
Some objects can also have portions that do not change color. In the example below, the bottom half of the left vase is always blue.
Creating ItemColor Furniture
The process of making ItemColor furniture is meant to be fairly easy assuming the Whirled SDK has been installed.
Step 1 - Set up
Download this zip file Media:Itemcolor.zip. This zip file contains an example and the ItemColor Class. Make sure to place ItemColor.as in the same folder as your furniture. This file handles adding the proper Mouse listeners, drawing and coloring the palette and updating and applying the memory.
Step 2 - Drawing
Draw your furniture so that the clips that change color are in shades of gray.
Step 3 - Assigning the Color Clip
Make sure that the clip that will change color is called color_mc. This should be nested inside the furniture symbol.
Example 1: The vase is a symbol called plain_mc. Inside of it is another symbol with an instance name of color_mc.
Example 2: The vase is a symbol called strip_mc. Inside there are two symbols - one with an instance name of color_mc, which will change color and another symbol named blue_mc, which will not change color.
Step 4 - Naming Instances
Make sure that each ItemColor furniture has an instance name.
In this example, the vases have been named "vase1_mc", "vase2_mc" and "vase3_mc".
Step 5 - Coding
Add the required code to make the ItemColor furniture work:
<actionscript> import com.whirled.FurniControl; var _ctrl:FurniControl = new FurniControl(this)
new ItemColor(this, _ctrl, vase1_mc, 0, 0) new ItemColor(this, _ctrl, vase2_mc, 0, 0) new ItemColor(this, _ctrl, vase3_mc, 0, 0) </actionscript>
The first two lines are required for Whirled furniture and instantiate the FurniControl.
The next three lines instantiate the ItemColor furniture.
The first argument (this) refers back to the main instance and is used to draw the color menus. This should not be changed.
The second argument (_ctrl) is the Furniture Control. This is passed to properly manage the memory functions.
The third argument (vase1_mc) is the instance name of the furniture that will be provided with ItemColor functionality.
The third and fourth arguments are the x and y offsets of the center of the palette circle. Leave them at 0 to place the center of the palette at the origin point of the furniture item. Adjust them as needed for your piece of furniture.
Once that is done, publish the file to a SWF and upload it to Whirled!
The ItemColor Stuff Group is where you can go for any questions on creating ItemColor objects.