我是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 = "john@doe.com";
somebody.twitter = "@johndoe";
people.addItem(somebody);
somebody = new Object();
somebody.firstname = "Jane";
somebody.lastname = "Baker";
somebody.phone = "5559981272";
somebody.email = "jane@baker.com";
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 app)吗?谢谢大家。
发布于 2011-09-27 14:47:15
Flex Android应用程序只不过是美化了的浏览器。您可以在浏览器上测试代码并找出问题所在。
https://stackoverflow.com/questions/7565195
复制相似问题