PDA

View Full Version : Instantiation attempted on a non-constructor



Exodar
January 5th, 2008, 03:35 PM
package
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.geom.ColorTransform;

public class Color extends Sprite
{
public var Picture:Class;

public function Color()
{
transformColor();
}

private function transformColor():void
{
var pic:Bitmap = new Picture();
addChild(pic);

pic.transform.colorTransform = new ColorTransform(-1, -1, -1, 1,
255, 255, 255, 0);
}
}
}Using this as the document class for a separate fla file, i'm getting this error when the movie is exported:

TypeError: Error #1007: Instantiation attempted on a non-constructor.

why is this?

hatu
January 5th, 2008, 04:00 PM
Something wrong with Picture class probably. Can you post that class too

SquirtGun
January 5th, 2008, 04:04 PM
Get rid of your Picture variable. Just create an instance of the Picture class like you do in your function. I assume you have a separate Picture class?

~squirt

Exodar
January 5th, 2008, 04:11 PM
in my library i have a bitmap exported for actionscript, with the class name "Picture"

srikanthb15
September 27th, 2010, 11:32 AM
public var Picture:Class;
...
var pic:Bitmap = new Picture(); ...
Compile using .fla as Document class gives the error
TypeError: Error #1007: Instantiation attempted on a non-constructor.

Compile the same class using mxmlc comiler.
mxmlc color.as
We dont get any error.

Dont know exactly why it doesn't work with document class from .fla.

senocular
September 27th, 2010, 11:57 AM
in my library i have a bitmap exported for actionscript, with the class name "Picture"

Then your Picture class is defined there. You don't need to define it in your class. In your library it is pre-defined in the global space.

Follow squirt's advice.