pass variable to one function

  • I, i have to do a function with some variable, and i have to pass this variable with the call of function, how i have to do?

    Example:

    function abc{
    if (x=true){
    open image z
    } else {
    trace y
    }

    abc(true,image.jpg,hello);

    what is the correct function for to do this?
    Thanks.

  • Hi, thanks, i have changed the code, is right?
    Thanks.

    <action name="popup">
    if(%1 == true,
    set(layer[bg].visible,true);
    ,
    set(layer[popupimage2%].visible,true);
    ,
    tween(layer[popupimage2%].alpha,1.0,0.5);
    );
    if(1% == false,
    tween(layer[popupimage2%].alpha,0,0.5,default,set(visible,false));
    ,
    set(layer[bg].visible,false);

    </action>

    popup(true,7);

  • Ok now i have understand, bur have another problem..

    with this is working:

    <action name="popup">
    if(%1 == true,
    set(layer[bg].visible,true);
    set(layer[popupimage1].visible,true);
    tween(layer[popupimage1].alpha,1.0,0.5);
    ,
    tween(layer[popupimage1].alpha,0,0.5,default,set(visible,false));
    set(layer[bg].visible,false);
    );
    </action>

    but if i try to add 2% to the "popupimage" string for to pass the variable with the name of layer, it is not working

    <action name="popup">
    if(%1 == true,
    set(layer[bg].visible,true);
    set(layer[popupimage2%].visible,true);
    tween(layer[popupimage2%].alpha,1.0,0.5);
    ,
    tween(layer[popupimage2%].alpha,0,0.5,default,set(visible,false));
    set(layer[bg].visible,false);
    );
    </action>

    How i can add some numbers to the string "popupimage" and have popupimage1, popupimage2, popupimage7.....
    Thanks.

  • Thanks. now is perfect!!
    For everyone that have to open more image from hotspot, i have used this method.

    The code is this:

    <layer name="bg" type="container" keep="true" visible="false" bgcolor="0x000000" bgalpha="0.8" align="lefttop" width="100%" height="100%"/>

    <action name="popup">
    txtadd(imagetopopup,'popupimage',%2);
    if(%1 == true,
    set(layer[bg].visible,true);
    set(layer[get(imagetopopup)].visible,true);
    tween(layer[get(imagetopopup)].alpha,1.0,0.5);
    ,
    tween(layer[get(imagetopopup)].alpha,0,0.5,default,set(visible,false));
    set(layer[bg].visible,false);
    );
    </action>

    <layer name="popupimage1" url="images/myimage1.jpg" align="center" width="70%" height="prop" visible="false" alpha="0" onclick="popup(false,1);" />
    <layer name="popupimage2" url="images/myimage2.jpg" align="center" width="70%" height="prop" visible="false" alpha="0" onclick="popup(false,2);" />

    hotspot name="q1" url="skin/info-icon.png" ath="-95.582" atv="2.619" scale="0.7" onhover="showtext(Info opera, style1);" onclick="popup(true,1);" />
    hotspot name="q2" url="skin/info-icon.png" ath="-95.582" atv="2.619" scale="0.7" onhover="showtext(Info opera, style1);" onclick="popup(true,2);" />

Participate now!

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