Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-04-10
3
Medium Priority
?
1,014 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

688 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