Topic: Full Screen Mode in Flash Embed

Hi,

I've looked around in the forum for topics related to my problem, but haven't found anything that will solve my troubles. If this has been resolved elsewhere, please accept my apologies, and I would be extremely grateful if you could point me in the correct direction.

I have successfully embedded my Simpleviewer gallery in my Flash movie (AS3), using the code suggested in the Support pages:

var svAPI:Object; //svAPI is the object to call API methods on
var svLoader:Loader = new Loader();
addChild(svLoader);
svLoader.contentLoaderInfo.addEventListener(Event.INIT, onViewerInit);
svLoader.load(new URLRequest("simpleviewer.swf"));

/**
* Fired when preloader is available
* Can set gallery flashvars at this point
*/
function onViewerInit(e:Event):void{
Object(svLoader.content).addEventListener("svComplete", onGalleryLoaded);
var options:Object = Object(svLoader.content).embedOptions;
options.galleryURL = "gallery.xml";
}

/**
* Fired when gallery has completely loaded. API is now available.
*/
function onGalleryLoaded(e:Event):void{
svAPI = Object(svLoader.content).api;
svAPI.setSize(640,480);
}

Since I want to be able to move the SimpleViewer gallery around within the Flash movie, I have used the technique shown in the flash-embed sample files downloaded with SV Pro, in the "simpleviewer_flash_embed.fla" file - i.e. create a movie clip inside my Flash movie, and dump the above code inside that movie clip.

Everything is working perfectly - all images and thumbnails load, all picture information displays, all formats are correct, all navigation buttons work........... BUT the FullScreen mode does not work! It displays the button, and is clickable, but nothing happens when the button is clicked!

I have tried with the following code AFTER the above code, which was suggested in another thread here:

var params = {};            
params.allowfullscreen = true;

... but this does nothing.

I have also seen in the mentioned sample file "simpleviewer_flash_embed.fla" that this code is used to toggle the FullScreen Mode on and off, using an Event Listener when a button is clicked:

mcButton11.addEventListener(MouseEvent.CLICK,toggleFullscreen);
function toggleFullscreen(e:Event){
    svAPI.toggleFullscreen();
}

However, I don't want to use a button to toggle the mode on and off - I want to use the in-built functionality in SimpleViewer so that it is avilable as soon as the image gallery is loaded, and can be toggled on and off using the SV buttons.

Can this be done? Is there something I'm missing? I'm not great with AS3 but can move around code with relative ease.... I just feel like I'm almost there but I'm missing something...

Any help will be much appreciated!!!!

Thanks!!!!!

Re: Full Screen Mode in Flash Embed

Are you testing your SWF embedded in a HTML file? If so what embed code are you using to embed it? If you are not using the provided JavaScript embed code, the 'params.allowfullscreen = true;' code needs to go in your javascript embed code.

Felix Turner
SimpleViewer Support Team.

Re: Full Screen Mode in Flash Embed

Felix,

Thanks for your quick reply!

Yes, I'm testing my SWF in an HTML file.  This is the code I'm using to embed the SWF file in the HTML file:

<DIV style="margin-left:135px; margin-top:0px;">
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="900" HEIGHT="450" id="01-5_es" ALIGN="left">
<PARAM NAME=movie VALUE="01-5_es.swf">
<PARAM NAME=quality VALUE=high>
  <EMBED src="01-5_es.swf" quality=high bgcolor=#000000 WIDTH="900" HEIGHT="450" NAME="01-5_es" ALIGN="left" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>
</DIV>

...where "01-5.swf" is the name of the SWF file containing the embedded SimpleViewer gallery as mentioned above.

I've tried adding the parameter you suggest, and it solves the FullScreen Mode problem (i.e. the FullScreen Mode button is now working):

<DIV style="margin-left:135px; margin-top:0px;">
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="900" HEIGHT="450" id="01-5_es" ALIGN="left">
<PARAM NAME=movie VALUE="01-5_es.swf">
<PARAM NAME=quality VALUE=high>
  <EMBED src="01-5_es.swf" allowfullscreen=true quality=high bgcolor=#000000 WIDTH="900" HEIGHT="450" NAME="01-5_es" ALIGN="left" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>
</DIV>

However, it's still not doing what I need. It's actually the containing SWF file ("01-5.swf") that goes full-screen, and not the SimpleViewer gallery within it (which is what I need to go full-screen).

Any thoughts?

THANKS!

Last edited by fresnele (2011-01-13 11:10:44)

Re: Full Screen Mode in Flash Embed

If you want the SV gallery to fill the screen in fullscreen mode, you will need to add some logic to detect for fullscreen mode, then resize the SV gallery to fill the screen. Add something like this to your AS3 code:

stage.addEventListener( FullScreenEvent.FULL_SCREEN, onFullscreenToggle );

function onFullscreenToggle(event:FullScreenEvent)
{
   if (Stage["displayState"] == "normal")
   {
      // we're in normal mode, call a regular redraw
      onResize(null);
   }
   else
   {
      // we're in full screen mode, resize and reposition SV to fill stage
      svAPI.setSize(stage.stageWidth,stage.stageHeight);
      mcLoader. x = 0;
      mcLoader. y = 0;
   }
}
Felix Turner
SimpleViewer Support Team.

Re: Full Screen Mode in Flash Embed

Felix,

Thanks for all your help and sorry for being such a pain. I'm not that great with AS3 and this is doing my head in!

Still no joy.... I've tried what you suggest, but the AS3 code generates the following error:

1180: Call to a possibly undefined method onResize

referring to the

onResize(null);

line in your code.

I'm not sure if I'm doing something wrong...? I've placed this AS3 code inside the gallery container (i.e. where the SV galler is called) - is this correct?

Also, I've changed your lines:

mcLoader. x = 0;
mcLoader. y = 0;

to:

svLoader. x = 0;
svLoader. y = 0;

because they too were generating errors as the "mcLoader" property is not defined in my SWF file.

Re: Full Screen Mode in Flash Embed

The code I supplied above needs to go in the actions frame of the provided example FLA: 'simpleviewer_flash_embed.fla'

Felix Turner
SimpleViewer Support Team.

Re: Full Screen Mode in Flash Embed

Felix,

I've now placed the code where you say, but start getting weird results: the FullScreen mode works, but only resizes the pictures, and keeps the thumbnails and captions in the original position, overlapping the new resized images - and when I exit the FullScreen mode everything is out of place.

I'm obviously doing something wrong...  sad

Would it be possible for me to send you a ZIP file with my file setup (including FLA file) so that you could see exactly what my problem is? It's obvious that you know what you're talking about, and I just seem to be too limited in my AS3 knowledge to be able to implement the solution.

Please let me know if this would be possible, and if so how can I get it to you.

May thanks in advance, once again!