• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 279
  • Last Modified:

Can i make several flash objects in AS3 that acts independently?

I want to create a menu that has several buttons, each button is supposed to resize (in real life its supposed to add some length)  like this:


However how it is animated is unimportant, I only want to know the method for animating several objects independently.
  • 3
  • 3
1 Solution
Actually, you need to be more clear about what you want. I don't really understand what you mean by button is supposed to resize in real life?

Do you mean you want to allow it to auto resize itself as the text gets longer and then allow the button to resize too?

I can't help you if you give me these kind of details.

However, I can tell you that you that you can auto resize the text by setting

txt.autoSize = true;

For buttons to auto resize itself, you can use a couple of ways, but I won't mention the methods in case I understand them wrongly.

Please give me more details. Thanks.
walkman69Author Commented:
It's not that an advanced question, i'm quite new to flash, and want to learn how to use AS3.

In order to clarify somewhat, here goes: I only need to know how the mechanics behind making a more complex scene that has more than one interactive flash object works, since i am to make a menu that has several objects (or rows).

For example i'm not very sure how to implement that when doing a rollOut
so that while the last object rolls back some frames, the other one that has rollOver is progressing forward.. That's what i mean by having several objects animated independently.

Here is an example of what kind of menu one could create using the same method i'm after:


However this one is not made by using AS3 so it's not much help to me.

If you are trying to achieve what the tutorial showed you, it's pretty easy. However, I will modify a lot of code and their buttons. Because I don't agree with the method used to achieve what is needed, using extra redundant code and code is not kept organised.

Therefore, I will first download their .fla file and edit it to work for AS3. However, I will change some parts where I think is redundant and bad. From there, you should be able to see how you are going to do this in AS3.

I uploaded the .fla file. The code is all in one frame, to further simplify things I also didn't use classes.

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

walkman69Author Commented:
Very nicely done.. That was exactly what i was looking for.
walkman69Author Commented:
The only thing that confuses me is the

if (e.currentTarget.over)

isn't that true always?
Or is it just when the mouse is over an object?
The method I used in this example is not the best way to do things. Yes, it's a status that monitors whether the mouse is over an object, however it is not available by default in AS3. I created it myself.

Due to the fact that the buttons were made this way, I have no choice but to use this way to achieve what is needed. It is certainly not the best way to do it. An alternative way that will work for this too is using TweenLite but I do not know if you have prior experience with it so I decided not to use it in order not to confuse you.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now