A Flash Developer Resource Site

# Thread: Making a wheel with elements that grow as they get closer to the top.

1. ## Making a wheel with elements that grow as they get closer to the top.

Hey, I'm working on a project with a 2D, flat, globe, that rotates either left or right. Essentially, it's a circle. All around this circle are going to be buildings, evenly spaced. If you're having trouble visualizing that, see this illustration. http://www.more4kids.info/uploads/Im...g-hands-sm.jpg The children in this illustration would be the buildings I'm referring to. Now, the top most building will be the biggest, and the others will gradually get smaller. How can I get this working so that buildings ease in and ease out in size as the planet rotates?

Thanks!

If you have any clarifying questions, let me know.

2. bump!

3. still need help!

4. I would make sure that the transformation point is located at the base of the buildings, and centered x-wise. Then I would simply use some code to make them bigger or smaller as they rotate.

PHP Code:
``` this.addEventListener (Event.ENTER_FRAME, rotateTheThing);function rotateTheThing (e:Event):void{    main_mc.rotation += 1;    if (main_mc.rotation<180&&main_mc.rotation>0)    {        main_mc.b1_mc.scaleY-=.005;        main_mc.b1_mc.scaleX-=.005;    }    else    {        main_mc.b1_mc.scaleY+=.005;        main_mc.b1_mc.scaleX+=.005;    }    trace (main_mc.rotation);}  ```

5. Here is a zip file if you need it. In the sample I only made the first building do the scaling, you can add it for as many buildings as you need.

http://www.worldkit.com/TEMP/scaleBuilding.zip

6. awesome! thanks! this helps so much. i really appreciate you taking the time out to do this.

7. Hmm, I tried duplicating this, and now I get:

1021: Duplicate function definition.

Source: function rotateTheThing (e:Event):void

8. scratch that! it works! however, I do have another question. is there anyway to have the building, when it shrinks, remain where it was initially positioned on the globe? as in, the base would stay touching the same point of the globe, just the building would shrink in place (as opposed to drawing in towards the middle).

thanks!

9. Abelius wrote: "I would make sure that the transformation point is located at the base of the buildings, and centered x-wise." This should keep it from scaling in the middle.

I also tested the code in this post. I added additional movieclips, i.e. b1_mc, b2_mc, b3_mc, b4_mc and postioned them on a main_mc that is rotating. There is one in the top, bottom, left, and right. I found that with this code they all start at their normal size, scale down, then back up when they get to their original location. italianice388, were you wanting the buildings, b1_mc etc, to only be large when they get to the top of the globe?

10. yes! they should be tallest at the top of the globe.

11. also, thank you for directing me to abelius' quote! totally missed that. tsk.

thanks again, both of you guys. seems to be working just fine now!

edit:

so, how do i add the other buildings into the code? i've tried a few things and nothing seems to be working

12. bump!

13. I made an attempt but only got so far. I added additional buildings/objects to the main_mc. Imagine a circle with a building on top, bottom, left, and right like a cross. I write the code as follows. The only problem is that they are at their tallest point from their starting position. I know that you only want them at their tallest when they reach the top of the globe, so maybe someone else can make a recommendation.

stop();

function rotateTheThing (e:Event):void
{
main_mc.rotation += 1;
if (main_mc.rotation<180&&main_mc.rotation>0)
{
main_mc.b1_mc.scaleY-=.005;
main_mc.b1_mc.scaleX-=.005;
main_mc.b2_mc.scaleY-=.005;
main_mc.b2_mc.scaleX-=.005;
main_mc.b3_mc.scaleY-=.005;
main_mc.b3_mc.scaleX-=.005;
main_mc.b4_mc.scaleY-=.005;
main_mc.b4_mc.scaleX-=.005;
}
else
{
main_mc.b1_mc.scaleY+=.005;
main_mc.b1_mc.scaleX+=.005;
main_mc.b2_mc.scaleY+=.005;
main_mc.b2_mc.scaleX+=.005;
main_mc.b3_mc.scaleY+=.005;
main_mc.b3_mc.scaleX+=.005;
main_mc.b4_mc.scaleY+=.005;
main_mc.b4_mc.scaleX+=.005;
}
trace (main_mc.rotation);
}

14. thanks! yeah, the only problem now is making it so each building gets its maximum height once it reaches the top, not it's starting point.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap