Associating Action Script segment with an object

Posted on 2009-12-25
Last Modified: 2013-12-17
I have some action script that changes the color of text and I am trying to learn how to link the script with the target object. Can you help me with the steps to do this?
Thank you!
Question by:johndarby
    LVL 14

    Accepted Solution

    I suppose you mean that you want to change the colour of the object containing the text. If so, the recommended way to do it (applies both in AS2 and AS3) is to give the target object an instance name and change it's textColor. If the target object is inside a movieclip or many other objects, then you would need to give the movieclips or buttons above an instance name and then refer to them accordingly.

    For example, if the textfield have an instance name of "txt" and the it's in a container movieclip called "container", then you need to set
    container.txt.textColor = 0x000000; // this is black, you should change it to a colour you want
    LVL 1

    Author Closing Comment

    Thank you!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    wma to mp4 video format 23 98
    VCD to mp4 11 86
    merge adobe pdf files 14 75
    What interoffice LAN only messenger is recommended? 5 49
    This article shows how to convert a multi-page PDF file into multiple image files, with one image file created for each page of the PDF. It does this by utilizing an excellent, free software package called GraphicsMagick. The solution is amazingly s…
    This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
    The goal of the tutorial is to teach the user how to how to record live broadcast.
    The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

    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