Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

885 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