To add additional buttons I'd recommend you to write your own little plugin.
If it's an extra bar (like in you image) that's pretty simple, just create the GUI definitions in the ASUL file for the plugin and add the functionality by getting the elements using the deepGetChildByName function (call it on the outermost container, the one you create using createAsulObject(id:String)). If you want the buttons in the original navbar, add them in the navigationbar.asul and add the functionality by starting at the pluginLayer when using the deepGetChildByName (make sure your plugin declares a dependency on the navigationbar plugin in that case, to make sure it exists when the initialize function of your plugin is called).
So basically, copy Dummy plugin, in constructor declare ASUL definitions (and, if adding to the navigationbar plugin, add the
new Dependency("navigationbar")):
If it's a completely separate bar
public function SecondBar() {
super("secondbar", "1.0.0", [], true, true);
}
If it's integrated into the original navbar
public function SecondBar() {
super("secondbar", "1.0.0", [new Dependency("navigationbar")], true, true);
}
The last argument tells the engine to try and load localized strings for the plugin. If you don't use any (or hardcode them in asul files) you can remove that.
Assuming you ASUL looks somewhat like this:
<asul>
<!-- ... -->
<box id="secondbar">
<!-- Your buttons -->
<button name="button1">...</button>
<!-- ... -->
</box>
</asul>
The initialize function has to do the following:
override protected function initialize():void {
var secondBar:IAsulObject = createAsulObject("secondbar") as IAsulObject;
if (secondBar) {
var button1
:DisplayObject = secondBar.deepGetChildByName
("button1");
if (button1) {
button1.
addEventListener(MouseEvent.
CLICK, handleButton1Click
);
}
// ...
}
}
If you have additional buttons in the navigationbar:
override protected function initialize():void {
var button1
:DisplayObject = IAsulObject
(megazine.pluginLayer
).deepGetChildByName
("button1");
if (button1) {
button1.
addEventListener(MouseEvent.
CLICK, handleButton1Click
);
}
// ...
}
There'd be the third possibility of defining the buttons in your ASUL, creating them (createAsulObject) and adding them to the navigationbar via the addButton function, but I think this is enough for now
