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

Individual enterframe events in actionscript 3

New Here ,
Feb 23, 2014 Feb 23, 2014

Hello i am currently working on my first artillery game. I am following this great tutorial http://www.emanueleferonato.com/2007/04/28/create-a-flash-artillery-game-step-1/. However i want to make my game in AS3 so i am trying to implement the code to AS3 which has been no problem so far. But i am stuck on this step:

  cannonball_fired.onEnterFrame = function() {

        this._x += this.dirx/50;

        this._y += this.diry/50;

  };

How would i do something like this in AS3 without declaring a new canonball class? I just want to keep all the code on my actions frame. Thanks in advance

TOPICS
ActionScript
1.2K
Translate
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

LEGEND , Feb 23, 2014 Feb 23, 2014

It could be something like...

cannonball_fired.addEventListener(Event.ENTER_FRAME, moveCF);

function moveCF(evt:Event):void {
        var cf:MovieClip = MovieClip(evt.currentTarget);
        cf.x += cf.dirx/50;
        cf.y += cf.diry/50;
}

Translate
LEGEND ,
Feb 23, 2014 Feb 23, 2014

It could be something like...

cannonball_fired.addEventListener(Event.ENTER_FRAME, moveCF);

function moveCF(evt:Event):void {
        var cf:MovieClip = MovieClip(evt.currentTarget);
        cf.x += cf.dirx/50;
        cf.y += cf.diry/50;
}

Translate
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 ,
Feb 23, 2014 Feb 23, 2014

Thank you that was excactly what i was looking for

Translate
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
LEGEND ,
Feb 23, 2014 Feb 23, 2014
LATEST

You're welcome John

Translate
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