Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to override flex component rendering?
    primarykey
    data
    text
    <p>I am learning flex, but I cannot understand the phylosophy of action script overrides - assigning custom handler and calling super of that class does not produce the same result as I would suspect from normal inheritance mechanism.</p> <p>For example - a chart series has property ItemRenderer - pointing with the mouse gives out the base class for ?inheritance? in my case - </p> <pre><code>mx.charts.chartClasses.HLOCSeriesBase.itemRenderer </code></pre> <p>flex help gives this:</p> <pre><code>itemRenderer Type: mx.core.IFactory CSS Inheritance: No Language Version: ActionScript 3.0 Product Version: Flex 3 Runtime Versions: Flash9, AIR 1.1 A factory that represents the class the series will use to represent individual items on the chart. This class is instantiated once for each element in the chart. Classes used as an itemRenderer should implement the IFlexDisplayObject, ISimpleStyleClient, and IDataRenderer interfaces. The data property is assigned the chartItem that the skin instance renders. </code></pre> <p>so I went on and created a class witch inherits it:</p> <pre><code>package { // Empty package. import mx.charts.series.items.HLOCSeriesItem; import mx.core.IDataRenderer; import mx.core.IFlexDisplayObject; import mx.styles.ISimpleStyleClient; import flash.display.Graphics; import mx.charts.chartClasses.HLOCSeriesBase; import mx.charts.series.CandlestickSeries; public class CycleColorRenderer extends HLOCSeriesBase implements IFlexDisplayObject, ISimpleStyleClient, IDataRenderer { private var _chartItem:HLOCSeriesItem; public function CycleColorRenderer() { super(); } public function get data():Object { return _chartItem; } public function set data(value:Object):void { _chartItem = value as HLOCSeriesItem; invalidateDisplayList(); } override protected function updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); } } </code></pre> <p>MXML application rendering reasignment:</p> <pre><code>&lt;mx:CandlestickSeries dataProvider="{TICKER}" openField="open" highField="high" lowField="low" closeField="close" displayName="TICKER" itemRenderer="CycleColorRenderer" &gt; </code></pre> <p>It compiles OK, but running it I see an empty list and as C with some C++ programmer I fail to grasp what can go wrong here - all instances are doing what the base class would??</p> <p>Maybe there is some sort of language specific concepts about inheritance?</p>
    singulars
    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.
 

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