<quote>
On 6/26/06, Ian Skinner <[EMAIL PROTECTED]> wrote:
> If one can tell me how to easily create an array of my "Day" objects
> with data in them? Currently this is done by a ColdFusion CFC and the
> magic of remoteObject.
You can use <mx:Array> or in ActionScript create the array and add elements.
</quote>
I get how to create an array of basic value, not sure how to create an array of
objects.
<quote>
You should have a import path.to.Day; in a script block in the mxml file that
you use a Day instance. dayCells.currentItem as Day just castes
dayCells.currentItem to a Day object, eh? A couple things
1) I would think dayCells.currentItem should already be a Day object if your
Day.as and Day.cfc are setup properly. One of the beauties of remoting is the
'synching' of AS objects with server side objects. Can you post Day.as and
Day.cfc?
</quote>
I would have thought so, but I get the following error when I don't cast and/or
import a drawDay (as I have renamed Day to remove some confusion).
TypeError: Error #1034: Type Coercion failed: cannot convert [EMAIL PROTECTED]
to drawDay.
at MethodInfo-575()
at mx.binding::Binding/mx.binding:Binding::wrapFunctionCall()
at MethodInfo-1542()
at mx.binding::Binding/mx.binding:Binding::wrapFunctionCall()
at mx.binding::RepeatableBinding/::recursivelyProcessIDArray()
at mx.binding::RepeatableBinding/execute()
at mx.binding::BindingManager$/executeBindings()
at mx.core::Container/executeBindings()
at mx.core::Container/createComponentFromDescriptor()
at mx.core::Container/createComponentsFromDescriptors()
at mx.core::Container/mx.core:Container::createChildren()
at mx.core::UIComponent/initialize()
at mx.core::Container/initialize()
at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()
at
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdded()
at mx.core::Container/addChildAt()
at mx.core::Container/addChild()
at mx.core::Container/createComponentFromDescriptor()
at mx.core::Repeater/::createComponentFromDescriptor()
at mx.core::Repeater/::createComponentsFromDescriptors()
at mx.core::Repeater/::recreate()
at mx.core::Repeater/::execute()
at mx.core::Repeater/set dataProvider()
at MethodInfo-572()
at MethodInfo-1542()
at mx.binding::Binding/mx.binding:Binding::wrapFunctionCall()
at mx.binding::RepeatableBinding/::recursivelyProcessIDArray()
at mx.binding::RepeatableBinding/::recursivelyProcessIDArray()
at mx.binding::RepeatableBinding/execute()
at mx.binding::Binding/watcherFired()
at mx.binding::Watcher/notifyListeners()
at mx.binding::PropertyWatcher/eventHandler()
at flash.events::EventDispatcher/dispatchEvent()
at MobileCalendar/set days()
at MobileCalendar/resultHandler()
at MobileCalendar/__svc_result()
at flash.events::EventDispatcher/dispatchEvent()
at mx.rpc::AbstractService/dispatchEvent()
at mx.rpc.remoting.mxml::RemoteObject/dispatchEvent()
at
mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
at
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
at mx.rpc::Responder/result()
at mx.rpc::AsyncRequest/acknowledge()
at
::NetConnectionMessageResponder/NetConnectionChannel.as$42:NetConnectionMessageResponder::resultHandler()
at mx.messaging::MessageResponder/result()
<quote>
2) how are you fetching the data? Are you using a DAO? What is the return
type on your CFC method?
</quote>
I have built this off the Phones example. I have a mobileCalendar.cfc with a
getDays() function that returns an array of Day.cfc objects for each day of a
given 4 to 6 week period depending on the month. I have the drawDay.as (was
Day.as) file.
<mx:RemoteObject id="svc" destination="ColdFusion"
source="flex.MobileCalendar.CF.MobileCalendar"
result="resultHandler(event)"
showBusyCursor="true" />
private function initApp():void
{
// Force day class to load
svc.getCalendar(calDate, 2);
}
// getDays() result handler
public function resultHandler(event:ResultEvent):void
{
var p1:ArrayCollection = new ArrayCollection();
p1.source=event.result as Array;
days = p1;
}
creationComplete="initApp()">
<quote>
also try
<mx:GridItem width="14%">
<mx:Label text="{dayCells.currentItem.date.toString()}" color="white" />
<ian:dayFormat2 dayData="{dayCells.currentItem}" />
</mx:GridItem>
dunno about how that will align, but who cares just some testing, eh?
</quote>
Yes, that works. I was using that syntax when I was getting my custom
component to work. Now, I am trying to pass the entire object in, so that I
can use all the properties in the custom component.
<quote>
Have you got the FB debugging working yet? This will really help you determine
if the AS objects are getting the proper type. Had a issue with this myself
recently.
</quote>
No, when I tried to run with a break point, I got a dialog box asking what
server something was running on. Any value I tried produced no results.
Confidentiality Notice: This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:37:2874
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/37
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:37
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54