Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8565591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:27:38+00:00 2026-06-11T17:27:38+00:00

I’m not having any success, getting a background to show at 0.5 alpha on

  • 0

I’m not having any success, getting a background to show at 0.5 alpha on a mouseover, with a Sprite as the parent of a TextArea. The best I can get is the text appearing at 0.5 transparency on MouseOver, which is completely not what I’m looking for. I want the text at maximum alpha regardless of Mouse State and only the background(Sprite) to appear at half transparency on MouseOver. I’d rather avoid tweens if possible. Here’s my code:

var textSprite:Sprite  = new Sprite();

    public function Main()
    {
        textSprite.graphics.beginFill(0x000000, 0);
        textSprite.graphics.drawRect(94.95, 80.95, 390, 130); 
        textSprite.graphics.endFill();
        textSprite.addChild(picArea1);//textarea added on stage, same dimensions, transparent background
        textSprite.buttonMode = true;
        textSprite.useHandCursor = true;
        stage.addChild(textSprite);


        textSprite.addEventListener(MouseEvent.MOUSE_OVER, applyAlpha);
        textSprite.addEventListener(MouseEvent.MOUSE_OUT, noApplyAlpha);
    }

    function applyAlpha(event:MouseEvent):void {
       textSprite.alpha = 0.5;
    }

    function noApplyAlpha(event:MouseEvent):void {
       textSprite.alpha = 0;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:27:40+00:00Added an answer on June 11, 2026 at 5:27 pm

    Setting the sprite’s alpha also affects all of it’s children (by design) which is your current issue.

    The way you’re currently doing it (drawing the background with the graphics object), you’d have to redraw the graphics of the sprite on mouse over/out.

    Here is method you could use:

    public function Main()
    {
        drawTextBG(); //a new function I made to avoid duplicating code
        textSprite.addChild(picArea1);//textarea added on stage, same dimensions, transparent background
        textSprite.buttonMode = true;
        textSprite.useHandCursor = true;
        stage.addChild(textSprite);
    
    
        textSprite.addEventListener(MouseEvent.MOUSE_OVER, applyAlpha);
        textSprite.addEventListener(MouseEvent.MOUSE_OUT, noApplyAlpha);
    }
    
    //new function I made, this draws the background and makes the transparency the value passed in. I set the default to 1 (totally visible)
    function drawTextBG(bgAlpha:Number = 1):void {
        textSprite.graphics.clear();
        textSprite.graphics.beginFill(0x000000, bgAlpha);
        textSprite.graphics.drawRect(94.95, 80.95, 390, 130); 
        textSprite.graphics.endFill();
    }
    
    function applyAlpha(event:MouseEvent):void {
       drawTextBG(.5); //redraw the background with half (.5) alpha
    }
    
    function noApplyAlpha(event:MouseEvent):void {
       drawTextBG(); //redraw the background with the default value (1 - totaly visible)
    }
    

    Now, if your using a TLF (text-layout-framework) text field you can just use the backgroundColor and backgroundAlpha properties of the text field and forgo drawing a background manually.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I want to show the soap response to UIWebview.. my soap response is, <p><img
I need a function that will clean a strings' special characters. I do NOT
Does anyone know how can I replace this 2 symbol below from the string
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.