How are indices determined in the flash viewer?

  • I have a function that iterates over the indices between two elements to automatically align them to a certain standard. This works deterministically in the HTML5 viewer -- that is to say, I always get the result I'm looking for in the HTML5 viewer. However, in the Flash viewer, the indices seem to be in a random order, so that two child elements will not have consecutive indices.

    Example code follows.

    Code
    <layer name="main_sidebar" keep="true"
      type="container"
    > <!-- and other various positioning things... -->
    <layer name="sub_tab_one" keep="true" style="my_tab_style" /> <!-- and other styling and positioning things -->
    <layer name="sub_tab_two" keep="true" style="my_tab_style" />
    <layer name="sub_tab_three" keep="true" style="my_tab_style" />
    <!-- and so on... -->
    </layer>

    One would expect `layer[sub_tab_one].index`, `layer[sub_tab_two].index`, and `layer[sub_tab_three].index` to be consecutive, and they are in the HTML5 viewer. However, in the Flash viewer, the order of indices is unpredictable. Is there any way around this?

    Alternatively, is there any easy way to iterate over the child elements of a layer?

    Rylee Fowler
    Full Stack Developer, Devio, LLC.

  • Hi,

    the order depends on the xml parser, but normally they should be parsed top-to-down...

    Btw - regarding 'it works in HTML5 viewer' - when saying that, please test ALL browsers - e.g. so far I know the xml parser of the IE browser also parses xml elements (at xml attributes) in a random order.

    Directly interating over <layer> child elements is currently not possible.

    Best regards,
    Klaus

  • Hey,

    Thanks Klaus. I re-implemented my solution in a non-parser-reliant method. I realize that it's no fault of krpano, but instead of the browser creators XML parser implementations.

    Rylee Fowler
    Full Stack Developer, Devio, LLC.

Jetzt mitmachen!

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