home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 145 / MOBICLIC145.ISO / pc / DATA / DSS145 / DSS145_12 / DSS145_12.swf / scripts / dss145_12 / Question.as < prev    next >
Text File  |  2012-07-19  |  1KB  |  47 lines

  1. package dss145_12
  2. {
  3.    public class Question
  4.    {
  5.        
  6.       
  7.       public var no:int;
  8.       
  9.       public var idLM:String;
  10.       
  11.       public var text:String;
  12.       
  13.       public var reponses:Vector.<Reponse>;
  14.       
  15.       public function Question()
  16.       {
  17.          this.reponses = new Vector.<Reponse>();
  18.          super();
  19.       }
  20.       
  21.       public function melangerReponses() : void
  22.       {
  23.          var tri:Function = null;
  24.          tri = function(param1:Number, param2:Number):Number
  25.          {
  26.             return Number(Math.round(Math.random() * 2) - 1);
  27.          };
  28.          var _tab_alea:Array = [];
  29.          var i:int = 0;
  30.          while(i < this.reponses.length)
  31.          {
  32.             _tab_alea.push(i);
  33.             i++;
  34.          }
  35.          _tab_alea.sort(tri);
  36.          var _reponsesResult:Vector.<Reponse> = new Vector.<Reponse>();
  37.          var j:int = 0;
  38.          while(j < _tab_alea.length)
  39.          {
  40.             _reponsesResult.push(this.reponses[_tab_alea[j]]);
  41.             j++;
  42.          }
  43.          this.reponses = _reponsesResult;
  44.       }
  45.    }
  46. }
  47.