function MakeDialog() { var toolkitCore = GetToolkitCore(); if (toolkitCore) toolkitCore.ShowWindow("resource:/res/samples/dexanimdialog.xul", window); } function ModalDialog() { var toolkitCore = GetToolkitCore(); if (toolkitCore) toolkitCore.ShowModalDialog("resource:/res/samples/dexanimdialog.xul", window); } function GetToolkitCore() { var toolkitCore = XPAppCoresManager.Find("ToolkitCore"); if (!toolkitCore) { toolkitCore = new ToolkitCore(); if (toolkitCore) toolkitCore.Init("ToolkitCore"); } return toolkitCore; } // preload an array of offscreen images var images = new Array(4); var imageNames = new Array("up.gif", "right.gif", "down.gif", "left.gif"); var animationFrame = 0; var animationFunction = null; for(var i = 0; i < 4; i++) { images[i] = new Image(); images[i].src = "sampleimages/" + imageNames[i]; } function animateButtonImage() { var button = document.getElementById("animation"); if (button) { button.src = images[animationFrame].src; animationFrame = (animationFrame + 1) % 4; animationFunction = setTimeout("animateButtonImage()", 250); } } function startAnimation() { if (animationFunction == null) animateButtonImage(); } function stopAnimation() { if (animationFunction) clearTimeout(animationFunction); animationFunction = null; }