How to play flash animation ?

  • Hi,

    I have integrated a flash animation as hotspot in a virtual tour and i want to play it when i click on it.
    I think that is possible but i don't know what function do i have to use.
    If necessary i can change it to plugin.

    Can you help me please ?

    Thanks.

  • Hi,

    I think you have to do your animation in Flash and Action Script 3.

    Create an animation in flash and create AS3 code to play your animation when mouse is clicked :

    Code
    MouseEvent.CLICK

    Then, insert your flash plugin in xml file in krpano.

  • thanks for your help,

    i've tried this code

    Code
    b_0.addEventListener(MouseEvent.CLICK, button_function);
    b_0.buttonMode = true;
    function button_function( evt:MouseEvent ) {
    gotoandplay(1);
    }

    but it didn't work. the animation starts before i click.

    is there a problem with my script ?

  • i've integrated the swf in the virtual tour but when i click on it it does'nt play :(

    here is the code

  • Hi,

    First, do your animation work when you preview it in Flash ? When mouse is clicked, your animation play ?

    If it works, then you should try to integrate it as a plugin in xml file.

    And did you add this code in your flash project ?

    Code
    import krpano_as3_interface;
    var krpano:krpano_as3_interface = krpano_as3_interface.getInstance();
  • yes the animation works and when i click it play the animation.

    now i tried this code

    Code
    import krpano_as3_interface;
    var krpano:krpano_as3_interface = krpano_as3_interface.getInstance();
    stop();
    b_0.addEventListener(MouseEvent.CLICK, button_function);
    b_0.buttonMode = true;
    function button_function( evt:MouseEvent ) {
    gotoAndPlay(1);
    }

    but the animation in the virtual tour works in loop *confused* (i haven't changed the code in the xml it's always like this :

    )

  • Quote

    i just want you to know that if i put the animation as plugin then it works correctly (with the events of the mouse)

    Great ! *smile*

    Quote

    but i want to use it as hostspot

    then you could add an action in your xml file to your plugin with "onclick" for example :

    Code
    <plugin name="animation"
     	        url="your-flash-plugin.swf"
    	        onover=""
    	        onhover=""
    	        onout=""
    	        ondown=""
    	        onup=""
    	        onclick="lookto(180,0,150);"
    	        />

    Or you could add an action in your flash plugin in AS3 :

    Code
    krpano.call("lookto(0,25,20));");

    Good luck !

  • Hi,

    when using a swf as "distorted" hotspot, the own events of the swf will not work anymore,
    because the swf will be rendered to a bitmap, and then only this bitmap will be displayed distorted,
    that means there is no connection anymore between the displayed object and the real swf,

    a solution could be to use the normal krpano events,
    you can also call your own AS3 functions from there,

    or to add your own events direct to the 'real' Sprite object of the hotspot,

    have also a look here:
    https://krpano.com/docu/plugins/

    first you need to know the 'name' of the hotspot or plugin,
    this can be get in AS3 via the krpano PLUGINEVENT_REGISTER,

    e.g.


    then you could add your own functions to the plugin/hotspot
    and call them from xml,
    e.g:


    and call it from xml:

    Code
    <hotspot ... onclick="test();" .. />


    or if you want to add own events - there is "sprite" member variable that contains the real
    visible sprite object,
    e.g.

    best regards,
    Klaus

Participate now!

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