A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Manipulating the color object in a MC

  1. #1
    Member
    Join Date
    Mar 2002
    Posts
    45

    Manipulating the color object in a MC

    I have a MC named i_button residing on my _root timeline. I want to change the color of a movieclip residing inside i_button.

    I can easily accomplish this within the i_button timeline by placing an actionscript frame with the following code:
    var i_color:Color = new Color(i_background);
    i_color.setRGB(0xff9933);

    However, I can not manipulate the color of i_background when I move back to the _root timeline. Can someone please help me out with the code to accomplish this.

  2. #2
    Member
    Join Date
    Mar 2002
    Posts
    45
    By the way, I am using actionscript 2.0
    Also, from the main timeline I already tried:
    i_button.i_color.setRGB(0xff9933);

    However this did nothing

  3. #3
    Member
    Join Date
    Mar 2002
    Posts
    45
    I am authoring with Adobe Flash CS3 and exporting to Flash Player 8. According to Adobe Live docs

    Color class
    Availability: Flash Player 5

    I am assuming this means the color class was available as of Flash Player 5. However, I have come to learn that later versions of Flash handle things in different ways and not all actionscript is backwards compatible.

    So the question remains, how do I manipulate a MC inside an MC residing on my main timeline.

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    If you work in AS2, this is what you should use:
    ColorTransform constructor

    gparis

  5. #5
    Member
    Join Date
    Mar 2002
    Posts
    45
    I have it working within the i_button MC. I simply have a frame in there with actionscript changing the color of i_background to orange:
    var i_color:Color = new Color(i_background);
    i_color.setRGB(0xff9933);

    The problem is when I move to the main timeline, I can not get the i_background MC inside the i_button MC to change colors. I thought that appending "i_button." to "i_color" would do the trick but it didnt.

  6. #6
    Member
    Join Date
    Mar 2002
    Posts
    45
    Am I not giving yall enough information or what? I dont think this is to hard of a question and it is absolutely killing me as I have been trying to solve this problem for several HOURS spanning two days.

  7. #7
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Which version of the program are you using? You say you code AS2, so i give you a link to an AS2 method. Yet, you seem to be coding AS1, using a deprecated method (setRGB). In any case, the path should be appended to the movieclip instance name, not the color object.

    gparis

  8. #8
    Member
    Join Date
    Mar 2002
    Posts
    45
    Quote Originally Posted by hcaraway
    I am authoring with Adobe Flash CS3 and exporting to Flash Player 8.
    Color class
    Availability: Flash Player 5

    I have tried it every way but this didnt work either:
    var i_color:Color = new Color(i_button.i_background);
    i_color.setRGB(0xff9933);

    I found a work around but ony by making a new key frame exactly where I want the background color to change and then by placing the following actionscript on the i_button MC containing the i_background MC whose color I want to change:

    onClipEvent (load) {
    var i_color = new Color(this.i_background);
    i_color.setRGB(0xff9933);
    }

    as soon as the movie continues playing from this frame, the original i_button is loaded containing the i_background with the original color. This achieves the desired effect.

  9. #9
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    I think the problem may be that you are targetting an object that doesn't exist (yet) at the time of the call.

    gparis

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center