A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: New AS file won't recognize my instance names

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Posts
    21

    Question New AS file won't recognize my instance names

    I get the error "Access of undefined property menu_bar" when menu_bar is an instance name directly on the main timeline. I'm not sure how I would call it in the other class. It also isn't exported for actionscript is that the problem?



    I have it imported to my document class as:

    var mouseClicks:MouseClicks = new MouseClicks();
    addChild(mouseClicks);


    Then the class looks like this:

    Code:
    package{
    	import flash.display.MovieClip;
    	import flash.events.*;
    	
    	public class MouseClicks extends MovieClip{
    		
    		public function MouseClicks(){
    			
    			menu_bar.about_us.aboutUs_button.about_hitbox.addEventListener(MouseEvent.CLICK, _handleAboutClick);
    /*			menu_bar.about_us.RTB.readyToBuy.rtb_hitbox.addEventListener(MouseEvent.CLICK, _handleRtbClick);
    			menu_bar.about_us.RTB.portfolio.portfolio_button.p_hitbox.addEventListener(MouseEvent.CLICK, _handlePortfolioClick);
    			menu_bar.about_us.RTB.portfolio.services.s_button.s_hitbox.addEventListener(MouseEvent.CLICK, _handleServicesClick);
    			menu_bar.about_us.RTB.portfolio.services.design_options.designOptions_button.do_hitbox.addEventListener(MouseEvent.CLICK, _handleDOClick);*/
    			
    			
    		}
    		
    		public function _handleAboutClick(MouseEvent:Event):void{
    				trace("clicked");
    		}
    		
    		
    	}
    	
    }

  2. #2
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813
    You are not identifying exact where the menu_bar is located. You code indicates that it is local to the package, when in fact it isn't and is only available on the main timeline. You need to provide the path outside of the package.
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

  3. #3
    Junior Member
    Join Date
    Apr 2009
    Posts
    21
    Quote Originally Posted by samac1068 View Post
    You are not identifying exact where the menu_bar is located. You code indicates that it is local to the package, when in fact it isn't and is only available on the main timeline. You need to provide the path outside of the package.
    How would I go about doing that?

Tags for this Thread

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