I experienced the same problem (error message) when trying to cast 
the selected item of the master array to it's associated VO.  After 
trying the code from the Store, Login and Phone samples, with no 
resolution, I decided to work around it - for now.  I was able to 
cast the individual elements (ModelLocator.getInstance
().phoneVO.description = phones[0].description).  But, if you had to 
do this in every command, the idea of a centrally defined VO in the 
model would be lost.  I wonder if something changed to break this 
feature between Beta1 and Beta2.  

- Tim Hoff


--- In flexcoders@yahoogroups.com, "Rick Schmitty" <[EMAIL PROTECTED]> 
wrote:
>
> Hello I'm trying to get the phone selector running on cairngorm 2 
and
> am having some problems
> 
> After chaning references to http://www.adobe.com/2006/mxml and
> changing ApplicationView.mxml setPropety from <mx:SetProperty
> property="enabled" value="false" /> to <mx:SetProperty 
name="enabled"
> value="false" />  I also changed PhoneVO.as to implement 
ValueObject
> 
> I now get:
> 
> "Implicit coercion of a value with static type 'Object' to a 
possibly
> unrelated type 'com.mycompany.phones.model:PhoneVO'"
> 
> 
> Here is the ApplicationView.mxml
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml";
>       xmlns:view="com.mycompany.phones.view.*"
>       currentState="{model.applicationState}"
>       height="400"
>       layout="horizontal"
>       title="Nokia Phone Selector"
>       width="700">
>       
>       <mx:Script>
>               <![CDATA[
>                       import 
com.mycompany.phones.model.ApplicationModel;    
>                       import com.mycompany.phones.model.PhoneVO;
>                       import 
com.mycompany.phones.controller.PhoneGetEvent;
>                       import flash.events.Event;
>                       
>                       public static var STATE_DEFAULT:String = "";
>                       public static var STATE_LOADING:String 
= "loading";
>                       
>                       [Bindable]
>                       public var model:ApplicationModel = 
ApplicationModel.getInstance();
>               ]]>
>       </mx:Script>
>       
>       <mx:List id="phoneList"
>               dataProvider="{model.phones}"
>               height="100%"
>               labelField="name"
>               width="150" />
>               
>       <view:PhoneDetails id="phoneDetails"
>               phone="{phoneList.selectedItem}"
>               width="100%" />
>       
>       <mx:states>
>               
>               <mx:State name="{STATE_LOADING}">
>               
>                       <mx:SetProperty name="enabled" 
value="false" />
>                               
>               </mx:State>
>               
>       </mx:states>
>       
> </mx:Panel>
> 
> 
> And here is the PhoneVO:
> 
> package com.mycompany.phones.model {
>       
>       import org.nevis.cairngorm.vo.ValueObject;
>       
>       [Bindable]
>       [RemoteClass(alias="com.mycompany.phones.model.PhoneVO")]
>       
>       public class PhoneVO implements ValueObject {
>       
>               public var name:String;
>               public var description:String;
>               public var price:Number;
>               public var image:String;
>               public var series:String;
>               public var triband:Boolean;
>               public var camera:Boolean;
>               public var video:Boolean;
>               public var highlight1:String;
>               public var highlight2:String;
> 
>               public function PhoneVO() {
>                       name  = "";
>                       description = "";
>                       price = 0;
>                       image = "";
>                       series = "";
>                       triband = false;
>                       camera = false;
>                       video = false;
>                       highlight1 = "";
>                       highlight2 = "";
>               }
>               
>       }
> }
> 
> And here is PhoneVO.cfc
> 
> <cfcomponent>
> 
> <cfproperty name="name" type="string" default="">
> <cfproperty name="description" type="string" default="">
> <cfproperty name="price" type="numeric" default="0">
> <cfproperty name="image" type="string" default="">
> <cfproperty name="series" type="string" default="">
> <cfproperty name="triband" type="boolean" default="false">
> <cfproperty name="camera" type="boolean" default="false">
> <cfproperty name="video" type="boolean" default="false">
> <cfproperty name="highlight1" type="string" default="">
> <cfproperty name="highlight2" type="string" default="">
> 
> <cffunction name="init" output="false"
> returntype="com.mycompany.phones.model.PhoneVO">
>       <cfscript>
>       this.name = "";
>       this.description = "";
>       this.price = 0;
>       this.image = "";
>       this.series = "";
>       this.triband = "false";
>       this.camera = "false";
>       this.video = "false";
>       this.highlight1 = "";
>       this.highlight2 = "";
>       </cfscript>
>       <cfreturn this />
> </cffunction>
> 
> <cffunction name="populate" output="false" returntype="void">
>       <cfargument name="data" type="Struct" />
>       <cfscript>
>       this.name = data.name;
>       this.description = data.description;
>       this.price = data.price;
>       this.image = data.image;
>       this.series = data.series;
>       this.triband = data.triband;
>       this.camera = data.camera;
>       this.video = data.video;
>       this.highlight1 = data.highlight1;
>       this.highlight2 = data.highlight2;
>       </cfscript>
> </cffunction>
>       
> </cfcomponent>
> 
> 
> I can't tell what other object I'm not being strict enough on,
> anything obvious missing?
>







--
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