Skip to main content
Inspiring
August 20, 2007
Question

Changing Properties via AS3

  • August 20, 2007
  • 11 replies
  • 1724 views
I'm trying to write the proper AS3 script to change the properties of a single movie clip called blueMC. I'm using input text fields that have instance names with a button next to them to trigger the change in the MC's properties. Here's my code thus far:

yscale_btn.addEventListener(MouseEvent.CLICK, yScale);
xscale_btn.addEventListener(MouseEvent.CLICK, xScale);
alpha_btn.addEventListener(MouseEvent.CLICK, alphaChange);
rotate_btn.addEventListener(MouseEvent.CLICK, rotateChange);
xloc_btn.addEventListener(MouseEvent.CLICK, xLoc);
yloc_btn.addEventListener(MouseEvent.CLICK, yLoc);

function yScale(event:MouseEvent):void {
blueMC.scaleY = yScale.text;
}
function xScale(event:MouseEvent):void {
blueMC.scaleX = xScale.text;
}
function alphaChange(event:MouseEvent):void {
blueMC.alpha = alphaChange.text;
}
function rotateChange(event:MouseEvent):void {
blueMC.rotate = rotateChange.text;
}
function xLoc(event:MouseEvent):void {
blueMC.x = xLoc.text;
}
function yLoc(event:MouseEvent):void {
blueMC.y = yLoc.text;
}

When I test the movie, I get the following errors: 1023: Incompatible override and 1021: Duplicate Function Definition.

I don't see anything duplicated in my functions, they all seem pretty unique other than the format. Can you help?
This topic has been closed for replies.

11 replies

Inspiring
August 20, 2007
usually AS3 provides a trace back to the function causing the problem. is it doing that for you here as well? Nothing to do with the problem but....

A recommendation though after looking at the code would be to convert that text to Numbers and round it off to 2 or 3 decimal places. This may actually eliminate the 1023 error which in turn could very well kill the 1021 error as well.
padrepioAuthor
Inspiring
August 20, 2007
So encase it with Math.round like this:

blueMC.scaleY = Math.round(yScale.text);

Is that what you mean? Or is it because I need to type the input text field:

blueMC.scaleY = yScale.text:Number;