00:00
00:00
Newgrounds Background Image Theme

Chan99 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Something wrong with my AS3.0

508 Views | 3 Replies
New Topic Respond to this Topic

Something wrong with my AS3.0 2014-02-08 11:25:20


I sat here for an hour trying to figure out what's wrong with it.

var clicked =MouseEvent.CLICK
var buttons = new Array(ClothingButton, ColourButton, StatButton, BioButton);

for (var a=0; a<buttons.length; a++) {
buttons [a].buttonMode=true
buttons [a].addEventListener(clicked,buttonClick);
}

function buttonClick(e:Event) :void {
switch (e.target.name) {
case "ClothingButton" :
Clothing.visible = !Clothing.visible
break;
case "ColourButton" :
ColourRef.visible = !ColourRef.visible
break;
case "StatButton" :
Stats.visible = !Stats.visible
break;
case "BioButton" :
BioInfo.visible = !BioInfo.visible
break;
}
}

When I debug the movie it gives me this error;

Attemping to launch and connect to Player using URL C:\Users\Karl\Desktop\New folder (2)\Furaffinity\Commissions\Refs\Amadi\AmadiRefAnimated - experiment.swf
[SWF] C:\Users\Karl\Desktop\New folder (2)\Furaffinity\Commissions\Refs\Amadi\AmadiRefAnimated - experiment.swf - 444925 bytes after decompression
ReferenceError: Error #1056: Cannot create property buttonMode on flash.display.SimpleButton.
at AmadiRefAnimated_fla::MainTimeline/AmadiRefAnimated_fla::frame1()[AmadiRefAnimated_fla.MainTimeline::frame1:38]

I very new at this and my Dyslexia makes it even harder, i'm assuming it's something stupidly simple.

Response to Something wrong with my AS3.0 2014-02-08 11:57:15


NEVERMIND. figured it out.

Response to Something wrong with my AS3.0 2014-02-08 11:58:04


At 2/8/14 11:25 AM, karloss01 wrote: I sat here for an hour trying to figure out what's wrong with it.

Try to read the error message, it's plain english:

ReferenceError: Error #1056: Cannot create property buttonMode on flash.display.SimpleButton.

It tries to create a property buttonMode, but it cannot do that.
It refers to this line:

buttons [a].buttonMode=true

The objects you put into the array are buttons. They are of type SimpleButton.
This class doesn't have a property "buttonMode".
A button class would not have a property that decides if it's a button or not.

If you post code again, put it into code tags to make it readable.

btw, what are you trying to do here?

var clicked =MouseEvent.CLICK

Why do you want to stick that constant into a variable?

Response to Something wrong with my AS3.0 2014-02-08 14:10:58


At 2/8/14 11:58 AM, milchreis wrote: btw, what are you trying to do here?
var clicked =MouseEvent.CLICK
Why do you want to stick that constant into a variable?

I laughed, milchreis, good job. Hilarious stuff.