launch node

Summary

The launch node visits a specified URL. It can be used to send the user to a web site using the device's browser or to display a video full screen.

For more information see the XML reference entry for launch.

Constructor

launch.new( type , url , [id] )

The type parameter indicates the type of the resource at the URL. The accepted values are launch.WEB and launch.VIDEO.

The url parameter indicates the full URL of the resource to display. It must include the protocol (e.g. http://).

The parameter id is optional. If specified the node will be given this id.

Example C.26. Use of launch constructor

<scene>
	<script type="text/x-lua">
	
		mylaunch = launch.new(launch.WEB, "http://example.com")
		scene:appendNode(mylaunch)
	
	</script>

</scene>

Functions

node:setOnReturnTrigger( event )

Indicates an event node to trigger when the user returns to the scene from the resource. Note that for some platform and resource type combinations this may never happen.

Example C.27. Use of setOnReturnTrigger

<scene>
	<script type="text/x-lua">
	
		myevent = scene:getById("myevent")
	
		mylaunch = launch.new(launch.VIDEO, "http://example.com/example.mp4")
		mylaunch:setOnReturnTrigger(myevent)
		
		scene:appendNode(launch)
		
	</script>
	
	<event id="myevent">
		<!-- OMITTED actions that occur when the video is finished --> 
	</event>
	
</scene>


Functions common to action nodes

node:reset()

Resets this action such that it will occur again (from the beginning).

node:setNoTimes( val )

Sets the number of times this action should occur. Pass the value -1 to repeat indefinitely.

Example C.28. Use of setNoTimes

<scene>
	<script type="text/x-lua">
		
		mytransition = scene:getById("mytransition")
		
		mytransition:setNoTimes(10)
		
	</script>
	
	<transition id="mytransition"
				object="myplane" 
				what="position" 
				start="0 0 0" end="1 1 1" 
				length="1000 />

	<object id="myplane" type="primitives://plane.aro"/>
	
</scene>


Functions common to nodes

col graphnode:getColor()

Returns a table of 4 values - red, green, blue and alpha (transparency) between 0.0 and 1.0.

Example C.29. Use of getColor

<scene>
	<script type="text/x-lua">
		
		myplane = scene:getById("myplane")
		cols = myplace:getColor()
		red = cols[1]
		green = cols[2]
		blue = cols[3]
		alpha = cols[4]
		
	</script>
	<object id="myplane" type="primitives://plane.aro" color="0.5 1 1 0.75"/>
</scene>


boolean graphnode:isVisible()

Returns true if the node is set to visible, or false otherwise.

graphnode:setColor( col )

Sets the color of the node. Pass a 4-element table with entries { red, green, blue, alpha }. Values are expressed between 0.0 and 1.0.

Example C.30. Use of setColor

<scene>
	<script type="text/x-lua">
		
		myplane = scene:getById("myplane")
		
		--         r    g   b    a
		newcol = { 0.1, 1, 0.5, 0.25 } 
		myplane:setColor(newcol)
		
	</script>
	<object id="myplane" type="primitives://plane.aro"/>
</scene>


graphnode:setVisible( true or false )

Sets the visibility of the node. Invisible nodes are not displayed and do not respond to events e.g. onhover, onclickdown etc.