Jump to content
Search Community

drop down menu help?

TheMightyMac test
Moderator Tag

Recommended Posts

Hello all, I am having a very difficult time with my drop down menu and keep getting the error "TypeError: Error #2007: Parameter child must be non-null.at flash.display::DisplayObjectContainer/setChildIndex() at navBarNew_fla::MainTimeline/myWorkOver()" I only have one button that will have a drop down menu and when I roll over it I get the error. I've checked everything many times and can't figure it out. I'll attach the FLA file and if anyone can take a look it will be greatly appreciated. Oh, and I followed a tutorial here to create it: http://www.tutvid.com/tutorials/flash/t ... nMenus.php

 

I've created a drop down menu like this when following the tutorial exactly and had no problems but for this menu I added tweens using GreenSock and the buttons have nested MCs etc.

 

Thanks in advance.

Link to comment
Share on other sites

this is the line that is throwing the error:

 

navBar_mc.setChildIndex(event.target as MovieClip, 1);

 

if you trace event.target.name it is myWorkHit

 

 

 

i'm guessing myWorkHit can not get shifted around by navBar_mc.setChildIndex();

 

-----

 

do this:

 

function myWorkOver (event:MouseEvent): void
{
	trace(event.target.name); // displays myWorkHit

  TweenLite.to(navBar_mc.myWork_mc.myWorkBtn, .2, {y:-4, ease:Back.easeOut});
  TweenMax.to(navBar_mc.myWork_mc.myWorkBtn.orangeMyWorkBtn, .2, {colorTransform:{tint:0xffff66, tintAmount:.4}});
  //navBar_mc.setChildIndex(event.target as MovieClip, 1);
  dropMenu_mc.gotoAndStop(event.target.name);
}

 

 

and then inside dropdown_mc, change the frame label to myWorkHit

 

the drop down will at least show up when you rollOver work.

Link to comment
Share on other sites

Awesome! Works like a charm. Thanks Carl!!!

 

I'm guessing that line that was messing it up wasn't working because the of way I structured my button's mouse over, is that correct?

 

One more question, on my AS layer in the main timeline I'll put the mouseclick functions for my main buttons, should I put the mouseclick functions for the drop down buttons there or inside the drop down mc's AS layer?

Link to comment
Share on other sites

yeah, i think the way you have things structured isn't exactly like the tutorial.

 

and I would suggest putting your code on Frame 1 of the main timeline instead of putting it inside movie clips.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...