[OK] Call layers with buttons

  • I still have error on my "Home" button...

    I tried to call layer with button but it's not working very nice *sad*

  • use only 1 button.

    <plugin name="9angleON"
    align="bottom"
    crop="0|0|65|65"
    customColor="true"
    height="prop"
    keep="true"
    action1or2="1"
    onclick="IF(action1or2 == 1, displayangle-90(), closeangle-90()); switch(action1or2,2,1);"
    onovercrop="0|65|65|65"
    url="test-33mmdata/graphics/menu/menu13.png"
    width="40"
    x="180" y="10"/>

    <action name="displayangle-90">

    set(plugin[angle-90].visible,true);
    set(plugin[9angleon].url, test-33mmdata/graphics/menu/menu14.png);

    </action>

    <action name="closeangle-90">

    set(plugin[angle-90].visible,false);
    set(plugin[9angleon].url, test-33mmdata/graphics/menu/menu13.png);

    </action>

    that should work for you. clikcing the button first time will check the variable actionaorb for a 1 since it is 1 it will run the first action to display the 90 angle. at the same time switching the variable to 2 and changing the url to menu14. next time it is clicked the variable is 2 so it will run the second action and reverse everything back.

    if it still does not work change your plugin names to start with a letter and not a number.

    your first setup did not work becuase your buttons are stacked on top of each other and the 2 actions only make the 90 angle visible and change the onclick action. there was no code to make the buttons switch places so the display button is always on top and the close button cannot be accessed.

    to fix your current setup add a zorder to the buttons if it is not declared they default to 1 so they both have the same zorder it is a random thing which ones ends up on top. usually the first one does but that is not always the case. set the display buttons zorder to 2 and the close to 1 so it is underneath then use these actions which will not make the display button visible or not. when it is it will be on top when it isnt the close button will then be accessable. you wont need to change the onclick actions using 2 separate buttons.
    both solutions should work the first uses less code since you do not have to duplicate the button code twice.

    <action name="displayangle-90">
    set(plugin[angle-90].visible,true);
    set(plugin[9angleon].visible, false);
    </action>

    <action name="closeangle-90">
    set(plugin[angle-90].visible,false);
    set(plugin[9angleon].visible, true);
    </action>

    again remember using numbers for plugin names could cause wierd issues.

    4 Mal editiert, zuletzt von VN2011 (20. Februar 2011 um 03:32)

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!