Jump to content
Search Community

a few Questions, advice please.

Evostar* test
Moderator Tag

Recommended Posts

Hi. i have answered all of my questions but 1 on my own.

 

but i have problem with my array event.

 

my Button Text scales to 1.5 x and y on Mouse event Click.

 

how do i reset the Scale X + Y to 1 after a different button is clicked?

 

i have added my fla 49kb to help explain.

 

here is all my code. and i have the 6 buttons on stage with instance names that are in the array.

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;

TweenPlugin.activate([blurFilterPlugin]);

home.btnname.btntxt.text="Home";
aboutus.btnname.btntxt.text="About Us";
pricelist.btnname.btntxt.text="Pricelist";
products.btnname.btntxt.text="Products";
promotions.btnname.btntxt.text="Promotions";
contactus.btnname.btntxt.text="Contact Us";

var MenuArray = [home, aboutus, pricelist, products, promotions, contactus];

var BtnGroup:MovieClip;
for (var i:Number = 0; i < MenuArray.length; i++)
{
  BtnGroup = MenuArray[i];
  TweenMax.from(BtnGroup, 1, {y:-80, delay:0.075* i, ease:Elastic.easeOut});
}

container.scaleX=0;
TweenMax.to(container, 1, {scaleX:1, delay:0.25, ease:Elastic.easeOut});

for each (var btn in MenuArray) {

btn.buttonMode = true;
btn.useHandCursor = true;
btn.mouseChildren = false;
bar.mouseEnabled = false;
btn.addEventListener(MouseEvent.MOUSE_OVER, onBtnOver);
btn.addEventListener(MouseEvent.CLICK, onBtnClick);
}

function onBtnOver (event:MouseEvent):void {
trace(event.target.name + " = Roll Over!");
TweenMax.to(event.target.btnname, 0.2, {blurFilter:{blurY:30}});
TweenMax.to(event.target.btnname, 0.2, {blurFilter:{blurY:0}, delay:0.2});
TweenMax.to(bar, 1, {x:event.currentTarget.x, ease:Elastic.easeOut});
}

function onBtnClick (event:MouseEvent):void {
trace(event.target.name + " = Clicked!");
TweenMax.to(event.target.btnname, 0.1, {blurFilter:{blurX:30}});
TweenMax.to(event.target.btnname, 0.1, {blurFilter:{blurX:0}, delay:0.1});
TweenMax.to(event.target.btnname, 0.1, {scaleX:1.5, scaleY:1.5, delay:0.1});
TweenMax.to(container, 0.8, {scaleX:0, alpha:0, ease:Elastic.easeIn, onComplete:Load});
	function Load():void{
   	container.gotoAndStop(event.target.name);
TweenMax.to(container, 0.8, {scaleX:1, alpha:1, ease:Elastic.easeOut});
}
}

 

thankyou again for your time and advice.

 

Evo.

Link to comment
Share on other sites

im finding im having a problem with the mouse click event its tweening when i roll over quickly and when i click. why is this? :D

 

to be more specific when i roll over the button then roll off. then roll back on again (roll on for the 2nd time) it does the click function. even tho i no click.

Link to comment
Share on other sites

First of all, when you're using TweenMax, you shouldn't ever need to include overwrite:0 because it automatically uses the AUTO overwrite mode which is intelligent enough to figure out overlapping properties and times and only kills stuff when necessary.

 

Regarding the argument error, you must be passing the wrong number of arguments to a function. I couldn't tell by the very small code snippet you pasted in here - it must be somewhere else in your code.

 

I would recommend separating your questions into the most short, succinct ones possible and post each one separately in the forums. You put a bunch of questions in one post and it was a bit difficult to follow it all. It's also always best to try to isolate the issues in their own SUPER simple FLA files. For example, if you're having trouble with a rollover/out and a click handler getting mixed up, create a separate FLA with one button that you try your rollover with. If that works, then add the rollout. If that works, add the click. Add layer upon layer until it breaks and then you'll have a much better idea of what's going on. Use trace() a lot to print values to the screen at runtime so you can see what's going on under the hood.

 

Hope that helps.

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