• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Strange error that occurs randomly...

Explorer ,
Apr 02, 2012 Apr 02, 2012

Copy link to clipboard

Copied

HI,

I'm using flash builder and I have a strange error, this error occurs randomly and in order to fix it I do the following:

1) Remove the line where the error is

2) Save the file (so the workspace is rebuild), the problem is gone

3) Paste the line removed

4) Save again and there is no problem

Here's a piece of code:

protected function comboHandler(event:ComboEvent):void

{

          u.profilo = Profilo(event.picked);

}

The ComboEvent picked is of type Object

The u is referring to a class where there is a getter and setter

public function get profilo():Profilo

{

          return profilo_value;

}

 

public function set profilo(i:Profilo):void

{

          profilo_value = i;

}

The error I get from Flash Builder is

1118: Implicit coercion of a value with static type listClass:Profilo to a possibly unrelated type listClass:Profilo.

Why do I get this error?

Is it related to flash builder?

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

no one?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

It would be great if you share code snippets of the Profilo class?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

Here's the full Profilo Class

package testClass

{

  import mx.collections.ArrayList;

  public class Profilo

  {

  public var COD_CLIENTE:String = "";

  [Bindable]public var COD_PROFILO:String = "";

  public var DESC_PROFILO:String = "";

  public var selected:Boolean = false;

  private var FUNZIONI:ArrayList = new ArrayList();

  public function Profilo()

  {

  }

  public function getFunzione(i:int):String

  {

        var t:ProfiloFunzioni = ProfiloFunzioni(FUNZIONI.getItemAt(i));

        return t.COD_FUNZIONE;

   }

  public function get funzioniCount():int

  {

  return FUNZIONI.length;

  }

  }

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

Its gives error in this line :

u.profilo = Profilo(event.picked);

Its error related to type conversion. Refer the following example:

Application file:

<?xml version="1.0" encoding="utf-8"?>

<!-- http://bharatria.wordpress.com/ -->

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                                 xmlns:s="library://ns.adobe.com/flex/spark"

                                 xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

          <fx:Script>

                    <![CDATA[

                              import spark.events.IndexChangeEvent;

 

                              import testClass.Profilo;

                              protected function cb_changeHandler(event:IndexChangeEvent):void

                              {

                                             // TODO Auto-generated method stub

                                             var classRef:Profilo = new Profilo();

                                             classRef.profilo = String(cb.selectedItem);

                              }

                    ]]>

          </fx:Script>

 

          <s:ComboBox id="cb"

                                        change="cb_changeHandler(event)">

                    <s:ArrayList>

                              <fx:String>Flash</fx:String>

                              <fx:String>Flex</fx:String>

                              <fx:String>Dreamweaver</fx:String>

                              <fx:String>Photoshop</fx:String>

                    </s:ArrayList>

          </s:ComboBox>

 

 

</s:Application>

Profilo Class :

package testClass

{

          import mx.collections.ArrayList;

 

          public class Profilo

          {

                    public var profilo_value:String = "";

 

                    public function get profilo():String

                    {

                              return profilo_value;

                    }

 

                    public function set profilo(i:String):void

                    {

                              profilo_value = i;

                    }

          }

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 16, 2012 Apr 16, 2012

Copy link to clipboard

Copied

LATEST

profilo is not a string but an Object (of the class Profilo) so I can not do what's in the example...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines