two "onclicks" at the same plugin.

  • I'm using a code to display the thumbnail list within (parented) with a background and I'd like to show this menu onclick. So far I did it, the problem is when the menu is showing I"d like to hide it onclick. How can I do that? IS possible to have 2 "onclicks"?

    The code is:

    <plugin
    name="menu"
    url="images/menu.png"
    keep="true"
    visible="true"
    enabled="true"
    handcursor="true"
    capture="false"
    zorder="1"
    alpha="0.70"
    blendmode="normal"
    smoothing="true"
    align="top"
    edge="left"
    x="0" y="0"
    ox="0" oy="-55"
    rotate="0"
    width="" height=""
    scale="1"
    scale9grid=""
    crop=""
    mask=""
    onloaded=""
    onclick="action(menu_show);"
    onhover=""
    onout=""
    ondown=""
    onup=""

    />

    />

    <action name="menu_show">
    tween(plugin[menu].y,100,distance(700,3),linear);
    </action>

    <action name="menu_hide">
    tween(plugin[menu].y,0,distance(700,3),linear);"
    </action>


    <plugin name="thumbnails"
    url="as3Thumbsforkrpano.swf?TheXML=gallery1.xml"
    align="leftttop"
    keep="true"
    parent="menu"
    />

  • Code
    <plugin name="thumbnails" 
    url="as3Thumbsforkrpano.swf?TheXML=gallery1.xml" 
    align="leftttop"
    keep="true"
    parent="menu"
    onclick="menu_hide();"
    />

    but it's maybe nice to make a close button..

    you also have an /> to much after the first plugin.. *attention*

    Tuur *thumbsup*

  • Code
    <plugin name="thumbnails" 
    url="as3Thumbsforkrpano.swf?TheXML=gallery1.xml" 
    align="leftttop"
    keep="true"
    parent="menu"
    onclick="menu_hide();"
    />

    but it's maybe nice to make a close button..

    you also have an /> to much after the first plugin.. *attention*

    Tuur *thumbsup*

    Fantastic Tuur. It's better than I thought, I mean with your code the menu hides when user select a thumb :)
    Thanks

  • another way is switching varable

  • my current code is:

    What I need to do?

  • I think this should do it:


    Also, I changed the code for the delayed call so it would close the menu 2 seconds after you leave the menu (but if you return to the menu within two seconds it doesn't close). I think this was what you were asking about in this post

    Hope this helps

    steve

    Edited once, last by pinsane (June 16, 2010 at 4:23 AM).

  • I just improved the code and now the menu can be open onclick and hide onclick and also it's closed automatically if mouse out, but with a small delayedcall (to avoid "jerky" mouse movement) that is cancelled if mouse over the menu again.

    Here's the code, if anyone is interested:

  • hmm now I see you edited the code above :)
    We came to the same solution using different way. This is nice about logical computer language :)


    Nice work Fellipe, things are moving along nicely for you in a very short time.

    Regarding the delayedcall, it seemed to me you were trying to add hysteresis to the menu. I think your code does a nice job of "debouncing" the menu, but note that if you continually move over the menu and then out it is possible for an onout event to occur right before one of the previous delayedcall actions fire. If this occurs, the menu will immediately retract, even though the cursor just left the menu. By using an incrementing number rather than a boolean, you can ensure that the desired time passes after the last departure from the menu before it retracts.

    Hope that helps

    steve

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!