Copy link to clipboard
Copied
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 9 | 1061: Call to a possibly undefined method startDrag through a reference with static type Class. |
Scene 1, Layer 'script', Frame 1, Line 12, Column 9 | 1061: Call to a possibly undefined method stopDrag through a reference with static type Class. |
Scene 1, Layer 'script', Frame 1, Line 3, Column 8 | 1061: Call to a possibly undefined method addEventListener through a reference with static type Class. |
Scene 1, Layer 'script', Frame 1, Line 4, Column 8 | 1061: Call to a possibly undefined method addEventListener through a reference with static type Class. |
Once again, thanks for your help!
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now