Categories

Skipping flash header animation on certain pages

Template-help.com Team November 15, 2010
No votes yet.
Please wait...
Q: How can I make a flash header play full animation on certain pages only but skip it on the rest of the pages? A: In the HTML code of our templates you’ll find one of the following two blocks of code: The 1st one (you’ll find in our earlier templates):
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0″ width=”880″ height=”800″> <param name=”movie” value=”flash/header.htm”> <param name=”quality” value=”high”> <param name=”menu” value=”false”> <embed src=”flash/header.htm” quality=”high” pluginspage=”http://www.macromedia.com/go/getflashplayer” type=”application/x-shockwave-flash” width=”880″ height=”800″></embed> </object>
The 2nd one:
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0″ width=”745″ height=”328″> <param name=”movie” value=”flash/Header.htm”> <param name=”quality” value=”flash/header.htm”> <param name=”menu” value=”false”> <param name=”wmode” value=”transparent”> <!–[if !IE]> <–> <object data=”flash/Header.htm” width=”745″ height=”328″ type=”application/x-shockwave-flash”> <param name=”quality” value=”flash/header.htm”> <param name=”menu” value=”false”> <param name=”wmode” value=”transparent”> <param name=”pluginurl” value=”http://www.macromedia.com/go/getflashplayer”> FAIL (the browser should render some flash content, not this). </object> <!–> <![endif]–> </object>
You should put a parameter into Flash with the help of one of these blocks of code. In the .FLA file there should be an Action Script code that will accept this parameter and handle it. To add parameters do the following: In the first case update the code in this way:
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0″ width=”880″ height=”800″> <param name=”movie” value=” flash/header.swf?par=skip“> <param name=”quality” value=”high”> <param name=”menu” value=”false”> <embed src=” flash/header.swf?par=skip” quality=”high” pluginspage=”http://www.macromedia.com/go/getflashplayer” type=”application/x-shockwave-flash” width=”880″ height=”800″></embed> </object>
In the second case update it in this way:
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0″ width=”745″ height=”328″> <param name=”movie” value=”flash/Header.htm”> <param name=”quality” value=” flash/header.swf?par=skip“> <param name=”menu” value=”false”> <param name=”wmode” value=”transparent”> <!–[if !IE]> <–> <object data=”flash/Header.htm” width=”745″ height=”328″ type=”application/x-shockwave-flash”> <param name=”quality” value=” flash/header.swf?par=skip“> <param name=”menu” value=”false”> <param name=”wmode” value=”transparent”> <param name=”pluginurl” value=”http://www.macromedia.com/go/getflashplayer”> FAIL (the browser should render some flash content, not this). </object> <!–> <![endif]–> </object>
From the ActionScript code this parameter will be available as _root.par . It means that you can use conditions like this:
if(_root.par == “skip”){ //your code here //you usually use gotoAndStop(); or gotoAndPlay(); functions to skip a certain number of frames }
In real situations you will usually incorporate this condition into the code for the preloader. The code for the preloader can look like this one:
onClipEvent (load) { total = _root.getBytesTotal(); } onClipEvent (enterFrame) { loaded = _root.getBytesLoaded(); percent = int(loaded/total*100); text = percent+”%”; gotoAndStop(percent); if ((loaded == total) && (_root.par == “skip”)) { _root.gotoAndStop(200); // usually the frame number where animation finishes } else if (loaded == total) { _root.gotoAndPlay(2); } }
See also:
This entry was posted in General tutorials, Working with Flash and tagged animation, flash, skip. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket