Jump to content
Search Community

Yet another simple Timeline max question. [SOLVED]

ej23 test
Moderator Tag

Recommended Posts

I'm realizing that I should have asked in my previous post in regards to Timeline Max, because I know this probably also falls into the "basic" category.

 

How can I assign a "onComplete" command to my Timeline?

 

Basically I want my Timeline to reverse, and when it completes, to run another function.

 

function elclosing1(event:MouseEvent):void
{

TheSquares.reverse();
}


function elclosing(event:MouseEvent):void {     

dispatchEvent(new Event("elclosing", true));    

}

 

Basically I want my timeline to run the second function on the bottom, after it completes reversing and I am at a loss as to where exactly I should put the code.

 

I'd post the full code, but I'm sure nobody has the time to go though it all. But I've assigned the first function to a button.

 

Anyone got any ideas?

 

Thanks in advance for any additional help.

Link to comment
Share on other sites

Use the vars object just like in TweenLite and TweenMax.

 

var myTimeline:TimelineMax = new TimelineMax({onComplete:myCompleteFunction, onReverseComplete:myReverseCompleteFunction});

 

With TimelineMax, you could use Event Listeners instead if you want, but callbacks are faster.

Link to comment
Share on other sites

So then I would then just declare the "OnReverse" function on the initial line of the timeline?

 

Also, my assumption is no, but does Timeline Max/Lite interfere at all with event dispatching?

 

Specifically, the reverse function I am using, in the code of a child swf, that will ultimately be closed, once it dispatches an event to it's parent swf.

I'd like to have this event dispatched on the completion of my timeline's reversal.

 

Here is the code if it's of any importance.

 


var mainmenu:mainmenubutton = new mainmenubutton();
addChild(mainmenu);
mainmenu.height = 3.85;
mainmenu.width = 3.85;
mainmenu.x = 500;
mainmenu.y = 367.9;
mainmenu.alpha = 0;

mainmenu.addEventListener(MouseEvent.CLICK, elclosing1);







var TheSquares:TimelineMax = new TimelineMax({delay:1,yoyo:false,onReverseComplete:elclosing});


TheSquares.insert( new TweenMax (thevertline, .5,{alpha:1, height:80,ease:Cubic.easeOut}));

TheSquares.insert( new TweenMax (thevertline, .95,{delay:.55, x:595.5,ease:Cubic.easeInOut}));

TheSquares.insert( new TweenMax (felasquare, .75,{delay:1.25, alpha:1, width:85.2, height:85.2,ease:Back.easeOut}));

TheSquares.insert( new TweenMax (selectasquare, .75,{delay:1.30, alpha:1, width:85.2, height:85.2,ease:Back.easeOut}));

TheSquares.insert( new TweenMax (eddiesquare, .75,{delay:1.35, alpha:1, width:85.2, height:85.2,ease:Back.easeOut}));

TheSquares.insert( new TweenMax (ebirdsquare, .75,{delay:1.40, alpha:1, width:85.2, height:85.2,ease:Back.easeOut}));

TheSquares.insert( new TweenMax (ss, .75,{delay:1.45, alpha:1, width:85.2, height:85.2,ease:Back.easeOut}));

TheSquares.insert( new TweenMax (ecuadorsquare, .75,{delay:1.5, alpha:1, width:85.2, height:85.2,ease:Back.easeOut}));

TheSquares.insert( new TweenMax (thevertline, .75,{delay:2, y:245.8, height:183.5,ease:Cubic.easeOut}));

TheSquares.insert( new TweenMax (thevertline, .75,{delay:2.30, y:279.8, height:80,ease:Cubic.easeOut}));

TheSquares.insert( new TweenMax (thevertline, .89,{delay:2.78, x:24.5, ease:Cubic.easeInOut}));

TheSquares.insert( new TweenMax (bbooksquare, .75,{delay:3, width:85.2, height:85.2, alpha:1,ease:Back.easeOut}));

