A Flash Developer Resource Site

Page 3 of 5 FirstFirst 12345 LastLast
Results 41 to 60 of 88

Thread: Trace(childName)

  1. #41
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I think the problem may be that those functions are only defined on certain frames in the root. Ideally, you want them to be methods of the Document Class itself. So if you have a document class already, put the functions there. If you don't, create one and put the functions there as public functions.

  2. #42
    Member
    Join Date
    Sep 2009
    Posts
    72
    It doesn't seem to be removing the movieclip..It's not throwing any errors or anything. It' s just not functioning.

  3. #43
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    The only way it would not remove the clip is if the clip got put on the display without going through showModalContent. Like for instance if it were placed through the IDE. If there is an initial state with a modal content clip showing, you'll have to set currentlyShowing to that clip at the beginning.

    Also the thing about the Document Class. These functions need to be part of the root itself, not only some frames in the root timeline.

  4. #44
    Member
    Join Date
    Sep 2009
    Posts
    72
    I don't have a document class, I guess I should learn how to do it all through a document class. Seems like I would run into less problems..I'll make that and get right back to you.

    Thanks!

  5. #45
    Member
    Join Date
    Sep 2009
    Posts
    72
    okay, I think this is just confusing me more and more..So once I have those functions in the document class I need to move EVERYTHING to the root?

  6. #46
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    No, actually. As long as the other stuff calls the right functions in the root/document you should not need to move where that code is actually located. You SHOULD however remove all the unnecessary duplicate functions and tests for null and removeChilds, etc.

  7. #47
    Member
    Join Date
    Sep 2009
    Posts
    72
    Alright, this is really my first real time using the document class..

    In there I have this..

    Code:
    package {
    
    	import flash.display.*;
    	import FluidLayout.*;
    
    	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);
    		}
    	}
    	
    	import flash.display.MovieClip;
    
    
    	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;
    		}
    	}
    
    }
    In the subnav movieclip I have this:

    Code:
    workcatagorydropdown_mc.catagoryinteractive_mc.addEventListener(MouseEvent.CLICK, interactiveHandler);
    
    function interactiveHandler(event:MouseEvent):void {
    	//newParent.gotoAndStop("two")
    	newRoot.gotoAndStop("web");
    	removeModalContent();
    
    }
    I get this:
    1180: Call to a possibly undefined method removeModalContent.

  8. #48
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    A couple of small things. That's a lot of initialization code in your document class constructor. All of that could go in an initialization function. The only real reason to do so is that constructor functions are not run in an optimized fashion, so moving it to another function would be a little faster. Don't worry about that now.

    It is traditional for all imports to go at the top.

    You should make the currentlyShowing property private.

    The reason that removeModalContent() does not work like that in the subnav clip is that within that clip the "this" variable refers to subnav, not the document. Make that newRoot.removeModalContent(); And newRoot can be set to type Website rather than just MovieClip.

  9. #49
    Member
    Join Date
    Sep 2009
    Posts
    72
    What do you mean by newRoot can be set to type website rather than just Movieclip? Could you elaborate on that?

    Here as an update:

    Code:
    package {
    	
    	import flash.display.*;
    	import FluidLayout.*;
    
    	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;
    		}
    	}
    
    }
    Code:
    workcatagorydropdown_mc.catagoryinteractive_mc.addEventListener(MouseEvent.CLICK, interactiveHandler);
    
    function interactiveHandler(event:MouseEvent):void {
    	newRoot.gotoAndStop("web");
    	newRoot.removeModalContent();
    
    }

  10. #50
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I mean that this line:
    Code:
    var newRoot=root;
    could give newRoot an explicit type of Website

    Code:
    var newRoot:Website = Website(root);
    Then the compiler knows what methods newRoot has, because it knows what type of thing it is.

  11. #51
    Member
    Join Date
    Sep 2009
    Posts
    72
    OH! Alright. I see, so we are defining where the root will be coming from...

    Code:
    	private var currentlyShowing:MovieClip=null;
    1013: The private attribute may be used only on class property definitions.

    What is this referring to?

  12. #52
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You need to put currentlyShowing, showModalContent, and removeModalContent inside the class. Right now, you have them in the package, but outside the class.

  13. #53
    Member
    Join Date
    Sep 2009
    Posts
    72
    That's what I was thinking..I was searching it.
    After fixing that it is giving me this error:

    TypeError: Error #1034: Type Coercion failed: cannot convert SILVERCOLLECTIVEv16cs4_fla::MainTimeline@408bf2e1 to Website.

  14. #54
    Member
    Join Date
    Sep 2009
    Posts
    72
    Does this have to do with changing the function to a public function?

    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");
    	
    }

  15. #55
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    The type error you posted indicates that your document class (root) is not actually Website. Did you set the document class?

  16. #56
    Member
    Join Date
    Sep 2009
    Posts
    72
    wow. Just go ahead and slap me. Since I did that it's throwing a ton of errors dealing with tweenlite and tweenmax, do I need to consolidate all these different classes into the main document class?

  17. #57
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    No, you shouldn't have to. What are the errors?

    You might have to import the TweenLite and TweenMax classes into the other classes so that the compiler knows what's up.

  18. #58
    Member
    Join Date
    Sep 2009
    Posts
    72
    I fixed a few of the errors..

    These are the errors:

    1046: Type was not found or was not a compile-time constant: FullScreenEvent.

    Warning: 3594: getStackTrace is not a recognized method of the dynamic class Error.

    Warning: 3590: void used where a Boolean value was expected. The expression will be type coerced to Boolean.

    I didn't copy of the errors, but those are the 3 different unique instances of the errors. 3590 appears multiple times...
    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.events.MouseEvent;
    
    
    
    	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;
    			}
    
    		}
    
    	}
    
    }
    Last edited by aesthetics7; 02-03-2010 at 01:32 AM.

  19. #59
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You need to import FullScreenEvent to wherever it is used.

    I don't know what's up with the getStackTrace line, since Error actually does declare that function.

    Can you post the lines associated with the latter two errors after fixing the first one?

  20. #60
    Member
    Join Date
    Sep 2009
    Posts
    72
    I fixed the other errors, the only one I have left is this:
    1119: Access of possibly undefined property textField through a reference with static type Website.
    Code:
    	this.textField.text=this.stage.displayState;

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