I created separate own canvas component for Home page, Contact page, Rules page etc. In my main application it has link button like Home,Contact,Rules in application controller(child state) .
我为主页,联系页面,规则页面等创建了单独的自己的画布组件。在我的主应用程序中,它有应用程序控制器(子状态)中的Home,Contact,Rules等链接按钮。
<?xml version="1.0" encoding="utf-8"?><mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="903" height="508" backgroundImage="@Embed(source='image/mainbackground.png')">
<mx:label x="483" y="166" label="Welcome to our site"/>
<mx:DateChooser x="229" y="166"/>
If you click home button then show homepage canvas. How can i Implement? or refer me any url for study
如果单击主页按钮,则显示主页画布。我该如何实施?或者推荐我学习任何网址
1 个解决方案
#1
Between the script tags
脚本标签之间
public static const HOME:Number = 0;
public static const CONTACT:Number = 1;
You can use a viewstack to display different views and myStack.selectedIndex is just a number but I like it more to do this with a static value so you only have to change it on one place if something changes
您可以使用视图堆栈来显示不同的视图,myStack.selectedIndex只是一个数字,但是我更喜欢使用静态值来执行此操作,因此您只需要在某个地方更改它
<mx:LinkButton label="home" click="{myStack.selectedIndex = HOME}"/>
<mx:ViewStack id="myStack" creationPolicy="auto" width="100%" height="100%">
<view:Home/>
<view:Contact/>
</mx:ViewStack>
#1
Between the script tags
脚本标签之间
public static const HOME:Number = 0;
public static const CONTACT:Number = 1;
You can use a viewstack to display different views and myStack.selectedIndex is just a number but I like it more to do this with a static value so you only have to change it on one place if something changes
您可以使用视图堆栈来显示不同的视图,myStack.selectedIndex只是一个数字,但是我更喜欢使用静态值来执行此操作,因此您只需要在某个地方更改它
<mx:LinkButton label="home" click="{myStack.selectedIndex = HOME}"/>
<mx:ViewStack id="myStack" creationPolicy="auto" width="100%" height="100%">
<view:Home/>
<view:Contact/>
</mx:ViewStack>