Skip to main content
Known Participant
April 12, 2018
Answered

applying styles to library MCs added to the stage

  • April 12, 2018
  • 2 replies
  • 265 views

Hi,

I am at really at a loss on this. If I manually place an image component on the stage, I can apply CSS styles to it no problem.

myImage.style.WebkitFilter = "invert(1)";

This works fine!

HOWEVER

if I add the image from the library via script, e.g., stage.addChild(myImage), the style doesn't apply to the same image. Any ideas on how to apply styles to images added to the stage from the library via script? This is driving me absolutely nuts. Thanks in advance.

    This topic has been closed for replies.
    Correct answer ClayUUID

    Components create browser DOM elements floated over the stage. That's why they can take CSS styles. Library items rendered to the the stage canvas element are just pixels on a bitmap. You can't style pixels.

    2 replies

    ClayUUIDCorrect answer
    Legend
    April 16, 2018

    Components create browser DOM elements floated over the stage. That's why they can take CSS styles. Library items rendered to the the stage canvas element are just pixels on a bitmap. You can't style pixels.

    Preran
    Legend
    April 16, 2018

    In the time that an expert gets to your question, can you have a look at the following articles to see if there is anything here that can help?

    https://code.tutsplus.com/tutorials/adjust-the-color-properties-of-an-image-using-actionscript-3--active-8596

    Adobe Flash Professional CS5 * Setting styles

    Thanks,

    Preran