Help: To finish Code for create dynamic image layer with border around. SOLVED

  • Hi, I working in easy code for show a picture as layer type Image:

    Code
    <action name="create_picture_window">
    addlayer(%1);
    set(layer[%1].url,%2);
    set(layer[%1].align,center);
    set(layer[%1].onclick,removelayer(%1));
    </action>

    For use:
    create_picture_window(mypicture1,picture1.jpg);

    Very simple until now, but for add a background border: How to create that layer using width and height of the first layer created?

    I tried creating container layer, copyng the width and height and add 15 px but not work.
    Please helpme to complete this code, use the argument vars instead of % is too welcome.

    Greets,

    Fernando

  • Try something like this

  • Thanks very much Pantux, your solution is ok. My question was not.

    I can´t use it the bgborder property, because I need to put objects inside this border (title, exit button). I would require add 15px to container layer width and similar value to height, for example 5px.

    I think that the solution is way calc for add the border.
    Very grateful,
    Fernando.

  • <action
    name="creafoto_ventana">

    <!-- the background or border-->
    addlayer(fondo_%1);
    set(layer[fondo_%1].type,container);
    set(layer[fondo_%1].maskchildren,true);
    set(layer[fondo_%1].align,center);
    set(layer[fondo_%1].bgborder,5 0x0000ff 0.5);
    set(layer[fondo_%1].bgroundedge,8);
    set(layer[fondo_%1].bgalpha,1);
    set(layer[fondo_%1].bgcolor,0x0000ff);
    set(layer[fondo_%1].bgcapture,true);
    set(layer[fondo_%1].ondown,draglayer(););

    <!-- the picture -->
    addlayer(%1);
    set(layer[%1].url,%2);
    set(layer[%1].align,center);
    set(layer[%1].zorder,1);
    set(layer[%1].parent,fondo_%1);
    set(layer[%1].onloaded,
    set(tempowidth,get(layer[%1].width));
    inc(tempowidth,45);
    set(layer[fondo_%1].width,get(tempowidth));
    set(tempoheight,get(layer[%1].height));
    inc(tempoheight,45);
    set(layer[fondo_%1].height,get(tempoheight));

    </action>

Participate now!

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