Hotspot object initialisation and content issue with SET()

  • Hi all!

    I ran into a weird behaviour with the set() method.

    I'm making a pano where I search for a hotspot, and I store the found hotspot into a variable with set() for later use.
    Because I want a clear algorithm, I initialize the variables I make use of using

    Code
    set( storageVar, NULL );


    then later in the code, if I found the hotspot I'm looking for, I store it with

    Code
    set( storageVar, myHotspot )

    I'm expecting to be able to access the hotspot attributes with

    Code
    ... storageVar.name ...


    but I only can trace "storageVar.name" or "null" if Im ake use of get().

    This
    is, in my opinion, very strange. And more over, I noticed that, if I DO
    NOT initialize my variable with null, the code works as expected, I
    trace the actual name of the hotspot!

    Example:


    Result displayed:

    Code
    INFO: We copied original "hs1" object as: [object Object] into [object Object] named "hs1"
    INFO: We then copied "hs1" object as: [object Object] into NULL initialized [object Object] named "secondStore.name"
    INFO: We last copied "hs1" object as: [object Object] into non declared [object Object] named "hs1"


    Note on line 2 that: my storageHS is an Object (expected) but its name attribute can't be find while
    on line 3, we can get the object and its attribute...

    Does anyone can explain me what I'm missing?

    You can have a live demo here:
    http://anoril.no-ip.com/jsiTest/test.html ( xml is there: http://anoril.no-ip.com/jsiTest/test.xml )
    To observe the issue, just move the view arround and click the interogation mark. :)

    Regards,

    « Quidquid latine dictum sit, altum sonatur »
    Pentax stuff.

  • Hi,

    sorry, but I can't reproduce your problem - neither with your example nor with self testing...

    Such problem could happen when the 'secondStore' variable was FIRST defined as number or string value - by the first definition a variable get its type and on later assignments the new value will be convert to the type of the variable.

    If that's the problem - you can use delete(secondStore); instead of set(secondStore,null); to avoid that problem.

    Best regards,
    Klaus

  • Hi!

    Thanks for your reply, Klaus.

    I'm struck that you can't reproduce! I got the error just by following the link I provided (with two different computers *wacko* )
    (Win7 both, Firefox, html5:always, krpano 1.19-pr3)

    Anyway, thanks for your workarround! My aim is to check against "null" to be sure I work with stuff...


    As far as I understand your explaination, I suppose the system cannot set the initial type of 'null' then go crazy when casting hotspot(object) into the null type... *confused*

    Best regards,

    Paul

    « Quidquid latine dictum sit, altum sonatur »
    Pentax stuff.

Jetzt mitmachen!

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