1 | DEF Example_1 Script { |
2 | field SFColor currentColor 0 0 0 |
3 | eventIn SFColor colorIn |
4 | eventOut SFBool isRed |
5 | url "javascript: |
6 | function colorIn(newColor, ts) { |
7 | // This method is called when a colorIn event is received |
8 | currentColor = newColor; |
9 | } |
10 | function eventsProcessed( ) { |
11 | if (currentColor[0] >= 0.5) // if red is at or above 50% |
12 | isRed = true; |
13 | }" |
14 | } |