Jump to content
Search Community

Is this a complete mess?

WhiteDesign test
Moderator Tag

Recommended Posts

Hello again!!!!


Still being a bit of a novice I just wanted to run this code past you to make sure I'm not making a complete dogs breakfast of how I'm structuring my code or that I'm making things slow and clunky because of excess 'stuff'. The whole thing works brilliantly, I just to be sure I'm doing things properly!



Louisa :D


/////////////// Main Menu

TweenLite.to(info.myMenu_btn.myMenuButtons, 0, {autoAlpha:0});

info.myMenu_btn.addEventListener(MouseEvent.ROLL_OVER, mouseOverHandler);
info.myMenu_btn.addEventListener(MouseEvent.ROLL_OUT, mouseOutHandler);

function mouseOverHandler(e:Event):void {

TweenLite.to(info.myMenu_btn.myMenuButtons, 0.5, {autoAlpha:1});
function mouseOutHandler(e:Event):void {
TweenLite.to(info.myMenu_btn.myMenuButtons, 1, {autoAlpha:0});

////////////////////// Menu Buttons

	TweenMax.from(info.profile, 1, {autoAlpha:0, blurFilter:{blurX:20, blurY:20}});
	TweenMax.to(info.otherInfo, 0, {autoAlpha:0, blurFilter:{blurX:20, blurY:20}});
	TweenLite.to(info.panel, 0, {scrollRect:{left:0, right:913, top:0, bottom:516}});
	TweenMax.to(pageMenu, 0, {autoAlpha:0, blurFilter:{blurX:20, blurY:20}});

	function playProfileInfo(e:Event) 
	TweenMax.to(info.profile, 1, {autoAlpha:1, blurFilter:{blurX:0, blurY:0}});
	TweenMax.to(info.otherInfo, 1, {autoAlpha:0, blurFilter:{blurX:20, blurY:20}});
	TweenLite.to(info.panel, 1, {scrollRect:{left:0, right:913, top:0, bottom:516}});
	function playMoreInfo(e:Event) 
	TweenMax.to(info.profile, 1, {autoAlpha:0, blurFilter:{blurX:20, blurY:20}});
	TweenMax.to(info.otherInfo, 1, {autoAlpha:1, blurFilter:{blurX:0, blurY:0}});
	TweenLite.to(info.panel, 1, {scrollRect:{left:0, right:913, top:0, bottom:430}});


////////////// Close Panel	

	function closeProfile(e:Event) 
	TweenMax.to(info, 1, {autoAlpha:0, blurFilter:{blurX:20, blurY:20}});
	TweenMax.to(pageMenu, 1, {autoAlpha:1, blurFilter:{blurX:0, blurY:0}});

	function closeBtnProfile(e:Event) 
	TweenMax.to(info, 1, {autoAlpha:0, blurFilter:{blurX:20, blurY:20}});
	TweenMax.to(pageMenu, 1, {autoAlpha:1, blurFilter:{blurX:0, blurY:0}});

Link to comment
Share on other sites

I'm not a Tweenlite god or anything but your code looks fine to me... At least if it is a complete mess, my code is too :)


The only thing is I'm wondering why you're using TweenLite and TweenMax? I might be wrong but since you're already using TweenMax, the "damage is done" on the filesize so you could simply use it all the time for clarity... (also it saves one key press :lol: ) If that is because it conflicts with the one before, you could use the wonderfull TimelineLite to sequence you tweens (even if they're all having a time of 0).



Link to comment
Share on other sites

Just to clarify, since TweenMax extends TweenLite, the total file size incurred by using TweenLite AND TweenMax together is exactly the same as if you only used TweenMax. But there is a small benefit to using TweenLite even if you use TweenMax elsewhere in your project - since there's less conditional logic in the rendering routines, TweenLite tweens can run SLIGHTLY faster than TweenMax tweens. You'd never notice unless you're tweening hundreds or thousands of tweens simultaneously, though, so it shouldn't be a major concern either way. Since I'm an efficiency freak, I tend to use TweenLite for all tweens that don't specifically require a TweenMax feature.


Speed test: http://blog.greensock.com/tweening-speed-test/


So yeah, using just TweenMax would be a bit more clear I suppose and there isn't a compelling reason to mix & match, but if you're a fellow efficiency freak, it's fine to do. :)

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...