TheSquares.insert( new TweenMax (corneliussquare, .75,{delay:3.05, width:85.2, height:85.2, alpha:1,ease:Back.easeOut}));

TheSquares.insert( new TweenMax (garysquare, .75,{delay:3.10, width:85.2, height:85.2, alpha:1,ease:Back.easeOut}));

TheSquares.insert( new TweenMax (la, .75,{delay:3.15, width:85.2, height:85.2, alpha:1,ease:Back.easeOut}));

TheSquares.insert( new TweenMax (ejcardsquare, .75,{delay:3.20, width:85.2, height:85.2, alpha:1,ease:Back.easeOut}));

TheSquares.insert( new TweenMax (sevensquare, .75,{delay:3.25, width:85.2, height:85.2, alpha:1,ease:Back.easeOut}));

TheSquares.insert( new TweenMax (thevertline, 1,{delay:4, height:0, alpha:0, ease:Cubic.easeOut}));

TheSquares.insert( new TweenMax (creative, .75,{delay:4.05,alpha:1, width:113.8, height:24, ease:Back.easeOut}));

TheSquares.insert( new TweenMax (mainmenu, .75,{delay:4.05,alpha:1, width:33.9, height:33.9, ease:Back.easeOut}));

TheSquares.insert( new TweenMax (nexter, .75,{delay:4.05,alpha:1, width:33.9, height:33.9, ease:Back.easeOut}));





function felaexpander(event:MouseEvent):void
{
TweenMax.to(felasquare, .25, {width:92.2,height:92.2, x:53.2, y:159.8, ease:Sine.easeInOut});
TweenMax.to(felasquare, .5, {bevelFilter:{blurX:10, blurY:10, strength:.5, angle:150, highlightcolor:5, highlightAlpha:1, shadowAlpha:.5,distance:2}});
}

function defelaexpander(event:MouseEvent):void
{
TweenMax.to(felasquare, 4, {width:85.2,height:85.2, x:59.2, y:164.8, rotation:0,ease:Elastic.easeOut});
   TweenMax.to(felasquare, .25, {bevelFilter:{blurX:10, blurY:10, strength:.5, angle:150, highlightcolor:5, highlightAlpha:1, shadowAlpha:.5,distance:2}});
}


function selectaexpander(event:MouseEvent):void
{
TweenMax.to(selectasquare, .25, {width:92.2,height:92.2, x:142.5, y:159.8, ease:Sine.easeInOut});
TweenMax.to(selectasquare, .5, {bevelFilter:{blurX:20, blurY:20, strength:2, angle:-300, highlightcolor: 10, highlightAlpha:.15, shadowAlpha:.15,distance:3}})
}

function deselectaexpander(event:MouseEvent):void
{
TweenMax.to(selectasquare, 4, {width:85.2,height:85.2, x:148.7, y:164.8, rotation:0,ease:Elastic.easeOut});
   TweenMax.to(selectasquare, .25, {bevelFilter:{blurX:10, blurY:10, strength:.5, angle:150, highlightcolor:5, highlightAlpha:1, shadowAlpha:.5,distance:2}});
}


function eddieexpander(event:MouseEvent):void
{
TweenMax.to(eddiesquare, .25, {width:92.2,height:92.2, x:233, y:159, ease:Sine.easeInOut});
TweenMax.to(eddiesquare, .5, {bevelFilter:{blurX:20, blurY:20, strength:2, angle:-300, highlightcolor: 10, highlightAlpha:.15, shadowAlpha:.15,distance:3}})
}

function deeddieexpander(event:MouseEvent):void
{
TweenMax.to(eddiesquare, 4, {width:85.2,height:85.2, x:238.2, y:164.8, rotation:0,ease:Elastic.easeOut});
   TweenMax.to(eddiesquare, .25, {bevelFilter:{blurX:10, blurY:10, strength:.5, angle:150, highlightcolor:5, highlightAlpha:1, shadowAlpha:.5,distance:2}});
}

