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


    [size=12]
    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>

  • 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

  • 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

  • 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 :


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

    Code
    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 !

  • 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:

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


    or:

    Code
    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

  • Hi,

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

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

  • Hi Klaus, Salut Michel *wink*

    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 !

  • 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:
    https://krpano.com/docu/plugins/

    this as3 codes would be needed in the plugin:

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

    Code
    import krpano_as3_interface;

    then get the an instance of the interface:

    Code
    var krpano:krpano_as3_interface;
    krpano = krpano_as3_interface.getInstance();

    now you can call krpano actions with the call function:

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

    best regards,
    Klaus

  • Quote

    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 !).

  • Hi Klaus,

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

    In xml file, i put :

    Code
    <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:

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

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

    Can you explain how to use in as3 :

    Code
    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

  • 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 *wink*

    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 *wink*

    Thanx again Klaus, your example helps a lot !

    Edited once, last by Vinyl (July 2, 2009 at 6:01 AM).

Participate now!

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