Jump to content
Search Community

TweenMax onComplete

pigsInSpace test
Moderator Tag

Recommended Posts

Hi,

 

I'm very new to both Flash and therefore GreenSock. My apologies in advance if I am asking something low level and obvious... we've all got to start somewhere right?

 

I am trying to get the main timeline to return to the "home" label when the tween completes. Here's the code that isn't working. All help much appreciated.

 

function goHome(evt:Event):void{
gotoAndPlay("home");
trace("working");
}

TweenMax.from(today01_mc, 14, {y:683, ease:Linear.easeNone, delay:1, onComplete:goHome});

Link to comment
Share on other sites

The problem is that your goHome() function is expecting an "evt" parameter but you're not feeding it one. You should either remove that parameter, make it optional by setting a default (like function goHome(evt:Event=null)) or pass a parameter using the onCompleteParams special property of TweenMax. I suspect the easiest way in this case is option #2:

 

function goHome(evt:Event=null):void{
  gotoAndPlay("home");
  trace("working");
}

TweenMax.from(today01_mc, 14, {y:683, ease:Linear.easeNone, delay:1, onComplete:goHome});

Link to comment
Share on other sites

Hi,

first of all great Tweening Engine! :) Just bought the ClubGreen Membership.

 

Sorry for this dumb question but I am totally new to AS3.

I just qant to set a MC visible=false when the TimlineMax finishes.

But I get this error:

 

TypeError: Error #1010: Ein Begriff ist nicht definiert und hat keine Eigenschaften.
at MethodInfo-2198()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at com.greensock.core::TweenCore/complete()
at com.greensock::TimelineMax/complete()
at com.greensock::TimelineMax/renderTime()
at com.greensock.core::SimpleTimeline/renderTime()
at com.greensock::TweenLite$/updateAll()

 

I guess I have to write the function diffrent. Could somebody help me out.

 

My Code is this:

function bt1Click(evt:MouseEvent) {
trace("home");

var timeline1:TimelineMax = new TimelineMax({onComplete:myhome});

// Aktiven Button einfärben ///
timeline1.insertMultiple([new TweenMax(this.navi.bt1.bt1back, 0.5, {tint:0xFFFFFF,ease:Sine.easeIn}), new TweenMax(this.navi.bt1.bt1text, 0.5, {tint:0x87CAA2,ease:Sine.easeIn})], 0, TweenAlign.START, 0);

// Alle Texte einfärben ///
timeline1.insertMultiple( TweenMax.allTo([this.navi.bt2.bt2text, this.navi.bt3.bt3text, this.navi.bt4.bt4text, this.navi.bt5.bt5text], 0.5, {tint:0xFFFFFF,ease:Sine.easeIn}, 0.1), 0);

// Alle Hintergründe einfärben ///
timeline1.insertMultiple( TweenMax.allTo([this.navi.bt2.bt2back, this.navi.bt3.bt3back, this.navi.bt4.bt4back, this.navi.bt5.bt5back], 0.5, {tint:0x87CAA2,ease:Sine.easeIn}, 0.1), 0);

// Ausfahren/Einfahren///
timeline1.insertMultiple([new TweenLite(this.navi.bt1, 1, {y:0}), new TweenLite(this.navi.bt2, 1, {y:220}), new TweenLite(this.navi.bt3, 1, {y:257}),new TweenLite(this.navi.bt4, 1, {y:294}),new TweenLite(this.navi.bt5, 1, {y:331})], 0, TweenAlign.START, 0);

timeline1.insertMultiple([new TweenLite(this.navi.home.bkgrmc1, 1, {height:184,alpha:0.8}), new TweenLite(this.navi.home.mc1text, 1, {alpha:1})], 0, TweenAlign.START, 0);


timeline1.insertMultiple([new TweenLite(this.navi.nosotros.bkgrmc3, 1,{height:1,alpha:0}), new TweenLite(this.navi.nosotros.inhalt3, 0.5, {alpha:0}), new TweenLite(this.navi.nosotros.mc3text, 0.8, {alpha:0})], 0, TweenAlign.START, 0);
timeline1.insertMultiple([new TweenLite(this.navi.freel.bkgrmc4, 1,   {height:1,alpha:0}), new TweenLite(this.navi.freel.inhalt4, 0.5, {alpha:0}), new TweenLite(this.navi.freel.mc4text, 0.8, {alpha:0})], 0, TweenAlign.START, 0);
timeline1.insertMultiple([new TweenLite(this.navi.contact.bkgrmc5, 1, {height:1,alpha:0}), new TweenLite(this.navi.contact.inhalt5, 0.5, {alpha:0}), new TweenLite(this.navi.contact.mc5text, 0.8, {alpha:0})], 0, TweenAlign.START, 0);
timeline1.insertMultiple([new TweenLite(this.navi.trabajo.bkgrmc2, 1, {height:1,alpha:0}), new TweenLite(this.navi.trabajo.inhalt2, 0.5, {alpha:0}), new TweenLite(this.navi.trabajo.mc2text, 0.8, {alpha:0})], 0, TweenAlign.START, 0);

function myhome(evt:Event=null):void{
  this.test.visible=false;
  trace("myhome");
}
}



Link to comment
Share on other sites

Solved. Sorry so stupid problem is solved. :roll:

 

function bt1Click(evt:MouseEvent) {
trace("home");

var timeline1:TimelineMax = new TimelineMax({onComplete:myhome});

// Aktiven Button einfärben ///
timeline1.insertMultiple([new TweenMax(this.navi.bt1.bt1back, 0.5, {tint:0xFFFFFF,ease:Sine.easeIn}), new TweenMax(this.navi.bt1.bt1text, 0.5, {tint:0x87CAA2,ease:Sine.easeIn})], 0, TweenAlign.START, 0);


}


function myhome():void{
  this.test.visible=false;
  trace("myhome");
}

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...