You can try and put an if that prevents changing the maximum or the data
property if they aren't any different.

if( value !== data ) {
   // do your function in here.
}

That will prevent it from looping.

Charlie

On Mon, Sep 13, 2010 at 1:21 AM, Laurence MacNeill
<[email protected]>wrote:

> Yep -- it appears that when you change the maximum, minimum, or value, the
> set data function gets called...   That's it then...
>
> Thanks,
> L.
>
>
>
> On Sun, Sep 12, 2010 at 11:30 PM, Marty Blood <[email protected]>wrote:
>
>> It's probably the maximum that is causing the loop.  You could just try
>> commenting that out and see if it solves the stack overflow error.  If so
>> then you'll know that Kit was right in that setting the maximum in turn
>> calls set data.
>>
>> You might try overriding the set maximum function then too and control it
>> that way to avoid having it caught in the loop.
>>
>> -Marty
>>
>>
>> On Sun, Sep 12, 2010 at 10:56 PM, Laurence MacNeill <
>> [email protected]> wrote:
>>
>>> And why don't my other custom Item Renderers get stuck in the same loop?
>>> I'm referencing 'data' in them as well -- shouldn't their get/set data
>>> functions get caught in the same infinite loop?
>>>
>>> L.
>>>
>>>
>>>
>>> On Sun, Sep 12, 2010 at 10:53 PM, Laurence MacNeill <
>>> [email protected]> wrote:
>>>
>>>> Yeah, it seems that way to me too...  So how do I stop that?  Is it not
>>>> possible to use a Numeric Stepper in a DataGrid as an Item Renderer, then?
>>>> That can't be right...
>>>>
>>>> L.
>>>>
>>>>
>>>>
>>>> On Sun, Sep 12, 2010 at 10:50 PM, Kit McCormick <
>>>> [email protected]> wrote:
>>>>
>>>>> Just a guess:
>>>>> Changing the maximum value of the slider causes set data to be called,
>>>>> and so you're code is in an infinite loop.
>>>>>
>>>>> On Sun, Sep 12, 2010 at 9:54 PM, Laurence MacNeill
>>>>> <[email protected]> wrote:
>>>>>  > I'm trying to use a Numeric Stepper as a custom Item Renderer and
>>>>> Editor in
>>>>> > a DataGrid...  I keep getting a Stack Overflow error...
>>>>> >
>>>>> > Please, someone tell me what the heck is wrong with this code?!
>>>>> Because I
>>>>> > see nothing wrong with it...
>>>>> >
>>>>> > The column from the DataGrid looks like this:
>>>>> > <mx:DataGridColumn headerText="Qty" dataField="user_sold" width="25"
>>>>> > editable="true" itemRenderer="com.ItemRenderers.QtyRenderer"
>>>>> > rendererIsEditor="true" editorDataField="value"/>
>>>>> >
>>>>> > And the file QtyRenderer.mxml looks like this:
>>>>> > <?xml version="1.0" encoding="utf-8"?>
>>>>> > <mx:NumericStepper xmlns:mx="http://www.adobe.com/2006/mxml";
>>>>> > width="100%" minimum="1" stepSize="1">
>>>>> >
>>>>> >      <mx:Script>
>>>>> >           <![CDATA[
>>>>> >                public override function set data(value:Object):void {
>>>>> >                     super.data = value;
>>>>> >                     if (data != null) {
>>>>> >                          this.maximum = data.sell_limit;
>>>>> >                     }
>>>>> >                }
>>>>> >
>>>>> >           ]]>
>>>>> >      </mx:Script>
>>>>> >
>>>>> > </mx:NumericStepper>
>>>>> >
>>>>> > The 'data' being referenced is a value-object with many fields in it,
>>>>> two of
>>>>> > which are user_sold (the amount the user has purchased) and
>>>>> sell_limit (the
>>>>> > maximum amount the user may purchse).  Seems simple enough to set a
>>>>> damn
>>>>> > maximum on a Numeric Stepper -- but for some reason it just won't
>>>>> work with
>>>>> > the above example...  Can someone PLEASE tell me why?
>>>>> >
>>>>> > Thanks,
>>>>> > Laurence MacNeill
>>>>> > Mableton, Georgia, USA
>>>>> >
>>>>>
>>>>>
>>>>> -------------------------------------------------------------
>>>>> To unsubscribe from this list, simply email the list with unsubscribe
>>>>> in the subject line
>>>>>
>>>>> For more info, see http://www.affug.com
>>>>> Archive @ http://www.mail-archive.com/discussion%40affug.com/
>>>>> List hosted by http://www.fusionlink.com
>>>>> -------------------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>

Reply via email to