Action script 3.0 help (Please :) )

Hey all,

I’m having a little problem with Action Script 3.0.

I’m basically trying to add ‘PaddleTwo’ to the stage at a certain x, y location, yet I keep getting the error shown, and I’m not quite sure why.

Also, I can’t figure out why the code functions I’ve defined in the ‘PaddleTwo’ class won’t run from the Main class, I’ve imported the ‘PaddleTwo’ class and added the sprite to the stage.

Anyway help would be much appreciated.

P.s. I’m not very good with programming, but I need to get this done :frowning:

Attachments


Capitalization matters in ActionScript – your constructor needs to be called PaddleTwo, not paddleTwo. Also, it needs to be a Constructor, not a method. I forget how AS3 does Constructors, but I don’t think it’s the same as methods.

I didn’t spot that :o

Also, I’m not entirely sure what the difference is between a constructor and a method, I believe a method is a function?

Anyway, I scrapped the code and restarted and it’s working fine now, so I guess I had some other problems.

I appreciate the help though, thank you :slight_smile:

Constructor is done correctly for AS3.

AS3 is very type sensitive, also starting to annoy me.

Glossing way over it, a constructor is basically a method that’s the same name of the class and is automatically called when an object of that particular class is being created.

Really the only major difference you need to worry about is that constructors are used when creating an object and methods are used to do work with objects