function ebirdexpander(event:MouseEvent):void
{
TweenMax.to(ebirdsquare, .25, {width:92.2,height:92.2, y:159, x:320.6, ease:Sine.easeInOut});
TweenMax.to(ebirdsquare, .5, {bevelFilter:{blurX:20, blurY:20, strength:2, angle:-300, highlightcolor: 10, highlightAlpha:.15, shadowAlpha:.15,distance:3}})
}

function deebirdexpander(event:MouseEvent):void
{
TweenMax.to(ebirdsquare, 4, {width:85.2,height:85.2, x:327.6, y:164.8, rotation:0,ease:Elastic.easeOut});
   TweenMax.to(ebirdsquare, .25, {bevelFilter:{blurX:10, blurY:10, strength:.5, angle:150, highlightcolor:5, highlightAlpha:1, shadowAlpha:.5,distance:2}});
}


function ssexpander(event:MouseEvent):void
{
TweenMax.to(ss, .25, {width:92.2,height:92.2, y:160, x:412, ease:Sine.easeInOut});
TweenMax.to(ss, .5, {bevelFilter:{blurX:20, blurY:20, strength:2, angle:-300, highlightcolor: 10, highlightAlpha:.15, shadowAlpha:.15,distance:3}})
}

function dessexpander(event:MouseEvent):void
{
TweenMax.to(ss, 4, {width:85.2,height:85.2, x:417.1, y:164.8, rotation:0,ease:Elastic.easeOut});
   TweenMax.to(ss, .25, {bevelFilter:{blurX:10, blurY:10, strength:.5, angle:150, highlightcolor:5, highlightAlpha:1, shadowAlpha:.5,distance:2}});
}


function ecuadorsquareexpander(event:MouseEvent):void
{
TweenMax.to(ecuadorsquare, .25, {width:92.2,height:92.2, y:159, x:501, ease:Sine.easeInOut});
TweenMax.to(ecuadorsquare, .5, {bevelFilter:{blurX:20, blurY:20, strength:2, angle:-300, highlightcolor: 10, highlightAlpha:.15, shadowAlpha:.15,distance:3}})
}

function deecuadorsquareexpander(event:MouseEvent):void
{
TweenMax.to(ecuadorsquare, 4, {width:85.2,height:85.2, x:506.5, y:164.8, ease:Elastic.easeOut});
   TweenMax.to(ecuadorsquare, .25, {bevelFilter:{blurX:10, blurY:10, strength:.5, angle:150, highlightcolor:5, highlightAlpha:1, shadowAlpha:.5,distance:2}});
}


function sevensquareexpander(event:MouseEvent):void
{
TweenMax.to(sevensquare, .25, {width:92.2,height:92.2, y:248.5, x:54, ease:Sine.easeInOut});
TweenMax.to(sevensquare, .5, {bevelFilter:{blurX:20, blurY:20, strength:2, angle:-300, highlightcolor: 10, highlightAlpha:.15, shadowAlpha:.15,distance:3}})
}

function desevensquareexpander(event:MouseEvent):void
{
TweenMax.to(sevensquare, 4, {width:85.2,height:85.2, x:59.2, y:253.9, ease:Elastic.easeOut});
   TweenMax.to(sevensquare, .25, {bevelFilter:{blurX:10, blurY:10, strength:.5, angle:150, highlightcolor:5, highlightAlpha:1, shadowAlpha:.5,distance:2}});
}


function ejcardsquareexpander(event:MouseEvent):void
{
TweenMax.to(ejcardsquare, .25, {width:92.2,height:92.2, y:248.5, x:143.9, ease:Sine.easeInOut});
TweenMax.to(ejcardsquare, .5, {bevelFilter:{blurX:20, blurY:20, strength:2, angle:-300, highlightcolor: 10, highlightAlpha:.15, shadowAlpha:.15,distance:3}})
}

