Thank you for your reply,
 
This is very odd, it's been a while that i'm having this weird behavior, everything is fine now without changing my code, I just stopped my flex instance, deleted generated files and re-launched the instance. It's not the first time this happens.
 
 

João Fernandes

Secção de Desenvolvimento

Departamento de Informática

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of kaibabsowats
Sent: quarta-feira, 31 de Agosto de 2005 6:18
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Model changed when used as dataProvider (Cairngorm)

This is a stab in the dark.

When calling
"EventBroadcaster.getInstance().broadcastEvent("someCommand",
modelLocator.myArray)" the EventBroadcaster takes the
modelLocator.myArray parameter and sets the event.data object, which
actaully keeps a pointer to modelLocator.myArray.  Then it calls
dispatchEvent( event ).  Somewhere in the event object the event.data
will be set to some undefined or some unwanted value. 

To alleviate this just create a new instance of the myArray before
calling the broadcastEvent funciton like this:

var tmpArray:Array = new Array();
for( var a in modelLocator.myArray ) {
    tmpArray[ a ] = modelLocator.myArray[ a ];
}
EventBroadcaster.getInstance().broadcastEvent("someCommand", tmpArray);

This will work for simple arrays, if they are nested objects you might
want to double check that all the data is created in the new temp Array.


--- In flexcoders@yahoogroups.com, João Fernandes <[EMAIL PROTECTED]>
wrote:
> Hi there,

> When broadcasting an event in cairngorm an using an array from my
modelLocator as parameter it works fine till I use the same parameter
as dataProvider (for some component).
> <!---
> EventBroadcaster.getInstance().broadcastEvent("someCommand",
modelLocator.myArray)
> --->
> If I broadcast without using ModelLocator.myArray as a dataProvider,
the array passed is the correct but if I use something like this :
>  <mx:DataGrid id="dg" dataProvider="{modelLocator.myArray}"> what I
get in my command is an array of length of 1 with my array inside it.

>  I'm binding directly the modelLocator.myArray because any changes
in the dataGrid updates my model.

> Anyone knows this issue? or knows a workaround?
> Thanks

>
> João Fernandes
>
> Secção de Desenvolvimento
>
> Departamento de 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




Reply via email to