parenting not working for a layer

  • hi all

    i have two container (layer) that will get different maps to show.
    my idea was do make two layer with the two different maps and then write an action that sets the wright container as parent to those two maps so that they get position of the parent.

    at the moment this is not working for me, is the parent function supposed to do such kind of stuff?

    thanks
    sven

  • another try

    i have a layer 1:

    Quote

    <layer name="skin_mainmap" state="closed" type="container" visible="true" align="bottomleft" x="10" y="10" zorder="2" width="260" height="110" bgcolor="0x000000" bgalpha="1" onover="skin_maphover(skin_mainmap);" onout="skin_maphover(skin_mainmap);" />

    and a layer 2:

    Quote

    <layer name="map1" type="container" parent="layer[skin_mainmap]" visible="false" width="100%" height="100%" bgcolor="0x654321" bgalpha="1"/>

    why is it not aligning to the correctly to the parent object, it still aligns to the stage...
    do i need to follow a special hierarchy, like first the parent and then the child in the code?
    do i need special writing in parent="..."

    thanks for your answers
    sven

  • Hi

    It should work without any problem. Perhaps this change will help.


    <layer name="map1" type="container" parent="layer[skin_mainmap]" visible="false" width="100%" height="100%" bgcolor="0x654321" bgalpha="1"/>

    to

    <layer name="map1" type="container" parent="skin_mainmap" visible="false" width="100%" height="100%" bgcolor="0x654321" bgalpha="1"/>


    Piotr

  • Hi)

    Ususally code

    Code
    parent="layer[parentlayer]"

    works well enough. I see from your code that "skin_mainmap" doesn't have

    Code
    keep="true"

    attribute. That means it's located inside some other layer, perhaps. Can you share a link to see the full code?

    Regards,

    Alexey

  • thanks for you answers!

    i already tried changing the syntay from:

    parent="layer[skin_mainmap]"

    to

    parent="skin_mainmap"

    but it's still not working.

    also i've now set keep="true" for the both parent and child. still no success :(

    here is the whole code of the menu layers. http://www.filedropper.com/parentingpart
    the layers googlemaps and radarmaps should be parented to skin_mainmap and skin_extramap.

    thanks for your help guys
    sven

  • i just experienced something strange

    until now i've set the parent wright in the child layer. that did not work.
    now i've set it over an action called with the event onxmlcomplete. now it works.
    can't believe that...

  • i just experienced something strange

    until now i've set the parent wright in the child layer. that did not work.
    now i've set it over an action called with the event onxmlcomplete. now it works.
    can't believe that...

    i just wanted to point that out...
    why are you even doing this in the xml?
    if you set your layer structure in xml directly, you dont need to set the parent property,
    because you can just put your layer in the correct place (as child of your parent layer)

    --> why dont you just move your googlemaps layer down in your structure to be the child of skin_mainmap

    i think i only used parent dynamically, and its possible that it only works like this.

    ( btw: should we get an confirmation for your vr event on 17th? i didnt get one :) )

  • why are you even doing this in the xml?
    if you set your layer structure in xml directly, you dont need to set the parent property,

    for sure, normally i would do that. but this parent is not static, it changes to another parent when you change our custom settings in the xml file.
    therefore it makes no sense to give it a static parent in the structure.

    -> betreffend der anmeldung, gib mir doch per PN deinen Namen durch, dann schaue ich ob du auf der liste bist!

    grüsse
    sven

Participate now!

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