First AS3 file...ReferenceError: Error #1065: Variable draggableClip is not defined.
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: First AS3 file...ReferenceError: Error #1065: Variable draggableClip is not defined.

  1. #1
    Member
    Join Date
    Mar 2004
    Posts
    45

    Question First AS3 file...ReferenceError: Error #1065: Variable draggableClip is not defined.

    OK, this is my first attempt at coding in AS3.
    I have created a class (within a package) and added it as the documentClass (within the stage properties in Flash CS3).

    When I check the syntax of the code I get no errors, however, when I try to run the FLA file, I get the following error:

    ReferenceError: Error #1065: Variable draggableClip is not defined.

    Here is the code I am using:

    Code:
    package {
    
    	import flash.display.MovieClip;
    	import flash.events.MouseEvent;
    
    	class draggableClip extends MovieClip {
    
    		private var dragging:Boolean;
    
    		public function draggableClip():void {
    			dragging = false;
    			this.addEventListener(MouseEvent.MOUSE_DOWN, thisMouseDown);
    			this.addEventListener(MouseEvent.MOUSE_MOVE, thisMouseMove);
    			this.addEventListener(MouseEvent.MOUSE_UP, thisMouseUp);
    		}
    
    		private function thisMouseDown(event: MouseEvent):void {
    			trace("here i am at "+this);
    			if (!this.dragging) {
    				this.dragging = true;
    				this.x = parent.mouseX;
    				this.y = parent.mouseY;
    			}
    		}
    
    		private function thisMouseMove(event: MouseEvent):void {
    			if (this.dragging) {
    				this.x = parent.mouseX;
    				this.y = parent.mouseY;
    			}
    		}
    
    		private function thisMouseUp(event: MouseEvent):void {
    			this.dragging = false;
    		}
    	}
    }

    What I'm basically trying to do is attach (cast?) this class (if possible) to 3 MovieClip instances on stage. Am I going about this the wrong way?
    I've been searching the internet for hours to try and get this FLA to compile successfully, so I'm hoping posting here will help.

    Any help much appreceated,
    Cheers,
    SamuraiDave

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,436
    public class draggableClip

    Classes are by default internal.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Member
    Join Date
    Mar 2004
    Posts
    45
    Thanks very much for such a fast reply, that did the trick!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com