Flash button to close the ancestor div

  • Hello there,

    I mostly write everything in javascript instead of ac3. But there is a problem here.

    Since I wanted to use flash buttons instead of iframe and div on swf object, I wanted to put "onclick" method on close button inside of pano. It is like that:
    1- when button is loaded add close panorama onclick function to the button:

    krpano().call('set(layer[closePanoramaButton].onloaded, js(addClosePanoramaOnClick()))');


    2- related function:


    function addClosePanoramaOnClick() {
    krpano().set('layer[closePanoramaButton].onclick', 'js(closePanorama())');
    }

    3- and closePanorama function is:
    function closePanorama(){
    $('#panoramaDivC').fadeOut("slow");

    }

    The problem is when I hide the div with this method, next time my krpano() method returns krpano with no functions. Strangely hiding the div which is including panorama erases all krpano methods. If I hide the same div with a normal div's onclick, it doesn't happen.

    What would be the problem? I am stucked on this problem more than 2-3 hours at least.

    Edit:
    What does it do?
    __flash__removeCallback(document.getElementById("krpanoSWFObject"), "externalMouseEvent2");


    this one happens if I do document.getElementsById("krpanoSWFObject").style.display="none";

    Edited once, last by electronicpanda: new clues I found about the situation (May 10, 2013 at 4:34 PM).

  • Hi,

    note - some browsers are closing the Flashplayer when using display=none on it - and when showing again, they will restart and with a new instance.

    Best regards,
    Klaus

    I see, thank you for the answer. After creating this post I realized that in Internet Explorer 9 and 10 when you try to hide the parent div it erases all the methods because of Internet Explorer's bug. Unfortunately, since I cannot enforce my customers to use different browsers (government foundation), I decided to re-initialize panorama once more everytime when user wants to see another photo. It worked like a charm.

    I wanted to use buttons as html elements (div), but again, unfortunately, in internet explorer opaque and transparent modes run so slow and in direct mode, if I use iframes to bypass flash view, whenever I click on panorama iframes dissapear strangely. Still I am happy to find a good solution.

Participate now!

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