I have several Sprites inside
stage.__children["userdata ..."] |
and they are nested in each other... like groups that are holding its children. Also there are Self.References added to
that are pointing to each "group" and to each nested "child" inside such a group.
I want to have the ability to delete my groups and the children - remove them from memory and the stage object.
Can I do this somehow through the Self.References? eg.
stage:removeChild( stage.RECT ) |
? When I try to do this this (and I tried a lot other things too) then I get error:
The supplied Sprite must be a child of the caller.
stack tracebackHere is the content of stage object:
Value = {
| userdata: 0x101d6d420 = {
| | __parent = {} -- Value (self reference)
| | Ebene_1 = {
| | | __parent = {} -- Value.userdata: 0x101d6d420 (self reference)
| | | __children = {
| | | | userdata: 0x101ddc960 = {
| | | | | __parent = {} -- Value.userdata: 0x101d6d420.Ebene_1 (self reference)
| | | | | Obj2 = {
| | | | | | __parent = {} -- Value.userdata: 0x101d6d420.Ebene_1.__children.userdata: 0x101ddc960 (self reference)
| | | | | | __children = {
| | | | | | | userdata: 0x101d2e2c0 = {
| | | | | | | | __userdata = "userdata: 0x10625a928"
| | | | | | | | __parent = {} -- Value.userdata: 0x101d6d420.Ebene_1.__children.userdata: 0x101ddc960.Obj2 (self reference)
| | | | | | | }
| | | | | | }
| | | | | | __userdata = "userdata: 0x10625a3c8"
| | | | | }
| | | | | __userdata = "userdata: 0x10622ed68"
| | | | | Obj1 = {
| | | | | | __parent = {} -- Value.userdata: 0x101d6d420.Ebene_1.__children.userdata: 0x101ddc960 (self reference)
| | | | | | __children = {
| | | | | | | userdata: 0x101d2b1c0 = {
| | | | | | | | __userdata = "userdata: 0x10622cb08"
| | | | | | | | __parent = {} -- Value.userdata: 0x101d6d420.Ebene_1.__children.userdata: 0x101ddc960.Obj1 (self reference)
| | | | | | | }
| | | | | | }
| | | | | | __userdata = "userdata: 0x10623ca88"
| | | | | }
| | | | | __children = {
| | | | | | userdata: 0x101d23f50 = {} -- Value.userdata: 0x101d6d420.Ebene_1.__children.userdata: 0x101ddc960.Obj1 (self reference)
| | | | | | userdata: 0x101d2e1b0 = {} -- Value.userdata: 0x101d6d420.Ebene_1.__children.userdata: 0x101ddc960.Obj2 (self reference)
| | | | | }
| | | | }
| | | }
| | | __userdata = "userdata: 0x10623e398"
| | | RECT = {} -- Value.userdata: 0x101d6d420.Ebene_1.__children.userdata: 0x101ddc960 (self reference)
| | }
| | __userdata = "userdata: 0x10623e358"
| | __children = {
| | | userdata: 0x101d2b470 = {} -- Value.userdata: 0x101d6d420.Ebene_1 (self reference)
| | }
| }
| Obj2 = {} -- Value.userdata: 0x101d6d420.Ebene_1.__children.userdata: 0x101ddc960.Obj2 (self reference)
| __userdata = "userdata: 0x106225d28"
| Obj1 = {} -- Value.userdata: 0x101d6d420.Ebene_1.__children.userdata: 0x101ddc960.Obj1 (self reference)
| Ebene_1 = {} -- Value.userdata: 0x101d6d420.Ebene_1 (self reference)
| RECT = {} -- Value.userdata: 0x101d6d420.Ebene_1.__children.userdata: 0x101ddc960 (self reference)
| __children = {
| | userdata: 0x101d6d420 = {} -- Value.userdata: 0x101d6d420 (self reference)
| }
} |
the structure is actually like:
stage
Ebene_1
RECT
Obj1
Obj2
Ebene_1 <- Self.Reference
RECT <- Self.Reference
Obj1 <- Self.Reference
Obj2 <- Self.Reference |
But when adding Self.References the whole stage object looks weird... I use this function for adding:
function selfreferencing( t )
for k,v in pairs( t ) do
if string.find(tostring(k), "^[^\_]") then
stage[k] = v
selfreferencing( v )
end
end
end
selfreferencing( stage.__children ) |
Comments
I don't understand exactly but if you want to remove RECT from its parent you should call:
Likes: GGGRRR123
I want remove RECT from its parent, from stage and also everything that was inside RECT.
Your suggestion removes the object from screen. I cannot longer see it. but it is still in the memory and in the stage hierarchy... How to remove everything at all?
this is whats left inside stage hierarchy:
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
Edit: After you call stage.RECT:removeFromParent(), RECT is not at the stage hierarchy anymore.
And hoped it would remove RECT and every Sprite nested inside it (Obj1, Obj2).
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!