Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex ItemRenderer Example Troubles, what am I doing wrong
    primarykey
    data
    text
    <p>Hello to whomever wishes to help me.</p> <p>I'm trying to implement this example: <a href="http://ramblingdeveloper.com/ramblings/2011/9/24/creating-a-flex-spark-list-of-checkbox-bound-to-xml-dataprov.html" rel="nofollow">http://ramblingdeveloper.com/ramblings/2011/9/24/creating-a-flex-spark-list-of-checkbox-bound-to-xml-dataprov.html</a></p> <p>My example is fairly the same with a few small differences which I modified the whole code accordingly.</p> <p>My MXML Application:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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" minWidth="955" minHeight="600"&gt; &lt;fx:Declarations&gt; &lt;fx:XML format="e4x" id="namesXML"&gt; &lt;people&gt; &lt;person&gt; &lt;name&gt;Leon&lt;/name&gt; &lt;/person&gt; &lt;person&gt; &lt;name&gt;Mathilda&lt;/name&gt; &lt;/person&gt; &lt;person&gt; &lt;name&gt;Stansfield&lt;/name&gt; &lt;/person&gt; &lt;person&gt; &lt;name&gt;Benny&lt;/name&gt; &lt;/person&gt; &lt;/people&gt; &lt;/fx:XML&gt; &lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt; &lt;/fx:Declarations&gt; &lt;fx:Script&gt; &lt;![CDATA[ import mx.collections.XMLListCollection; var temp:XMLListCollection = new XMLListCollection(namesXML.children()); ]]&gt; &lt;/fx:Script&gt; &lt;s:List itemRenderer="CheckBoxItemRenderer" dataProvider="{temp}"/&gt; </code></pre> <p></p> <p>and my MXML ItemRenderer:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" autoDrawBackground="true"&gt; &lt;s:CheckBox label="{data.person.name}"/&gt; &lt;/s:ItemRenderer&gt; </code></pre> <p>I keep getting a Null Object Reference and have been messing around with where I think the problem is:</p> <pre><code>&lt;s:CheckBox label="{data.person.name}"/&gt; </code></pre> <p>Which is how I'm accessing my XML data, but I'm not 100% sure since XML and XML traversal isn't my strongest point. Any small insight would help while I sit and keep tweaking it on my end for a breakthrough.</p> <p>EDIT: Fixed the ItemRenderer code, was missing the closing tag. EDIT #2: The name of my ItemRenderer file is CheckBoxItemRenderer like the example has.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload