Flex4: how to create the view states in as class (code-behind)

本小妞迷上赌 提交于 2019-12-25 08:25:13

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/42549177/flex4-how-to-create-the-view-states-in-as-class-code-behind

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!