You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Tuesday, June 23rd 2009, 5:51am

How to really close a window (not just hyde) ?

Hi !

I would like to create a link to close a window. I don't want to hyde it but to close it (so the window and the swf file in it stop playing).

I have created :

I've put in a swf file (a video).



The window appears and the video plays.

My problem, when i click on the link "close window" in the window html, the window is just hidden (i can hear the "sound" still playing, even if the window has disapeared). I would like the video stop playing when i click on the link "close window" (event:action(hidewindow,htmltext)

What should i do ? Create an action ? The action should be "close window", not just hyde window... You see what i mean ?

Can you help me ? Thanx

/Vinyl
</plugin>

2

Tuesday, June 23rd 2009, 9:51am

Hi,

the problem here is that the video-swf must stop the sound by itself!
there is no way to force that from external (from krpano),

for videos I would recommend using the new videoplayer plugin,
there the video can be controlled,

best regards,
Klaus

3

Tuesday, June 23rd 2009, 2:04pm

Hi Klaus,

Thank you for your quick answer !

I dont really want to control the video because there is in my video a flash control player.

I would like to create a plugin / action which close completly my window, not hyde it

(because the video is still playing even if it is hyden - )

I've seen on that post that we can use "remove plugin", or unload ?

Or maybe, i can create a flash button in my swf file which can close the window and stop the video ?

What do you think about that ?

I'm using krpano 1.07 but i've donwloaded 1.08. I try the video plugin now.

Thank you

/Vinyl

nelk

Intermediate

Posts: 358

Location: Paris

  • Send private message

4

Tuesday, June 23rd 2009, 3:45pm

If the plugin you use make something like

Source code

1
Stage.addChild( ... )


Then the video could not be unload by krpano. You have to unload it by yourself.
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

5

Tuesday, June 23rd 2009, 5:56pm

Hi nelk !

Thank you for your help !

I've seen your blog, very interesting. I'm also french !

Concerning my question :

You can find an example here :

http://www.reflexion-graphic.com/krpano-1-forum/voiture.html

Editor is on, you can watch the code.

You'll see 2 green hotspots.

When you click on them, a window appears with a video. You can play/stop the video. Try to click on the link "close window" while a video is playing. You will heard the sound even if the window is hydden.

I'm using this plugin :


Source code

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
26
27
28
29
30
31
32
33
34
 	        url="%SWFPATH%/plugins/textfield.swf"
	        keep="false"
 	        visible="false" enabled="false" handcursor="true" capture="true" children="true"
 	        zorder="0"
 	        alpha="0.00" blendmode="normal"
 	        smoothing="true"
 	        origin="center" edge=""
 	        x="0" y="0"
 	        width="660" height=""
	        scale="1"
	        onloaded=""
	        onover=""
	        onhover=""
	        onout=""
	        ondown=""
	        onup=""
	        onclick=""
	        autosize="center"
	        background="true"
	        backgroundcolor="0x333333"
	        blur="20"
	        bordercolor="0xFFFFFF"
	        borderwidth="1"
	        css="data:css1"
	        glow="0"
	        glowcolor="16777215"
	        html="data:html1"
	        roundedge="0"
	        selectable="false"
	        shadow="5"
	        textblur="20"
	        textglow="0"
	        textglowcolor="16777215"
	        textshadow="0"


Then, in the htmlfield, i've placed a swf file with a video in it (autoplay : false). There is a control of the video in the swf file (play/stop/...). The video plays, it's perfect !


I use this action to hyde the window (as in the exemple textfield) :

Source code

1
2
3
4
5
		set(plugin[%1].enabled,false);
		tween(plugin[%1].alpha,0);
		tween(plugin[%1].blur,20);
		tween(plugin[%1].textblur,20,,,set(plugin[%1].visible,false));
	



The window hyde correctcly but the video is still playing. I can hear the sound !!




How could i make the window close (no need to control the video), but close, make the window unload or someting like this.


Thank you again !

6

Tuesday, June 23rd 2009, 8:03pm

Hi,

you could try to remove the textfield plugin it via "removeplugin(name);"
but I'm sure you will still hear the sound,

(try also to switch to fullscreen, the videoplayer will take the control over it )

the video swf needs to stop the video by itself on removing from stage or on an "UNLOAD" event,
e.g.
if you have the video as3 source code you could do something like this:

Source code

1
this.addEventListener(Event.REMOVED_FROM_STAGE, stopplugin);

or:

Source code

1
this.addEventListener(Event.UNLOAD, stopplugin);   

and in the stopplugin() function, stop the video, close the videostream and so on...

or just try using the videoplayer plugin, that should be the better solution

best regards,
Klaus

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

7

Tuesday, June 23rd 2009, 8:14pm

Hi,

I think the problem is you are closing the plugin htmltext with the action hidewindow that only make disappear the plugin !!!

Source code

1
2
3
4
5
6
	<action name="hidewindow">
		set(plugin[%1].enabled,false);
		tween(plugin[%1].alpha,0);
		tween(plugin[%1].blur,20);
		tween(plugin[%1].textblur,20,,,set(plugin[%1].visible,false));
</action>

He do not stop your video included in that plugin !!! In fact, if you return displaying the plugin htmltext, you will see the video at the point it is playing...

I think you must talk to the video itself with some kind of function to stop it !!!

What video player is it?

Salut.

8

Wednesday, June 24th 2009, 12:38am

Hi Klaus, Salut Michel ;-)

