FORUMS: list search recent posts

external Swf and center it

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ricky Milling
external Swf and center it
on Jan 22, 2013 at 10:50:09 pm

Hi i have created a page that takes a external swf file (as it means i only have to update this one) and then displays it, however i would like it to be in the center (horizontally) and the react to the way people resize their browser windows.

So far i have this code

var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("RickyMillingMain.swf");

I have tried aligning it to the center, i can move it via the x axis but that just moves it without taking notice of the browser window. I have also tried using the stage high /2 - heigh /2. But i cant seem to get it to work.

Return to posts index

Sam Mattern
Re: external Swf and center it
on Jan 23, 2013 at 2:29:15 pm

You can do a combination javascript/flash solution using ExternalInterface. Write a javascript function that monitors the window size and calls a resizer function in your flash document, passing the window size, to update it the size of your swf.

Here's an example of using ExternalInterface for bi-directional communication. Instead of using a button to trigger the javascript function, you'd use a javascript event like window.onresize or jquery event $(window).resize.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved