Solved

Change color of movieClip type on mouse event (ActionScript 3)

Posted on 2009-04-10
3
998 Views
Last Modified: 2013-11-11
The code below works as expected; however, I want to change the color of the type to 0xff0000. I tried to use the first three lines of commented code instead of the uncommented code, and I got the following error:

1119: Access of possibly undefined property color through a reference with static type flash.display:DisplayObject.

What am I doing wrong?
public function navOver(evt:MouseEvent):void {
			//var tempColor:Color;
			//tempColor = 0xFF0000;
			//DisplayObject(evt.target).color = 0xff0000;
			DisplayObject(evt.target).alpha = .5;
			//var tempButtonEvent:MouseEvent = evt;
			//trace("mss");
			//trace(tempButtonEvent);
			//tempButtonEvent.alpha=.5;
		}

Open in new window

0
Comment
Question by:msukow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Expert Comment

by:john_hollings
ID: 24119960
are you importing this class at the frist frame of your movie's root timeline?

import flash.display.*
or
import flash.display.DisplayObject.*;
0
 

Author Comment

by:msukow
ID: 24120606
yes
0
 

Accepted Solution

by:
msukow earned 0 total points
ID: 24122932
I figured it out. I used the attached function. i also had to make sure that I imported the following:
import flash.geom.ColorTransform;
public function navOut(evt:MouseEvent):void {
  var colorTransform:ColorTransform = DisplayObject(evt.target).transform.colorTransform;
  colorTransform.color = 0x373535;
  DisplayObject(evt.target).transform.colorTransform = colorTransform;
}

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

738 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