InitialObjectDescriptor {
 objectDescriptorID 1
 audioProfileLevelIndication 255
 visualProfileLevelIndication 254
 sceneProfileLevelIndication 1
 graphicsProfileLevelIndication 1
 ODProfileLevelIndication 1
 esDescr [
  ES_Descriptor {
   ES_ID 1
   decConfigDescr DecoderConfigDescriptor {
    streamType 3
    decSpecificInfo BIFSConfig {
     isCommandStream true
     pixelMetric true
     pixelWidth 600
     pixelHeight 400
    }
   }
  }
 ]
}

OrderedGroup {
 children [
  Background2D {
   backColor 1 1 1
  }
  WorldInfo {
   info ["This shows script modifying nodes directly" "" "GPAC Regression Tests" "$Date: 2007-07-27 09:46:10 $ - $Revision: 1.2 $" "(C) 2002-2004 GPAC Team"]
   title "Node Modification Script test"
  }
  Shape {
   appearance Appearance {
    material DEF MAT Material2D {
     filled TRUE
    }
   }
   geometry DEF IFS IndexedFaceSet2D {
    colorIndex [0 1 2 3 4 5]
    coordIndex [0 1 2 3 4 5]
    color Color {
     color [0 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 1]
    }
    coord Coordinate2D {
     point [-120 0 -50 100 50 100 120 0 50 -100 -50 -100]
    }
   }
  }
  DEF TS TimeSensor {
   loop TRUE
  }
  Transform2D {
   translation -150 -120
   children [
    Shape {
     appearance Appearance {
      material Material2D {
       emissiveColor 0 0 0
       filled TRUE
      }
     }
     geometry DEF TEXT Text {
      string [""]
      fontStyle FontStyle {
       family ["SANS"]
       justify ["BEGIN" "BEGIN"]
       size 20
      }
     }
    }
   ]
  }
  DEF SCRIPT Script {
   eventIn SFTime act
   field SFNode n USE IFS
   field SFNode t USE TS
   field SFNode txt USE TEXT
   field SFInt32 roll 0
   url ["javascript: function act(value, timestamp) {roll++;count = n.colorIndex.length;first = n.colorIndex[0];for (i=0; i<count; i++) {if (i+1==count) {n.colorIndex[i] = first;} else {n.colorIndex[i] = n.colorIndex[i+1];}}txt.string[0] = 'ColorIndexes: ' + n.colorIndex.toSource();txt.string[2] = 'Current Cycle length: ' + (count * t.cycleInterval) + ' seconds';txt.string[1] = 'Running for ' + timestamp + ' seconds';switch (roll) {case 6:t.enabled = FALSE;t.cycleInterval = 0.5;t.enabled = TRUE;break;case 18:t.enabled = FALSE;t.cycleInterval = 0.1;t.enabled = TRUE;break;case 78:t.enabled = FALSE;t.cycleInterval = 0.05;t.enabled = TRUE;break;case 198:roll = 0;t.enabled = FALSE;t.cycleInterval = 1;t.enabled = TRUE;break;}}"   ]
  }
 ]
}

ROUTE TS.cycleTime TO SCRIPT.act

