Compass code from FPP to KRP

  • Hi,

    Well i'm using a compass code in FPP, working fine and try (with no sucess so far) to adapt it to KRP
    i have a plugin with a movieclip called "compass_ring_btn",
    i want it rotate accordingly to the pano pan :

    in FPP i use an invisible hotspot in xml

    Code
    <!-- COMPASS -->
    <spot id="deltarotation" rotation="0" />


    where "rotation" will be the north direction value

    with this AS3 code in my plugin :

    Then to adapt to KRP,
    i make an invisible hotspot in xml like this :

    Code
    <hotspot name="deltarotation" url="any.png" handcursor="false" visible="false" ath="100" atv="0" >

    where "ath" will be North direction...

    and in my Plugin AS3 :

    as you see, i'm pretty noob in AS3 :wacko: , because i'm designer.
    so any help appreciated.


    Thanks

    Edited once, last by zadda (November 12, 2008 at 12:03 PM).

  • Hi,

    must must calculate the delta to the current looking direction (view.hlookat):
    (and you have mixed up "plugin" and "hotspot" )

    e.g.

  • a final request :
    flash throw me an loop error (because of the timer)
    ReferenceError: Error #1069: ath property not found on string and there no default value..

    then how i set up a default value for ath,
    i've tried with no success :
    if (isNaN(ath)) {
    ath = 0;
    }
    (sorry again my poor coding ?( )

    however it works fine over KRP, but i would like to make the thing bugless.

    Thanks

    (by the way , little planet view is great ! congrats ! )

  • Hi,

    when did you get this error?
    always? only when loading a new pano?

    please also be sure that "version" in the xml files is set to "1.0.7" or higher,
    for example - if it was set to "1.0.5" krpano didn't return a "Object", it returns only a "String",
    this could be also the problem...

    best regards,
    Klaus

  • Hi,

    this error come ONLY in the output panel in Flash CS3 IDE,
    but i don't see in browser using Flash Player 10 (there no debugger installed yet),
    i supose it works fine because "ath" has a number value while the compass is playing over krpano 1.07,

    in the AS3 code , we just have to give a default value to "ath" if nothing is found (if ath ==null) then ath = 100..
    but i do'nt know exactly the syntax of this...

    Thanks

  • Hi,

    you mean - when running it without krpano?

    you can check if the plugin runs in krpano by using a ADDED_TO_STAGE event:

    Code
    this.addEventListener(Event.ADDED_TO_STAGE, startup_in_krpano);
    
    
    function startup_in_krpano (evt:Event):void
    {
      // e.g. - set here anything to note you're running on krpano
    }

    or check if the "krpano.get" function from the interface was set,
    e.g:

    best regards,
    Klaus

  • Hi Klaus,

    Quote

    you mean - when running it without krpano?

    Yes, exactly,
    the Output Panel of FLASH CS3 is looping this error, stressing my CPU (i guess) and myself (i sure :D )

    But Fixed now !

    Thanks Klaus, Great support ! :thumbup:  
    (and support is the key of success)

  • Hi Klaus,

    i just need one more small fix *wink*

    so,
    i'm using successfully the compass code in my plugin,


    but when i load a new pano (throught an hotspot in .xml with the following action :
    onclick="loadpano(pano2.xml,qtvr=pano2.mov,KEEPALL,BLEND(2));" )
    --
    the Flash 10 Debugger version throw me an error :

    // TypeError: Error #1009:Cannot access a property or method of a null object reference.
    // at compass_AS3_fla:MainTimeline/startup_in_krpano/compass_AS3_fla:updateFov()[compass_AS3_fla.MainTimeline::frame1:329]
    // at flash.utils::Timer/_timerDispatch()
    // at flash.utils::Timer/tick()
    --
    the compass find his new orientation after loading the new pano.
    so everything works as expected but the error while pano transition..

    then, i think i have to setup a conditional , because when loading a new pano,
    there no more stage or no pano or something like that...
    so i have to stop the timer or something similar,
    forgive my ignorance as i'm not really a coder guy *smile*

    i think , it will be obvious for you and just matter of minutes,
    for my part i've tried many solution without success so far...


    So any help welcome *smile*

    and an happy (successful) new year (of course) *thumbup*

  • Hi,

    I think the problem is, that when loading a new pano, all hotspots without keep="true"
    are removed,

    you can fix this, by adding keep="true" to your hotspot,
    or if in the new xml a new hotspot with the name "deltarotation" is defined,
    the hotspot doesn't exists only for a short time,
    so just check if the hotspot object is not null, and do nothing in the meanwhile,

    e.g.

    wish you a happy new year too
    Klaus

Participate now!

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