all groups > flash actionscript > october 2006 >
You're in the

flash actionscript

group:

createClassObject not working on my component


createClassObject not working on my component Sunny
10/29/2006 5:09:20 PM
flash actionscript:
I have created a component called Mediablock and I have initialized it
so that I can use the createClassObject method with it:

static var symbolName:String = "Mediablock";
static var symbolOwner:Object = Mediablock;
var className:String = "Mediablock";

This does not work - it returns undefined.

import flashblocks.*
mc = this.createClassObject(Flashblocks,"media1",6);
trace("createClassObject: "+mc)

But yet the object exists: trace(Mediablock) and the component works
fine if I drag an instance on to the stage.

Here is a clue. createClassObject WILL WORK if I drag a Flash component,
like the Button, into the library as well. But if I delete the Button
component, my Mediablock component will not work anymore.

Any ideas. I have tried converting to compiled clip first and still nothing.

If anyone has any ideas please let me know

Thanks,

--
Sunny
Re: createClassObject not working on my component Sunny
10/29/2006 5:59:06 PM
On the other hand if I drag an instance of the component onto the stage,
I can createClassObject inside of the component like this:

mc = eb.createClassObject(Editblock, "eb1", 50);
trace("createClassObject: "+mc) // returns new instance eb1
trace(eb.createClassObject) // [type Function]

I still can not create an instance elsewhere.

mc = createClassObject(Editblock, "eb1", 50);
trace("createClassObject: "+mc) // This returns undefined

Sunny




[quoted text, click to view]
Re: createClassObject not working on my component Sunny
10/30/2006 1:36:17 PM
Here is the solution...

I needed to drag a copy of the UIObject MC into my 2nd frame assets of
my component.

Just importing the UIObject is not enough.

Maybe this will help someone else out.

Sunny

FLASH CONTENT MANAGEMENT | http://www.flashblocks.com



[quoted text, click to view]
AddThis Social Bookmark Button