Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
function set content(value: IContentVO): void { if ( _content != value ) { _oldContent = _content; _content = value; updateContent(); }}/// updateContent does the heavy lifting of creating the correct view ofthe content typefunction updateContent(): void { if ( _oldContent == null && _content == null ) { // no need to update the view -- ignore it return; } // reset the transition state flags _isTransitionInDone = _isTransitionOutDone = false; _isCrossFade = false; // meaning we only trigger contentReady()-method when both transitions has been completed (contentReady() sets .enabled to true); _previousView = _currentView; // store reference to current view // create new movieclip for the new content if ( _content != null && !_isTransitioning ) { _currentView = ContentViewFactory.byType( _content.type ) as IContentView; _currentView.addEventListener( ContentEvent.TRANSITION_IN_COMPLETE, inTransitionDone, true, 0, false ); _currentView.addEventListener( ContentEvent.TRANSITION_OUT_COMPLETE, outTransitionDone, true, 0, false ); _currentView.mouseEnabled = false; // disable mouse input _currentView.enabled = false; _contentContainer.addChild( _currentView ); } // check how we need to do the transition in only, out only or cross fade? if ( _oldContent == null && _content != null ) { IContentView(_previousView).transitionIn(); } else if ( _content == null && _oldContent != null ) { IContentView(_previousView).transitionOut(); } else { _isCrossFade = true; // will enable view when both transitions are finished IContentView(_previousView).transitionIn(); IContentView(_previousView).transitionOut(); }}