PDA

View Full Version : Control Browser Scroll Position from Flash


Livi17
08-19-2009, 02:20 AM
I hope I put this in the proper forum.

I have a flash movie that is 1050px in height. the bottom part appears off-screen on most browsers.

During the movies loading sequence, some animation happens off screen that users with low resolution will miss. It's not imperative that they see it, however I thought it would be cool if I could control the browser's scroll bars so the HTML page scrolls down for them until the animation is finished, and then it scrolls it back up to the top of the page. If it's not too hard, easing during the scroll would be awesome, also.

I am not even sure what would be needed to accomplish this. I am assuming it will require javascript function calls from flash, but I have no idea how to do that.

Livi17
08-19-2009, 03:42 AM
This is similar to what I am trying to do, only the scroll would be initiated by a flash command instead of a button click.

Article:
http://www.dezinerfolio.com/2007/08/08/df-javascript-smooth-scroll

Sample:
http://www.dezinerfolio.com/wp-content/uploads/smoothscrolldemo/df_smooth_scroll.html

If there was a way to call the javascript function that makes this javascript scroll with easing possible, that would be exactly what i need.

I'm not sure this could be achieved using ExternalInterface in some way or not.

tadster
08-26-2009, 12:39 AM
hmmm...it seems that that script works just by being part of the page, no?
All that gets called is calls to href anchors: (#footer, #middle...)
so If you have that script in the page, from flash you just have to call the anchored urls:
(as an example)

navigateToURL("www.examplesofnicescrolling.html#footer");



if some JS function needs to be called, and that js function is included in the same page your flash is embeded in, the external interface can be used to call such JS functions as follows:
(imagine you had a JS function named "theJSFunction")



ExternalInterface.call("theJSFunction");




hope this helps