Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 97529

AS3: Basic Animation Problem

$
0
0

Hello community,

 

I'm new to CS3 and am having the following difficulties with animation:

 

I added ~40 lines of code to the first frame, which in theory does the following:

Upon clicking the ZDelta button, the ZDelta will undergo an animation.

The current functionality is this:

While the SWF is in 'Play' mode, the graphic moves (without clicking!) repeatedly from frame 0 to frame 1 (spazzy oscillations).

While the SWF is in 'Stop' mode, the graphic completes the animation (without clicking!). Clicking the ZDelta after it's done does not rewind it.

 

- I would like to have a solution which works dynamically rather than a hard-coded animation, i.e., using AS3.

- I have tried adding stop() commands immediately after the Animator object is initialized.

- The function which is supposed to rewind() / play() does receive flow of control when clicking ZDelta (as expected).

- There aren't any compiler errors.

 

Here is the portion of the code that I am troubleshooting.

import fl.motion.easing.Linear;
import fl.motion.*;
import fl.transitions.Tween;
ZDelta.addEventListener(MouseEvent.CLICK,clickfuncDt);
var ZD_Animator:Object = new Animator();
var ZD_MotionBase:Object = new MotionBase();
var ZD_Keyframe:Object = new Keyframe();
var ZD_Tween1:Object = new Tween(ZDelta,"x",Linear.easeNone,0,550,24,false);
var ZD_Tween2:Object = new Tween(ZDelta,"y",Linear.easeNone,0,400,24,false);
ZD_Keyframe.tweens = [ZD_Tween1,ZD_Tween2];
ZD_MotionBase.addKeyframe(ZD_Keyframe);
ZD_Animator.target = ZDelta;
ZD_Animator.motion = ZD_MotionBase;
ZD_Animator.stop(); // this is my attempt to fix it
function clickfuncDt(x) {  ZD_Animator.rewind();  ZD_Animator.play(); // receives flow of control
}

 

I think it may have something to do with the way frames advance...

Any help would be greatly appreciated.


Viewing all articles
Browse latest Browse all 97529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>