function deejcardsquareexpander(event:MouseEvent):void
{
TweenMax.to(ejcardsquare, 4, {width:85.2,height:85.2, x:148.7, y:253.9, ease:Elastic.easeOut});
   TweenMax.to(ejcardsquare, .25, {bevelFilter:{blurX:10, blurY:10, strength:.5, angle:150, highlightcolor:5, highlightAlpha:1, shadowAlpha:.5,distance:2}});
}


function laexpander(event:MouseEvent):void
{
TweenMax.to(la, .25, {width:92.2,height:92.2, y:248.5, x:233.2, ease:Sine.easeInOut});
TweenMax.to(la, .5, {bevelFilter:{blurX:20, blurY:20, strength:2, angle:-300, highlightcolor: 10, highlightAlpha:.15, shadowAlpha:.15,distance:3}})
}

function delaexpander(event:MouseEvent):void
{
TweenMax.to(la, 4, {width:85.2,height:85.2, x:238.2, y:253.9, ease:Elastic.easeOut});
   TweenMax.to(la, .25, {bevelFilter:{blurX:10, blurY:10, strength:.5, angle:150, highlightcolor:5, highlightAlpha:1, shadowAlpha:.5,distance:2}});
}


function garysquareexpander(event:MouseEvent):void
{
TweenMax.to(garysquare, .25, {width:92.2,height:92.2, y:248.5, x:322.2, ease:Sine.easeInOut});
TweenMax.to(garysquare, .5, {bevelFilter:{blurX:20, blurY:20, strength:2, angle:-300, highlightcolor: 10, highlightAlpha:.15, shadowAlpha:.15,distance:3}})
}

function degarysquareexpander(event:MouseEvent):void
{
TweenMax.to(garysquare, 4, {width:85.2,height:85.2, x:327.6, y:253.9, ease:Elastic.easeOut});
   TweenMax.to(garysquare, .25, {bevelFilter:{blurX:10, blurY:10, strength:.5, angle:150, highlightcolor:5, highlightAlpha:1, shadowAlpha:.5,distance:2}});
}


function corneliussquareexpander(event:MouseEvent):void
{
TweenMax.to(corneliussquare, .25, {width:92.2,height:92.2, y:248.5, x:412.1, ease:Sine.easeInOut});
TweenMax.to(corneliussquare, .5, {bevelFilter:{blurX:20, blurY:20, strength:2, angle:-300, highlightcolor: 10, highlightAlpha:.15, shadowAlpha:.15,distance:3}})
}

function decorneliussquareexpander(event:MouseEvent):void
{
TweenMax.to(corneliussquare, 4, {width:85.2,height:85.2, x:417.1, y:253.9, ease:Elastic.easeOut});
   TweenMax.to(corneliussquare, .25, {bevelFilter:{blurX:10, blurY:10, strength:.5, angle:150, highlightcolor:5, highlightAlpha:1, shadowAlpha:.5,distance:2}});
}

function bbooksquareexpander(event:MouseEvent):void
{
TweenMax.to(bbooksquare, .25, {width:92.2,height:92.2, y:248.5, x:501.1, ease:Sine.easeInOut});
TweenMax.to(bbooksquare, .5, {bevelFilter:{blurX:20, blurY:20, strength:2, angle:-300, highlightcolor: 10, highlightAlpha:.15, shadowAlpha:.15,distance:3}})
}

function debbooksquareexpander(event:MouseEvent):void
{
TweenMax.to(bbooksquare, 4, {width:85.2,height:85.2, x:506.5, y:253.9, ease:Elastic.easeOut});
   TweenMax.to(bbooksquare, .25, {bevelFilter:{blurX:10, blurY:10, strength:.5, angle:150, highlightcolor:5, highlightAlpha:1, shadowAlpha:.5,distance:2}});
}


function elclosing1(event:MouseEvent):void
{

TheSquares.reverse();
}


function elclosing(event:MouseEvent):void {     

dispatchEvent(new Event("elclosing", true));    

}

 

This is my first attempt at something like this, so if something is obviously wrong, please bear with my minor league coding skills :)

 

Much Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...