Skip to main content
kathym14621340
Participating Frequently
May 24, 2015
Question

Scene 1, Layer 'actions', Frame 1, Line 1, Column 14 1086: Syntax error: expecting semicolon before leftbrace.

  • May 24, 2015
  • 1 reply
  • 774 views

Trying to change colour of an object using buttons.

this is my code

on (release) {

  var object = new Color (_root.object) ;

  object.setRGB(0x0066CC) ;

}

but then the error comes up and object doesnt change colour..!!!!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
May 24, 2015

that's (incorrect) as2 code.

are you publishing for as3 or as2?

kathym14621340
Participating Frequently
May 24, 2015

as3

kglad
Community Expert
Community Expert
May 24, 2015

delete the code you showed.

assign your button an instance name (eg, btn1) and attach to the first keyframe that contains btn1:

btn1.addEventListener(MouseEvent.CLICK,btn1F);

function btn1F(e:MouseEvent):void{

var ct:ColorTransform=btn1.transform.colorTransform;

ct.color=0x0066cc;

btn1.transform.colorTransform=ct;

}