• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Help with AS1 to AS2 Conversion

New Here ,
Dec 24, 2016 Dec 24, 2016

Copy link to clipboard

Copied

Hello.

I have a flash file that was saved with flash5 to work on AS1. I need it to get it working with Flash8 and AS2, but when I change the publish settings to Flash8 it doesn't work. Can you help me get it working for AS2 ?

I'm posting the scripts below :

MovieClip.prototype.move = function (centerx, centery, inertia, k) { x = -this._x+centerx;y = -this._y+centery;xp = xp*inertia+x*k;yp = yp*inertia+y*k;_x += xp;_y += yp;};

  1. onClipEvent (enterFrame) {
  2.     // We define the reference point
  3.     centerx = _root.Target._x;
  4.     centery = _root.Target._y+50;
  5.     // temporary variables used to calculate
  6.     // the speed of the mass
  7.     x0 = this._x;
  8.     y0 = this._y;
  9. }
  10. onClipEvent (enterFrame) {
  11.     if (pressing) {
  12.         startDrag(this, true);
  13.         xp = this._x-x0;
  14.         yp = this._y-y0;
  15.         x0 = this._x;
TOPICS
ActionScript

Views

864

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 26, 2016 Dec 26, 2016

store the prev frame value in a variable.  that variable will be available in the next (and all subsequent) frames.

eg, for a movieclip mc:

prev frame

mc.prevX=mc._x;

subsequent frame

var diffX:Number=mc_x-mc.prevX;

Votes

Translate

Translate
Community Expert ,
Dec 25, 2016 Dec 25, 2016

Copy link to clipboard

Copied

are those clipevents attached to two different movieclips?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 26, 2016 Dec 26, 2016

Copy link to clipboard

Copied

Yesb ut I think I sorted it out. I need help with a different issue.

How would I find an objects difference in _x position of the current frame and the _x position of the previous frame? So I can subtract those values and figure out how much it moved in one frame.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 26, 2016 Dec 26, 2016

Copy link to clipboard

Copied

store the prev frame value in a variable.  that variable will be available in the next (and all subsequent) frames.

eg, for a movieclip mc:

prev frame

mc.prevX=mc._x;

subsequent frame

var diffX:Number=mc_x-mc.prevX;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 26, 2016 Dec 26, 2016

Copy link to clipboard

Copied

Alright thanks, this should work.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 26, 2016 Dec 26, 2016

Copy link to clipboard

Copied

LATEST

you're welcome.

(p.s when using the adobe forums, please mark helpful/correct responses, if there are any.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines