Integrating methods from a class file into AS2 object

Subscribe to Integrating methods from a class file into AS2 object 4 posts, 3 voices

Sign in to reply


 
avatar for SumYungGai SumYungGai 130 posts
Flag Post

Basically I have an Object that’s stored in my library, and I have a Class file for it. When I don’t say

Game.ballHandler["Ball0"] = new brickSmasherBall();

The Object appears on my screen, but it doesn’t inherit the methods I want. But if I do put that, it has the methods, but doesn’t appear on screen.

Any way I can get the best of both worlds? Is there something I have to do in the library to make them compatible? Or can’t that happen in AS2?

 
avatar for UnknownGuardian UnknownGuardian 1704 posts
Flag Post

Forgive my ignorance, but why do you say

Game.ballHandler["Ball0"]

What is ballHandler that you can access some object by passing in a String in the []?

 
avatar for Moonkey Moonkey 669 posts
Flag Post
Originally posted by UnknownGuardian:

Forgive my ignorance, but why do you say

Game.ballHandler["Ball0"]

What is ballHandler that you can access some object by passing in a String in the []?

You can do that with an instance of any dynamic class (MovieClips, Arrays, Objects etc)

Is there something I have to do in the library to make them compatible?

You need to use attachMovie instead of creating a new object. If that isn’t working, there must be a problem with your linkage. If you tick export for actionscript and make sure the ‘class’ field matches the name of the class exactly it should work.

 
avatar for SumYungGai SumYungGai 130 posts
Flag Post

=) Found the problem.

I had previously done all that you said to do Moonkey (match the class name, attachMovie), but I called the class before importing it. I’m so dumb =P

Sign in to reply


Click Here