How to close a swf plugin?

  • Hi,

    After looking at numerous xml filesI have set up a swf which is basically a text and image scroller.

    Code
    <plugin name="toppanel" url="info/overhead_panel.swf" zorder="20" align="center" alpha="0" visible="false" onclick="action(hideallimages);" />


    I have assigned it to appear when a hotspot is clicked on



    and the actions



    Problem is, the scroller shows up but when I click on the actual scroll bar to scroll down and view the rest of the content it makes the swf disappear because of the onclick="action(hideallimages) code which is in place to close it. I'm not bright enough to make a X in the top right hand part of the swf scroller and somehow make the scroller disappear.

    Could anyone please point me in the right direction on how to set up such an 'X' button?

    I noticed that Milo has floating windows with an 'X' on at https://krpano.com/forum/wbb/www.milotimbol.com but they seem have something to do with YUI and not flash.

    My brain hurts *confused*

    Thanks,

    Andrew

  • Andrew;

    you could add an X on top of the scroll, just add another hotspot/plugin and use the zorder to put it on top of the scroller:

    Code
    <plugin name="scroll" url="scroll.png" zorder="1" align="topright" x="20" y="20" >
    <plugin name="close" url="x.png" zorder="2" align="topright" x="10" y="10" onclick="action(close);" >

    that is a very basic and untested code, but in theory it should work, of course the align and x and y are just examples you will have to find the right ones for your code.

  • You can also use the parent / child structure.

    Borrowing Shanti's code... you can just add the parent attribute and then the align becomes relevant to the scroll plugin... and if you move / change the location of scroll... the x will go along with it. Also, this prevents you from having to add additional action steps to hide / show the x button... as it will disappear with the parent.

    Code
    <plugin name="close" url="x.png" parent="scroll" zorder="2" align="topright" edge="center" x="0" y="0" onclick="action(close);" >

    Note: I tested this with the existing textfield.swf plugin and it sorta works... I'll post a link when I upload it later. The problem I'm having is that the x button doesn't want to go to the correct location.

  • http://goto.marlincreek.com/closeswf/index.html

    That's a quick sample that is using the parent / child structure.

    In the top right is a button that will open / close the box

    As a child to the textfield.swf, there's another button on the bottom edge of the blue box.... it should be on the bottom right corner... but it's not getting there. Plus, it's shaped is squished up some. It is supposed to be square (32x32).

    I tried switching around locations, edges, origins and all give similar issues.

    info.xml

    Attached is the xml file for the info box and relevant buttons.

    I checked and I have the latest krpano.swf and textfield swf.

  • Wow! Thanks for the replies. A look at both your info and I was able to get my swf scrolling window up and running using the idea of the close button on another layer, the 'Parent' feature and a bit of my old code for the open and close.

    To be honest my head was that mashed from spending hours on this *cursing*

    The swf scrolling window

    Code
    <plugin name="mainpanel" url="info/main_panel.swf" zorder="20" align="center" alpha="0" visible="false" />

    The 'close' button

    Code
    <plugin name="closewindow_01" url="skin/close.png" zorder="21" parent="mainpanel" align="topright" x="12" y="8" alpha="1" visible="true" onhover="showtext(CLOSE WINDOW,buttonstyle)" onclick="action(hideallimages);" />

    Hotspot on 360 image

    Actions to hide and show the swf scrolling window


    And here's the viewer window with it in action. When I click on the helicopter panel within the 360 degree shot the swf appears. I have to make another 6 hotspots and scrollers. The actual scrolling swf needs a makeover but at least the damn thing works now.


    I did notice that the two up and down arrows on the scroll bar are stretched which sounds like something similar to the problem you are having Graydon with that 'i' button in your demo button but the actual alignment of the X button has no issues at all with the plugin code.

    Thanks again to the both of you and I'm sure there's enough info on here to help anyone out in the future with a similar question *wink*

    Andrew

Participate now!

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