Beiträge von MikkoK

    Hi

    Is there a way to scale the content inside a textfield all at once?

    In my tour I have hotspots that open a popup layer that can contain text, links, images or even embedded youtube videos, basic html. I know you can scale the text by simply altering the size of the font but then the images and other content still stay the same size.

    The root of my problem is that the popups look too big on mobile devices because of the larger stagescale being applied in the default skin for mobile. I tried giving the textfield layer and its parent layer scale.mobile="0.5" but that doesn't affect the content of the textfield.

    The textfield layer is always the same, I just show/hide it and change the html through an action when the user clicks a hotspot if that makes any difference.

    Hi

    I'm trying to create a row of buttons that take you to a different website.

    I have a custom xml element in the tour.xml file:

    <aptmenu name="test1" targeturl="http://www.google.com" image="aptmenu/test1.jpg"/>
    <aptmenu name="test2" targeturl="http://www.iltalehti.fi" image="aptmenu/test1.jpg"/>
    <aptmenu name="test3" targeturl="http://www.hs.fi" image="aptmenu/test1.jpg"/>


    In the vtourskin.xml file I have an action that creates the button row. I've mostly just copied the skin_addthumbs action. I try to assign the targeturl attributes to openurl in the buttons' onclick events:

    for(set(i,0), i LT aptmenu.count, inc(i), calc(layername, 'skin_aptmenu_' + i);
    addlayer(get(layername));
    set(layer[get(layername)],
    url=get(aptmenu[get(i)].image),
    keep=true, parent='skin_aptmenu',
    align='lefttop',
    crop=get(thumbcrop),
    width=get(thumbwidth),
    height=get(thumbheight),
    x=calc(thumbpadding + i*thumbxoffset),
    y=get(thumbpadding),
    onclick=openurl(get(aptmenu[get(i)].targeturl), _self)
    );
    );


    The image for the buttons is loaded just fine, so the attributes are read correctly, but when I click a button, the targeturl value is null. The browser tries to open localhost/null.

    I've managed to deduce that this is some kind of a scope issue. When I set the scope of the action to global, define a variable with the targeturl and then use that variable in openurl it works:

    for(set(i,0), i LT aptmenu.count, inc(i), calc(layername, 'skin_aptmenu_' + i);
    addlayer(get(layername));

    def(test, string, get(aptmenu[get(i)].targeturl));

    set(layer[get(layername)],
    url=get(aptmenu[get(i)].image),
    keep=true, parent='skin_aptmenu',
    align='lefttop',
    crop=get(thumbcrop),
    width=get(thumbwidth),
    height=get(thumbheight),
    x=calc(thumbpadding + i*thumbxoffset),
    y=get(thumbpadding),
    onclick=openurl(get(test), _self)
    );
    );

    However the variable is overwritten in each loop and every button opens the last targeturl in the aptmenu elements. Apparently variables defined inside a loop aren't local to that loop? How do I get the targeturl attributes correctly to openurl?