Skip to content

Commit

Permalink
if a display object container is deleted, it deletes all its content.
Browse files Browse the repository at this point in the history
  • Loading branch information
julapy committed Nov 15, 2011
1 parent 349d03e commit c4df3a9
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion ofxFlashDisplayObjectContainer.cpp
Expand Up @@ -9,6 +9,11 @@

#include "ofxFlashDisplayObjectContainer.h"

#include "ofxFlashBitmap.h"
#include "ofxFlashShape.h"
#include "ofxFlashSprite.h"
#include "ofxFlashMovieClip.h"

ofxFlashDisplayObjectContainer :: ofxFlashDisplayObjectContainer()
{
typeID = OFX_FLASH_TYPE_DISPLAY_OBJECT_CONTAINER;
Expand All @@ -20,7 +25,38 @@ ofxFlashDisplayObjectContainer :: ofxFlashDisplayObjectContainer()

ofxFlashDisplayObjectContainer :: ~ofxFlashDisplayObjectContainer()
{
//
for( int i=0; i<children.size(); i++ )
{
ofxFlashDisplayObject *child;
child = children[ i ];

if( child->typeID == OFX_FLASH_TYPE_DISPLAY_OBJECT )
{
delete child;
}
else if( child->typeID == OFX_FLASH_TYPE_SHAPE )
{
delete (ofxFlashShape*)child;
}
else if( child->typeID == OFX_FLASH_TYPE_BITMAP )
{
delete (ofxFlashBitmap*)child;
}
else if( child->typeID == OFX_FLASH_TYPE_SPRITE )
{
delete (ofxFlashSprite*)child;
}
else if( child->typeID == OFX_FLASH_TYPE_MOVIECLIP )
{
delete (ofxFlashMovieClip*)child;
}
else
{
assert( false ); // child of unknown type. something wrong here.
}
}

children.clear();
}

///////////////////////////////////////////////
Expand Down

0 comments on commit c4df3a9

Please sign in to comment.