i need to make the drop down menu dissapear when my mouse goes outside the box.
i’m using on (rollout) {
_root.menu._visible = false;
}
and menu is the mc… any tips? :sure:
this is my as on my mc, and it has an xml attached as well.
[FONT=Courier New][/FONT]
[FONT=Courier New]onClipEvent (load)
{
function executeAction(action, targetType)
{
trace(targetType);//you can delete this line!
if (targetType == "url")
{
//getURL( action , "_blank");
//uncomment above line to use getURL if targetType=="url"
}
else if (targetType == "non_url")
{
//loadMovie( action , _parent.content);
//uncomment above line to use loadMovie if targetType=="non_url", assuming we have an mc "content" on the stage.
}
}
function selectItem(item)
{
if (this[item].action != null && curItem != item)
{
executeAction(this[item].action, this[item].targetType);
}
if (this[item].sub == false || curItem == item)
{
curItem = null;
removeSub();
}
else
{
curItem = item;
buildSub(item);
}
}
function buildSub(item)
{
var i;
var s;
var j;
var d = 0;
this.attachMovie("subholder", "subholder", 100);
var k = this.subholder;
var total_subs = 0;
var correct_item = (Number_Items - item) + 1;
for (i in menuObj["item" + correct_item])
{
if (typeof(menuObj["item" + correct_item]) == "object" && i!="sub" && i!="action" && i!="targetType")
{
total_subs++;
}
}
var Present_sub = total_subs - 1;
for (i = 1;i < total_subs;i++)
{
k.attachMovie("sub", i, d);
s = k*;
s.name = menuObj["item"+correct_item]["sub"+Present_sub].name;
s.action = menuObj["item"+correct_item]["sub"+Present_sub].action;
s.targetType = menuObj["item"+correct_item]["sub"+Present_sub].targetType;
s._x = 20;
s._y = (s._height + subSpacer) * d;
d++;
Present_sub--;
}
k._y = this[item].basey + this[item]._height + menuSpacer;
var u=1;
for (i in menuObj)
{
j = this[u];
if (this[item]._y < j._y)
{
j.target = j.basey + k._height + menuSpacer;
}
else
{
j.target = j.basey;
}
u++;
}
subs=total_subs;
onenterframe = menuAnimation;
}
function removeSub()
{
this.subholder.removeMovieClip();
depth = 1;
for (i in menuObj)
{
this[depth].target = this[depth].basey;
depth++;
}
onenterframe = menuAnimation;
}
function menuAnimation()
{
var i;
var j;
var k = true;
var depth = 1;
for (i in menuObj)
{
j = this[depth];
j._y = j._y + (j.target - j._y) / menuSpeed;
if (menuTolerance < Math.abs(j.target - j._y))
{
k = false;
}
else
{
j._y = j.target;
}
depth++;
}
if (k)
{
onenterframe = null;
if (curItem != null)
{
activateSub();
}
}
}
function activateSub()
{
var d = 0;
for (i=1;i<subs;i++)
{
subholder*.start = getTimer();
subholder*.delay = subDelay * d;
subholder*.gotoAndPlay(2);
d++;
}
}
MovieClip.prototype.activateMenu = function()
{
var d = 0;
for (i=1;i<Number_Items+1;i++)
{
this*.start = getTimer();
this*.delay = itemDelay * d;
this*.gotoAndPlay(3);
d++;
}
}
var menuSpacer = 1; //sets the vertical space between main items
var subSpacer = 1; //sets the vertical space between sub items
var menuSpeed = 5; //sets the menu animation speed
var menuTolerance = 1;
var subDelay = 170; //set the delay for the sub items entering the stage
var itemDelay = 100; //set the delay for the main items entering the stage
var curItem = null;
var menuObj = _parent.menuObj;
var onenterframe = null;
var Present_item = Number_Items;
var loop_condition = Number_Items + 1;
for (d = 1; d<loop_condition; d++)
{
this.attachMovie("item", d, d);
k = this[d];
k._x = 20;
k._y = (k._height + menuSpacer) * d;
k.name = menuObj["item" + Present_item].name;
k.action = menuObj["item" + Present_item].action;
k.targetType = menuObj["item" + Present_item].targetType;
k.sub = menuObj["item" + Present_item].sub;
k.basey = k._y;
if (k.sub == false)
{
k.icon._visible = false;
}
Present_item--;
}
activateMenu();
}
onClipEvent (enterFrame)
{
onenterframe();
}
on (rollout) {
_root.menu._visible = false;
}[/FONT]
[FONT=Courier New]
[/FONT]
[FONT=Courier New][/FONT]