Jump to content
Search Community

x y postion and scaleX

chefkeifer test
Moderator Tag

Recommended Posts

I am trying to make my coding a little more simpler. I am currently trying to tween 15 different buttons..

 

i am trying to make this variable work at does

how to i write what the current position of that button in code. I guess i should say I am trying to write something like this..is this how you would do it

var xpos:Number = currentTarget.name.x + 5;
var xpos:Number = currentTarget.na,e.y  - 5;

I am trying to make all of these objects to move up 5 and to the right 5 pixels.

 

over1.insert(TweenMax.to(menu.btn_welcome, 1, {x:xpos, y:xpos,scaleX:scalex, scaleY:scaley}));

 

also when i use the scaleX and just put in the code to scale up 1.5 it works fine but when i make variable and refer to it it says it too large to display

the variable i am using is

var scalex:Number = 1.5;

Link to comment
Share on other sites

ok i totally forgot about doing this

 

x:"5", y:"-5"

but when i used that instead actually putting the actual coordinates it seems to be chopping. any reason for that

 

also forget about the scale issue..i was still asleep when i wrote that..no need to do a variable in that case..

Link to comment
Share on other sites

another thing i figured out is when using the this

over state

over1.insert(TweenMax.to(event.currentTarget, 1, {x:"2.5",y:"-5", z:25}));

out state

out1.insert(TweenMax.to(event.currentTarget, 1, {x:"-2.5", y:"5", z:0}));

 

every time you go back over the button it never really goes back to its original position. If i went over the button 100 times it would eventually move off the screen. so i am trying to figure out a way for it to move just 5 pixels up and 5 pixels to the left and then it goes back to its original position every time you ROLL_OUT

Link to comment
Share on other sites

I'm not sure why you're using insert() - are you building a TimelineLite/Max?

 

Here's what I'd do:

 

var myTween:TweenLite = new TweenLite(mc, 1, {x:"2.5", y:"-5", z:25, paused:true}));
function over(e:MouseEvent):void {
   myTween.play();
}
function out(e:MouseEvent):void {
   myTween.reverse();
}

 

(add your event listeners too of course)

Link to comment
Share on other sites

i am writing a timeline

would i write it like this?

 

var over1:TimelineMax = new TimelineMax(paused:true);
				over1.insert(TweenMax.to(event.currentTarget, 1, {dropShadowFilter:{color:0x000000, alpha:1, blurX:5, 
															blurY:5, angle:45, distance:10}}));
				over1.insert(TweenMax.to(event.currentTarget, 1, {x:"2.5",y:"-5", z:25}));
				over1.insert(TweenMax.to(event.currentTarget, 1, {glowFilter:{color:0xc8db00, 
															alpha:1, blurX:5, blurY:5}}));
//*****====================================================*****
// BUTTON OVER FUNCTION
function over(event:MouseEvent){//MAIN BUTTONS
			over1.play();
		}
//------------------------------------------------
//BUTTON OUT FUNCTION
function out(event:MouseEvent){//MAIN BUTTONS
			over1.reverse();
		}
//*****====================================================*****

 

and of course i have my event listeners :D

Link to comment
Share on other sites

It's because you're referencing event.currentTarget in your code, but you don't define "event" anywhere. I'm not quite sure what you're trying to accomplish with that code, so I can't tell you what to replace it with - you probably need to reference a particular object that you're wanting to tween. I assume this code isn't inside a handler function that has "event" as a parameter.

Link to comment
Share on other sites

the reason i am was using event.currentTarget was because i have multiple buttons doing the same thing and trying to use the code you recommended. How would i use that same tween for multiple buttons.

and be able to play and reverse.

 

Happy Thanksgiving by the way.

Link to comment
Share on other sites

I am really new to this..i am not familiar with subclass...I just want to make sure that when I use the

 

x:"2.5", y:-5

 

it does not studder and it goes back to its original position. Jack recommended using the play and reverse which i like but not sure how to implement that with mutliple buttons for one over and out functions

Link to comment
Share on other sites

i have tried this but it does it all at the same time..

 

var over1:TimelineMax = new TimelineMax({paused:true});
				over1.insertMultiple(TweenMax.allTo([welcome,dragStrip, motocross, rvCamping,tentCamping, mudOval, oval_dirtTrack,
													 		zipLine, topWorld, bathHouse, ticketBooth, pavilion,
															jrMotocross, washArea, mudBog], 1, {dropShadowFilter:{color:0x000000, alpha:1, blurX:5, 
															blurY:5, angle:45, distance:10}}));
				over1.insertMultiple(TweenMax.allTo([welcome,dragStrip, motocross, rvCamping,tentCamping, mudOval, oval_dirtTrack,
													 		zipLine, topWorld, bathHouse, ticketBooth, pavilion,
															jrMotocross, washArea, mudBog], 1, {x:"2.5",y:"-5", z:25}));
				over1.insertMultiple(TweenMax.allTo([welcome,dragStrip, motocross, rvCamping,tentCamping, mudOval, oval_dirtTrack,
													 		zipLine, topWorld, bathHouse, ticketBooth, pavilion,
															jrMotocross, washArea, mudBog], 1, {glowFilter:{color:0xc8db00, 
															alpha:1, blurX:5, blurY:5}}));


   function over(e:MouseEvent):void {
       over1.play();
   }
   function out(e:MouseEvent):void {
       over1.reverse();
   }

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