A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] Reference Error #1069

  1. #1
    Junior Member
    Join Date
    Nov 2008
    Posts
    2

    resolved [RESOLVED] Reference Error #1069

    Hello all,

    I'm trying to control the main timeline through a child movie clip and get this error when I click on the targeted movie clip:

    ReferenceError: Error #1069: Property MovieClip not found on flash.text.TextField and there is no default value.
    at michael.gui::MenuButton/onClick()

    This is the part of the code that is giving me problems:

    Code:
    evt.target.MovieClip(root).gotoAndStop(menuText.text);
    I've posted the entire class here:

    Code:
    package michael.gui {
    	
    	import flash.display.*;
    	import flash.text.*;
    	import gs.TweenMax;
    	import gs.easing.*
    	import flash.events.*;
    	
    	public class MenuButton extends MovieClip {
    		
    		public function MenuButton(labl:String) {
    			menuText.text = labl;
    			animMenu();
    			addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
    		}
    		
    		private function animMenu():void {
    			TweenMax.to(this, 1, {x:350, ease: Back.easeInOut});
    		}
    		
    		private function onClick(evt:MouseEvent):void {
    			evt.target.MovieClip(root).gotoAndStop(menuText.text);
    			trace(menuText.text);
    		}
    	}
    }
    Any help, tips, or suggestions would be great. Thanks...

  2. #2
    Junior Member
    Join Date
    Oct 2008
    Posts
    26
    off the top of my head, i think your issue is you are trying to typecast root as a movieclip in the middle of a displayobject list hierarchy. im not testing this, but try for example

    Code:
    MovieClip(root).gotoAndStop(menuText.text);
    you shouldnt event need to include evt.target, if your button is sitting somewhere in your FLA file, even if its dynamically created, "root" refers to the stage
    //peace.*

  3. #3
    Junior Member
    Join Date
    Nov 2008
    Posts
    2
    This worked perfectly and thanks for the explanation. The display list is intimidating!

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