Hi Carl,
I have the same question about adding a replay button, but I don't understand how to apply the sample code that you've given. The complete code for my animation is below. There is only one frame in the timeline with all of the animation being controlled by AS. I'm a beginner when it comes to AS3, so please excuse my clunky code as I'm sure there's a more streamlined way to write it
//imports
import flash.external.ExternalInterface;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import com.greensock.TweenLite;
import com.greensock.loading.ImageLoader;
import com.greensock.easing.Linear;
//clicktag for invisible button
function getBrowserName():String
{
var browser:String;
//Uses external interface to reach out to browser and grab browser useragent info.
var browserAgent:String = ExternalInterface.call("function getBrowser(){return navigator.userAgent;}");
//Determines brand of browser using a find index. If not found indexOf returns (-1).
if(browserAgent != null && browserAgent.indexOf("Firefox")>= 0) {
browser = "Firefox";
}
else if(browserAgent != null && browserAgent.indexOf("Safari")>= 0){
browser = "Safari";
}
else if(browserAgent != null && browserAgent.indexOf("MSIE")>= 0){
browser = "IE";
}
else if(browserAgent != null && browserAgent.indexOf("Opera")>= 0){
browser = "Opera";
}
else {
browser = "Undefined";
}
return (browser);
}
function openWindow(url:String, target:String = '_blank', features:String=""):void
{
var WINDOW_OPEN_FUNCTION:String = "window.open";
var myURL:URLRequest = new URLRequest(url);
var browserName:String = getBrowserName();
switch (browserName)
{
//If browser is Firefox, use ExternalInterface to call out to browser
//and launch window via browser's window.open method.
case "Firefox":
ExternalInterface.call(WINDOW_OPEN_FUNCTION, url, target, features);
break;
//If IE,
case "IE":
ExternalInterface.call("function setWMWindow() {window.open('" + url + "', '"+target+"', '"+features+"');}");
break;
// If Safari or Opera or any other
case "Safari":
navigateToURL(myURL, target);
break;
case "Opera":
navigateToURL(myURL, target);
break;
default:
navigateToURL(myURL, target);
break;
}
}
function clickedb(e:MouseEvent):void { //function for SIPC
var sURL: String;
if ((sURL = root.loaderInfo.parameters.clickTag)) {
openWindow(sURL);
}
//navigateToURL(new URLRequest("#"), "_blank");
}
thisBTN.addEventListener(MouseEvent.CLICK, clickedb);
//objects on stage
imageMC.alpha = 1;
replayBtn.alpha = 0;
ccLogo.alpha = 1;
giftsTF.alpha = 0;
tableTF.alpha = 0;
bedroomTF.alpha = 0;
bathTF.alpha = 0;
everywhereTF.alpha = 0;
finalLockup.alpha = 0;
//begin animation: image begins panning from right to left while logo fades out and gifts type fades in
TweenLite.to(imageMC, 13, {x:-1500, delay:1.5, ease:Linear.easeNone} );
TweenLite.to(ccLogo, .5, {alpha:0, delay:2.5} );
TweenLite.to(giftsTF, .5, {alpha:1, delay:2.8} );
TweenLite.delayedCall(5.25, tweenGiftsOut);
//gift type fades out and table type fades in
function tweenGiftsOut()
{
TweenLite.to(giftsTF, .5, {alpha:0} );
TweenLite.to(tableTF, .5, {alpha:1, delay:0.5} );
TweenLite.delayedCall(3, tweenTableOut);
}
//table type fades out and bedroom type fades in
function tweenTableOut()
{
TweenLite.to(tableTF, .5, {alpha:0} );
TweenLite.to(bedroomTF, .5, {alpha:1} );
TweenLite.delayedCall(2, tweenBedroomOut);
}
//bedroom type fades out and bath type fades in
function tweenBedroomOut()
{
TweenLite.to(bedroomTF, .5, {alpha:0} );
TweenLite.to(bathTF, .5, {alpha:1} );
TweenLite.delayedCall(2, tweenBathOut);
}
//bath type fades out and everywhere type fades in
function tweenBathOut()
{
TweenLite.to(bathTF, .5, {alpha:0} );
TweenLite.to(everywhereTF, .5, {alpha:1} );
TweenLite.delayedCall(2, tweenEverywhereOut);
}
//everywhere type fades out and final call to action lockup and replay button fade in
function tweenEverywhereOut()
{
TweenLite.to(everywhereTF, .5, {alpha:0} );
TweenLite.to(finalLockup, .5, {alpha:1} );
TweenLite.to(replayBtn, .5, {alpha:1} );
}
//need to add the coding for a replay button (replayBtn) here, but not sure how to do it