Jump to content
GreenSock

vdubplate

Can anyone see why my onComplete function will not work?

Recommended Posts

Can anyone see why my onComplete function in function test2 will not work?

I'm testing and I can not get it to fire.

 

[as]

 

import flash.events.MouseEvent;

import com.greensock.*;

import com.greensock.easing.*;

import flash.events.Event;

 

var Clicking:uint=0;

var tab_x = CLIPcontainer_mc.x;

 

CLIPcontainer_mc.mc1_mc.buttonMode = 1;

CLIPcontainer_mc.mc2_mc.buttonMode = 1;

CLIPcontainer_mc.mc3_mc.buttonMode = 1;

 

CLIPcontainer_mc.alpha = 0;

 

var AutoPlay:TimelineMax = new TimelineMax({repeat:-1});

 

AutoPlay.append(TweenMax.to(CLIPcontainer_mc, 3, {alpha:1, delay: 1}));

AutoPlay.append(TweenMax.to(CLIPcontainer_mc, 3, {x:tab_x + -270, delay: 1}));

AutoPlay.append(TweenMax.to(CLIPcontainer_mc, 3, {x:tab_x + -540, delay: 1}));

AutoPlay.append(TweenMax.to(CLIPcontainer_mc, 1, {alpha:0}));

 

AutoPlay.restart();

 

 

CLIPcontainer_mc.mc1_mc.addEventListener(MouseEvent.CLICK, test)

CLIPcontainer_mc.mc2_mc.addEventListener(MouseEvent.CLICK, test2)

CLIPcontainer_mc.mc3_mc.addEventListener(MouseEvent.CLICK, test3)

 

function test(event:MouseEvent):void{trace("C1"); AutoPlay.pause();}

 

function test2(event:MouseEvent):void{

 

trace("C2");

 

AutoPlay.append(TweenMax.to(CLIPcontainer_mc, 3, {x:tab_x + -270, delay: 1, onComplete: GO}));

 

function GO():void

{

trace('onComplete:Pause working!');

AutoPlay.pause();

}

 

 

}

 

function test3(event:MouseEvent):void{trace("C3"); AutoPlay.pause();}

 

[/as]

Link to comment
Share on other sites

I don't think you can nest functions ('GO' is inside 'test2'). I'm surprised it compiles.

  • Like 1
Link to comment
Share on other sites

I actually got it to work eventually although I didn't get the result I was looking for.

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