Child layer not displaying

  • <style name="s1" bgcolor="0xFFFFFF" bgalpha="0.5" align="leftbottom" x="5" y="85" width="270" height="370"/>
    <style name="s2" width="100" height="100" bgcolor="0x228444" type="text" />

    In a scene this works okay:

    Code
    <layer name="s1" type="container" style="s1">
        <layer name="s2" style="s2" />
    </layer>

    I'm trying to do the same from an action: <scene ... onstart="ac1();" ... >

    Code
    <action name="ac1" scope="local" >
        addlayer(s1); 
        layer[s1].loadstyle(s1);
        set(layer[s1].type, container);  
        addlayer(s2);
        layer[s2].parent = s1; 
        layer[s2].loadstyle(s2); 
    </action>

    This only displays layer s1. What am I missing?
    Thank you

  • Code
    <action name="ac1" scope="local" >    
        addlayer(s1); 
        set(layer[s1].type, container); 
        layer[s1].loadstyle(s1);
        addlayer(s2);
        set(layer[s2].parent, s1); 
        layer[s2].loadstyle(s2); 
    </action>

    Now it works. Lines order and set(layer[s2].parent, s1); instead of layer[s2].parent = s1;

Participate now!

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