Hi,
when i make a fullscreen button that flips automaticaly, when the screen changes or is being changed by another action, i use this code:
Code
// FULLSCREEN
this.btn_fullscreen.addEventListener(MouseEvent.CLICK, Fullscreen);
this.btn_fullscreenclose.addEventListener(MouseEvent.CLICK, Fullscreen);
addEventListener(Event.ADDED_TO_STAGE, init);
function init(e:Event):void
{
//je kan pas naar stage events luisteren, nadat het toegevoegd is aan de stage. Vandaar dat je even moet
//wachten op de ADDED_TO_STAGE event.
stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullscreen_event);
}
function Fullscreen(evt:MouseEvent)
{
switch (evt.type)
{
case MouseEvent.CLICK :
if (stage.displayState == StageDisplayState.FULL_SCREEN)
{
stage.displayState = StageDisplayState.NORMAL;
this.btn_fullscreen.visible = true;
this.btn_fullscreenclose.visible = false;
}
else
{
stage.displayState = StageDisplayState.FULL_SCREEN;
this.btn_fullscreen.visible = false;
this.btn_fullscreenclose.visible = true;
}
break;
}
}
function fullscreen_event (event:FullScreenEvent):void
{
if (event.fullScreen == true)
{
// now being in fullscreen mode
this.btn_fullscreen.visible = false;
this.btn_fullscreenclose.visible = true;
}
else
{
// back to window mode
this.btn_fullscreen.visible = true;
this.btn_fullscreenclose.visible = false;
}
}
Display More
Now i want that for the gallery button aswell, so that is being traced if the gallery is visible and when not then change/flip the button...
So how to do that... re-write this..???
Code
// Gallery
this.btn_gallery.addEventListener(MouseEvent.CLICK, ShowGallery);
this.btn_galleryclose.addEventListener(MouseEvent.CLICK, ShowGallery);
var ShowGalleryToggled:Boolean = false; //variable om te kijken of autorotate aangezet is.
function ShowGallery(evt:MouseEvent)
{
switch (evt.type)
{
case MouseEvent.CLICK :
if(!ShowGalleryToggled)
{
krpano.call("action(showgallery)");
this.btn_galleryclose.visible = true;
this.btn_gallery.visible = false;
ShowGalleryToggled = true;
}
else
{
krpano.call("action(hidegallery)");
this.btn_galleryclose.visible = false;
this.btn_gallery.visible = true;
ShowGalleryToggled = false;
}
break;
}
}
Display More
Thanx a lot!!
Tuur