Help me debug my portfolio!

Hi guys,

Here is a rough version of my portfolio. Be gentle.

http://dma.sjsu.edu/~art101b/jbernardo/portfolio/

I’m trying to figure out how to fix my menu, which is expanded and closed by if else statements. That is, if _xmouse reaches a certain point it expands (and the menu instance jumps to frame 30), if _xmouse leaves that region and the menu instance is at frame 30, then the menu instance jumps to a segment of the timeline in which the menu closes. At the end of this segment menu instance timeline returns to frame 1.

Here is the AS for the menu’s expanding and closing functionality, which is embedded on the menu instance itself:

onClipEvent (enterFrame) {
    if (this._currentframe == 1) {
        if (_xmouse<30) {
            this.gotoAndPlay(2);
        } else {
            null;
        }
    } else {
        null;
    }
    if (this._currentframe == 30) {
        if (_xmouse>185) {
            this.gotoAndPlay("menuClose");
        } else {
            null;
        }
    } else {
        null;
    }
}

The problem is when you scroll out of the menu too fast when it is expanded and roll over another button, the menu gets stuck!

I don’t wanna bog this thread down with all of my AS so I’ll only post it if it’s going to be necessary. What do you guys think could be causing this problem?

A far better and more simplistic approach would be using something like this


import mx.transitions.Tween;
import mx.transitions.easing.*;

menuMC.onRollOver = function () {
	var openTween:Tween = new Tween (menuMC, "_x", Strong.easeOut, -75.0, 0, .75, true);
};

menuMC.onRollOut = function () {
	var closeTween:Tween = new Tween (menuMC, "_x", Strong.easeOut, 0, -75, .75, true);
};

Obviously that’s just 3 minutes of coding so you can spice it up a bit but I think you’ll be better off that way. One thing you’ll want to do is only allow the rollout effect once the open motion is completed so you don’t get a jerky effect. Or something along those lines.

[quote=Digitalosophy;2328862]A far better and more simplistic approach would be using something like this

ActionScript Code:
[LEFT][COLOR=#0000FF]import[/COLOR] mx.[COLOR=#000080]transitions[/COLOR].[COLOR=#000080]Tween[/COLOR];

[COLOR=#0000FF]import[/COLOR] mx.[COLOR=#000080]transitions[/COLOR].[COLOR=#000080]easing[/COLOR].*;

menuMC.[COLOR=#0000FF]onRollOver[/COLOR] = [COLOR=#000000]function[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
    var openTween:Tween = [COLOR=#000000]new[/COLOR] Tween [COLOR=#000000]([/COLOR]menuMC, [COLOR=#FF0000]"_x"[/COLOR], Strong.[COLOR=#000080]easeOut[/COLOR], -[COLOR=#000080]75[/COLOR].[COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR], .[COLOR=#000080]75[/COLOR], [COLOR=#000000]true[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR];

menuMC.[COLOR=#0000FF]onRollOut[/COLOR] = [COLOR=#000000]function[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
    var closeTween:Tween = [COLOR=#000000]new[/COLOR] Tween [COLOR=#000000]([/COLOR]menuMC, [COLOR=#FF0000]"_x"[/COLOR], Strong.[COLOR=#000080]easeOut[/COLOR], [COLOR=#000080]0[/COLOR], -[COLOR=#000080]75[/COLOR], .[COLOR=#000080]75[/COLOR], [COLOR=#000000]true[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR];
[/LEFT]

Obviously that’s just 3 minutes of coding so you can spice it up a bit but I think you’ll be better off that way. One thing you’ll want to do is only allow the rollout effect once the open motion is completed so you don’t get a jerky effect. Or something along those lines.[/quote]

thanks for your help. i’ve never heard of these classes, i will have to read up on them to understand them more.

While you’re learning - the Adobe Tween class is awful; it’s slow, unoptimized, and just generally not good. You should check out [U]TweenLite[/U].

the arrow seems to flip when its running around, plus that is generally a bit naff

the zippy stuff is good though

hmmm, i’ll take a look at what you suggested. i’d rather stick to what’s already available to me though. is there a place i can read about the adobe tween class? it’s not coming up in the CS3 help directory.

I can understand feeling a little hesitant to use custom classes, but I promise you - TweenLite is basically an industry standard tool, everyone uses it instead of the Adobe classes.

He’s right. Use a tweening class! and TweenLite (or max) is very good. I just made the switch from fuse to tweenmax

Trust us on this. I tried using the tween class on a game I was hired to make and it regularly failed. Stopping in the middle of the tween, or not executing at all. I ended up writing one from scratch since it is a really simple class in the first place. The one I wrote pretty much implemented the same exact thing as the Flash class but mine actually worked. Go figure.

Anogar is correct, he’s a smart guy listen to him.

I make examples like that because it doesn’t require you to download class files. The example was merely a logical example of how I feel you should go about it.

I think you’d have a lot of fun coding that navigation triangle with Tweenmax “orient to bezier”. (just download the class and learn it; you’ll be glad you did)

BTW, I like your site.
I found the triangle to be very interesting and functional; it’s a great idea.