addplugin/removeplugin HELP!

  • Hello


    I need a button to open a swf, as a plugin. First I defined it in the xml to be loaded and not to be shown, but i realized that, because it has a animated intro, if i click on the button which supposed to show it, the animation is already gone because it "ran" in the background, as invisible. Also, a problem was that without removing the plugin, if i closed it with the hide function, the next time the button was pressed, it continued from where it was left, not from the beginning as I needed it. So i chose to use the following code:


    <plugin name="img1" url="" align="center" onclick="removeplugin(img1);"/>

    <hotspot name="meniu" url="meniu.swf" zoom="false" ath="-80.3633" atv="2" scale="0.4" blendmode="normal" onhover="showtext(Meniul);"

    onclick="addplugin(img1);
    set(plugin[img1].align,center);
    set(plugin[img1].url, men.swf);"/>


    following thing happens:

    I press the button(hotspot), the plugin appears from the beginning including the wanted animation.

    I press on any button in the animation, it works

    I press outside the button area, anywhere on the window, the window disappears

    I press again on the hotspot, the plugin appears again from the beginning, as wanted

    I press to close it, it doesn't close anymore.


    I don't understand why the whole thing functions only once, and the second time it doesn't close again.

    I also tried following code:


    <hotspot name="meniu" url="meniu.swf" zoom="false" ath="-80.3633" atv="2" scale="0.4" blendmode="normal" onhover="showtext(Meniul);"

    onclick="addplugin(img1);
    set(plugin[img1].align,center);
    set(plugin[img1].url, men.swf);
    set(plugin[img1].onclick,removeplugin(img1);"/>

    Please help!


    Thanks! *cool*

    Mike

    Edited once, last by michaelpop (May 18, 2009 at 10:30 AM).

  • Hmm can't get it to work either, tried different settings (capture true, enabled true, mousechildren false etc) but the onclick doesnt get triggered (i tried to trace it) I normally add a closebutton in the flashmovie

  • ...can you give me a code example for the xml and for the flashfile's close button? does it close the flash file in a way that when reopening it, it plays from the beginning? or is there any code in the pano xml, an action for the opening button, that reinitialises the opened flashfile to play from the beginning?

    Thanks,

    Mike

  • Hi,

    which krpano version do you use? and which swf?

    in all versions below 1.0.8 beta 7 a plugin or hotspot was only removed
    from the "stage" on calling "removeplugin()" or "removehotspot()",

    so the swf plugin/hotspot itself should listen for a "REMOVED_FROM_STAGE"
    event and remove itself correctly,

    now with version 1.0.8 beta7 a plugin/hotspot is also "unloaded",
    that means also an "UNLOAD" event was send for which the plugin
    can listen,

    so the "REMOVED_FROM_STAGE" or "UNLOAD" events can be used
    inside the plugin to get notice about the removing and remove
    also alls child objects and so on...

    have a look at the plugin examples source files (.as) which are
    included in the 1.0.7 download for examples how to add and remove
    a plugin correctly,

    one additional note - if you are using a AS2 swf - there is unfortunately
    no way for unloading it! (an flash issue/limitation)

    best regards,
    Klaus

  • Hello


    The swf is a AS2 swf, and now I understand the incompatibility. But I found, thinking on all possibilities, a "second-hand" solution that works:


    <plugin name="img1" url="" align="center" onclick="set(plugin[img1].url,blank.swf); set(plugin[img1].visible,false);"/>


    <hotspot name="men" url="men.swf" zoom="false" ath="-80.3633" atv="3" scale="0.4" blendmode="normal" onhover="showtext(blabla);" onclick="set

    (plugin[img1].visible,true);
    addplugin(img1);
    set(plugin[img1].align,center);
    set(plugin[img1].url,men.swf);
    "/>


    It disappears by clicking outside the flash buttons, and everytime it is recalled by pressing the hotspot, the changing of the URL makes it re-run from the beginning.


    Thanks,


    Mike

Participate now!

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