Observable Texture load states
Reported by lindsay.kay (at xeolabs) | August 20th, 2010 @ 01:57 PM | in V0.7.7
Make Texture node states observable with listeners
new SceneJS.Texture({
layers: [
{
uri:"http://scenejs.org/library/textures/misc/general-zod.jpg"
}
],
listeners: {
"state-changed":
function(event) {
switch (event.params.newState) {
case SceneJS.Texture.STATE_INITIAL:
alert("SceneJS.Texture.STATE_INITIAL");
break;
case SceneJS.Texture.STATE_LOADING:
// At least one layer still loading
alert("SceneJS.Texture.STATE_LOADING");
break;
case SceneJS.Texture.STATE_LOADED:
// All layers loaded
alert("SceneJS.Texture.STATE_LOADED");
break;
case SceneJS.Texture.STATE_ERROR:
// One or more layers failed to load - Layer
// will limp on, remaining in this state
alert("SceneJS.Texture.STATE_ERROR: " + params.exception.message || params.exception);
break;
}
}
}
},
//..
)
No comments found
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
SceneJS provides easy access to WebGL through a simple and declarative JavaScript API. The SceneJS API is functional, which enables its scene definitions to be really compact and expressive, while hooking into other JavaScript code just that little bit more smoothly.