My videoplayer is a video imported in a flash as3 file.

Klaus, i'll try your solution and i'll tell you. I think of an other possibility :

Can a button created in flash as3 make a window close (like the action : action : hidewindow) ?

What do you think of my exemple ? It would be great to have the possibility to open windows with videos. It would be a great option !

Bye !

9

Wednesday, June 24th 2009, 10:46pm

Can a button created in flash as3 make a window close (like the action : action : hidewindow)
Hi,

yes, from Flash any krpano actions can be called,
use the "krpano_as3_interface" for that,
see here:
http://krpano.com/docu/plugins/

this as3 codes would be needed in the plugin:

first import the interface (at the top of the code):

Source code

1
import krpano_as3_interface;


then get the an instance of the interface:

Source code

1
2
var krpano:krpano_as3_interface;
krpano = krpano_as3_interface.getInstance();


now you can call krpano actions with the call function:

Source code

1
krpano.call("action(hidewindow);");


best regards,
Klaus

10

Thursday, June 25th 2009, 12:33am

Quoted

from Flash any krpano actions can be called
Hi, your answer makes me happy !


I guess it is possible to create a button which would close my window and stop the video playing in the same time.

This button would be placed in the swf file (the swf file with the link to the video.flv)

I'll work on that now.

Thank you for all your advices Klaus (and for your quick answer !).

11

Friday, June 26th 2009, 3:28pm

Hi Klaus,

I used krpano_as3_interface and it works !
Krpano is full of possibilities !!

In xml file, i put :

Source code

1
 <krpano>  <plugin name="test" url="test.swf" /></krpano> 


Here is an example : I created a very simple flash plugin named test.swf.

http://www.reflexion-graphic.com/krpano-1-forum/voiture.html


Button 2 (right) : action get url krpano.com
Button 1 (left) : It doesn't work yet, i want to call a krpano action

The code in as3 for button 2:

Source code

1
homeButton.addEventListener(MouseEvent.CLICK, gotoAuthorPage);


I need some help because i'm new to AS3.

Can you explain how to use in as3 :

Source code

1
krpano.call("action(hidewindow);");


If possible, it would be nice to have an example of code for a button in as3 which call an action in krpano.


thanx

12

Monday, June 29th 2009, 1:16pm

If possible, it would be nice to have an example of code for a button in as3 which call an action in krpano.
yes, have a look at this example:
http://krpano.com/examples/cs3plugin/
(the .fla of it is included there for downloading)

best regards,
Klaus

13

Thursday, July 2nd 2009, 5:40am

first plugin

Hi Klaus,

Thanks a lot.
This exemple is perfect.

I spent all the night on it and I understand now how to create a plugin and how to call an action from flash.

It’s possible to build more complex interface now and have at the end one swf file.

It’s a nice way to share interfaces, pictures gallery, and video… But actually without sound unless i find a solution to this question :
How to stop FLV audio playback on navigation.

As i said, i’m new to AS3 (but spent a lot of time on as2 ;-)

I know how to create simple flash navigation in as3 like in this exemple :

http://www.reflexion-graphic.com/krpano-1-forum/voiture.html

There are 2 hotspots.

One loads a flash menu, not finished yet

One loads a plugin : very simple « home made » flash navigation created in as3.

You can switch from one page to another

It works perfect with picture, text, but not video :

The problem is, when switching away from a state to a different state, even though the child is removed, the current video apparently keeps playing as I can hear the audio continuing on.

This problem happens in flash (it’s not specific to krpano).
There are a lot of topics about that on the net.

But i still don’t know how to create a simple as3 button which would do these actions in the same time :

---> krpano.call("set(plugin[plugin01].visible,false);");

---> "Stop / Unload / remove plugin" in as3

It seems that the Unload is the good solution.

But i have still syntax problem.

Thanx to krano : I spend my night on as3 now ;-)

Thanx again Klaus, your example helps a lot !

This post has been edited 1 times, last edit by "Vinyl" (Jul 2nd 2009, 6:01am)


14

Thursday, July 2nd 2009, 10:18am

The problem is, when switching away from a state to a different state, even though the child is removed, the current video apparently keeps playing as I can hear the audio continuing on.
Hi,

a video must be stopped manually in flash by closing it's "stream",
see here:
http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/net/NetStream.html#close()

best regards,
Klaus

15

Friday, July 17th 2009, 4:53am

Thanx Klaux ! Finaly, with your help, it works ! Ill post soon an example ;-)

16

Thursday, June 26th 2014, 5:43pm

Hi Vinyl,

Could you please post your code here to close a video.

Lots of people like me are looking for this ... *rolleyes*

Thanks for your feedback.