actionscript question
- Started
- Last post
- 3 Responses
- fourtenlabs
so i'm writing a as2.0 flash 8 filter effect class...i'm having problems when i try to create an object before the constructor as a property and then create a new object to replace it in the contstructor. maybe this code will explain better. how do i fix this:
class BlurObject {private var blur_bmp:BitmapData;
public function BlurObject () {
this.blur_bmp:BitmapData = new BitmapData(100, 100, true, 0);
}
}
- enjine0
you had a space between Bitmap and Data. You don't even need to strong type it in the constructor.
also, you have to import the BitmapData class before you declare the BlurObject class, like so:
import flash.display.BitmapData;
class BlurObject {
private var blur_bmp:BitmapData;public function BlurObject () {
this.blur_bmp = new BitmapData(100, 100, true, 0);
}
}depending on what you want to do with it (i'm really not sure how yr planning on setting this up), you may also need to extend this BlurObject class from the MovieClip class.
at any rate, the code above does not throw any errors in the compiler.
- fourtenlabs0
thanks, not strong typing inside the constructor fixed everything. i'm making a class that when you create the object and pass it a movie clip, blur direction, and max blur the movie clip will have a motion blur going for when it tweens. do you think that'd be better as an extension of the movieclip class as opposed to a stand alone class?
- enjine0
dunno can go either way.
you should be good with composition if that's all yr trying to do with this one. like a little formatting tool that you can pass different mcs.
try to make it so you can use the same instantiation for multiple mcs, not one instantiation per mc, but one that you pass them all through
... good luck.