Trigger sidr plugin from as3

121 Views Asked by At

I have a sidr left menu on my page, currently triggered by the default href link included with the plugin. How would I trigger the function from a .swf file on the same page?

Here is my current sidr:

<a id="simple-menu" href="#sidr">Toggle menu</a>

<div id="sidr">
    <!-- Your content -->
    <ul>
    <li>Lists:</li>
    <li><a href="#">List 1</a></li>
    <li class="active"><a href="#">List 2</a></li>
    <li><a href="#">List 3</a></li>
    </ul>
</div>
<script>
    $(document).ready(function () {
        $('#simple-menu').sidr();
    });
</script>

And this is the as3 code I used to try and trigger the menu to pop out:

menu_btn.addEventListener(MouseEvent.CLICK, menu);
function menu(e:MouseEvent)
{
    import flash.external.*;
    var str = ExternalInterface.call("menuOut");
}

And function called from the as3:

function menuOut() {
    $("#simple-menu").click(function (event) {
        $('#simple-menu').sidr();
    });
}
1

There are 1 best solutions below

0
On

Please try:

function menuOut() {
    $("#simple-menu").click(function (event) {
        $.sidr('close', 'sidr');
    });
}