Forum Discussion
EnTerr
9 years agoRoku Guru
"Veeta" wrote:
As far as I'm aware, you can't do it.
[spoiler=on class-name as a factory in RSG:18uh2wpi]There's a compilation step when using Scene Graph XML that only happens once on startup. During that step is where you define a component and give it a name.<component name = "MyPoster" extends = "Poster" >
Then later you refer to this component by name.m.grid = createObject("roSGNode","MarkupGrid")
m.grid.translation = "[100,100]"
m.grid.itemComponentName = "MyPoster"
What you've done with makeGridItem() is created a single instance of the Rectangle component type and given that instance a unique id of `gridItem`. MarkupGrid isn't looking at id's of object instances with itemComponentName, it's looking at the registry of defined component types.[/spoiler:18uh2wpi]
Well explained!
Follow-up/lead question - how about using one a the pre-defined classes (e.g. m.grid.itemComponentName = "Poster" instead of = "MyPoster") ... works?