Type mismatch in assignment statement

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default Type mismatch in assignment statement

    Hi all,

    Here my problem

    tcrComp1.method = method.selectedItem;

    In the left side::
    tcrComp1: an object of type TCRComponents
    method : is an attribute of type String

    In the right side::
    method : is a comboBox that includes an array of Strings like

    <mx:ComboBox id="method" width="50">
    <mx:dataProvider>
    <mx:Array>
    <mx:String>post</mx:String>
    <mx:String>get</mx:String>
    </mx:Array>
    </mx:dataProvider>
    </mx:ComboBox>


    I have tried to do the following

    tcrComp1.method = String(method.selectedItem);
    tcrComp1.method = method.selectedItem.toString;
    tcrComp1.method = (String)method.selectedItem;

    But all of them fail.
    Where is the problem.? and how can I fix it?

    Thanks in advance




    Digital Hand Guest

  2. Similar Questions and Discussions

    1. Type mismatch error
      This query works fine on a live server using an MSSQL database: <cfquery name="qIndex" datasource="#appDSN#" username="shampoo"...
    2. Interface Type Mismatch
      This works in Java, so it is not clear why Actionscript does not implement it the same way. If an instance of a class that implements an Interface...
    3. Type mismatch?
      Hi i'm getting a type mismatch error, anyone tell me why pls? conn.Execute "DELETE FROM Bmemo WHERE (tDate <= '" & date() & "')" tDate is a...
    4. Type Mismatch
      I'm at my wits end here. I am getting type mismatch error in a ASP page when I try to multiply decimals*integers. This shouldn't be this difficult....
    5. Type Mismatch again
      Hi, One page passes a strIssueNo to another, so on the 2nd page: Dim IssueNo IssueNo = Request.Item("strIssueNo") This 2nd page is designed...
  3. #2

    Default Re: Type mismatch in assignment statement

    Is this in Flex 1.5 or Flex 2?

    For flex 2 try the following code sample.



    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">

    <mx:Script>
    <![CDATA[

    private var myObj:Object;

    [Bindable]
    private var debug:String;

    private function changeHandler( event:Event ):void
    {
    myObj = new Object();
    myObj.method = event.target.selectedItem as String;
    debug = myObj.method;
    }

    ]]>
    </mx:Script>


    <mx:ComboBox id="method" width="50" change="changeHandler(event)">
    <mx:dataProvider>
    <mx:String>post</mx:String>
    <mx:String>get</mx:String>
    </mx:dataProvider>
    </mx:ComboBox>

    <mx:Label text="{ debug }" />

    </mx:Application>

    Andrew Spaulding Guest

  4. #3

    Default Re: Type mismatch in assignment statement

    Andrew Spaulding , thanks for your replay.

    I am using Flex 1.5 right now.
    Digital Hand Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139