Author Topic: Making custom buttons  (Read 454 times)

Ruriko

  • Newbie
  • *
  • Posts: 8
Making custom buttons
« on: September 09, 2010, 05:46:28 am »
I want to make a custom button that jumps to a specific page. How can I do this?

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1985
  • MegaZine3 Developer
    • MegaZine3
Re: Making custom buttons
« Reply #1 on: September 13, 2010, 02:30:47 pm »
Where do you want to add those buttons?
Assuming you want to add them in the NavigationBar, just copy an existing one, and then, depending on whether the book runs in the browser you can either:
* [in browser] remove the name attribute and add an target="_self" url="javascript:void(MegaZine.gotoPage(12));" (or whatever page to jump to)
* [not in browser] change the name, and add handling in AS3 (either in the navigationbar plugin and recompile that one, or in an own plugin)
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

Ruriko

  • Newbie
  • *
  • Posts: 8
Re: Making custom buttons
« Reply #2 on: September 16, 2010, 01:17:00 pm »
I want to replace the top nav with my custom buttons so I did what you said but I'm confused about if it runs in browser. You say that I need to remove name attribute but I don't see it in the script

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1985
  • MegaZine3 Developer
    • MegaZine3
Re: Making custom buttons
« Reply #3 on: September 18, 2010, 01:30:30 pm »
If you don't need it to run in the standalone Flash Player (i.e. as a .exe, for example) then you're safe. It's just because the standalone Flash Player has no JavaScript capabilities, so it needs to run in a web browser for that.

As for the names: if you based yours on the existing buttons, which look like this, e.g
Code: (xml)
  1. <togglebutton name="btn_mute" style="common mute"/>
you'll notice there's a name attribute (with value btn_mute in this case). These names are used by the navigationbar plugin to attach event handler to those buttons. So if you use JavaScript to trigger anything if that button is clicked, you should remove that, to avoid side effects. If you're unsure and want feedback, feel free to post your XML (or at least a snippet of it) here.
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.