Thanks! I had given up on using the _up, _over, _down mc-button method in as3 because of that flicker. Your explaination and solution make perfect sense.
jimbo *********** REPLY SEPARATOR *********** On 3/1/2008 at 9:08 PM Joseph Balderson wrote: >Just found this thread while trying to work this out myself. > >I have tried the same technique as discused here, and my button was >flickering too, until I discovered that it's because of the event >bubbling and regarding child objects as buttons themselves. What you >need to do is set > >btn_mc.mouseChildren = false; > >...and the flickering is solved. When I turned that on I didn't need to >use addChild, which I never quite understood the rationale anyways since >my movie clip button is already on the timeline. Here's what I have: > >btn_mc.addEventListener(MouseEvent.CLICK,clickHandler); >btn_mc.buttonMode = true; >btn_mc.mouseChildren = false; >function clickHandler(evtObj:MouseEvent):void >{ > trace("button clicked!"); >} > >On my button timeline I have _up, _over, _down frames, plus a few custom >states, and each state frame has a movie clip with several child movie >clips in turn. > >You might also encounter flickering if your over and up states are of >different sizes, in which case you should define an alpha 0 movie clip >containing the "hit" shape of the button on the bottom layer spanning >all frames, and in the code include > >btn_mc.hitArea = hit_mc; > > >Worked for me. >_______________________________________________________________ > >Joseph Balderson, Flash Platform Developer | http://joeflash.ca >Writing partner, Community MX | http://www.communitymx.com >Abobe Certified Developer & Trainer > > >Jim Berkey wrote: >> Fuomo, >> One more question, if you have the inclination . . . >> I put the statement on each frame of the button mc, and it works as >expected, but as I mouse over the shape, there is a flicker between the up >state to the over state - I thought it might be that part of the graphic >was transparent and losing focus, but that is not the case? >> >> http://jimbo.us/lab/FinalAssets3.fla >> http://jimbo.us/lab/FinalAssets3.swf >> >> >> jimbo >> >> *********** REPLY SEPARATOR *********** >> >> On 6/28/2007 at 9:48 PM Fumio Nonaka wrote: >> >>> When the statement you put is processed the play head in the btn_play >>> instance is in the first frame, in which the over_mc instance does not >>> exist. This is what the error tells you. Therefore >>> InteractiveObject.mouseEnabled for over_mc cannot be set. >>> >>> trace(btn_play.over_mc); // Output: null >>> >>> The statement should be placed in the second frame of the btn_play, or >>> inside the over_mc itself. >>> _____ >>> Jim Berkey wrote: >>>> Can you explain using' InteractiveObject.mouseEnabled' to allow a mc >>> inside a mc acting as a button a little more? I have a mc called >>> button_play, with the three frames (_up, _over, and _down), in the over >>> frame, instead of a graphic, I placed a mc, gave it instance name >over_mc, >>> and on the main timeline, put: >>>> btn_play.over_mc.mouseEnabled = false; >>>> >>>> I got this error: >>>> TypeError: Error #1009: Cannot access a property or method of a null >>> object reference. >>>> at FinalAssets2_fla::MainTimeline/FinalAssets2_fla::frame1() >>> Good luck, >>> -- >>> Fumio Nonaka >>> mailto:[EMAIL PROTECTED] >>> http://www.FumioNonaka.com/ >>> My books<http://www.FumioNonaka.com/Books/index.html> >>> Flash community<http://F-site.org/> >>> _______________________________________________ >>> Flashcoders@chattyfig.figleaf.com >>> To change your subscription options or search the archive: >>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >>> >>> Brought to you by Fig Leaf Software >>> Premier Authorized Adobe Consulting and Training >>> http://www.figleaf.com >>> http://training.figleaf.com >> >> >> >> _______________________________________________ >> Flashcoders@chattyfig.figleaf.com >> To change your subscription options or search the archive: >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> >> Brought to you by Fig Leaf Software >> Premier Authorized Adobe Consulting and Training >> http://www.figleaf.com >> http://training.figleaf.com >> >_______________________________________________ >Flashcoders mailing list >Flashcoders@chattyfig.figleaf.com >http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders