dcsimg
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Mysteriously disappearing MCs

  1. #1
    Junior Member
    Join Date
    Oct 2005
    Posts
    6

    Mysteriously disappearing MCs

    Hi,

    Im working on a sitehttp://www.radiiconsulting.com and everything seems to be working fine in the Flash API.
    However, when posted online the little menu buttons that tween in just disappear after a few seconds(after a RollOver mouse event)...If I move my mouse over the area where they are they appear again, but then just mysteriously disappear.

    The MCs act as additional text 'buttons' to the main graphical menu.
    Initially, they are not visible(off the stage and alpha'd out), but once a menu item from the graphical menu is selected and then that page is closed I have them tween into place, using TweenMax...
    For instance, say you go to the site and click on the inner circle(about us) then close that page..they come into view..if not touched, they will stay on the stage, but if you rollOver them and just wait..they will begin to disappear...
    Here is the relevant code:
    Code:
    		private function addMenuBottom(e:Event=null):void
    		{
    			b_menus = [b_menu0,b_menu1,b_menu2,b_menu3,b_menu4];
    			for each (var mc2:MovieClip in b_menus)
    			{
    				mc2.buttonMode = true;
    				mc2.addEventListener(MouseEvent.ROLL_OVER,playOverBottom);
    				mc2.addEventListener(MouseEvent.ROLL_OUT,playOutBottom);
    				mc2.addEventListener(MouseEvent.CLICK,popUpper);
    			}
    		}
    function playOverBottom(evt:MouseEvent):void
    		{
    
    			tt = new Tooltip(this.stage,0xFFFFFF);
    			tt.scaleX = tt.scaleY = .75;
    			addChild(tt);
    			var et:MovieClip = evt.currentTarget as MovieClip;
    			if ((et != evt.currentTarget))
    			{
    				return;
    			}
    			switch (evt.currentTarget)
    			{
    
    				case b_menu0 :
    					tt.showBottom("ABOUT US");
    					break;
    				case b_menu1 :
    					tt.showBottom("SERVICES");
    					break;
    				case b_menu2 :
    					/*lifering3.cont.flag.menutitle.text = "BUY";*/
    					tt.showBottom("RESOURCES");
    					break;
    				case b_menu3 :
    					tt.showBottom("BLOG");
    					break;
    				case b_menu4 :
    					tt.showBottom("CONTACT");
    					break;
    
    				default :
    					trace("default");
    
    
    			}
    			TweenMax.to(et.letter, 1, {rotationX:360, ease:Back.easeOut,onComplete:function(){et.letter.rotationX=0;}});
    
    		}
    		function playOutBottom(evt:MouseEvent):void
    		{
    			evt.currentTarget.gotoAndStop(1);//this isnt even necessary just put in to try to fix
    			removeChild(tt);
    
    
    		}
    		private function popUpper(evt:MouseEvent):void
    		{
    			removeChild(tt);
    
    			switch (evt.currentTarget)
    			{
    				case b_menu0 :
    					caseNum = 0;
    					myLoadURL = "about.swf";
    					/*swfX = 100;
    					swfY = 70;*/
    					//swfZ = swfZholder = 0;
    					swfX = 0;
    					swfY = 0;
    					swfRotX = -90;
    					break;
    				case b_menu1 :
    					caseNum = 1;
    					myLoadURL = "services.swf";
    
    					swfX = 0;
    					swfY = 0;
    					swfRotX = -90;
    					//swfZ = swfZholder = 0;
    					break;
    				case b_menu2 :
    					caseNum = 2;
    					myLoadURL = "resources.swf";
    					swfX = 0;
    					swfY = 0;
    					swfRotX = -90;
    					/*swfX = 100;
    					swfY = 70;*/
    					//swfZ = swfZholder = 0;
    					break;
    				case b_menu3 :
    					caseNum = 3;
    					myLoadURL = "blog.swf";
    					swfX = 0;
    					swfY = 0;
    					swfRotX = -90;
    					/*swfX = 100;
    					swfY = 70;*/
    					//swfZ = swfZholder = 0;
    					break;
    				case b_menu4 :
    					caseNum = 4;
    					myLoadURL = "contact.swf";
    					swfX = 0;
    					swfY = 0;
    					swfRotX = -90;
    					//swfZ = swfZholder = 0;
    					break;
    			}
    
    			for each (var mc:MovieClip in menus)
    			{
    				mc.buttonMode = false;
    				mc.removeEventListener(MouseEvent.ROLL_OVER,playOver);
    				mc.removeEventListener(MouseEvent.ROLL_OUT,playOut);
    				mc.removeEventListener(MouseEvent.CLICK,popUpper);
    			}
    			for each (var mc2:MovieClip in b_menus)
    			{
    				mc2.buttonMode = false;
    				TweenMax.to(mc2, .5 ,{y:740,alpha:0,ease:Back.easeOut});
    				mc2.removeEventListener(MouseEvent.ROLL_OVER,playOverBottom);
    				mc2.removeEventListener(MouseEvent.ROLL_OUT,playOutBottom);
    				mc2.removeEventListener(MouseEvent.CLICK,popUpper);
    			}
    			var imgLoader:Loader = new Loader  ;
    			imgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,progressHandler);
    			imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,onLoaded);
    			imgLoader.load(new URLRequest(myLoadURL));
    			trace("POP");
    		}
    		private function removeFade(e:Event):void
    		{
    			addMenus();
    			addMenuBottom();
    			for each (var mc2:MovieClip in b_menus)
    			{
    
    				TweenMax.to(mc2, 1 ,{y:674.30,alpha:1,ease:Back.easeOut});
    
    			}
    			ringTimer.addEventListener(TimerEvent.TIMER,motionClouds);
    			ringTimer.start();
    			removeEventListener("closeEvent", removeFade);
    			removeChild(content);
    
    		}
    	}
    Any idea as to what could be going on?

    Thanks,
    ---Yvette

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Sounds like you might be rotating some text fields. Unless you embed those fonts, text will not render at any rotation other than 0. A workaround would be to draw those clips or textfields into a bitmap and rotate that.

  3. #3
    Junior Member
    Join Date
    Oct 2005
    Posts
    6
    Thanks 5TonsOfFlax...However, the font is embedded and the rotation does render...they just disappear after a while...leaving them untouched after initially mousing over them..should do the trick..and there is an onComplete function called by the Tween which should be setting their rotationX back to 0.
    strangely, I think it had been working fine until I repositioned the MCs and put that red rectangle in the background.
    How would I go about drawing them into a bitmap?

    Thanks,
    ----Yvette

  4. #4
    Junior Member
    Join Date
    Oct 2005
    Posts
    6
    Actually, I don't think I embedded those fonts...let me try that first, but I am still interested to learn how to draw them into a bitmap

    Thanks again,
    ---Yvette

  5. #5
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    If the lack of embedding is not the source of the problem, then the bitmap technique is not necessarily the solution.

    In general, to draw something to a bitmap, create a new bitmap of the appropriate size, then use the draw method. I'm on my phone now so looking up the actual apis is cumbersome, but it's something like this:
    Code:
    var bmd:BitmapData = new BitmapData(mc.width, mc.height);
    bmd.draw(mc);
    var bm:Bitmap = new Bitmap(bmd);
    addChild(bm);

  6. #6
    Junior Member
    Join Date
    Oct 2005
    Posts
    6
    Thanks so much...Presently, I'm traveling and therefore unable to check on whether the font is embedded or not, but if it is you may hear from me in about a week or so...hopefully, you'll still be around to help.
    Your help is much appreciated btw..

    Thanks,
    ---Yvette

  7. #7
    Junior Member
    Join Date
    Oct 2005
    Posts
    6
    Hi 5TonsOfFlax,

    Embedding the fonts didnt work...Should I try the draw bitmap technique? Or what could be the problem?

    Thanks again,
    ---Yvette

  8. #8
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I still think the problem is something else. Which function in your code above is the problem?
    If this is a code-only project (probably not), zip it up and send it to me and I'll take a look.

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