Ryan,
Your code works only if you drag-and-drop an instance of the Fuse Component on Stage. You'd better ask Moses about that behaviour...

Regards,
Julien.



Ryan Potter a écrit :
Is there a way to step back and forth through animations in Fuse?

I created a simple animation (code below) to test this. I am new to
Fuse.

Problem:

I am trying to make it so that I can click a button (the two lower
clips) and launch an animation action in fuse.

So far I can't get it to work properly.  When the clip moves to the
right, it automatically moves back.  It shouldn't do that.

It should move to the right by clicking the green square, and move back
by clicking the blue one.  It doesn't work.

First, if you look at the trace statements, both of the x parameters are
showing up as 110. The second x prop should be 10. Weird.
The second problem is that I can't get the fuse action to stop after
running 1 action. I am using version 1.0 of Fuse.
Please help I'm stumped.

/*

Trow the code below into a movie and run it.

*/

stop();

import com.mosesSupposes.fuse.Fuse;

init();

function init(){

            drawFuse();

            buildClips();

}

/* draw three clips */
function buildClips(){

            var clip1 = drawClip(this, "clip",
this.getNextHighestDepth(), 50, 50, 0xff0000);

            clip1._x = 10;

            clip1._y = 10;

            var clip2 = drawClip(this, "clip",
this.getNextHighestDepth(), 50, 50, 0x00ff00);

            clip2._x = 10;

            clip2._y = 70;

            clip2.onPress = function(){ this._parent.amimateItem(0);};

            var clip3 = drawClip(this, "clip",
this.getNextHighestDepth(), 50, 50, 0x0000ff);

            clip3._x = 10;

            clip3._y = 130;

            clip3.onPress = function(){ this._parent.amimateItem(1);};

            var moveRight = {target:clip1, x:clip1._x+100,
ease:"easeInOutExpo", seconds:1, trigger:false};

            var moveLeft = {target:clip1, x:clip1._x,
ease:"easeInOutExpo", seconds:1, trigger:false};

/*
do a little tracing to see what props are getting set

*/
            for(prop in moveRight){

                        trace(prop+" <::> "+moveRight[prop]);

            }

            trace("*******************");

            for(prop in moveLeft){

                        trace(prop+" <::> "+moveRight[prop]);

            }

/* add the actions to fuse */
            addAnimation(moveRight);

            addAnimation(moveLeft);

}

function drawFuse(){

            f = new Fuse();

}

function addAnimation(obj){

            f.push(obj);

}

function amimateItem(id){

            trace("animate item called");

            f.skipTo(id);

            //          f.start();

}

function drawClip(target, clip, depth, w, h, color){

            var c = target.createEmptyMovieClip(clip+depth, depth);

                        c.beginFill(color, 100);

                        c.moveTo(0,0);

                        c.lineTo(w,0);

                        c.lineTo(w,h);

                        c.lineTo(0,h);

                        c.lineTo(0,0);

                        c.endFill();

                        return c;

}

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to