mardi 18 avril 2017

Tween functions for series of menus wont work after the 1st

I am having a problem with a series of drop down menus i'm trying to make. I have 3 buttons, each of which when hovered over, drops down a sub menu with options. The problem I'm running into is that the first menu works, it drops down as it should. The second and third menus however do not work, and I don't understand why. I'm not getting an error code, and some googling directed me to people who were having similar problems suggesting flash garbage collection might be what is causing my issue. i'm not sure how to structure it so that this wont happen. I should also add that this is my first time posting so I apologize for any format issues in the post, and I'm very new to coding so any help will be much appreciated, I don't really know the questions to ask to get me going in the right direction.

Thankyou for your time

The code I have so far is as follows

import fl.transitions.Tween;
import fl.transitions.easing.Regular;

stop();

menu_cont.paint_rect.alpha = 0;
menu_cont.trim_rect.alpha = 0;
menu_cont.wheels_rect.alpha = 0;

menu_cont.paint_btn.addEventListener(MouseEvent.ROLL_OVER, paintRollOver);
menu_cont.paint_rect.addEventListener(MouseEvent.MOUSE_OUT, paintMouseOut);
menu_cont.trim_btn.addEventListener(MouseEvent.ROLL_OVER, trimRollOver);
menu_cont.trim_rect.addEventListener(MouseEvent.MOUSE_OUT, trimMouseOut);
menu_cont.wheels_btn.addEventListener(MouseEvent.ROLL_OVER, wheelsRollOver);
menu_cont.wheels_rect.addEventListener(MouseEvent.MOUSE_OUT, wheelsMouseOut);

var paintMenuTween:Tween = new Tween (menu_cont.paint_menu, "y", 
Regular.easeOut,menu_cont.paint_menu.y, 50, .5, true);
var paintMenuTween2:Tween = new Tween (menu_cont.paint_menu, "y", 
Regular.easeOut,menu_cont.paint_menu.y, -15, .5, true);
var trimMenuTween:Tween = new Tween (menu_cont.trim_menu, "y", 
Regular.easeOut,menu_cont.trim_menu.y, 50, .5, true);
var trimMenuTween2:Tween = new Tween (menu_cont.trim_menu, "y", 
Regular.easeOut,menu_cont.trim_menu.y, -15, .5, true);
var wheelsMenuTween:Tween = new Tween (menu_cont.wheels_menu, "y", 
Regular.easeOut,menu_cont.wheels_menu.y, 50, .5, true);
var wheelsMenuTween2:Tween = new Tween (menu_cont.wheels_menu, "y", 
Regular.easeOut,menu_cont.wheels_menu.y, -15, .5, true);

function paintRollOver (event:MouseEvent):void {
    paintMenuTween = new Tween (menu_cont.paint_menu, "y", 
Regular.easeOut,menu_cont.paint_menu.y, 50, .5, true);
    trace ("paint over")
}

function paintMouseOut (event:MouseEvent):void {
    paintMenuTween2 = new Tween (menu_cont.paint_menu, "y", 
Regular.easeOut,menu_cont.paint_menu.y, -15, .5, true);
trace ("paint out")
}

function trimRollOver (event:MouseEvent):void {
    trimMenuTween = new Tween (menu_cont.trim_menu, "y", Regular.easeOut,menu_cont.trim_menu.y, 50, .5, true);
    trace("trim over")
}

function trimMouseOut (event:MouseEvent):void {
    trimMenuTween2 = new Tween (menu_cont.trim_menu, "y", Regular.easeOut,menu_cont.trim_menu.y, -15, .5, true);
    trace("trim out")
}

function wheelsRollOver (event:MouseEvent):void {
    wheelsMenuTween = new Tween (menu_cont.wheels_menu, "y", Regular.easeOut,menu_cont.wheels_menu.y, 50, .5, true);
    trace ("wheels over")
}

function wheelsMouseOut (event:MouseEvent):void {
    wheelsMenuTween2 = new Tween (menu_cont.wheels_menu, "y", Regular.easeOut,menu_cont.wheels_menu.y, -15, .5, true);
    trace ("wheels out")
}

Aucun commentaire:

Enregistrer un commentaire