Eric
Eric

Reputation: 2091

(Flash CS4/AS3) Error #1007: Instantiation attempted on a non-constructor

Having a bit of a problem creating an instance of an object. Bear in mind that this is timeline based and NOT an external class…

var foo:Object {
    var a:String;
    var b:String;
}

var new_foo:Object;

function makeFoo():void
{
    new_foo = new foo();
}

function doStuff(e:MouseEvent):void
{
    makeFoo();
}

Everything runs fine until the 'new_foo = new foo();' bit, at which point I get the #1007 error.

Any ideas?

Upvotes: 0

Views: 2523

Answers (1)

a--m
a--m

Reputation: 4782

the problem is your object. missing some sintax, here is how to declare a object with two empty strings:

var foo:Object = {
    a:"",
    b:""
}

Upvotes: 1

Related Questions