[COLOR=“Green”][SIZE=4]SOLVED - see thread[/SIZE][/COLOR]
Hi.
To explain what I want in a easy way I will use an example.
Say I want to make a flash movie with cars of different kind. Every car looks different and have their own specifications like weight, horse powers, top speed. So… I want to create a class Car that can hold the variables weight, horsePowers, topSpeed and should be linked with a specific MovieClip (the car).
The problem is I cannot link all my MovieClips, holding the cars, to the same class Car!
Should I create a container to associate with the class and then place different car MovieClips in them depending on which car object I’m creating? (so the MovieClip itself is sort of a variable)
|
|
|
/
package
{
import flash.display.MovieClip;
import flash.display.DisplayObject;
import flash.text.TextField;
public class Car extends MovieClip
{
private var _weight:Number;
private var _topSpeed:Number;
private var _movieclip:MovieClip;
function Car( weight:Number, topSpeed:Number, movieclip:MovieClip )
{
_weight = weight;
_topSpeed = topSpeed;
_movieclip = movieclip;
this.addChild(_movieclip);
}
}
}
And then I create an empty container_mc and volvo_mc, audi_mc, opel_mc. container_mc is linked with Car
var theVolvo:Car = new Car ( 1230, 230, volvo_mc);
Hope you get what I mean. Always hard to explain things you don’t know so good and that’s of course most often the case. :rambo: