开发者

Flex 3: Usuing a repeater & sending XML information to a component... havng some issues

开发者 https://www.devze.com 2023-03-01 06:50 出处:网络
I trying to import an XML file, and send bits and pieces to a custom component. My XML file is structured like this:

I trying to import an XML file, and send bits and pieces to a custom component.

My XML file is structured like this:

<projects>
  <project>
        <projName>{Insert title of project here}</projName>
        <startDate>{Insert date here}</startDate>
        <positions>
              <daysOffset>{Insert a number here}</daysOffset>
              <numDays>{Insert a number here}</daysOffset>
              <role>{Insert role here}</role>
              <student>{Insert name here}</student>
        </positions>
        // There can be an unlimited amount of positions listed
  </project>
  // There can be an unlimited amount of projects listed

I read in the XML data by using the following command:

<mx:XML id="projectsXML" xmlns="" source="xml/projects.xml" format="e4x" />

After the XML is imported, I try to use a repeater to send the information within each tag to a custom component. My code is below:

<mx:Canvas width="100%" height="95%" x="0" y="80">
    <mx:Repeater id="projectRP" dataProvider="{projectsXML}">
        <Block:project 
            oneDay="{usableSize.width/14}" 
            projectTitle="{projectRP.currentItem.project.projName}"
            projectDate="{projectRP.currentItem.pr开发者_如何学Pythonoject.startDate}"
            projectPositions="{projectRP.currentItem.project.positions as Array}"
            />
    </mx:Repeater>
</mx:Canvas>

When I save the project, I do not get any errors or warnings. However, when I attempt to output the values in the component, the projectPositions piece comes back as Null.

Anybody have any ideas? I've been trying to figure this out for the better part of two days, and I'm completely stumped :(


You're casting projectRP.currentItem.project.positions as Array but it is XMLList. So after casting you have null.

0

精彩评论

暂无评论...
验证码 换一张
取 消