更改视图状态
大家好,我的问题是,当我在状态 1 下创建一个按钮并根据代码单击它时,它应该在另一个状态下创建一个名为“展开”的组。然而,根据我的代码,它仍在当前状态 1 中进行分组。任何指导将不胜感激。
mybutton.addEventListener(MouseEvent.CLICK, max);
public function max(event:MouseEvent):void
{
currentState = 'expand';
var s:String;
s = "abc";
var myGroup:Group = new Group();
myGroup.id = s;
addElement ( myGroup );
container_Class2(myGroup);
}
hi guys my problem is when i create a button in state 1 and click on it according to code it should make a group in another state named as expand. However according to my code it is still making group in current state 1. any guidance will be appreciated.
mybutton.addEventListener(MouseEvent.CLICK, max);
public function max(event:MouseEvent):void
{
currentState = 'expand';
var s:String;
s = "abc";
var myGroup:Group = new Group();
myGroup.id = s;
addElement ( myGroup );
container_Class2(myGroup);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
currentState
只是类的一个属性,不存在“在状态中创建某些东西”之类的东西。如果你向你的类添加一个元素,无论状态如何,它都会存在。您可以创建一个元素作为容器的子元素,该元素仅在特定状态下出现:
...
currentState
is just a property of your class, there is no such things as "creating something in a state". If you add an element to your class it will exist whatever the state is.You can create an element as a child of a container which appears only in a specific state:
...