Author Topic: Passing parameters Megazine to Asul button  (Read 759 times)

rbaybayan

  • Full Member
  • ***
  • Posts: 54
Passing parameters Megazine to Asul button
« on: February 12, 2010, 08:00:39 am »

Hi Florian,

I had place my mz3v2.0.5 library as common to all the books. I created a custom button and defined this in navigation asul as "SHARE" and "EMAIL". Each button has a unique URL link per each book.

Is it possible that I can pass the URL string from Megazine.mz3 to Navigation asul button?

    Megazine.mz3
             say
        <book
               navigation.asul.button_share.url="www.yahoo.com">

In this case I do not need to copy the whole directory per each book. It is easy to make control and make changes to update all the books when the mz3v2.0.5 is common





Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1985
  • MegaZine3 Developer
    • MegaZine3
Re: Passing parameters Megazine to Asul button
« Reply #1 on: February 12, 2010, 08:43:04 pm »
Hmm, won't be as simple as that. You'll have to implement the logic that actually reads that parameter somewhere.
So the quickest thing would be to write a small plugin that does just that (registers a setting with that name and
then sets the url attribute of the ASUL element). Just a real quick draft to get the idea across:
Code: (actionscript3)
  1. public class ButtonShare extends AbstractPlugin {
  2.    public ButtonShare(data:PluginData = null) {
  3.        super(data || new PluginData("buttonshare", "1.0.0", [new Dependency("navigationbar", true)]));
  4.    }
  5.  
  6.    override protected function register():void {
  7.        settings.register("button_share", "");
  8.    }
  9.  
  10.    override protected function initialize():void {
  11.        var btn:IAsulObject = IAsulObject(megazine.pluginLayer).deepGetChildByName("button_share") as IAsulObject;
  12.        if (btn) {
  13.            btn.setAttribute("url", settings.getSetting("button_share"));
  14.        }
  15.    }
  16. }
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.