2

A flash-file was send to me with some animation in it. The client asked if I could just adjust a couple of images in the animation. But with the update to Animate CC, AS2 is no longer supported, so the animation doesn't work anymore. Since I'm not to familiar with AS2 or AS3, could someone please help so this works in AS3?

Thanks!

this.onEnterFrame = function () {
        this._rotation += 1.99 ;
        this._y += (30-this._y)*.05
}

1 Answers1

2

1) in AS3 you can't write code directly on a MC but you have to refer to that MC (let's call it myMovie).

2) _rotation and _y change into rotation and y

3) to use onEnterFrame you need to add a listener to the object and than call a function:

myMovie.addEventListener(Event.ENTER_FRAME, enterFrameFn);
function enterFrameFn (event) {
    myMovie.rotation += 1.99 ;
    myMovie.y += (30-myMovie.y)*.05;
}
Nadia
  • 247
  • 1
  • 13
  • 2
    As a matter of fact you **can** compose scripts on the MovieClip timeline and you can call methods and access properties without "this" reference. – Organis Mar 08 '17 at 13:38
  • Right...I meant that he can not write it clicking (not double click) on the MC (as often was used in past) and writing there. "inside" the MC yes it is possible. – Nadia Mar 08 '17 at 18:58
  • You're talking of onClipEvent clause (wow, someone out there still remember that), while code in original post is definitely a frame script. – Organis Mar 08 '17 at 19:00
  • LOL yes you're right! We are talking of something like 15-16 years ago (maybe more)? :-) – Nadia Mar 08 '17 at 19:05
  • It ended with the release of Macromedia Flash 2004 (aka Flash 7) and the introduction of AS2, or maybe even Flash 6 in 2002. It was so long ago, I don't actually remember. – Organis Mar 08 '17 at 19:12
  • So the actual equivalent code to the OP would be to use `this.` instead of `myMovie.` – Aaron Beall Mar 09 '17 at 16:06