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

Posted on 2009-12-31
Last Modified: 2012-05-08
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.
Question by:walkman69
    LVL 14

    Expert Comment

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

    Author Comment

    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.

    LVL 14

    Accepted Solution

    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.

    LVL 2

    Author Closing Comment

    Very nicely done.. That was exactly what i was looking for.
    LVL 2

    Author Comment

    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?
    LVL 14

    Expert Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
    Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
    This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
    Learn how to download your full Prezi presentation for offline presenting. Prezi doesn’t have to be viewed and shared in a web browser, even with a free account you can download your full presentation to share with others. Be sure to download any vi…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now