EXTERNPROTO MyFirstExternProto [
	field			MFString	url					[]
	eventIn			MFString	set_url
	eventOut		MFString	url_changed
	field			SFColor		color				[1 2 3]
	exposedField	SFRotation	scaleOrientation	0 0 1 0
	field			SFNode		nodeField			Material2D {emissiveColor 4 3 3}
] 45

PROTO MyFirstProto [
	exposedField	SFColor		myColor				0.41 0 0.14
	exposedField	SFBool		enabled				false
	eventOut		SFBool		isActive
]
{
	Appearance {
		material DEF PROTO_MATERIAL Material2D {
			 emissiveColor IS myColor
		}
	}
	DEF PROTO_TIME_SENSOR TimeSensor {
		enabled IS enabled
		isActive IS isActive
	}
	DEF PROTO_VALUATOR Valuator
	ROUTE PROTO_TIME_SENSOR.time TO PROTO_VALUATOR.inSFTime
	ROUTE PROTO_VALUATOR.outSFColor TO PROTO_MATERIAL.emissiveColor
}

Group {
    children [
		Inline {url 11}
		Group {
			children [
				DEF T1 Group {
					children [
						DEF SHAPE1 Shape {
							appearance {
								material MaterialKey {
									keyColor 0.1 0.22 0.33
								}
							}
							geometry DEF MY_CIRCLE Circle {
								radius 100.0
							}
						}
						DEF SHAPE2 Shape {
						}
						Shape {
							appearance {
								texture DEF MyImage ImageTexture {
									url 9
								}
							}
						}
						Shape {
							appearance DEF MY_PROTO MyFirstProto {
								myColor		0.222 0.444 0.666
							}
						}
						DEF TIS TimeSensor {
							loop TRUE
						}
						DEF TOS TouchSensor
						DEF POI PositionInterpolator2D {
							key [0.0 0.5 1.0]
							keyValue [100.0 100.0, 200.0 100.0, 100.0 100.0]
						}
						Shape {
							appearance MyFirstExternProto {
								color 0.53 0.35 0.98
							}
						}
					]
				}
				Group {
					children Shape {
						appearance {
							material DEF MAT Material2D {
								emissiveColor 0.0 0.8 0.0
							}
						}
					}
				}
				Group {
					children [
						Shape {
							appearance {
								material Material2D {
									emissiveColor 0.8 0.8 0.8
								}
							}
							geometry DEF TEXTNODE Text {
								string "ab\"c\\d"
								length 4
							}
						}
						USE TOS
						DEF TIS2 TimeSensor {
							cycleInterval 2		
						}
						DEF COI ColorInterpolator {
							key [0.0 0.5 1.0]
							keyValue [0.0 0.8 0.0, 0.8 0.0 0.0, 0.0 0.8 0.0]
						}
					]
				}			
			]
		}
		DEF START_INLINE Conditional {		// this is the format for Conditional
			buffer APPEND TO T1.children
				Inline {
					url 7
			}
		}
		DEF STOP_INLINE Conditional {		// this is the format for Conditional
			buffer DELETE LAST T1.children

		}
	]
}

ROUTE MY_PROTO.isActive TO TIS2.loop
ROUTE TOS.touchTime TO TIS.startTime
ROUTE DEF ROUTE2 TIS.fraction_changed TO POI.set_fraction
ROUTE TIS.fraction_changed TO COI.set_fraction
ROUTE COI.value_changed TO MAT.emissiveColor
ROUTE SHAPE1.appearance TO SHAPE2.appearance

UPDATE OD [
	ObjectDescriptor {
		ObjectDescriptorID	7
		URLstring Inline.trif
	}
	{
		ObjectDescriptorID	9
		URLstring Image.trif
	}
	{
		objectDescriptorID	11
		muxScript PROTOs-and-multiple-OD-updates.scr
	}
	{	
		objectDescriptorID	45
		muxScript PROTOs-and-multiple-OD-updates.scr
	}
]

AT 100 APPEND TO T1.children 						
	Shape {
		appearance MyFirstExternProto {
			color 0.55 0.56 0.54
		}
	}

AT 1000 REPLACE MY_PROTO.enabled BY TRUE
AT 1500 REPLACE MY_PROTO.enabled BY FALSE

AT 2050 {
  	REPLACE SHAPE1.appearance BY {
  		material Material2D {
  			emissiveColor 3 4 5
  		}
  	}
 	REPLACE START_INLINE.activate BY TRUE
 	DELETE SHAPE1
}

AT 4000 UPDATE OD {
	ObjectDescriptorID	9
	URLstring Pop.trif
}

AT 5000 UPDATE ESD in 11 {
	ES_ID 23
	OCR_ES_Id 22
	muxInfo {
		fileName ShrinkCircle.bif
		streamFormat BIFS
	}
	decConfigDescr {
		streamType 3		// BIFS Stream
		bufferSizeDB 1000
	}
	slConfigDescr {
		useAccessUnitStartFlag TRUE
		useAccessUnitEndFlag TRUE
		useTimeStampsFlag TRUE
		timeStampResolution 100
		timeStampLength 14
	}
}

AT 10000 REPLACE STOP_INLINE.activate BY TRUE
AT 15000 REPLACE START_INLINE.activate BY TRUE
AT 16000 REMOVE OD 7
AT 17000 REMOVE ESD FROM 11 [23]