views:

239

answers:

1

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?

+1  A: 

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

var foo:Object = {
    a:"",
    b:""
}
dome
Something is still amiss. I changed the object as suggested but I am still receiving the same error.
Eric
I think I found it… I was trying to instantiate the object, but after some digging I found that just doing what you suggested above actually made the "instance" automatically… Once I removed the new_foo references, it worked fine. So now to reuse it later I'll just make a loop that blanks out the values to start over. :)
Eric