[Xerte] How to use the judge function correctly
Dave Burnett
d_b_burnett at hotmail.com
Wed Feb 18 20:40:43 GMT 2009
Thanks Julian.
Yes, this does work;
if (interaction.XMLElement.childNodes[2].clip().correct == undefined) {
interaction.XMLElement.childNodes[2].clip().CreateAttribute['correct'];
interaction.XMLElement.childNodes[2].clip().correct = 0;
}
But I'll use the node syntax you suggested:
node.attributes.myNewAttribute = "value";
Subject: RE: [Xerte] How to use the judge function correctly
Date: Wed, 18 Feb 2009 20:05:09 +0000
From: Julian.Tenney at nottingham.ac.uk
To: xerte at lists.nottingham.ac.uk
If you are building the file at runtime (I think you are) then, yes, my preferred way is to work with the XML. It is then parsed and the file is created. There may be a danger that by setting properties directly, you miss something else the code does when initalising icons. So, yes, for example, you could set the correct property on a response movieclip, but if the engine also does something else at that point (like add the response to the array) then it won't happen.
I think, in the case of 'correct' you can set it at runtime, because I seem to remember building it to work in a dynamic way. That may not be the case for every movieclip property that has a corresponding xml attribute.
J
From: xerte-bounces at lists.nottingham.ac.uk on behalf of Dave Burnett
Sent: Wed 18/02/2009 19:11
To: Xerte list
Subject: RE: [Xerte] How to use the judge function correctly
I must have fat-fingered a key somewhere.
Just rebuilt it and I do get a 2 value for
interaction.responses.length
with an int with 3 responses attached.
interaction.responses[1] gives me
_level0.engine.IFC.PG_MC20.Int_MC1.box3
Is that the whole array?
I guess the point is to address the XML nodes as opposed to the underlying constructors?
Subject: RE: [Xerte] How to use the judge function correctly
Date: Wed, 18 Feb 2009 18:09:48 +0000
From: Julian.Tenney at nottingham.ac.uk
To: xerte at lists.nottingham.ac.uk
I thought the same thing...
From: xerte-bounces at lists.nottingham.ac.uk on behalf of Dave Burnett
Sent: Wed 18/02/2009 18:08
To: Xerte list
Subject: RE: [Xerte] How to use the judge function correctly
I could test that, but since I got 0 instead of Undefined for the length query, I assumed the rest of the objects had to exist.
Subject: RE: [Xerte] How to use the judge function correctly
Date: Wed, 18 Feb 2009 18:02:25 +0000
From: Julian.Tenney at nottingham.ac.uk
To: xerte at lists.nottingham.ac.uk
does it exist when you try and get at it?
debug(question) ?? undefined??
From: xerte-bounces at lists.nottingham.ac.uk on behalf of Dave Burnett
Sent: Tue 17/02/2009 16:26
To: Xerte list
Subject: RE: [Xerte] How to use the judge function correctly
Hmm.
My interaction (id question) has 4 responses with names, id's, correct set to 1.
If I debug:
question.responses.length
I get 0
Subject: RE: [Xerte] How to use the judge function correctly
Date: Tue, 17 Feb 2009 15:17:15 +0000
From: Patrick.Lockley at nottingham.ac.uk
To: xerte at lists.nottingham.ac.uk
Hello
I don't know how this function works, but I can possibly help as thus
INTERACTION.prototype.judge = function() {
//check that each response whose correct is not undefined
//has the same status as correct
for (var i = 0; i<this.responses.length; i++) {
if (this.responses[i].correct != undefined) {
//trace(this.responses[i].correct +" " +this.responses[i].status);
if (this.responses[i].correct != this.responses[i].status) {
//doesn't match - user cannot have matched all correctly
return false;
}
}
}
return true;
};
That is the flash source code of the function, so it looks like you need to set responses for the interactions for a judge to work.
Pat
From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Peter Huppertz
Sent: 17 February 2009 15:07
To: xerte at lists.nottingham.ac.uk
Subject: [Xerte] How to use the judge function correctly
Hi List,
another beginner's question. Imagine the following structure:
-- page 1
---- interaction: id=question1
-------- button 1: correct=0
-------- button 2: correct=0
-------- button 3: correct=1
-- page 2
---- script: question1.judge()
The script returns undefined, regardless of what the user clicks. I also tried false and true instead of 0 and 1. What's wrong?
Peter Huppertz
Get more out of the Web. Learn 10 hidden secrets of Windows Live. Learn Now
See how Windows Mobile brings your life together—at home, work, or on the go. See Now
See how Windows Mobile brings your life together—at home, work, or on the go. See Now
_________________________________________________________________
Stay up to date on your PC, the Web, and your mobile phone with Windows Live.
http://clk.atdmt.com/MRT/go/msnnkwxp1020093185mrt/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20090218/f28fd22a/attachment.html
More information about the Xerte
mailing list