How to use the onComplete function, and embed one function within another.


hi,

i'm trying embed 1 function in , i'm having trouble doing so. want first animation(scaling film) happen before run interactive scene. keep getting error: "incorrect number or arguments, expected 1". think need put in brackets after oncomplete, i'm lost is. if appreciated. thanks.

 

 

function filmscale(e:event):void{

if (film_mc.currentframe == 20) {

tweenlite.to(film_mc, 1, {scalex:1.1, scaley:1.1});

}

function oncomplete(){

interactivescene();

trace("oncomplete, run interactive scene ");

}

}

nesting functions bad form, don't it. oncomplete function doesn't receive parameters default shouldn't getting expected 1 argument on it, sure interactivescene() doesn't expect something? anyway, need add oncomplete tweenlite call... change code so:

 

function filmscale(e:event):void{

     if (film_mc.currentframe == 20) {

          tweenlite.to(film_mc, 1, {scalex:1.1, scaley:1.1, oncomplete:scalecomplete});

     }

}

function scalecomplete(){

     interactivescene();

     trace("oncomplete, run interactive scene ");

}

 

 

also, instead of using enterframe monitor getting frame in clip, might consider using events system instead. @ frame 20 in clip dispatch event like:

 

dispatchevent(new event("frame20reached"));

stop();

 

and in timeline containing clip, add listener:

 

film_mc.addeventlistener("frame20reached", filmscale, false, 0, true);

 

and filmscale run... ending need continuously checking.



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Hur installera Joomla på One.com - Joomla! Forum - community, help and support

removing index.php from URL address - Joomla! Forum - community, help and support

「イメージマップのアンカー名には、...」のエラーが出ないようにしたい