Error:1067 - Implicit coercion of a value of type QName to an unrelated type QName

hi,
I'm new in flex and my english not good. I'll try to explain
my problem :(
I have an application mxml and a component mxml. I imported a
wsdl from .net webservice.
In main mxml I added:
<mx:Application .....
xmlns:webservices="generated.webservices.*"/>
and
<webservices:xService id="m_service"/>
there is no problem for this. But when I added into component
mxml like this:
<mx:Canvas.....
xmlns:webservices2="generated.webservices.*"/>
and
<webservices2:xService id="m_service2"/>
I'm getting the following error:
error line sample: (and 633 similar lines in
generated.webservices)
responseMessage.wrappedQName = new QName("
http://tempuri.org/","GetMemberListResponse");
error:
1067: Implicit coercion of a value of type QName to an
unrelated type QName
When I removed the <webservices2:xService
id="m_service2"/> line from component mxml, I'm not getting an
error.
Flex 3.0 - sdk 4.0
Thanx for your helps

thanx your answer,
I changed (like this:[WebService(Namespace = "
http://Info.WebService/MyInfoService"))
but it doesn't work. I still have same problem.
It's really strange problem. When I used in application mxml,
it's working. But when I used in component mxml, I'm getting error.
I tested the web servise in other test application mxml with
following code: (it's working excellent)
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" xmlns:webservices="generated.webservices.*"
creationComplete="test12()">
<mx:Script>
<![CDATA[
import mx.rpc.AsyncToken;
private function test12():void
m_service12.addgetFuelList_header(GetAuthHeader());
m_service12.getFuelList();
]]>
</mx:Script>
<mx:Script source="***/ServiceAuthHeaderGetter.as"/>
<webservices:TankInfoService id="m_service12"/>
<mx:DataGrid
dataProvider="{m_service12.getFuelList_lastResult}">
</mx:DataGrid>
</mx:Application>
And finally I closed "Enable strict type checking" from
project properties and the errors are disappeared.
But now I got new problems with webservice :)
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
I guess <webservices:TankInfoService id="m_service"/>
is null.
But why?
in component mxml
I added xmlns:webservices="generated.webservices.*" namespace
and
<webservices:TankInfoService id="m_service"/>
my code is:
m_service.addgetMemberList_header(GetAuthHeader());
m_service.getMemberByUserPassword(this.txtUser.text,
this.txtPassword.text);
the error:
TypeError: Error #1009: Cannot access a property or method
of a null object reference.
Any ideas???

Similar Messages

  • 1067: Implicit coercion of a value of type void to an unrelated type mx.collections:ArrayCollection.

    Here is what I have going on.
    When a button in my app is clicked it will instantiate a new object called ButtonCommand, within that object I create a new instance of a ListVO called vo.  I then reference my model object that also has a separate instance of the same Value Object ListVO class, reference its properties and place it into the corresponding property of the new VO object. Here is the code.
    var vo:ListVO = new ListVO();
    vo.name = model.list.name;
    vo.id = model.list.id;
    vo.amount = model.list.amount;
    vo.category = model.list.category;
    Within that same ButtonCommand class, next line I am trying to add the new ListVO instance to an arrayCollection that is also referenced from my model object, so here is the code for that.
    model.listCollection = model.listCollection.addItem(vo);
    I get the following error : -1067: Implicit coercion of a value of type void to an unrelated type mx.collections:ArrayCollection.
    And here is my getter/setter for the model.listCollection.
    public function get listCollection ():ArrayCollection
          return _listCollection;
    public function set listCollection(value:ArrayCollection):void
          _listCollection = value;
    Any Ideas?

    I thought model.listCollection is an ArrayCollection?
    model.listCollection is an ArrayCollection as shown in the example model code a few posts back.
    public class Model extends Actor
         //- PROPERTIES - //
         //-- other properties are here
         private var _listCollection:ArrayCollection = new ArrayCollection();
         public function Model()
         super();
         //other getter and setters here
         public function get listCollection ():ArrayCollection
         return _listCollection;
         public function set listCollection(value:ArrayCollection):void
         _listCollection = value;
    I am finding this to be very odd, seems like a simple getter setter situation, but I feel I must be missing something. The code trace(model.listCollection); should trace out as an ArrayCollection and not the VO object I am trying to add to it. Also when i run the code model.listCollection.addItem(vo); it should add the vo to the array collection through my setter, but yet it seems to try to access my getter.
    I took Kglads advice and traced out  _listCollection within my getter before my return statement and it returns [object ListVO]..... confused for sure. I am going to change the _listCollection property in the model from private with a getter/setter to a public and see what happens.

  • 1067: Implicit coercion of a value of type Class to an unrelated type flash.display:MovieClip

    Hello, i've a class named LoadImages with the code:
    package
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
        import flash.events.Event;
        import flash.display.Loader;
        public class LoadImages extends MovieClip
            private var _root:MovieClip=new MovieClip();
            public function LoadImages(numImages:Number, rt:MovieClip)
    and i've a second class named MainJogo that call's LoadImages:
    package
        import flash.events.*;
        import flash.display.Loader;
        import flash.display.MovieClip;
        import flash.display.Stage;
        import LoadImages;
        public class MainJogo
             #error
            private var imgMc:LoadImages=new LoadImages(2,this);
              #error
            public function MainJogo(url:String)
    if i just post the MainJogo class code in TimeLine there is no problems but if i run the app like this with 2 classes i keep getting the error
    1067: Implicit coercion of a value of type Class to an unrelated type flash.display:MovieClip.
    Can someone help me please?
    thanks

    MainJogo is not a Movieclip so "this" (in the scope of MainJogo) is not a MovieClip.
    if MainJogo did extend the movieclip class, you would probably still need to cast "this" as a MovieClip.
    you could use:
    package
        import flash.events.*;
        import flash.display.Loader;
        import flash.display.MovieClip;
        import flash.display.Stage;
        import LoadImages;
        public class MainJogo extends MovieClip
    private var imgMc:LoadImages=new LoadImages(2,MovieClip(this));
            public function MainJogo(url:String)

  • 1067: Implicit coercion of a value of type void to an unrelated type Array.

            public function Helicopter (stageRef:Stage) : void
                this.stageRef =stageRef;
                addEventListener(Event.ENTER_FRAME, loop, false, 0, true);
                addEventListener(Event.ENTER_FRAME, Backdrop);
                key = new KeyObject(stageRef);
                x = stageRef.stageWidth/2;
                y = stageRef.stageHeight/2;
    I'm basically having the following error:
    1067: Implicit coercion of a value of type void to an unrelated type Array.
    In relation to the event listener that calls 'Backdrop'. Backdrop is a public function in another class, but it does still recognise Backdrop as a function. Any ideas on what might be causing the error?

    there's no Backdrop method there.  and, if you're importing your Backdrop class, you can't use a Backdrop method.  i don't know what you're trying to do but if you're trying to create a Backdrop instance use the following:
    package com.chopper.helicopter
                import flash.display.MovieClip;
                import flash.events.Event;
                import com.senocular.utils.KeyObject;
                import flash.display.Stage;
                import flash.ui.Keyboard;
            public class Backdrop extends flash.display.MovieClip
            public function Backdrop() : void
      trace ("Working code")
    /* none of this makes sense
                x += vx;
                if (vx > maxspeed)
                    vx = maxspeed;
                else if (vx < -maxspeed)
                    vx = -maxspeed;
    package com.chopper.helicopter
        import flash.display.MovieClip;
        import flash.events.Event;
        import com.senocular.utils.KeyObject;
        import flash.display.Stage;
        import flash.ui.Keyboard;
        public class Helicopter extends MovieClip
            private var gravity:Number = 1;
            private var vy:Number = 0;
            public var vx:Number = 0;
            private var key:KeyObject;
            private var stageRef:Stage;
    private var bd:Backdrop;
            public var maxspeedG:Number = 6;
            public var maxspeed:Number = 3;
            private var friction:Number = 0.92;
            public function Helicopter (_stageRef:Stage) : void
                stageRef =_stageRef;
                addEventListener(Event.ENTER_FRAME, loop, false, 0, true);
                trace ("working code")
                addEventListener(Event.ADDED_TO_STAGE, backdropF);
                key = new KeyObject(stageRef);
                x = stageRef.stageWidth/2;
                y = stageRef.stageHeight/2;
    private function backdropF(e:Event):void{
    bd=new Backdrop();
    stageRef.addChild(bd);
            public function loop(e:Event) : void
    // some of these variables appear to be undefined
                vy += gravity;
                y += vy;
                x += vx;
                if (vy > maxspeedG)
                    vy = maxspeedG;
                else if (vy < -maxspeed)
                    vy = -maxspeed;
                if (vx > maxspeed)
                    vx = maxspeed;
                else if (vx < -maxspeed)
                    vx = -maxspeed;
                if (vx > 0)
                    scaleX = 1;
                else if (vx < 0)
                    scaleX = -1;
                if (y > stageRef.stageHeight)
                    y = stageRef.stageHeight;
                    vy = -8
                rotation = vx*2;
                if (key.isDown(Keyboard.RIGHT))
                    vx += .5;
                else if (key.isDown(Keyboard.LEFT))
                    vx -= .5;
                else
                    vx *= friction;
                if (key.isDown(Keyboard.UP))
                    vy -= 1;
                else if (key.isDown(Keyboard.DOWN))
                    vy += .5;

  • Error while migrating to Flex 4.5.1 (1067: Implicit coercion of a value...)

    I am getting the following error while migrating my application from Flex 3.6 to Flex 4.5.1:
    1067: Implicit coercion of a value of type __AS3__.vec:Vector.<Object> to an unrelated type Array.
    The error is thrown on the following piece of code:
    var list:ArrayCollection=new ArrayCollection(dgSoftwareTitles.selectedItems);
    dgSoftwareTitles is defined as:
    <s:DataGrid id="dgShareCategoryForTransfer"
    x="34"
    y="369"
    requestedRowCount="5"
    width="90%"
    selectedIndex="-1"
    selectionMode="multipleRows">
    <s:columns>
    <s:ArrayList>
    <s:GridColumn headerText="SoftwareTitle"
    dataField="idSoftware"
    visible="false"/>
    <s:GridColumn headerText="SoftwareName"
    dataField="softwareName"
    visible="false"/>
    ...more GridColumns
    </s:columns>
    </s:ArrayList>
    </s:DataGrid>
    Any ideas why this would trow the "1067: Implicit coercion of a value of type __AS3__.vec:Vector.<Object> to an unrelated type Array" error?
    Thanks!
    Lee

    I think that dgSoftwareTitles.selectedItems is a type of Vector while
    public function ArrayCollection(source:Array = null) expects an array as a source.

  • 1067: Implicit coercion of a value of type String to an unrelated type

    Hi,
    I created a webservice based on sql server 2005 with several methods successfully.
    I am having headach now just trying to do some simple tests with Flex :-(
    I used the "Import WebService", it created some code "generated webservices".
    My test method p_SEARCH_NAME_SOUNDEX is based on a sql procedure wich take a varchar (128) as a parameter => NAL_NOM.
    I am just trying to debug this function (error at line in red)
           public function searchEntry(name:String):void
                // Register the event listener for the findEntry operation.
                //agenda.addfindEntryEventListener(handleSearchResult);
                myWS.addp_SEARCH_NAME_SOUNDEXEventListener(handleSearchResult);
                // Call the operation if we have a valid name.
                if(name!= null && name.length > 0)
                   myWS.p_SEARCH_NAME_SOUNDEX(name);
    I got this error message:
    067: Implicit coercion of a value of type String to an unrelated type generated.webservices:NAL_NOM_type1.
    FLEX has creaetd a type called NAL_NOM_type1 for my class:
    * NAL_NOM_type1.as
    * This file was auto-generated from WSDL by the Apache Axis2 generator modified by Adobe
    * Any change made to this file will be overwritten when the code is re-generated.
    package generated.webservices
        import mx.utils.ObjectProxy;
        import flash.utils.ByteArray;
        import mx.rpc.soap.types.*;
         * Wrapper class for a operation required type
        public class NAL_NOM_type1
             * Constructor, initializes the type class
            public function NAL_NOM_type1() {}
            public var varchar:String;public function toString():String
                return varchar.toString();
    I tried to do myWS.p_SEARCH_NAME_SOUNDEX(NAL_NOM_type1(name));
    and also declared "name" as NAL_NOM_type1... but i still get this error.
    This is how it declared my webservice method:
            public function p_SEARCH_NAME_SOUNDEX(nAL_NOM:NAL_NOM_type1):AsyncToken
                 var _internal_token:AsyncToken = _baseService.p_SEARCH_NAME_SOUNDEX(nAL_NOM);
                _internal_token.addEventListener("result",_P_SEARCH_NAME_SOUNDEX_populate_results);
                _internal_token.addEventListener("fault",throwFault);
                return _internal_token;
    I am even not on the level of assigning the data to my grid... i just want to see how it gets the data first in debug.
    Thanks in advance for you help.
    kr,
    Meta

    Thanks _Natasha_
    I tried this:
    var t = new NAL_NOM_type1();
    t.varchar = name;
    myWS.p_SEARCH_NAME_SOUNDEX(t);
    It passes the 1st step :-) but I get another error now :-/
    I think it try to get back NAL_NOM_type1 from the server of course on the WSDL side it know only NAL_NOM
    Error: Cannot find definition for type 'http://NABSQL64DEV/::NAL_NOM_type1'
        at mx.rpc.xml::XMLEncoder/encodeType()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc \xml\XMLEncoder.as:1426]
    I guess I have to change my constructor type... i am not used to these stuff :-s
    is this generating method the best way to access your data with webservices?
    the turorials I saw are xml file or array based... is there any link similar to my issue so I can learn better?

  • Loads of errors with classes: 1067 implicit coercion 118 illegal assignment

    Hi
    I have a main.fla and the two classes below VirtualGarage and VirtualCar. Main has VirtualGarage as its class which in turn works with VirtualCar. The code seems quite good but I get these errors. If anybody could help
    Cheers
    //VirtualGarage class
    package
    public class VirtualCar extends VirtualGarage
    var carSpeed:Number;
    var carColour:String;
    var carPrice:String;
    var car;
    public function VirtualCar(speed,colour,price)
    this.carSpeed = speed;
    this.carColour = colour;
    this.carPrice = price;
    //VirtualCar class
    package
    import VirtualCar;
    public class VirtualGarage
    private var newVirtualCar;
    public function VirtualGarage()
    newVirtualCar:VirtualCar = new VirtualCar(20,"red",30000);
    trace(newVirtualCar.speed;

    Hi - thank you very much.
    I know have the concept pretty well learnt. Although I find the statement class extends something to be ambiguous - it doesn't actually extend it - it inherits methods and properties from it. That's why I was so confused.
    However, I still have an error after modifying certain parts of code
    Main is now VirtualGarage.fla
                      VirtualGarage.as - class document
                      VirtualCar.as - another class
    Both .as docs reside in a folder called "garage" therefore there package name is garage.
    I get these errors 1067 implicit coercion... and 1188 illegal assignment to VirtualCar
    VirtualGarage.as
    package garage
    import flash.display.Sprite;
    public class VirtualGarage extends Sprite
    private var newVirtualCar:VirtualCar;
    public function VirtualGarage()
    newVirtualCar:VirtualCar = new VirtualCar("red"); //throws the error - 1067 implicit coercion... and 1188 illegal assignment to VirtualCar
    VirtualCar.as
    package garage
    public class VirtualCar //extends what? ie: a movieclip that calls it or the main class
    public var colour:String;
    public function VirtualCar(newColour)
    colour = newColour;

  • Implicit coercion of a value of type String to an unError while Adding Dynamic Rows To Flex DataGrid

    Hi friends
    I  want to add interger for in next next rows while clicking tab  button,one i enter all the values in one row if i press tab means next  row will be editable.for making that i added the following code.i have  some error shows like this
        [Bindable]
                    private var tasks:ArrayCollection;
                    private static const ADD_TASK:int= "";
                    private function init():void
                        tasks = new ArrayCollection();
                        tasks.addItem(new Task(0.01,100000,0));
                        tasks.addItem({frmAmount:ADD_TASK});
                    private function checkEdit(e:DataGridEvent):void
                        // Do not allow editing of Add Task row except for
                        // "Click to Add" column
                        if(e.rowIndex == tasks.length - 1 && e.columnIndex != 0)
                            e.preventDefault();
            private function editEnd(e:DataGridEvent):void
                    // Adding a new task
                    if(e.rowIndex == tasks.length - 1)
                    var txtIn:TextInput =TextInput(e.currentTarget.itemEditorInstance);
                    var dt:Object = e.itemRenderer.data;
                    // Add new task
                    if(parseInt(txtIn.text) != ADD_TASK)
                        tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----->Multiple markers at this line:
                                                                                                                             -1067: Implicit coercion of a value of type String to an unrelated type int.
                                                                                                                                -txtIn
                    // Destroy item editor
                    commPlanDetGrid.destroyItemEditor();
                        // Stop default behavior
                    e.preventDefault();
            ]]>
    Please help if any suggession
    Thanks in advance
    B.Venkatesan

    The error message indicates the problem fairly clearly.  _feed_list is defined as a ComboBox in your first line of code.  You are passing that as an argument in your populate(_feed_list) line of code.  However, the populate function is expecting an XMLList object to be passed, not a ComboBox.
    You probably really mean to be using...
              populate(feed_items);
    since that is the only XMLList to be found

  • Implicit coercion of a value of type flash.display:MovieClip to an unrelated type Class.

    These are my errors: in Adobe Flash CS5.5
    I don't understand why this script doesn't work. I am new to Action Script 3.0 and I watched this incomplete video on youtube. -- http://www.youtube.com/watch?v=LC7BaZCForE&feature=relmfu -- and I got the fails below.
    Scene 1, Layer 'actionscript', Frame 1, Line 11 1067: Implicit coercion of a value of type flash.display:MovieClip to an unrelated type Class.
    Scene 1, Layer 'actionscript', Frame 1, Line 11 1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject.
    Main Timeline:
    import flash.filters.GlowFilter;
    import flash.events.MouseEvent;
    import flash.display.MovieClip;
    var navBtnGlow:GlowFilter = new GlowFilter(0x999999, 0.5, 0, 15, 1, 2, true, false);
    navbar_jj.addEventListener(MouseEvent.MOUSE_OVER, navOverF);
    navbar_jj.addEventListener(MouseEvent.MOUSE_OUT, navOutF);
    function navOverF(event:MouseEvent):void{
         event.target.filters = [navBtnGlow];
    navbar_jj.setChildIndex(event.target as MovieClip(event.target), 1);
    dropmenus_jj.gotoAndStop(navbar_jj.getChildAt(1).name);
    trace("We are Rolled Over..." + navbar_jj.getChildAt(1).name)
    function navOutF(event:MouseEvent):void{
         event.target.filters = [];
    Clicker Drop Down
    import flash.events.MouseEvent;
    stop();
    leadersframe_btn.addEventListener(MouseEvent.MOUSE_OVER, goBackF);
    function goBackF(event:MouseEvent):void{
        gotoAndStop (1);

    Use:
    navbar_jj.setChildIndex(MovieClip(event.target), 1);
    Or
    navbar_jj.setChildIndex(DisplayObject(event.target), 1);

  • Error #1067

    hi
    i imported an asp.net service to my flex application,
    the web service is consumed by many module , and after
    compiling (in strict mode) i got the following error:
    (99 error )1067: Implicit coercion of a value of type QName
    to an unrelated type QName.
    all of them reside in generated webservice
    dir/basexxxservice.as
    =================================================
    BaseahnServiceService = new
    WSDLService("BaseahnServiceService");
    BaseahnServicePort = new
    WSDLPort("BaseahnServicePort",BaseahnServiceService);
    BaseahnServiceBinding = new
    WSDLBinding("BaseahnServiceBinding");
    BaseahnServicePortType = new
    WSDLPortType("BaseahnServicePortType");
    BaseahnServiceBinding.portType = BaseahnServicePortType;
    BaseahnServicePort.binding = BaseahnServiceBinding;
    BaseahnServiceService.addPort(BaseahnServicePort);
    BaseahnServicePort.endpointURI = "
    http://localhost:2883/AHN/ahnservice.asmx";
    var validUser:WSDLOperation = new WSDLOperation("validUser");
    //input message for the operation
    requestMessage = new WSDLMessage("validUser");
    ==8 error (error:1067 - Implicit coercion of a value of type
    QName to an unrelated type QName)=======
    requestMessage.addPart(new WSDLMessagePart(new QName("
    http://localhost:2883/AHN/","name"),null,new
    QName("
    http://www.w3.org/2001/XMLSchema","string")));
    requestMessage.addPart(new WSDLMessagePart(new QName("
    http://localhost:2883/AHN/","password"),null,new
    QName("
    http://www.w3.org/2001/XMLSchema","string")));
    ===============================================================
    requestMessage.encoding = new WSDLEncoding();
    requestMessage.encoding.namespaceURI="
    http://localhost:2883/AHN/";
    requestMessage.encoding.useStyle="literal";
    requestMessage.isWrapped = true;
    ==2 error (error:1067 - Implicit coercion of a value of type
    QName to an unrelated type QName)=======
    requestMessage.wrappedQName = new QName("
    http://localhost:2883/AHN/","validUser");
    ==========================================================================
    responseMessage = new WSDLMessage("validUserResponse");
    ==4error (error:1067 - Implicit coercion of a value of type
    QName to an unrelated type QName)=======
    responseMessage.addPart(new WSDLMessagePart(new QName("
    http://localhost:2883/AHN/","validUserResult"),null,new
    QName("
    http://www.w3.org/2001/XMLSchema","boolean")));
    ==========================================================================
    responseMessage.encoding = new WSDLEncoding();
    responseMessage.encoding.namespaceURI="
    http://localhost:2883/AHN/";
    responseMessage.encoding.useStyle="literal";
    responseMessage.isWrapped = true;
    ==2 error (error:1067 - Implicit coercion of a value of type
    QName to an unrelated type QName)=======
    responseMessage.wrappedQName = new QName("
    http://localhost:2883/AHN/","validUserResponse");
    ============================================================================
    validUser.inputMessage = requestMessage;
    validUser.outputMessage = responseMessage;
    validUser.schemaManager = this.schemaMgr;
    validUser.soapAction = "
    http://localhost:2883/AHN/validUser";
    validUser.style = "document";
    BaseahnServiceService.getPort("BaseahnServicePort").binding.portType.addOperation(validUse r);
    simple webservice call:
    var myService:AhnService = new AhnService();
    myService.validUser(name,password);
    myService.addvalidUserEventListener(validUserHandler);
    myService.addAhnServiceFaultEventListener(connectionError);
    all (99 error) reside in the generated web service
    code(basexxxservice.as)
    and they are repeated for each imported web method
    i do n't have any error else where
    if i compile the code without strict mode the web service is
    working fine but my application is not stable(i got RTE)
    thanks in advance

    "LPVOID32" <[email protected]> wrote in
    message
    news:gqnhok$im7$[email protected]..
    > hi
    > i imported an asp.net service to my flex application,
    > the web service is consumed by many module , and after
    compiling (in
    > strict
    > mode) i got the following error:
    > (99 error )1067: Implicit coercion of a value of type
    QName to an
    > unrelated
    > type QName.
    http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf
    Q8

  • Quick problem / Error 1067

    Real simple program. Basically plots a dot wherever you click. Getting the error 1067: Implicit coercion of a value of type Class to an unrelated type Function.
    package {
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
        public class particle extends MovieClip {
            //private var _xmouse:Number;
            //private var _ymouse:Number;
            private var mc1:MovieClip = new MovieClip();
            private var mc2:MovieClip = new MovieClip();
            private var mc3:MovieClip = new MovieClip();
            private var mc4:MovieClip = new MovieClip();
            private var mc5:MovieClip = new MovieClip();
            public function particle() {
                mc1.graphics.beginFill(0xFF0000, .2);
                mc1.graphics.drawCircle(mouseX,mouseY,5);
                this.addChild(mc1);
                mc2.graphics.beginFill(0xFF0000, .2);
                mc2.graphics.drawCircle(mouseX,mouseY,4);
                this.addChild(mc2);
                mc3.graphics.beginFill(0xFF0000, .4);
                mc3.graphics.drawCircle(mouseX,mouseY,3);
                this.addChild(mc3);
                mc4.graphics.beginFill(0xFF0000, .6);
                mc4.graphics.drawCircle(mouseX,mouseY,2);
                this.addChild(mc4);
                mc5.graphics.beginFill(0xFF0000, 1);
                mc5.graphics.drawCircle(mouseX,mouseY,1);
                this.addChild(mc5);
                addEventListener (MouseEvent.CLICK, particle);
    Thanks a ton

    I dont know if i follow exactly what your trying to do.....and getting tired so i wont run the code myself to see it work
    But you cant call the class function from the eventlistener...this line here-->  addEventListener (MouseEvent.CLICK, particle);
    particle is your class definition......
    instead you should just have per se.........the addEventListener inside the particle function and call another function when it clicks like so
    package {
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
        public class particle extends MovieClip {
            //private var _xmouse:Number;
            //private var _ymouse:Number;
            private var mc1:MovieClip = new MovieClip();
            private var mc2:MovieClip = new MovieClip();
            private var mc3:MovieClip = new MovieClip();
            private var mc4:MovieClip = new MovieClip();
            private var mc5:MovieClip = new MovieClip();
            public function particle() {
                addEventListener (MouseEvent.CLICK, particle);
              public function drawParticle(event:MouseEvent)
                   mc1.graphics.beginFill(0xFF0000, .2);
                mc1.graphics.drawCircle(mouseX,mouseY,5);
                this.addChild(mc1);
    something along those lines....its just i'm sleepy so i wont test nor will i try to correct at this time....but you should get my drift... is like 2am right now.....so i'm off.....maybe next time i'll clarify more
    thelegendaryghost

  • Implicit coercion Error while Adding Dynamic Rows To Flex DataGrid

    Hi friends
    I   want to add interger for in next next rows while clicking tab   button,one i enter all the values in one row if i press tab means next   row will be editable.for making that i added the following code.i have   some error shows like this
        [Bindable]
                    private var tasks:ArrayCollection;
                    private static const ADD_TASK:int= "";
                    private function init():void
                        tasks = new ArrayCollection();
                        tasks.addItem(new Task(0.01,100000,0));
                        tasks.addItem({frmAmount:ADD_TASK});
                    private function checkEdit(e:DataGridEvent):void
                        // Do not allow editing of Add Task row except for
                        // "Click to Add" column
                        if(e.rowIndex == tasks.length - 1 && e.columnIndex != 0)
                            e.preventDefault();
            private function editEnd(e:DataGridEvent):void
                    // Adding a new task
                    if(e.rowIndex == tasks.length - 1)
                    var txtIn:TextInput =TextInput(e.currentTarget.itemEditorInstance);
                    var dt:Object = e.itemRenderer.data;
                    // Add new task
                    if(parseInt(txtIn.text) != ADD_TASK)
                        tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----->Multiple markers at this line:
                                                                                                                               -1067: Implicit  coercion of a value of type String to an unrelated type int.
                                                                                                                                  -txtIn
                    // Destroy item editor
                    commPlanDetGrid.destroyItemEditor();
                        // Stop default behavior
                    e.preventDefault();
            ]]>
    Please help if any suggession
    Thanks in advance
    B.Venkatesan

    Venktesan,
    You are trying compare String and int..! which is not possible try to case the txtIn.text to int using parseInt(txtIn.text).
    ORIGINAL:
    if(txtIn.text != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
                        tasks.addItemAt(new Task(txtIn.text, 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
    EDITED:
    if(parseInt(txtIn.text) != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
                        tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
    Thanks
    Pradeep

  • Error 1067 in AIR?

    I'm trying to make a Flash game with a simple socket server, and I have this package imported into the Flash document:
    package
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.events.IOErrorEvent;
        import flash.events.ProgressEvent;
        import flash.events.ServerSocketConnectEvent;
        import flash.net.ServerSocket;
        import flash.net.Socket;
        public class TCP extends Sprite
            private var serverSocket:ServerSocket;
            private var clientSockets:Array = new Array();
            public function TCP()
                try
                    // Create the server socket
                    serverSocket = new ServerSocket();
                    // Add the event listener
                    serverSocket.addEventListener( Event.CONNECT, connectHandler );
                    serverSocket.addEventListener( Event.CLOSE, onClose );
                    // Bind to local port 8087
                    serverSocket.bind( 8087, "127.0.0.1" );
                    // Listen for connections
                    serverSocket.listen();
                    trace( "Listening on " + serverSocket.localPort );
                catch(e:SecurityError)
                    trace(e);
            public function connectHandler(event:ServerSocketConnectEvent):void
                //Thesocket is provided by the event object
                var socket:Socket = event.socket as Socket;
                clientSockets.push( socket );
                socket.addEventListener( ProgressEvent.SOCKET_DATA, socketDataHandler);
                socket.addEventListener( Event.CLOSE, onClientClose );
                socket.addEventListener( IOErrorEvent.IO_ERROR, onIOError );
                //Send a connect message
                socket.writeUTFBytes("Connected.");
                socket.flush();
                trace( "Sending connect message" );
            public function socketDataHandler(event:ProgressEvent):void
                var socket:Socket = event.target as Socket
                //Read the message from the socket
                var message:String = socket.readUTFBytes( socket.bytesAvailable );
                trace( "Received: " + message);
                // Echo the received message back to the sender
                message = "Echo -- " + message;
                socket.writeUTFBytes( message );
                socket.flush();
                trace( "Sending: " + message );
            private function onClientClose( event:Event ):void
                trace( "Connection to client closed." );
                //Should also remove from clientSockets array...
            private function onIOError( errorEvent:IOErrorEvent ):void
                trace( "IOError: " + errorEvent.text );
            private function onClose( event:Event ):void
                trace( "Server socket closed by OS." );
    However, when I try to run the SWF, I get this:
    1067: Implicit coercion of a value of type Class to an unrelated type Function.
    This is what is in the FLA:
    import TCP;
    addEventListener(Event.ENTER_FRAME, TCP);
    The error shows up on the addEventListener. I have the publish settings in the FLA set to AIR 2.6. Why? Because when I have it set to Flash Player 10.2, I get this error:
    1046: Type was not found or was not a compile-time constant: ServerSocketConnectEvent.
    The ServerSocketConnectEvent is in the "TCP" package. I switched the publish settings to AIR because after doing a quick Google search, ServerSocketConnectEvent is apparently strictly meant for AIR. So that means switching the publish settings to AIR was the correct thing to do... right? Unless I'm getting something horribly wrong here...
    But basically, when it's set to Flash Player, it imports the package and TCP eventlistener just fine, but it screws up at the ServerSocketConnectEvent. So when I switch to AIR, I get that weird 1067 error at the addEventListener... is there something wrong with the package? I got it straight off of an example Adobe had, I couldn't imagine something being improperly coded... is there something I'm missing? Any help would be greatly appreciated, thanks.

    I've tried importing an example class as well, with literally no lines of code in it other than:
    package  {
        public class example {
            public function example() {
    And then this is in the FLA:
    import example;
    addEventListener(Event.ENTER_FRAME, example);
    And even with something as simple as that, I get the same error. So yes I would think you're right, but what would I do to fix this? Change the names of the function and class to unique ones? Change the name of the package itself? If so could I get some example? Because I'm a total noob when it comes to class importing and such... and again like I said, when I'm publishing with Flash Player it returns no errors as far as the importing goes, I'm just curious as to why it would be different when using AIR...

  • AS3: Classes, subclasses and "implicit coercion"

    Hi.
    I have created several custom classes:
    - Category, containing a string with the category's name.
    - SubCategory, extends Category.
    - CategoryList, containing an array of Category instances and
    a function getCategoryByName.
    - SubCategoryTracer, with a function subTrace that traces the
    name of a given SubCategory.
    When I use subTrace, if the argument is a direct SubCategory,
    it works fine, but if it's the result of getCategoryByName, even
    when it does return a SubCategory object, I get the following
    error:
    1118: Implicit coercion of a value with static type
    tests:Category to a possibly unrelated type tests:SubCategory.
    How can I get this to work? Thanks in advance.

    1. I guess you need to change the code to the following (read the comments):
    // Creates an object from the class called mySample
    var externalFile:mySample = new mySample();
    // allows the program to read the text box as a number
    * these two lines DO NOT read text field values when they change
    * so these two vars are useless unless you want to retain original values
    var num1 = Number(txtBox1.text)
    var num2 = Number(txtBox2.text)
    //Button event listener
    btnCalc.addEventListener(MouseEvent.CLICK, clickHandler);
    function clickHandler(e:MouseEvent):void
              // read textfields' values every time user clicks the button
              resultTextBox.text = String(externalFile.addNumbers(Number(txtBox1.text), Number(txtBox2.text)));
    2. You need to get into a habit to strictly type you variables and objects.
    3. You should get into a habit to declare variable namespace (private, public, etc.) of the variables. SO you class variables declarations should be:
    private var num1:Number;
    private var num2:Number;
    private var answer:Number;
    4. It is wise to name classes starting with upper case - it is a convention that makes AS programmer life easier.
    5. Since your class has no other task but calculate and return new value - declaring additional calss level variables (num1, num2, and answer) introduces an unnecessary overhead. These variables existence would be justified only if they were reused.
    I suggest your class should be like that (note that addNumber method's parameters are typed to Number):
    package
              public class MySample
                        //create a function
                        public function addNumbers(num1:Number, num2:Number):Number
                                  return num1 + num2; //this function returns something that can be used elsewhere

  • Error #1067 problem

    Hi,
    I am new to flash and trying to do a simple game but I ran across this problem
    1067: Implicit coercion of a value of type Array to an unrelated type flash.display:MovieClip.
    I am not sure what is going on but here is my code for Player.as
    package {
         import flash.display.MovieClip;
         import flash.events.Event;
         import flash.events.KeyboardEvent;
         import flash.ui.Keyboard;
         public class Player extends MovieClip {
              public var speed:int=30;
              public var theWall:MovieClip;
              public function Player() {
                   addEventListener(Event.ADDED_TO_STAGE,init);
              private function init(e:Event):void {
                   removeEventListener(Event.ADDED_TO_STAGE,init);
                   stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHit);
                   addEventListener(Event.ENTER_FRAME,testHit); //same as this.addEv.....'this' being object Player
              private function keyHit(event:KeyboardEvent):void {
                   switch (event.keyCode) {
                        case Keyboard.RIGHT :
                             x+=speed;
                             break;
                        case Keyboard.LEFT :
                             x-=speed;
                             break;
                        case Keyboard.UP :
                             y-=speed;
                             break;
                        case Keyboard.DOWN :
                             y+=speed;
                             break;
                        default :
                             break;
              private function testHit(e:Event):void {
                   for (var i:int,j:int = theWall.length; i < j; i++) {
                        if (hitTestObject(theWall[i])) { //same as this.hitTestObject(aWall),'this' being object Player
                             x-=speed; //same as this.x -= this.speed
    and here is the code in action panel
    var player1:Player = new Player();
    addChild(player1);
    player1.x = 344;
    player1.y = 219;
    var walls:Array = [wall1,wall2,wall3,wall4];
    player1.theWall = walls;
    Hope someone can help me...

    Chances are the issue lies between declaring...
    public var theWall:MovieClip;
    and the usage...
    for (var i:int,j:int = theWall.length; i < j; i++) {
             if (hitTestObject(theWall[i])) {

Maybe you are looking for