Re: [Flashcoders] Importing custom components via Actionscript

2005-12-22 Thread Alan MacDougall

[EMAIL PROTECTED] wrote:


I wanted to load these cells from the library on the fly, but I get an error. 
Here is the code I use:

import colorblock;
c = _root.createClassObject(colorblock, "blankClip" + i, (i + 1), 
{colorParam:hexArray[i]});
 

Are you able to instantiate a new object of the class in the same scope? 
Does it compile if you try


var testObj:colorblock = new colorblock();

(Also, I'd highly recommend changing class names to use initial caps -- 
ColorBlock instead of colorblock. It's such a universal standard that 
there's a slight chance the compiler is choking on the lowercase.)

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Importing custom components via Actionscript

2005-12-22 Thread ccusce
Hello, 
I am in the process of changing something from a movie-clip based process to a 
component-based process. This aspect of the project is a simple color-picker 
that is generated on the fly based on an array of colors passed in as 
parameters. 

Instead of this, I want to create several custom components on the fly based on 
what the particular dataset requires (how large the color array is). Each 
component is a cell, and that cell can take one parameter which is it's 
particular color and should return a value onChange.

I wanted to load these cells from the library on the fly, but I get an error. 
Here is the code I use:

import colorblock;
c = _root.createClassObject(colorblock, "blankClip" + i, (i + 1), 
{colorParam:hexArray[i]});

And here is the error:

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 42: The class or interface 
'colorblock' could not be loaded.
this.containerC =_root.createClassObject(colorblock, 
"blankClip" + i, (i + 1), {colorParam:hexArray[i]});

The variable "i" is defined, as is hexArray. The "import colorblock" appears on 
the top of the script, outside of all loops.

Can this be done? If so, what am I doing wrong?

Collin K Cusce
[EMAIL PROTECTED]
cell: 757-508-7623
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders