It doesn't work because Array methods like push(), unshift(), and splice() 
can't trigger databinding or any kind of notification to other objects that the 
array has changed. They are low-level player-level methods that don't send out 
events. Flex data provider APIs do send out events:

push() -> addItem()
unshift() -> addItemAt()
splice() -> addItemsAt()

- Gordon


-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alberto 
Albericio Salvador
Sent: Thursday, September 01, 2005 5:30 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Strange List behaviour

That worked, I cant imagine why the unshift method was not doing the job.

Thanks Clint.

Clint Modien escribió:

> From the livedocs
> http://livedocs.macromedia.com/flex/15/asdocs_en/
>  
> ||
>       |*addItemsAt* 
> <http://livedocs.macromedia.com/flex/15/asdocs_en/mx/controls/listclasses/DataProvider.html#addItemsAt>(
>  
> index: Number, newItems: Array) :  Void
> |Adds several items to the array.
>
>
> so your code might look like this to add data to the beginning of the 
> array...
>  
> var newItemsArray = [ newMsgFromPushData];
> listComponentsID.dataProvider.addItemsAt(0, newItemsArray );
>  
> On 9/1/05, *Alberto Albericio Salvador* <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Hi all,
>
>     Im using a List component to display the messages incoming from a "msg
>     push server". The dataProvider of the List is bound to "some array
>     variable". If I use the method *addItem* to inject data into the
>     array;
>     as a result of this action, the List grows downwards, leaving the
>     first
>     element always visible and loosing the last added msgs lost (gotta
>     use
>     the scrollbar to find them at the end). Well, I want the List to grow
>     upwards so that the last incoming msg gets displayed the first. I use
>     the *unshift* method but the array does not get modified. So, what is
>     happening here?
>
>     I know this is not a natural Flex question but I cant find why it
>     is not
>     working the way I want.
>
>     Nuke this post if you feel this is not the right place for it and
>     sorry.
>
>     --
>     Alberto Albericio Salvador
>     Aura S.A. Seguros
>     Departamento Informática
>
>
>
>     ------------------------ Yahoo! Groups Sponsor
>
>     --
>     Flexcoders Mailing List
>     FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>     Search Archives:
>     http://www.mail-archive.com/flexcoders%40yahoogroups.com
>     Yahoo! Groups Links
>
>     <http://groups.yahoo.com/group/flexcoders/>
>
>     <mailto:[EMAIL PROTECTED]>
>
>
>
>
>
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
>
>
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>
>     *  Visit your group "flexcoders
>       <http://groups.yahoo.com/group/flexcoders>" on the web.
>        
>     *  To unsubscribe from this group, send an email to:
>        [EMAIL PROTECTED]
>       <mailto:[EMAIL PROTECTED]>
>        
>     *  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------------------------------------------------
>


-- 
Alberto Albericio Salvador
Aura S.A. Seguros
Departamento Informática




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to