Why isn't this plugin working? (possibly xml-related)

  • Alright, this is probably something simple I'm overlooking, so I thought I'd paste here all the details and get some more minds on the problem *cool*

    I have this in my xml:

    Code
    <plugin name="history" url="gui/history.swf" backbutton="back_button" fwbutton="forward_button" keep="true" preload="true" />
    <plugin name="cap" url="gui/caption.swf" visible="true" align="leftbottom" x="0" y="0" handcursor="false" keep="true" preload="true" />
    
    
    (...)
    
    
    <events onxmlcomplete="action(qtvrcursor); plugin[history].register(get(localname)); plugin[cap].upd();" />

    This is how history.swf registers itself:

    And this is how caption.swf registers itself:

    The base plugin structure, startpluggin, stopplugin and such are *exactly* the same in both plugins (directly copied from the examples and other existing plugins).

    Why is it that while history.swf works perfectly, the call plugin[cap].upd(); in the load event fails with the error "WARNING: unknown action command: plugin[cap].upd" ?

    Calls to (krpano, not flash) trace from within caption.swf's registerEvent *do not seem to be working*, which means the call to upd would fail because it somehow fails to run registerEvent (!) and therefore never really assigns the upd function?

    However, visually speaking, caption.swf is being properly loaded and shows up where it's supposed to show up.

    What could be happening here?

  • Yes, no errors. At this time it ONLY contains this code:

    On the stage it contains one TLFText of the read only type whose instance name is 'caption'.

  • It's just a more advanced text component from Flash CS5. It displays text. Since it shows up in the krpano viewer nothing is wrong there. It's just upd() that doesn't run when called from the onxmlcomplete event, and also

    krpano.call("trace(Loaded);");

    This doesn't show in the log inside the krpano viewer so it's safe to assume it never runs.

  • okay, what is the stop() call? maybe try without it, and add more traces,
    e.g. you can also call - krpano.trace(0,msg) - this would be better:

  • hi, no, that's not nessecry,
    krpano will automatically dispatches a 'krpano_as3_interface.PLUGINEVENT_REGISTER' event after loading to send the name/path of the plugin, to let the plugin know under which name/path (like "plugin[cap]") it was loaded to krpano,

    best regards,
    Klaus

  • Hi, srisa. If you look more carefully at the code you'll see register is a custom function from the history plugin! It recieves whatever unique identifier you want to be used to tell panoramas apart (such that panoramas with the same identifier will be considered the same place) and, if the latest panorama in history is different from the current panorama, adds the current panorama to the history. One of the advantages of using a plugin for history (besides the fact that I don't really like the krpano if clause :P) is that it can work with php-generated xml to remember the direction you were looking at and, when you navigate through history, seamlessly load the panorama directly looking at that direction even with zoom and blend effects. I'll add the code to the wiki as soon as I get some real work done on it.

    klaus: NONE of the traces is showing up :S I'll look into problems with tlftext and files and post my findings in a few minutes.
    stop is a MovieClip function and it stops the timeline when there are 2 or more frames.

  • Well, when I replace the TLFText with a TextField the plugin works. The problem is, TextField doesn't have a vertical alignment setting, and I need my text to be aligned to the bottom of the field.

    Why would TLFText not work? The component seems to create an extra file textLayout_1.0.0.595.swz . I uploaded this both to the viewer path and to gui/, but it still doesn't work. Since none of the traces run, I'm assuming that when the plugin is imported into the viewer it is somehow unable to find this file, so it crashes in the very beginning at:

    import flashx.textLayout.*;

    The strangest thing is that the TLFText field is there and showing content, so I assume this shared library contains only the AS3 code for manipulating it, not the component itself. Would there be a way to solve this issue?

  • Ok, I solved it. In Publish Settings > Flash > AS3 Settings > Library path, under Runtime Shared Library settings, I changed the Default Linkage dropdown from Runtime Shared Library (RSL) to Merged into code and now it works (though the plugin is even bigger! TLFText takes a lot of space...)

    Sorry about all this. I find that explaining my problems to others often helps me solve them much faster by myself :P

  • I find that explaining my problems to others often helps me solve them much faster by myself :P

    This is usually the best problem solving process. Post it on a bulletin board and then the answer immediately comes to you. (right after you click submit) *cool*

Participate now!

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