I was building a website for a client, all self contained into one Flash file. A good friend pointed out to me that with every link in the footer, while it changed the site as expected, the site stayed in one place. Meaning the content changed, but there was no jump to the top of the page like you'd expect from a normal HTML page. A lot of these sites I build are landing pages for AMOE, meaning I'm basically doing in Flash what is normally done in HTML/Javascript. The main difference is that I don't do Javascript, so building these in Flash and giving an HTML experience (sounds funny, I know) is my goal. Doing this in Flash cuts down on my development time greatly. Annnnnnnnnnd tangent.
The point of this post is, you can scroll to the top of the browser window directly through a Flash call. And that ActionScript is?
import flash.external.ExternalInterface;
ExternalInterface.call("self.scrollTo(0,0)");
That's it. No need to reference a Javascript script in your HTML page. You can also use getURL with the same value, but I found that if you need to run any other scripts at the same time, they may clash. Javascript can only run one at a time if running through the address bar. I found this out while trying to use SWFAddress with getURL. One had to give.
Wednesday, April 14, 2010
Tuesday, April 13, 2010
Global clearInterval
i = setInterval(function(){},100) + 1
while(i--){
clearInterval(i)
}
I'll let Ted explain how it works:
http://ted.onflash.org/2004/11/fun-with-intervals.php
Subscribe to:
Posts (Atom)