Hi, all;

I have a component that extends Panel.  The panel title is bound to a private 
bindable variable that I set in commitProperties.  The title variable updates, 
but the titleTextField.text doesn't update, so the title always lags behind.

I haven't done Flex on a regular basis in a few months, so if someone can see 
what I'm doing wrong here, I'd appreciate it:

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml"; layout="vertical" 
xmlns:view="com.magnoliamultimedia.view.*" title="{_title}">
        <mx:states>
                <mx:State name="realObject">
                        <mx:AddChild>
                                <view:RealCourseObjectProperties width="100%" 
height="100%" id="realObjectProperties" />
                        </mx:AddChild>
                </mx:State>
        </mx:states>
        <mx:Script>
                <![CDATA[
                        import com.magnoliamultimedia.vo.ContainerItem;
                        import com.magnoliamultimedia.vo.PresentationContainer;
                        import com.magnoliamultimedia.vo.RealCourseObject;
                        private var _propertyObject:*;
                        private var _propertyObjectChanged:Boolean;
                        [Bindable]
                        private var _title:String='Properties';
                        
                        /**
                         * Object whose properties we want to show.
                         * Can be RealCourseObject, PresentationContainer, or 
ContainerObject
                         */
                        public function get propertyObject():* {
                                return _propertyObject;
                        }
                        public function set propertyObject(obj:*):void {
                                if (!(obj is RealCourseObject) && 
                                        !(obj is PresentationContainer) && 
                                        !(obj is ContainerItem)) 
                                {
                                        throw new Error('propertyObject must be 
RealCourseObject, PresentationContainer, or ContainerItem.');
                                        return;
                                }
                                if (obj != _propertyObject) {
                                        _propertyObject = obj;
                                        _propertyObjectChanged = true;
                                        invalidateProperties();
                                        invalidateDisplayList();
                                }
                        }
                        
                        override protected function commitProperties():void {
                                super.commitProperties();
                                if (_propertyObjectChanged) {
                                        //change state to reflect what kind of 
object was selected
                                        if (propertyObject is RealCourseObject) 
{
                                                currentState = 'realObject';
                                                realObjectProperties.realObject 
= propertyObject as RealCourseObject;
                                        }
                                        _title = propertyObject.title + ' 
Properties';
                                        invalidateDisplayList();
                                        _propertyObjectChanged=false;
                                }
                        }
                ]]>
        </mx:Script>
</mx:Panel>

Thanks!

Amy

Reply via email to