2012-08-08 53 views
0

我试图通过单击按钮将舞台状态更改为不同状态。问题是some times我得到例外The supplied DisplayObject must be child of the caller。 这里是我试图做些什么来改变状态尝试更改Flex 3中状态的例外情况

this.currentState = 'fullScreen'; 

这里thiscanvas

这里是国家fullscreen

<mx:State name="fullScreen"> 
      <mx:RemoveChild target="{lstExpert}"/> 
      <mx:RemoveChild target="{screenToggle}"/> 

      <mx:AddChild relativeTo="{outContainer}" position="firstChild"> 
       <mx:HBox id="topHeaderBox" horizontalAlign="left" verticalAlign="middle" width="98.5%" height="60"/> 
      </mx:AddChild> 

      <mx:AddChild relativeTo="{topHeaderBox}" position="firstChild" > 
       <mx:Label id="lblCourseName" width="100%" text="Name" color="#ffffff" fontFamily="Arial" fontSize="14" fontWeight="bold" height="20" />  
      </mx:AddChild> 

      <mx:AddChild target="{screenToggle}" relativeTo="{lblCourseName}" position="after" /> 



      <mx:AddChild relativeTo="message" position="before"> 
       <mx:Spacer id="Bar" height="5" width="2" /> 
      </mx:AddChild> 
</state> 

会是什么错误,这里的MXML?

+0

关于上下文的任何其他信息?例如定义状态的MXML文件或处理状态更改的ActionScript段。因为简单的分配不足以让人感觉到问题。 – 2012-08-08 07:52:41

+0

编辑这个问题,MXML为新状态 – 2012-08-08 09:22:16

回答

0

您可能想要绑定最后一个AddChild对象的relativeTo属性值。意思是这样写的:

<mx:AddChild relativeTo="{message}" position="before"> 

假设你有一个具有该id的元素。

希望这会有所帮助。

+0

非常感谢您的回复,但是这并不能解决问题,还有一件事我应该在这里提到,我在堆栈跟踪中看到了'firebug/getChild()',不幸的是我无法复制。打开萤火虫/闪光灯会导致这个错误? – 2012-08-08 11:37:57

+0

我可以重现..在堆栈跟踪中,我发现一条线在导入:: FireBug/onAdded ..请找到屏幕截图(http://i1155.photobucket.com/albums/p559/veeru-as/Stateexception巴纽) – 2012-08-08 11:53:21

相关问题