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

Action Script Question

Community Beginner ,
Sep 25, 2017 Sep 25, 2017

            addEventListener(Event.ENTER_FRAME, onEnterFrame);

        }

           

            private function onEnterFrame(event:Event):void {

               

                var dx:Number = circle_mc1.x - square_mc.x;

                var dy:Number = circle_mc1.y - square_mc.y;

                var angle:Number = Math.atan2 (dy,dx);

                var xVelocity:Number =Math.cos(angle) * speed;

                var yVelocity:Number =Math.sin(angle) * speed;

                square_mc.x += xVelocity;

                square_mc.y += yVelocity;

                circle_mc.addEventListener(MouseEvent.MOUSE_UP, Stopd)

               

            }

           

            private function Stopd(evt.MouseEvent):void

            {

                this.square_mc.stop;

            }

Getting the error code

1084: Syntax error: expecting rightparen before dot.

for the enlarged line.

TOPICS
ActionScript
409
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 , Sep 25, 2017 Sep 25, 2017

You want to use:

this.square_mc.stop();

Translate
LEGEND ,
Sep 25, 2017 Sep 25, 2017

You want to use:

this.square_mc.stop();

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
Community Beginner ,
Sep 25, 2017 Sep 25, 2017

Ok awesome, thank you.

Didn't quite have the effect I was looking for though. How do I get square_mc to go towards circle_mc until I let go of the mouse click? Right now it just goes part way every time a click wether I hold it or not.

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 ,
Sep 26, 2017 Sep 26, 2017
LATEST

You'll have to give me more information. It sounds like you have an action where you want an object to move on the stage while the mouse button is down and then to stop moving when the button is released. Is that correct? Can you share the code that you are using now to make the object move?

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