Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
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.
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.

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now