Solved

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

Posted on 2009-04-10
3
997 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

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

Suggested Solutions

Title # Comments Views Activity
Flash player plugin 13 7 346
how can i learn adobe flex step by step 4 125
bandwidth 5 80
Why is this simple, masked Flash animation flickering? 20 205
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…
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

713 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