SunQuest
           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 March 12th, 2003, 06:21 PM
Chanyom Chanyom is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Missouri
Posts: 31 Chanyom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Chanyom
Question How can I program an orbit?

I wish to creat a movie clip that will contain a number of "planets" (buttons) which will travel in an orbit. I am fairly new to ActionScript, so I don't know how to go about figuring out how to program this. Here's what I want to do:

ONE: Have the planet/button travel an eliptical (or circular) orbit. In order to make the orbital effect more authentic, I would like to know how I can control the scale of the image depending on where it is on the orbit: say 0 degrees is North, 90 is East, 180 is south and 270 is West--the image scale is 100% at 180/south, 75% at East/90 and West/270, and 50% at North/0.

TWO: When the cursor is over one of these planets (MouseOver) I want the orbital motion to pause (only while there is a MouseOver event happening).

THREE: When one of the planets is clicked, I want all the planets to fly to the left and rest in a straight vertical formation, with the one that was clicked being at the top.

If anyone has any good ideas about how I can acheive this ambitious project, I would greatly appreciate it.

Reply With Quote
  #2  
Old March 12th, 2003, 11:47 PM
rec rec is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: houston
Posts: 94 rec User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 40 m
Reputation Power: 6
That really shouldn’t be too hard to do.
Your “buttons” need to be movieclips so you can attach code to them either that or lplace the “buttons” inside of a movieclip. Place the movieclip on the stage and select it (make sure you give it an instance name) with the movieclip selected go to the actions window (expert mode) and type;

OnClipEvent(enterFrame) {
this._x += 5;
this._xscale += 1;
this._yscale += 1;
if(this._x >= 400) {
this.gotoAndPlay (2);
}
}

with a set up like this you would have two frames and a movieclip in each frame. One would have the object on one side of the orbit the other would have the clip on the other side of the orbit. The code above moves the clip from left to right and upon reaching 400 pixels from the left side of the stage sends the play head to frame 2 where you would have the other clip and instead of second line reading this._x += 5; it would read
this._x -= 5; and the >=400 value would be <= whatever the value is for the left hand position. You would also probably have to mirrored halves of this thing i.e. it goes half way across its orbit getting bigger as it goes and then switch to another clip or instance where it gets smaller as it continues its way across, though this last part may not be necessary. Something along these lines should do the orbit part of it.

The flying buttons and rollovers should also be pretty straight forward.

OnRollOver or onMouseOver you may have to define functions for these. I believe th rollover is just for buttons while the MouseOver is for movieclips.

Anyway this should be pretty straight forward you may have to go to the reference books once or twice for the syntax.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > How can I program an orbit?


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 1 hosted by Hostway