Skip to content

Views set up manually with BeanEvent.SET_UP_BEAN are not automatically torn down #29

@bclinkinbeard

Description

@bclinkinbeard

Migrated from SWIZ-60

Going through SET_UP_BEAN does not add the view to the wired views map, so when it is removed from stage it will not be automatically torn down because it's not in wiredViews.

Possible fix in handleBeanEvent():

case BeanEvent.SET_UP_BEAN:
    if( existingBean )
        if( existingBean.initialized )
            logger.warn( "{0} is already set up as a bean. Ignoring SET_UP_BEAN request.", event.source.toString() );
        else if( event.source is DisplayObject && event.source is ISetUpValidator )
            SwizManager.setUp( DisplayObject( event.source) );
        else
            setUpBean( existingBean );
    else
        setUpBean( constructBean( event.source, event.beanName, swiz.domain ) );
    break;

Which would seem to work since SwizManager.setUp() won't do anything with the view if it is already in the wired views list, and assuming that a DisplayObject implementing ISetUpValidator is infered to be a view that the developer is attempting to manually set up themselves.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions