You could probably add an event listener?
I am attaching a sample project. The sample project has a square that changes color when orientation changes. I have only tested it in the iOS simulator.
Here is the main code for it as well:
Code:
//create a global variable/namespace for use if we don't have already
if (typeof(myData) === "undefined") {
myData = {};
}
//helper function to get a rounded value between 0-255
function getRandomColorComponent() {
return Math.round(Math.random() * 255);
}
//get element on stage that has a cssid of 'box'
var element = document.querySelector('#box');
//if we haven't attached the listener allready lets do that
//Remeber: sometimes scenes are played multiple times
if (!myData.hasOrientationListener) {
//attach orientation listener
window.addEventListener('orientationchange', function () {
var r = getRandomColorComponent(),
g = getRandomColorComponent(),
b = getRandomColorComponent();
element.style.backgroundColor = "rgb("+r+","+g+","+b+")";
});
//set flag so we know we attached listenr
myData.hasOrientationListener = true;
}
OrientationChange.animproj.zip