why i cant use txtreplace or txtadd function

  • <scene name='scene_01' title='pano_a' .....
    <hotspot name='hs1' linkedscene='scene_01'/>

    now i click hotsopt to read the scene name---scene_01, and change the prefix 'scene_' to 'li_', i want got a string li_01;

    my code is following:

    Code
    txtreplace(li_num,get(linkedscene),'scene_','li_');
    trace(li_num);
    showlog();

    the result should be the 'li_01';
    but the true log result is 'li_num', doesn't get the number;

    when i use the following:

    Code
    subtxt(sce_num, get(linkedscene),6,2);	//the sce_num is 01;
    txtadd(li_num,'li_',sce_num);
    trace(li_num);
    showlog()


    the li_num should be 'li_01';
    but the true log result is 'li_num', still doesn't get the number;


    why?

    Edited 2 times, last by jigl (August 8, 2014 at 11:10 AM).

  • Hi,

    the second parameter in txtreplace() need to be a variable - that means try it without the get():

    Code
    txtreplace(li_num, linkedscene,'scene_','li_');

    for subtxt() it's the same, but in txtadd() the get() would be needed to add the content:

    Code
    subtxt(sce_num, linkedscene,6,2);
    txtadd(li_num,'li_',get(sce_num));
    trace(li_num);

    Best regards,
    Klaus

Participate now!

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