Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 18th, 2004, 09:26 AM
hypnotoad hypnotoad is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 18 hypnotoad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Moving things with AS in general.

Hey,

A while ago on orisinal.com i saw a neat bit of Flash...a sentence, with the letters made up of individual pixels. When you roll your mouse over the letters, they exploded out into their component pixels, which then zoomed back together when you move your mouse away. I've recently bought O'Reilly's book on ActionScript which has given me the basics of how this could be done, but I have a slight problem...I can get an object to move to a given point with AS, but I'm not sure how to get it to ANIMATE to that point - it just jumps from one point to another. I want it to smoothly animate. I think I need to do something with looping, but I'm not sure..can anyone help?

P.S. In pseudo-code I'm doing this to move the objects:

On start, get original pixel x/y values and store

On mouseover, generate random number and change x and y to this value.

On mouseout, set x and y to original values.


It's just a matter of animating them as such!

Thx

Reply With Quote
  #2  
Old February 18th, 2004, 10:11 AM
binkyboo binkyboo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 114 binkyboo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Here's an example using Penner's easing equations.

Frame 1:

Code:
Math.easeInOutQuad = function (time, beginX, changeX, durationX) {
	if ((time/=durationX/2) < 1) return changeX/2*time*time + beginX;
	return -changeX/2 * ((--time)*(time-2) - 1) + beginX;
};
time = 0;
beginX = myMC._x;
changeX = 300;
durationX = 20;
function movement(){
_root.myMC.onEnterFrame = function() {
	trace("called");
	if (time<=durationX) {
		this._x = Math.easeInOutQuad(time, beginX, changeX, durationX);
	} else {
		_root.myMC.onEnterFrame = null;
	}
	time++;
}
};


button:

Code:
on (release) {
	movement();
}


Check out http://www.robertpenner.com/easing/ for more examples. Good luck!!!

Reply With Quote
  #3  
Old February 18th, 2004, 10:25 AM
hypnotoad hypnotoad is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 18 hypnotoad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks...that's a little more complex than I wanted to get really, I just want to move the object, easing isn't important as such. I've got the movement working fine - it just jumps. I want to see the movement as if it had been tweened. Is there a simpler way?

Cheers.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > Moving things with AS in general.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT