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

Following Doug Winnie's Episode 19 Drag and Drop Objects

New Here ,
Aug 10, 2014 Aug 10, 2014

Hello Again:

Running the following script on Flash Professional CC 2014 on windows 7 leads to the following compiler errors:

import flash.events.MouseEvent;

dragMe.addEventListener(MouseEvent.MOUSE_DOWN, dragPoly);

dragMe.addEventListener(MouseEvent.MOUSE_UP, dropPoly);

function dragPoly(e:MouseEvent):void

{

  dragMe.startDrag();

}

function dropPoly(e:MouseEvent):void

{

  dragMe.stopDrag();

}

Scene 1, Layer 'script', Frame 1, Line 8, Column 91061: Call to a possibly undefined method startDrag through a reference with static type Class.
Scene 1, Layer 'script', Frame 1, Line 12, Column 91061: Call to a possibly undefined method stopDrag through a reference with static type Class.
Scene 1, Layer 'script', Frame 1, Line 3, Column 81061: Call to a possibly undefined method addEventListener through a reference with static type Class.
Scene 1, Layer 'script', Frame 1, Line 4, Column 81061: Call to a possibly undefined method addEventListener through a reference with static type Class.

Once again, thanks for your help!

TOPICS
ActionScript
209
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 ,
Aug 11, 2014 Aug 11, 2014

Based on the errors it appears you have assigned something a class name "dragMe" and are confusing that with an instance name.  The dragMe in your code is targeting an instance on the stage, not a class.

You should learn and try to follow naming conventions.  It will not only help you but will help others to help you as well.  Class names are normally written starting with an uppercase letter.  So in this case the class name would be DragMe (or Dragme).  The instance name of that object on the stage, which you assign in the Properties panel, could then be dragMe, or chester, or whatever else that begins with a lowercase letter.

What you might need to do is to right click the object in the library and choose Linkage, or Properties, and in there you want to change the Class name.  If this happens to be a class file that you created, then you will want to change that file's class name to the uppercase version.

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
Guide ,
Aug 11, 2014 Aug 11, 2014
LATEST

Another alternative to what Kglad proposed is to simply uncheck "export for Actionscript" on your dragMe symbol in the library. It doesn't look like you're assigning it a custom Class.

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