Help with addplugin troubles in as3

  • I am almost finished integrating a video player into my krpano project and I am stuck. Here is my project:

    http://earlycommit.com/clemson/test/vickery-auditorium.html

    I want to be able to load the video from a video button I have on my navigation but it is not working. I figure this should be done by addplugin but I cannot get it to function properly. Currently, I have the video player automatically load and I can get rid of it through the removeplugin function that I placed on the exit button video, but I cannot get the videoplayer to come back. Can anyone help? You can see my current code as well as commented previous attempts below:

    /* Video Button located in file rc.swf */

    button_video.addEventListener(MouseEvent.MOUSE_OVER, video_over);
    button_video.addEventListener(MouseEvent.CLICK, video_clicked);
    function video_clicked(mouseevent:MouseEvent):void
    {
    /*
    krpano.call("onclick=if(plugin[video-fb].visible == false , action(openaction), action(closeaction) );");
    krpano.set("plugin(video-fb).visible",true)
    krpano.set("addplugin[video-fb]")*/


    krpano.call("action(openaction)");
    }

    /*Code in xml file */

    addplugin(video-fb);
    <plugin name="video-fb"
    url="preview.swf"
    keep="false"
    ath="2.9395175792121506" atv="-8.489145343089376"
    zoom="false" distorted="false"

    width="880" height="480"
    state="opened"
    scale="1" scale9grid="" scalechildren="false" rotate="0"
    crop="" ondowncrop="" onovercrop=""
    visible="true" enabled="true" handcursor="false" capture="true" children="true"
    zorder="1"
    alpha="1.00" blendmode="normal" smoothing="true"
    refreshrate="auto"
    details="8"
    effect=""
    flying="0"
    inverserotation="false"
    usecontentsize="false"
    />

    addplugin(video-fb);
    set(plugin[video-fb].url,preview.swf
    set(plugin[video-fb].visible,true);

    removeplugin(video-fb);
    set(plugin[video-fb].visible,false);

    /*Code on exit button located in preview.swf */

    button_close.addEventListener(MouseEvent.CLICK, close_clicked);
    function close_clicked(mouseevent:MouseEvent):void
    {
    krpano.call("removeplugin(video-fb);")
    }

    Any ideas? Also, the Exit Video button does not dissapear when the video is in full screen. It is located on the same swf as the videoplayer. Does anyone know how to make it go away during fullscreen and then come back when the user returns to normal screen? Thanks for your help.

  • I see a number of things that should NOT be working, even if they are!

    Aren't those action calls inside any tag? They must be. If you want to put actions in your xml that should be run immediately when the xml is loaded, use

    Code
    <action name="myaction"> ... </action>
    <events onxmlcomplete="myaction();" />


    Code
    krpano.call("onclick=if(plugin[video-fb].visible == false , action(openaction), action(closeaction) );");

    Is this supposed to run immediately or when you click the plugin? if the latter, you must put it on a plugin attribute such as in

    Code
    krpano.set("plugin[video-fb].onclick,if(plugin[video-fb].visible == false, action(openaction);, action(closeaction););");


    Code
    krpano.set("plugin(video-fb).visible",true)

    Shouldn't this be [video-fb] instead of (video-fb)?


    Code
    krpano.set("addplugin[video-fb]")

    Here you should use krpano.call and () . Please note that addplugin creates an EMPTY plugin, so after using this you should use krpano.set on it to add the URL and other attributes.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!