Flex 移动应用程序列表 (android)
我是 Flex android 的新手,我现在一直在练习这个。我这里有一个带有 Flex Android 应用程序(AS3)的锻炼程序。这是我的 HomeView.mxml 的代码:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
title="Home">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var people:ArrayCollection;
private function init():void
{
people = new ArrayCollection();
var somebody:Object = new Object();
somebody.firstname = "John";
somebody.lastname = "Doe";
somebody.phone = "555213412";
somebody.email = "[email protected]";
somebody.twitter = "@johndoe";
people.addItem(somebody);
somebody = new Object();
somebody.firstname = "Jane";
somebody.lastname = "Baker";
somebody.phone = "5559981272";
somebody.email = "[email protected]";
somebody.twitter = "@janebaker";
people.addItem(somebody);
}
private function handleClick():void
{
navigator.pushView( PeopleDetails, peopleList.selectedItem );
}
]]>
</fx:Script>
<s:List id="peopleList" dataProvider="{people}" click="handleClick()" labelField="name" width="100%" height="100%" />
</s:View>
这是我的 PeopleDetails.mxml 的代码:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
title ="Person Details">
<fx:Script>
<![CDATA[
private function gotoHome():void
{
navigator.popToFirstView();
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:layout>
<s:VerticalLayout paddingBottom="5" paddingLeft="5" paddingRight="5" paddingTop="5"/>
</s:layout>
<s:Form width="100%" height="100%">
<s:FormItem label="Name:" width="100%">
<s:Label text="{data.name}"/>
</s:FormItem>
<s:FormItem label="Phone:" width="100%">
<s:Label text="{data.phone}"/>
</s:FormItem>
<s:FormItem label="Email:" width="100%">
<s:Label text="{data.email}"/>
</s:FormItem>
<s:FormItem label="Twitter:" width="100%">
<s:Label text="{data.twitter}"/>
</s:FormItem>
</s:Form>
<s:navigationContent>
<s:Button label="Home" click="gotoHome()"/>
</s:navigationContent>
</s:View>
现在,我的问题是,为什么我看不到我的列表,并且如果单击屏幕中的任意位置,它会带来我到 PeopleDetails.mxml 视图,仍然没有显示数据(但标签在那里)。?我的代码中遗漏了什么?
顺便说一句,我目前正在为我的应用程序使用 FlashDevelop,您可以推荐一些东西让我学习它(flex android 应用程序)吗?谢谢大家。
I am new in flex android and I've been practicing this right now. I have here an exercise program with flex android app (AS3). Here's the code of my HomeView.mxml:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
title="Home">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var people:ArrayCollection;
private function init():void
{
people = new ArrayCollection();
var somebody:Object = new Object();
somebody.firstname = "John";
somebody.lastname = "Doe";
somebody.phone = "555213412";
somebody.email = "[email protected]";
somebody.twitter = "@johndoe";
people.addItem(somebody);
somebody = new Object();
somebody.firstname = "Jane";
somebody.lastname = "Baker";
somebody.phone = "5559981272";
somebody.email = "[email protected]";
somebody.twitter = "@janebaker";
people.addItem(somebody);
}
private function handleClick():void
{
navigator.pushView( PeopleDetails, peopleList.selectedItem );
}
]]>
</fx:Script>
<s:List id="peopleList" dataProvider="{people}" click="handleClick()" labelField="name" width="100%" height="100%" />
</s:View>
And this is the code of my PeopleDetails.mxml:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
title ="Person Details">
<fx:Script>
<![CDATA[
private function gotoHome():void
{
navigator.popToFirstView();
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:layout>
<s:VerticalLayout paddingBottom="5" paddingLeft="5" paddingRight="5" paddingTop="5"/>
</s:layout>
<s:Form width="100%" height="100%">
<s:FormItem label="Name:" width="100%">
<s:Label text="{data.name}"/>
</s:FormItem>
<s:FormItem label="Phone:" width="100%">
<s:Label text="{data.phone}"/>
</s:FormItem>
<s:FormItem label="Email:" width="100%">
<s:Label text="{data.email}"/>
</s:FormItem>
<s:FormItem label="Twitter:" width="100%">
<s:Label text="{data.twitter}"/>
</s:FormItem>
</s:Form>
<s:navigationContent>
<s:Button label="Home" click="gotoHome()"/>
</s:navigationContent>
</s:View>
Now, my problem is, why is it that I can't see my list, and that if just click anywhere in the screen, it brings me to the the PeopleDetails.mxml view, and still, no data shown (but the labels where there).? What did I miss in my code?
And by the way, I'm currently using FlashDevelop for my apps, is there something you can recommend for me to study about it (flex android app)? thanks all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Flex Android 应用程序只不过是美化的浏览器。您可以在浏览器上测试您的代码并找出问题所在。
Flex Android Apps are nothing more than glorified browser. You can test your code on the browser and figure out the problem.