that's the problem. I suspect external calls, all one line after the
other, in the timeline, and maybe the timeline's playhead gets over
this code every frame ?
main.hatAndFace();
main.eyeball1();
main.eyeball1();
main.rightHand();
...
beno, could you try:
public function init():void {
hatAndFace();
eyeball1();
eyeball2();
rightHand();
leftHand();
}
then, in your FLA main timeline:
var main:Main = new Main();
addChild(main);
main.init();
stop(); // this stops the timeline playhead, just to be sure it won't
loop over 2 frames....
hth,
Cedric
stop(); just stops the playhead of a timeline in a movieclip, you are
tweening with code, two completely different things.
where is the code that calls the functions in this class?
2009/11/18 beno - <[email protected]>
Hi;
I have the following code. All the functions go in infinite loops
*except*
the first one, which is strange to me, since both it (hatAndFace,
and both
eyeball1 and eyeball2) all use the same greensock codes, yet the
latter two
repeat ad infinitum the alpha tween. Why is this? How do I control
it such
that it only plays once? I thought putting a "stop();" at the end
would do
the trick, but no :(
TIA.
beno
package
{
import flash.display.MovieClip;
import com.greensock.*;
import com.greensock.plugins.*;
import com.greensock.easing.*;
public class Main extends MovieClip
{
public function Main():void
{
}
public function hatAndFace():void
{
var mcHatAndFaceInstance:mcHatAndFace = new mcHatAndFace();
TweenPlugin.activate([AutoAlphaPlugin]);
addChild(mcHatAndFaceInstance);
mcHatAndFaceInstance.x = 350;
mcHatAndFaceInstance.y = 100;
mcHatAndFaceInstance.alpha = 0;
TweenLite.to(mcHatAndFaceInstance, 2, {autoAlpha:1});
}
public function eyeball1():void
{
var mcEyeballInstance1:mcEyeball = new mcEyeball();
TweenPlugin.activate([AutoAlphaPlugin]);
addChild(mcEyeballInstance1);
mcEyeballInstance1.x = 380;
mcEyeballInstance1.y = 115;
mcEyeballInstance1.alpha = 0;
TweenLite.to(mcEyeballInstance1, 2, {autoAlpha:1});
}
public function eyeball2():void
{
var mcEyeballInstance2:mcEyeball = new mcEyeball();
TweenPlugin.activate([AutoAlphaPlugin]);
addChild(mcEyeballInstance2);
mcEyeballInstance2.x = 315;
mcEyeballInstance2.y = 115;
mcEyeballInstance2.alpha = 0;
TweenLite.to(mcEyeballInstance2, 2, {autoAlpha:1});
}
public function rightHand():void
{
var mcHandInstance1:mcHand = new mcHand();
addChild(mcHandInstance1);
mcHandInstance1.x = 400;
mcHandInstance1.y = 200;
}
public function leftHand():void
{
var mcHandInstance2:mcHand = new mcHand();
addChild(mcHandInstance2);
mcHandInstance2.x = 800;
mcHandInstance2.y = 200;
}
}
}
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders