Posts by peasn

    Hey everyone,

    I built a multiple quiz for a tour about 10 years ago. I recently updated to the krpano (1.20.11). It loads a random question from xml each time and on the first load it works ok but on loading the next question it is returning NAN on the random number (ranQuestionNum). I've been trying to work out what is doing this but can't for the life of me find the problem.

    I'm hoping someone could run a pair of fresh eyes over the code please and maybe point out the error.

    Any help is much appreciated, thank you

    Pulling my hair out with this one, I can trace it out to be correct but when I try to use it as a reference to load the question I get null. Is it to do with variable type in the array?
    Hopefully someone can help me out

    I am creating a multiple choice quiz within krpano, which has a pool of about 50 questions in xml with names q1,q1,q3 etc. I want to load 8 random questions from that list but check that the question hasnt been loaded before.

    So I created an array storing the question names:

    Code
    createarray(questionArray);
    		<!-- store questions in array -->
    		for(set(i,0), i LT numOfQuestions, inc(i),
    			set(questionArray[get(i)].value, get(questions[get(quizName)].question[get(i)].name));
    		);

    Then pick a random question and remove it from the array:

    Code
    mul(ranQuestionNum, random, questionArray.count);
    add(ranQuestionNum, 1);
    roundval(ranQuestionNum);
    		
    txtadd(currQuestionName, questionArray[get(ranQuestionNum)].value);
    questionArray.removearrayitem(get(ranQuestionNum));

    So far that works but I cant get the text to populate from the currQuestionName:

    Code
    set(layer[question_text].html, get(questions[get(quizName)].question[get(currQuestionName)].text));

    Any ideas?

    Thanks, but I'm unfortunately still not able to reproduce an example where I would get a black screen...
    Can you please send me (privately) a link to the full example?

    Hey Klaus I added preload="true" back into the layer and the error isnt happening anymore *confused*
    This was definitely happening before or maybe I have totally lost it. Which is possible...

    Okay,the problems seems to be related to the parent usage - can you please show also the declaration of the textbox element?


    Sorry Klaus I should've added that. The above sits within a container:

    Code
    <layer name="textbox" type="container" align="center" x="0" y="0" width="90%" height="90%" zorder="99" scalechildren="true" bgcolor="0x111111" bgalpha="0" bgcapture="true" keep="true" >

    Here too - can you please show an example for this case?
    I'm trying to reproduce such problem, but haven't found a not-working case yet... just preload=true itself should be not the problem...

    Hey Klaus, I had a container layer at the start of my tour with language buttons like this:

    Code
    <layer name="intro_screen" type="container" parent="textbox" keep="true" align="center" x="2%" y="60%" width="450" height="90" preload="true"  >
    <layer name="english_btn" url="%CURRENTXML%/skin/intro_buttons.png" keep="true" align="center" x="-150" y="0" crop="0|0|320|158" onovercrop="0|158|320|158" ondowncrop="0|158|320|158" ondown="set(language,english); set(layer[intro_screen].visible, false);"  />
    	
    <layer name="irish_btn" url="%CURRENTXML%/skin/intro_buttons.png" keep="true" align="center" x="150" y="0" crop="320|0|320|158" onovercrop="320|158|320|158" ondowncrop="320|158|320|158" ondown="set(language,irish); set(layer[intro_screen].visible, false);" />			
    
    
    </layer>


    It was ok in the flash version but in HTML it was just black until I removed preload=true. Strange I know...

    I solved the problem. I had preload="true" on a container which was doing it. Not sure why as it worked in the previous version but glad I found it. Thanks guys

    Sorry, but please describe your problem more detailed.

    Hi Klaus, I converted the swf & javascript files to the latest version and all I get is a blank screen in the HTML5 version but the flash version works fine. The HTML version worked ok in the previous version. Its strange as it loads an imagemap I have in it but nothing else. My file isn't encrypted either and the error console reports everything is loaded. Should I attach my xml to look at? Im on an Intel Mac, tested in firefox & safari
    Thanks

    Im getting just a black screen with the imagemap visible in my html version, doesn't throw up any errors in the console. The flash version works fine. Ive tried commenting out blocks of code but still nothing. Any ideas?

    Hi Klaus, is there a bug with changing text within an dragable textfield layer in HTML with autoheight="true" set?
    When I turn off autoheight the text is visible but cuts off, but when I enable it no text is visible. I am loading text from another xml doc and populating the same masked text layer each time:

    my layers:

    Code
    <layer name="title" url="%SWFPATH%/plugins/textfield.swf" visible="false" children="false" parent="textbox" enabled="false" width="1024" zorder="97" align="topcenter" y="15" border="false" background="false" css="p{text-align:center; color:#E3E3E3; font-family:Ringbearer; font-weight:normal; font-size:36px;}" keep="true" />
    
    
    <layer name="textmask" type="container" visible="false" parent="textbox" align="lefttop" x="30" y="90" width="40%" height="60%" zorder="96" bgcolor="0xFFFFFF" enabled="true" bgalpha="0" maskchildren="true" keep="true" >
    				
    <layer name="text" url="%SWFPATH%/plugins/textfield.swf" visible="false" children="false" align="lefttop" x="0" y="0" width="100%" autoheight="true" border="false" background="false" css="p{text-align:left; color:#E3E3E3; font-family:Ringbearer; font-weight:normal; font-size:18px;}" ondown="draglayer_text(start,290);" keep="true" />
    </layer>


    my action to populate the textfield from a reference to another xml file which is loaded in:

    Code
    set(layer[text].y,0);     
    set(layer[text].css, text-align:left; color:#FFFFFF; font-family:Ringbearer; font-weight:normal; font-size:18px;); 
    set(layer[text].html, get(data[get(itemdesc)].content));


    does that look ok or is there a bug in the HTML side with the dargagble layers?

    Thanks

    Sorry Andrey, it just annoyed me as I am trying to learn how the code works and not seeking others to do it for me as suggested.
    Andrey can you set a layer as the target to build the frames/do the for loop? I cant seem to get it to build within a layer. Thanks

    Cheers for the replies. "RTFM" like Nupsi?!? Was I asking for you to do it for me? NO, I was simply asking for direction in how to achieve something as I couldnt find it in the manual & cant get it to work. I think you need to get your head out of your ass judging by your other ranting posts!
    Anyway thanks nefar1ous, I am trying to build the frames into a target layer within a plugin. It just seems to load it on top of the pano rather than inside the plugin. Is this possible to achieve?
    Thanks