only US$ 20.00
Reference - features of the toolbar component
addTool(label, icon, action, tooltip)
label: String, text that appears beside the icon (null or "" for no label)
icon: MovieClip that is used (make sure you export it for action script!)
action: if you provide a string, the function (on the same MovieClip as the toolbar) with this name is called. If you pass an object, function "onPress" of this object is called
tooltip: a little help text that appears when someone stays on a button (time can be set in the properties)
addTextfieldTool(label, width, action)
label: String, text that apperas initially in the text input
width: Number, size in pixel
action: Object, should have the function "onEnterKeyPress(str:String)" which is called when you hit enter while having the focus on the text field
addMenuTool(label, icon, submenu_items, action, tooltip)
label: String, text that appears beside the icon (null or "" for no label)
icon: MovieClip that is used (make sure you export it for action script!)
submenu_items: Array of Objects: {label: "String", icon: "String", data: "whatever you want to have returned"}
action: Object, function "onPress(data:Object)" is called when someone hits one of the tools. Top tool returns 0, sub-tools return according to the item (see "submenu_items")
tooltip: a little help text that appears when someone stays on a button (time can be set in the properties)
addSeparator()
adds a separator
disableToolAt(pos)
disables button at position pos + 1 (zero-based, first button is at position 0), do not confuse with tool_id (see note below)
enableToolAt(pos)
enables button at position pos + 1, do not confuse with tool_id (see note below)
removeAll()
removes all tools
setSize(width, height)
changes the width of the toolbar. You can omit height as this isn't implemented at the moment.
hideSubmenu()
hides the currently displayed submenu if any
addLabel(label, textcolor, width, align)
label: String, the text you want to display
textcolor: Number, a hex-number of the color, eg 0x77002 for our dark red
width: Number, labels have a static width (what makes it needless to redraw the toolbar every time you change the label)
align: String - "left", "right", "center"
addSliderTool(width, action, tooltip)
width: Number
action: Object, calls onSliderPress resp. onSliderRelease and returns the position (0 to 1) and the tool ID
tooltip: String, not yet implemented
setSliderToolPos(position, tool_id)
sets the position of a slider tool
position: Number between 0 and 1
tool_id: the ID of the slider tool (returned when you create any tool)
changeLabel(new_label, tool_id)
new_label: String
tool_id: the ID of the tool (returned when you create any tool) please do not try to change the label of label-less tools like the slider

IMPORTANT NOTE: addTool, addTextfieldTool, addMenuTool, addLabel and addSliderTool return an ID of the toolbar item. You may store this for changing the label or enabling the tool with enableTool(tool_id) or disabling with disableTool(tool_id). These new methods work with the internal tool_id which is returned when creating a tool

 
Drag the fsToolbar2 component from the Components panel (Ctrl-F7) to your stage.
Select your instance on the stage and open the Component Inspector (Alt-F7). You can set the preferences of your toolbar there.
Open the Properties panel (Ctrl-F3) and make sure you still have selected the toolbar. Here you can set a name, the width, and the position of the component
To add tools, you need ActionScript. Remember the name you gave the component, its 'fst' in this tutorial.
Create a new layer in your timeline where you put your code. If you don't want to do that, just highlight the frame where your toolbar is on.
Press F9 to display the Actions window. This is where you write the code that instructs the toolbar to add tools.
Use the reference on the left to find the methods you need. For example, write fst.addTool("label", "icon_movie_clip", event_handler_object, "tooltip text"); to add a simple button.
please look at the included sample, it's the easiest way to learn how the component works.

Gianni Frey
Gianni Frey
Gianni Frey is a ColdFusion, C#, and Flash Programmer, and a Layout Designer. He currently studies Computer Science at ETH Zurich.

gianni@frogstyle.ch

 
203 ms
© 2000 - 2004 frog style web engineering, all rights reserved