A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Main Class unable to identify Clips in the Flash IDE

Threaded View

  1. #1
    Senior Member
    Join Date
    Oct 2005
    Posts
    198

    Thumbs down Main Class unable to identify Clips in the Flash IDE

    Hi,

    I'm using the Flash IDE with a Main Class(CarouselNew) and for some reason, the objects that are on stage(given instance names) in the the Flash IDE are throwing errors when I try to run the swf. On the most basic level, I have a mc on the stage with an instance name of myContent and just tracing it throws an 1120 error--I added some ADDED_TO_STAGE event code in the initial declaration of the class to make sure that the mcs, like the myContent mc, are on the display list and yet it doesnt work---Also, if I have a mc within the myContent mc with an instance name of mycontainer would I access its properties like this:
    Code:
    myContent.mycontainer.z = 100;
    That's how I've been doing it until now.

    Can someone help?

    I can bypass the first trace error if I explicitly declare the var by using this:
    Code:
    public var myContent :MovieClip;
    but I don't understand why I would need to do that being its on the stage in the Flash IDE...and I still can't access the mc within that clip with an instance name of mycontainer...get a 1010 error--term is undefined...

    Here is some of the code and the code that throws the first error--
    Code:
    public function CarouselNew()
    		{
    			addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
    
    			function onAddedToStage(evt:Event):void
    			{
    				trace(myContent);
    				removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
    			}
    
    			if (stage)
    			{
    				contextMenu = new ContextMenu();
    				contextMenu.hideBuiltInItems();
    				init();
    				loadXML();
    				//addChild(myContent);
    
    			}
    			else
    			{
    				addEventListener(Event.ADDED_TO_STAGE,init);
    			}
    
    		private function init():void
    		{
    			container = new Sprite();
    			container.x = 450;
    			container.y = 450;
    			container.z = 400;
    			addChild(container);
    			cloudBut.visible = false;
    			cloudBut.buttonMode = true;
    			cloudBut.mouseChildren = false;
    
    			//cover.addEventListener(MouseEvent.CLICK, stageClick);
    			removeEventListener(Event.ADDED_TO_STAGE, init);
    			this.addEventListener(Event.ENTER_FRAME, loop);
    		}
    The trace statement throws that error...

    Thanks,
    ---Yvette
    Last edited by yvillicana; 11-28-2012 at 08:38 PM.

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