스피에서 : http://tourdeflex.adobe.com/flex4samples/GroupsAndContainers/TabbedNavigator/sample1.html
무슨 실수를 내 코드이 같은 출력을 재현하는 tyring
다음은 내 자신의 코드는 자신을 개발하지만, 스피 필요하지 않음지고 출력이 .. 무엇이 잘못되었는지 잘 모릅니다. pls는 친절하게 내 코드를 실행하고 나에게 정확한 솔루션을 제공합니다
TabBarDemo.mxml을
<?xml version="1.0" encoding="utf-8"?>
<s:Application 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:components="components.*">
<fx:Script>
<![CDATA[
import events.EmployeeEvent;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import vo.EmployeeVO;
public var empVO: EmployeeVO;
[Bindable]
public var empList: ArrayCollection;
protected function contactInfo_employeeEventHandler(event:EmployeeEvent):void
{
empVO = event.employeeInfoVO;
if(empVO != null)
empList.addItem(empVO);
else
Alert.show("Object is null");
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:VGroup>
<s:TabBar dataProvider="{contact}" />
<mx:ViewStack id="contact"
resizeToContent="true">
<components:ContactInfo id="contactInfo"
label="Employee Info"
employeeEvent="contactInfo_employeeEventHandler(event)"/>
<components:ContactList label="Employee List"
empList="{empList}"/>
</mx:ViewStack>
</s:VGroup>
</s:Application>
ContactInfo.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:NavigatorContent xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">
<fx:Metadata>
[Event(name="employeeEvent", type="events.EmployeeEvent")]
</fx:Metadata>
<fx:Script>
<![CDATA[
import events.EmployeeEvent;
import vo.EmployeeVO;
protected function submit_clickHandler(event:MouseEvent):void
{
var empVO: EmployeeVO = new EmployeeVO();
empVO.empName = empName.text;
empVO.address = address.text;
empVO.state = state.text;
empVO.city = city.text;
empVO.zip = zip.text;
var empEvent: EmployeeEvent = new EmployeeEvent("employeeEvent", empVO);
dispatchEvent(empEvent);
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Form>
<s:FormItem label="Name">
<s:TextInput id="empName"/>
</s:FormItem>
<s:FormItem label="Address">
<s:TextInput id="address" />
</s:FormItem>
<s:FormItem label="City">
<s:TextInput id="city" />
</s:FormItem>
<s:FormItem label="State">
<s:TextInput id="state" />
</s:FormItem>
<s:FormItem label="Zip">
<s:TextInput id="zip" />
</s:FormItem>
<s:FormItem>
<s:Button id="submit"
label="Submit"
click="submit_clickHandler(event)"/>
</s:FormItem>
</s:Form>
</s:NavigatorContent>
ContactList.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:NavigatorContent xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"
>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import spark.components.List;
import vo.EmployeeVO;
[Bindable]
public var empList: ArrayCollection;
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:DataGrid dataProvider="{empList}"/>
</s:NavigatorContent>
EmployeeEvent.as
package events
{
import flash.events.Event;
import vo.EmployeeVO;
public class EmployeeEvent extends Event
{
public var employeeInfoVO: EmployeeVO;
public function EmployeeEvent(type: String, employeeInfoVO: EmployeeVO)
{
super(type);
this.employeeInfoVO = employeeInfoVO;
}
}
}
EmployeeVO.as
package vo
{
public class EmployeeVO
{
public function EmployeeVO()
{
}
public var empName: String;
public var address: String;
public var state: String;
public var city: String;
public var zip: String;
}
}
응답을 기다리는 중!
오류 출력이 있습니까? FYI : swf를 마우스 오른쪽 버튼으로 클릭하고 "소스보기"를 선택하여 해당 TourDeFlex 예제의 소스를 볼 수 있습니다. 다음은 직접 링크입니다 : http://tourdeflex.adobe.com/flex4samples/GroupsAndContainers/TabbedNavigator/srcview/index.html – dvdgsng
iam은 필수 출력을 얻지 못하고 있습니다. iam은이 예제의 소스 코드를 사용하지 않고 있습니다. 구성 요소를 사용하여 노력하고 있습니다 .. –