[flexcoders] Re: Lagging Panel title

2009-09-17 Thread valdhor
Possibly...

  override public function invalidateDisplayList():void
{
 super.invalidateDisplayList();
 _title = propertyObject.title + ' Properties';
  }


--- In flexcoders@yahoogroups.com, droponrcll amyblankens...@...
wrote:

 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





[flexcoders] Re: Lagging Panel title

2009-09-17 Thread droponrcll
--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote:

 Possibly...
 
   override public function invalidateDisplayList():void
 {
  super.invalidateDisplayList();
  _title = propertyObject.title + ' Properties';
   }
 

I think what's going on is that they put the logic for changing the display of 
the title text in commitProperties instead of updateDisplayList.  Since my code 
was where it belonged in the commitProperties override--after their code, it 
didn't work.  I just moved the logic into the setter, but I think I could have 
put it above their logic in commitProperties as well...