Hi,
I'm busy with a interface for krpano, and I got the following problem. The interface consists of several buttons (within flash), when one of them is pressed, it loads a panorama. Easy. Now, the buttons have a active state and turn red when pressed as a way to show the user which panorama he is viewing atm. Now here's the problem, when you press a button it does a call to krpano to load the panorama, and the button turns red, however if you immediately press another button, It turns that button red, but because the pano was busy loading, it didnt receive the call to change the panorama. Especially when you spammclick all the buttons. My goal is to make it idiotproof.
So I was thinking of disabling the interface plugin (enabled = false) from every mouseclick untill the load is completed.
var LoadingTimer:Timer = new Timer(1000.0/30.0,0); //does a check every 1/30 sec
LoadingTimer.addEventListener(TimerEvent.TIMER, Loading_update);
LoadingTimer.start();
function Loading_update(timerevent:TimerEvent):void
{
if ( krpano.get("progress.loaddone") == "false" )
{
krpano.set("plugin[gui].enabled", false);
}
else
{
krpano.set("plugin[gui].enabled", true);
}
}
Display More
However I use tiles, and from the sample flash plugin I understand its hard to calculate the total filesize of all the tiles. So I then thought, Lets disable the interface for one second after each click. But this feels wrong too. The time krpano needs to progress a call is dependend on cpu, so 1 sec wouldnt be enough, but waiting 3secs for any user input could be to extreme.
How would you solve this? The correct solution would be changing the color of the button after the panorama progressed the first call and is ready to receive more calls (not nesescary after its done, for instance a user wants to go to panorama1 but accidently presses nr2. He realises this and presses panorama1 again, this would lead in panorama2 being loaded but button1 on red). Is this possible? Or perhaps another solution?