Javascript and flash can do some interesting things together. I built a
flash gallery that would load up images and depending on how much space it
needed, resize the div the flash was sitting in so browser scroll-bars came
into effect if necessary. Then, when a certain image is displayed large,
scrolling in the browser would move the large image inside the flash so it's
always centred within the browser window.
Here's my javascript, the flash should be simple to work out:

<script type="text/javascript">
 if (window.addEventListener)
{
window.addEventListener('scroll',scrollingDetector,false);
window.addEventListener('resize',resizeDetector,false);
}
else if (document.addEventListener)
{
document.addEventListener('scroll',scrollingDetector,false);
document.addEventListener('resize',resizeDetector,false);
}

function scrollingDetector()
{
var scrollY;
if (navigator.appName == "Microsoft Internet Explorer")
{
scrollY = document.body.scrollTop;
 }
else
{
scrollY = window.pageYOffset;
}
getFlashMovie("excl").setScrollY(scrollY);
}
 function resizeDetector()
{
var height;
if (navigator.appName == "Microsoft Internet Explorer")
{
height = documentbody.offsetHeight;
}
else
{
height = window.innerHeight;
}
getFlashMovie("excl").setHeight(height);
}
 function runFirst()
{
scrollingDetector();
resizeDetector();
}
 function getFlashMovie(movieName)
{
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
}
 function setFlashHeight(newH)
{
gid = document.getElementById("flashHolder");
//gid.style.width = "965px";
gid.style.height = newH +"px";
}
</script>


2009/2/18 Matt S. <[email protected]>

> Have you guys had experience with dynamic resizing of the flash via
> Javascript in order to use the browser scrollbar to scroll, eg with
> http://swffit.millermedeiros.com/ or something similar? any
> recommendations?
>
> thx,
>
> .m
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
The Random Lines
My online portfolio
www.therandomlines.com
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to