Sie sind nicht angemeldet.

1

Mittwoch, 20. Mai 2009, 03:24

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.

Quellcode

1
<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


Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<hotspot name="overpanel_hotspot"
keep="false"
visible="true" enabled="true" handcursor="true" capture="true" children="true"
zorder="0"
fillcolor ="0xffffff" fillalpha ="0.00" borderwidth ="0.0" bordercolor ="0xffffff" borderalpha ="0.00"
fillcolorhover="0xffffff" fillalphahover="0.10" borderwidthhover="4.0" bordercolorhover="0xffffff" borderalphahover="0.80"
fadeintime="0.150" fadeouttime="0.300" fadeincurve="1.100" fadeoutcurve="0.700"
onover=""
onhover="showtext(VIEW DETAILS,style2)"
onout=""
ondown=""
onup=""
onclick="action(showimage,toppanel);"
>
<point ath="-16.0287" atv=" 19.2338" />
<point ath=" 16.8424" atv=" 26.6108" />
<point ath=" 17.5392" atv=" 44.5072" />
<point ath=" 16.1113" atv=" 45.0294" />
<point ath=" 14.5786" atv=" 45.2628" />
<point ath=" 12.5888" atv=" 45.1151" />
<point ath="-14.8930" atv=" 36.0485" />
<point ath="-15.8619" atv=" 34.9577" />
<point ath="-16.5409" atv=" 33.7376" />
<point ath="-16.5489" atv=" 32.8822" />
</hotspot>



and the actions


Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
 <action name="hideimage">
tween(plugin[%1].alpha,0,distance(1,0.5),easeoutquad,set(plugin[%1].visible,false));
</action>

<action name="hideallimages">
action(hideimage,toppanel);
</action>

<action name="showimage">
action(hideallimages);
set(plugin[%1].visible,true);
tween(plugin[%1].alpha,1,distance(1,0.5),easeoutquad);
</action>



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 www.milotimbol.com but they seem have something to do with YUI and not flash.

My brain hurts *confused*

Thanks,

Andrew

Shanti

Fortgeschrittener

Beiträge: 301

Wohnort: Puerto Vallarta

Beruf: Web Developer

  • Nachricht senden

2

Mittwoch, 20. Mai 2009, 04:52

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:

Quellcode

1
2
<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.

Graydon

Profi

Beiträge: 614

Wohnort: Texas

Beruf: Industrial gas turbine services.

  • Nachricht senden

3

Mittwoch, 20. Mai 2009, 05:25

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.

Quellcode

1
<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.

Graydon

Profi

Beiträge: 614

Wohnort: Texas

Beruf: Industrial gas turbine services.

  • Nachricht senden

4

Mittwoch, 20. Mai 2009, 05:46

buggy but working sample

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.

Shanti

Fortgeschrittener

Beiträge: 301

Wohnort: Puerto Vallarta

Beruf: Web Developer

  • Nachricht senden

5

Mittwoch, 20. Mai 2009, 06:40

Graydon, cool! :D didn't even knew the parent option existed :D

6

Donnerstag, 21. Mai 2009, 03:49

Completed ;-)

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

Quellcode

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


The 'close' button

Quellcode

1
<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

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<hotspot name="mainpanel_hotspot"
 	keep="false"
 	visible="true" enabled="true" handcursor="true" capture="true" children="true"
  	zorder="0"
 	fillcolor ="0xffffff" fillalpha ="0.00" borderwidth ="0.0" bordercolor ="0xffffff" borderalpha ="0.00"
 	fillcolorhover="0xffffff" fillalphahover="0.10" borderwidthhover="4.0" bordercolorhover="0xffffff" borderalphahover="0.80"
 	fadeintime="0.150" fadeouttime="0.300" fadeincurve="1.100" fadeoutcurve="0.700"
 	onover=""
 	onhover="showtext(VIEW DETAILS,style2)"
 	onout=""
 	ondown=""
 	onup=""
 	onclick="action(showimage,mainpanel);"
>
<point ath="-16.0287" atv=" 19.2338" />
<point ath=" 16.8424" atv=" 26.6108" />
<point ath=" 17.5392" atv=" 44.5072" />
<point ath=" 16.1113" atv=" 45.0294" />
<point ath=" 14.5786" atv=" 45.2628" />
<point ath=" 12.5888" atv=" 45.1151" />
<point ath="-14.8930" atv=" 36.0485" />
<point ath="-15.8619" atv=" 34.9577" />
<point ath="-16.5409" atv=" 33.7376" />
<point ath="-16.5489" atv=" 32.8822" />
</hotspot>


Actions to hide and show the swf scrolling window

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 <action name="hideimage">
   	 tween(plugin[%1].alpha,0,distance(1,0.5),easeoutquad,set(plugin[%1].visible,false));
    </action>
    
    <action name="hideallimages">
   	 action(hideimage,mainpanel);
   	 action(hideimage,toppanel);
   	 action(hideimage,stickpanel);
   	 action(hideimage,infobox);
    </action>

    <action name="showimage">
   	 action(hideallimages);
   	 set(plugin[%1].visible,true);
   	 tween(plugin[%1].alpha,1,distance(1,0.5),easeoutquad);
    </action>



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 ;-)

Andrew