Flex4:如何在类中创建视图状态(代码隐藏) [英] Flex4: how to create the view states in as class (code-behind)

查看:160
本文介绍了Flex4:如何在类中创建视图状态(代码隐藏)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据Adobe的这个文档创建并应用视图状态

a>是< s:State /> 一个状态对象。
如何在ActionScript代码中创建视图状态?

我不必使用皮肤结构来声明状态。我甚至不声明扩展WindowedApplication的ApplicationClass中的状态。
解决方案是:只在Main.MXML中声明状态,并且使用正确的命名空间,在我的情况下它应该是custom。
这里是Main.MXML:

 <?xml version =1.0encoding =utf-8 >?; 
xmlns:s =library://ns.adobe.com/flex/spark
xmlns:mx =library://ns.adobe.com/flex/mx
xmlns:custom =components。*>
< custom:states>
< / custom:states>


< / custom:ApplicationClass>

我只想在不同的面板之间切换,所以这个方法对我很好。当然还有其他一些情况,在这些情况下,需要在剥皮的时候声明这些状态。
我已经从这个链接获得了这个解决方案:
错误:无法解析到组件实现。 / a>


According to this document from Adobe Create and apply view states is <s:State/> a state object. How to create the view states in code-behind ActionScript class?

解决方案

I have found a simple solution, and I don't have to declare the states using skinning architecture. I don't even to declare the states in my ApplicationClass which extends WindowedApplication. The solution is: declare the states only in the Main.MXML and by all means with the right namespace, in my case it should be "custom". Here is the Main.MXML:

<?xml version="1.0" encoding="utf-8"?>
<custom:ApplicationClass xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:s="library://ns.adobe.com/flex/spark"
                         xmlns:mx="library://ns.adobe.com/flex/mx"
                         xmlns:custom="components.*">
    <custom:states>  
        <s:State name="loginState"/> 
        <s:State name="infoState"/>
    </custom:states>

    <s:Panel id="loginPanel" title="Login" includeIn="loginState" />

</custom:ApplicationClass>

I only want to change between different Panels, so this method works well for me. There are certainly other cases, in which the states need to be declared in skinning. I have got this solution form this link: Error: Could not resolve to a component implementation.

这篇关于Flex4:如何在类中创建视图状态(代码隐藏)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