dcsimg
A Flash Developer Resource Site

Page 4 of 5 FirstFirst 12345 LastLast
Results 61 to 80 of 88

Thread: Trace(childName)

  1. #61
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Your Website class does not define a field called textField. If you're trying to get to a named instance on the displaylist, you can use getChildByName. Otherwise, you need to declare, instantiate, and put textField on the displayList.

  2. #62
    Member
    Join Date
    Sep 2009
    Posts
    72
    Okay cool. For now I just commented that code out b/c I realized I'm not even using that right now. So now that I can get back into what we were previously doing after setting the document class and working out those errors. It's not giving any type of result from the removeModalContent..

    Code:
    var newClassRoot:Website = Website(root);
    
    workcatagorydropdown_mc.catagoryinteractive_mc.addEventListener(MouseEvent.CLICK, interactiveHandler);
    
    function interactiveHandler(event:MouseEvent):void {
    	//newParent.gotoAndStop("two")
    	newClassRoot.removeModalContent();
    	newRoot.gotoAndStop("web");
    		
    
    }
    
    
    workcatagorydropdown_mc.catagoryprint_mc.addEventListener(MouseEvent.CLICK, printHandler);
    
    function printHandler(event:MouseEvent):void {
    
    	newRoot.gotoAndStop("print");
    			
    
    }
    
    
    workcatagorydropdown_mc.catagorymograph_mc.addEventListener(MouseEvent.CLICK, mographHandler);
    
    function mographHandler(event:MouseEvent):void {
    newClassRoot.removeModalContent();
    	newRoot.gotoAndStop("motion");
    			
    
    }
    Code:
    package {
    
    	import flash.display.*;
    	import FluidLayout.*;
    	import flash.display.Sprite;
    	import flash.display.StageAlign;
    	import flash.display.StageScaleMode;
    	import flash.events.Event;
    	import gs.*;
    	import gs.easing.*;
    	import fl.motion.easing.*;
    	import com.greensock.*;
    	import flash.text.AntiAliasType;
    	import flash.text.TextField;
    	import flash.text.TextFieldAutoSize;
    	import flash.text.TextFormat;
    	//import greensock.*;
    	import flash.events.MouseEvent;
    import flash.events.FullScreenEvent;
    
    
    	public class Website extends MovieClip {
    
    		public function Website() {
    			/* Set the Scale Mode of the Stage */
    			stage.scaleMode=StageScaleMode.NO_SCALE;
    			stage.align=StageAlign.TOP_LEFT;
    
    			/* Add the symbols to stage  
    			            var bg = new Background();  
    			            addChild(bg);  
    			                 */
    			var top = new top();
    			addChild(top);
    
    			var toprightoption = new toprightoption();
    			addChild(toprightoption);
    
    			//var middle = new Middle();  
    			//addChild(middle);  
    			var btmrightfooter = new btmrightfooter();
    			addChild(btmrightfooter);
    
    			/* Apply the alignment to the background   
    			              var bgParam = {  
    			                  x:0,  
    			                  y:0,  
    			                 offsetX: 0,  
    			                   offsetY: 0  
    			               }  
    			              new FluidObject(bg,bgParam);  
    			                     */
    			/* Apply the alignment to the top */
    			var topParam = {  
    			                   x:0,  
    			                  y:0,  
    			                   offsetX:0,  
    			                 offsetY:0  
    			              };
    			new FluidObject(top,topParam);
    
    			/* Apply the alignment to the toprightoption */
    			var toprightoptionParam = {  
    			                x:1,  
    			                y:0,  
    			                  offsetX: -toprightoption.width - 20,  
    			                 offsetY: 20  
    			            };
    			new FluidObject(toprightoption,toprightoptionParam);
    
    			/* Apply the alignment to the content 
    			             var middleParam = {  
    			                 x:0.5,  
    			                y:0.5,  
    			                 offsetX: -middle.width/2,  
    			                 offsetY: -middle.height/2  
    			             }  
    			             new FluidObject(middle,middleParam);  
    			           */
    			/* Apply the alignment to the btmrightfooter */
    			var btmrightfooterParam = {  
    			                 x:1,  
    			                 y:1,  
    			                 offsetX: -btmrightfooter.width - 10,  
    			                 offsetY: -btmrightfooter.height -10  
    			             };
    			new FluidObject(btmrightfooter,btmrightfooterParam);
    		}
    
    	private var currentlyShowing:MovieClip=null;
    
    		public function showModalContent(clip:MovieClip):void {
    			if (currentlyShowing!=null) {
    				removeChild(currentlyShowing);
    			}
    			currentlyShowing=clip;
    			addChild(currentlyShowing);
    		}
    
    		public function removeModalContent():void {
    			if (currentlyShowing!=null) {
    				removeChild(currentlyShowing);
    				currentlyShowing=null;
    			}
    
    		}
    
    	}
    
    }

  3. #63
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Doing absolutely nothing is exactly what I'd expect, if there had not been content previously shown via showModalContent. Was there such content?

  4. #64
    Member
    Join Date
    Sep 2009
    Posts
    72
    No, there was(is) not.

    So okay, I have to add something with showModalContent to remove it with removalModal..

    How would i declare what it is that I need to add with showModalContent?

    What I would be doing is going to a frame label..Or that's how I am doing it now..
    Last edited by aesthetics7; 02-03-2010 at 03:09 PM.

  5. #65
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You were adding and removing stuff all over originally. I thought that all your main things were MovieClips unto themselves?

    Anyway, if they are not, you can make them so, and add each with showModalContent when appropriate.

  6. #66
    Member
    Join Date
    Sep 2009
    Posts
    72
    Well, when needed I am using addChild and removeChild.. Otherwise, if I didn't need to some are placed on the time line. Such as with my main navigation I am going to a frame label then checking if certain movieclips exist I am removing them.

    See example:

    Code:
    nav_mc.workbtn_mc.addEventListener(MouseEvent.CLICK, buttonClick1);
    
    function buttonClick1(event:MouseEvent):void {
    	gotoAndStop("work");
    	stage.invalidate();
    	stage.addEventListener(Event.RENDER,renderedF);
    }
    
    function renderedF(e:Event) {
    	unimetal_homeref_mcExists();
    	motionss_mcExists();
    	home_mcExists();
    	//work_mcExists();
    	//workss_mcExists();
    	motion_mcExists();
    	workpersonalssExists();
    	workpersonalExists();
    	printss_mcExists();
    	stage.removeEventListener(Event.RENDER,renderedF);
    
    }
    
    
    
    function unimetal_homeref_mcExists():void {
    	if (unimetal_homeref_mc!=null) {
    		if (unimetal_homeref_mc.stage!=null) {
    			trace("YESdudemar unimetalhomeref exists");
    			removeChild(unimetal_homeref_mc);
    		} else {
    			trace("NO home ref does not exist");
    		}
    	}
    }
    So when that is clicked I am going to that frame label, and if any other movieClip is on the stage I am removing that clip.

    So basically I need to go through and change every single removeChild and addChild to showModalContent and removeModalContent? Do I really need to go and do that? Or can I just do it where we are referring to in the subnav?

  7. #67
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You should be able to keep the frames part as frames. Those are already mutually exclusive (though not with things added with addChild, of course).

    If the only addChild calls are those that you would have changed to showModalContent, you could actually override addChild in Website to call showModalContent for you.

    Basically, anything you want to be automatically removed when something else is added, should be added with showModalContent.

  8. #68
    Member
    Join Date
    Sep 2009
    Posts
    72
    so, I should be doing something like this correct?

    Code:
    workcatagorydropdown_mc.catagoryprint_mc.addEventListener(MouseEvent.CLICK, printHandler);
    
    function printHandler(event:MouseEvent):void {
    
    	showModalContent(print_mc);
    	removeModelContent();
    }
    Sorry for so many questions, this is just confusing me more and more the more ways there are at doing things..Thanks so much for your patience.

  9. #69
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Well, that would add print_mc as the modal content, then immediately remove it. If you want print_mc to show, just use showModalContent(print_mc).

    You only need to use removeModalContent when you want to remove the content and not replace it with anything else.

  10. #70
    Member
    Join Date
    Sep 2009
    Posts
    72
    so removeModalContent would remove the current clip correct?

    It gives me this error:
    1120: Access of undefined property print_mc.
    It has an instance name, and a linkage identifier as well.

  11. #71
    Member
    Join Date
    Sep 2009
    Posts
    72
    TypeError: Error #2007: Parameter child must be non-null.
    at flash.display:isplayObjectContainer/addChild()
    at Website/showModalContent()[/Design/The Silver Collective/_classes/Website.as:97]
    at SILVERCOLLECTIVEv18cs4_fla::mc_workcatagory_40/printHandler()[SILVERCOLLECTIVEv18cs4_fla.mc_workcatagory_40::fra me1:93]
    Code:
    			if (currentlyShowing!=null) {
    Code:
    			addChild(currentlyShowing);

  12. #72
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Yes, that is the purpose of removeModalContent - to remove the content, whatever it may be.

    If you're getting that error, then print_mc is undefined in the context you are calling it from. I suspect this is because it is a property of a different movieclip.

  13. #73
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    sorry, my last message referred to the print_mc situation.

    The above error would occur if you passed null to showModalContent.

  14. #74
    Member
    Join Date
    Sep 2009
    Posts
    72
    So, okay, I duplicated the clip, gave it a different instance name..

    Code:
    workcatagorydropdown_mc.catagoryprint_mc.addEventListener(MouseEvent.CLICK, printHandler);
    
    function printHandler(event:MouseEvent):void {
    print2_mc = new mc_print2();
    	//newRoot.gotoAndStop("print");
    	newClassRoot.showModalContent(print2_mc);
    	
    }
    1120: Access of undefined property print2_mc.

    How do I fix this?

  15. #75
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You need to declare new variables with var, otherwise the compiler thinks you're trying to set a variable that it should already know about.

    Code:
    var print2_mc:mc_print2 = new mc_print2();
    And none of that code gives anything an instancename, but you didn't need one anyway. What did you mean by saying you had given it a different instance name?

  16. #76
    Member
    Join Date
    Sep 2009
    Posts
    72
    and I can't have more than one arguement such as
    showModalContent & removeModalContent in the same function?

    1137: Incorrect number of arguments. Expected no more than 0.

    Code:
    workcatagorydropdown_mc.catagoryprint_mc.addEventListener(MouseEvent.CLICK, printHandler);
    
    function printHandler(event:MouseEvent):void {
    var print2_mc = new mc_print2();
    var work_mc = new mc_work();
    	//newRoot.gotoAndStop("print");
    	newClassRoot.showModalContent(print2_mc);
    	newClassRoot.removeModalContent(work_mc)
    }
    When I load print2_mc it will just overlap work_mc if I don't remove it..

  17. #77
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    The whole point of showModalContent is that it removes previous content for you. As long as work_mc was added with showModalContent(work_mc), then showModalContent(print2_mc) will automatically remove work_mc.

  18. #78
    Member
    Join Date
    Sep 2009
    Posts
    72
    I see where that can be very useful, what if I wanted to remove something then that wasn't loaded with removeModalContent? I will still try to load work_mc with showModalContent but I'm just curious

  19. #79
    Member
    Join Date
    Sep 2009
    Posts
    72
    Nice, that seems to work well. Thanks! I updated the back button to use showModalContent instead of addChild, I'll be changing a ton of stuff around tomorrow so I'll let you know how this works out and let you take a look.

  20. #80
    Member
    Join Date
    Sep 2009
    Posts
    72
    Flax,

    Just wanted to let you know I recoded the entire site based on the knowledge that you provided to me and everything is working really smooth now! Thanks alot!

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