Cannot be implicitly cast to Bitmap in class?

Hi all

I created a dynamic ResourceLoader class that loads all the necessary assets in an internal dictionary, store the Loader.content (which is a bitmap object) indexed by a string name. Everything works fine and dandy when I clone() the bitmapdata and cast to an object of display, but when I try to do the same thing and assign setStyle, I get this weird error:

Type coercion failed: cannot convert flash.display::Bitmap@c479439 to class.

How can this be? If everything is not derived from class?

So, instead: (only the lines below)

[Embed (source ='... / media/actionbar_def - click.png "")]
private var defClick: Class;
in ctor...
setStyle ("downSkin", defClick);

Now, I'm doing it:

mLoader.load (new URLRequest(I'.. / media/actionbar_def-click.png')));
After loading...
mImages ["defClick"] = mLoader.content;
during the construction of button...
setStyle ("downSkin", DisplayObject (new Bitmap (Bitmap(mImages["defClick"]).bitmapData.clone ()));

Does anyone have any suggestions on where I'm wrong?

Thank you.

ZenSeven

I thought about it, even if it does not solve my problem.

A 'class' is that actionscript is a static class - while Bitmap@c479439 is an instance of Bitmap. So it makes sense why it cannot convert!

I love being a n00b ActionScropt!

Tags: Flex

Similar Questions

  • Windows cannot load a file of the registry classes.

    Not sure if the events of thous are related or not.

    Windows cannot load a file of the registry classes.

    DETAIL - unknown error

    -
    -
     
      1542
      0
      2
      0
      0
      0 x 8000000000000000
     
      59778
     
     
      Application
      -PC
     
     

    -
      Unspecified error
     

     

    The description for event ID 0 in source ICCS is not found. Either the component that triggers this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

    If the event is on another computer, the display information had to be saved with the event.

    The following information has been included in the event:

    Service started

    Status of initialization of service objects.
    C:\Windows\system32\sppwinob.dll, msft:spp/windowsfunctionality/agent/7.0, 0 x 00000000, 0 x 00000000
    C:\Windows\system32\sppobjs.dll, msft:rm/algorithm/phone/1.0, 0 x 00000000, 0 x 00000000
    C:\Windows\system32\sppobjs.dll, msft:rm / 2005-pkey-algorithm, 0x00000000, 0x00000000
    C:\Windows\system32\sppobjs.dll, msft:spp/TaskScheduler/1.0, 0 x 00000000, 0 x 00000000
    C:\Windows\system32\sppobjs.dll, msft:spp/volume/services/kms/1.0, 0 x 00000000, 0 x 00000000
    C:\Windows\system32\sppobjs.dll, msft:spp/volume/services/kms/licenserenewal/1.0, 0 x 00000000, 0 x 00000000

    The Software Protection service made license status check.
    Application ID = 55 c 92734 d682 - 4 d 71-983e-d6ec3f16059f
    License status
    1: 5 - b65e - 01f5fc37-a99e - 45 c, 1 d762f3518ead, 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]
    2: 2e7d060d-4714-40f2-9896-1e4f15b612ad, 1, 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]
    3: 3b965dfc - 31 d 9-4903-886f-873a0382776c, 1, 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]
    4: 586bc076-c93d-429a-afe5-a69fbc644e88, 1, 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]
    5: 5e017a8a-f3f9-4167-b1bd-ba3e236a4d8f, 1, 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]
    6: 5 - b889 - 2088b06738cb 5e35dc43 - 389b - 47, 1, 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]
    7: 6a7d5d8a-92af-4e6a-af4b-8fddaec800e5, 1, 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]
    8: 9ab82e0c-ffc9-4107-baa1-c65a8bd3ccc3, 1, 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]
    9: 9f83d90f-a151-4665-ae69-30b3f63ec659, 1, 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]
    10: a63275f4-530c-48a7-b0d3-4f00d688d151, 1, 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]
    11: b8a4bb91-69b1-460d-93f8-40e0670af04a, 1, 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]
    12: d2c04e90-c3dd-4260-b0f3-f845f5d27d64, 1, 1 [(0 [0 x 00000000, 1, 0], [(?)])] (?) (0 x 1 00000000 0 0 msft:rm/algorithm/bios/4.0 0 x 00000000 0) (?) (?) (?)]) (1) (2)]
    13: e68b141f-4dfa-4387-b3b7-e65c4889216e, 1, 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]
    14: ee4e1629-bcdc-4b42-a68f-b92e135f78d7 1: 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]
    15: 4a8149bb - 7 d 61-49f4-8822-82c7bf88d64b, 1, 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]
    16: afd5f68f-b70f-4000-a21d-28dbc8be8b07 1: 0 [(0 [0xC004F014, 0, 0], [(?)])] (?) (?) (?) (?) (?)]) (1) (2)]

    I solved the problem by creating the new profile by running driver difficulty in this regard.

  • Cannot use casting "to more specific class ' function to the parent class of child class

    Hello

    I am using OOP for my request for data acquisition. I have different e/s analog and digital materials. I create a superclass named DAQ.lvclass. This class has four childs: analog in out analog, digital, and Digital Out. I am trying to invoke screws of the child of the parent class's class. For that I am throwing the class parent her child to aid "to a more specific class' function. But I get the below error.

    Error 1448 occurred at the more class specific in DAQ.lvclassMain.vi AQ

    Possible reasons:

    LabVIEW: Bad type cast. LabVIEW does not deal with the run-time value of this class of LabVIEW as an instance of the given class of LabVIEW.

    How can I handle these cases where I have to call child VI of the parent member?

    I have attached two screws 1 snapshot. Main DAQ: it's the class main VI parent who manages all functions. 2. read the analog inputs: this VI trying to set the parent class for its class of the child and child vi reads value of data acquisition task. I get the second error off VI.

    Kindly help.

    Honestly, I have NO idea on what you want to do.

    Inheritance of classes in EACH OOD (object-oriented design) requires to define common ground as the parent class. Children can add things like properties and methods.

    If you set children who have no points in common, you have made a mistake.

    If all children have too many different specific methods, your OOD is absent.

    Example:

    Parent defines the method A.

    1 child adds the B method.

    Child 2 adds method C.

    But method B will not be usable on 2 children while method C will not work with 1 child.

    It is an approach that you want to prevent. In any programming language oriented OBJECT. This adds unnecessary complexity leading to difficult to maintain the code, and it is prone to errors.

    However, if you're going to do, "to more specific class ' is the correct type cast. But your screenshots and error messages, it is obvious that refine you a particular child's casting only. You must extend the code to check the real child, specifically expressed and call the method. That being said, your code increases the complexity you want to add a bunch of case of structures which essentially nihilates all THE BENEFITS of the use of OOP.

    I'm sorry to say that.

    Norbert

  • Question about cast of more generic class

    I refnum controls and pages refnum and I want to know where is the best:

    (1) let LabVIEW doing work

    or (2) use the 'more generic class type conversion.

    In both cases the VI works fine.

    Thank you

    Jean-Marc

    'that's better... »

    I can't say definatively, but I've generally will do top-cast to build a table that you have illustrated LV.

    EDIT

    I just noticed your case apperas to have 50 more digital cases. What you do with this code? We may be able to offer alternatives (maybe).

    Ben

  • Cannot convert oracle.jbo.domain.Number to class the class java.lang.Long in EL

    I have this error:

    ViewId treatment < UIXRegion > < _warn > error: / frameworks-designer-task-flow/hand URI: FrameworksDesignerMain.jsff real-URI: EnterpriseProcessExecutionSchedules.jsff.

    java.lang.IllegalArgumentException: cannot convert 2 type class to class java.lang.Long oracle.jbo.domain.Number

    at com.sun.el.lang.ELSupport.coerceToNumber (unknown Source)

    at com.sun.el.lang.ELSupport.equals (unknown Source)

    at com.sun.el.parser.AstNotEqual.getValue (unknown Source)

    at com.sun.el.ValueExpressionImpl.getValue (unknown Source)

    at org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:73)

    to oracle.adfinternal.view.faces.renderkit.rich. LabeledInputRenderer.isDisabled (LabeledInputRenderer.java:285)

    My question is how do I find in my page jsff?  I see that it is on a property of disabled but I don't know which and there are many on this page.  I think it's one that looks like this: disabled = ' #{bindings. " "{PGSchedType.inputValue No 5}.  If my different EL expression?

    Thank you.

    Rudy

    JDev 11.1.2.4.0

    Hi Rudy,.

    I guess that you have spotted it right. Instead of 5 in your disabled property, use '5'


    I mean, just surround it with quotes like below


    disabled="#{bindings.PGSchedType.inputValue ne '5'}"
    

    Thank you

    SAIF

  • is it possible to transform a bitmap/bitmapData class

    Is there a way I can transform the content of a class to a bitmap and use this image as many times as I want. In my case, I create this class

    public class CreateRow_Col extends Sprite {
    
    
                        private var bgArray:Array = new Array();
                        private var myContainer:Sprite = new Sprite();
                        private var _Pat1:BitmapData = new Pattern1();
    
    
    
    
                        public function CreateRow_Col() {
                                  var bgClip = new Bitmap(_Pat1);
                                  var i:int = 0;
                                  var j:int = 0;
                                  while (bgClip.x < stage.stageWidth) {
                                            bgClip = new Bitmap(_Pat1);
                                            while (bgClip.y < stage.stageHeight) {
                                                      bgClip = new Bitmap(_Pat1);
                                                      myContainer.addChild(bgClip);
                                                      bgClip.x = bgClip.width * i;
                                                      bgClip.y = bgClip.height * j;
    
    
                                                      j++;
                                            }
    
    
                                            j = 0;
                                            i++;
                                  }
                                  addChildAt(myContainer,0);
                        }
    
    

    and then call it from the mainClass of the FLA

                             private var bf:CreateRow_Col = new CreateRow_Col();
                        private var bf2:CreateRow_Col = new CreateRow_Col();
    
    
                        public function MainClass_Test() {
                                  bf.x = 50;
                                  addChild(bf);
                                  bf2.x = 150;
                                  bf2.y = 350;
                                  addChild(bf2);
                        }
    
    

    But if I want to do like 500 instances of the class that will make the CreateRow_Col calculate 500times scene and fill it 500 times? or it will not?

    and even if it is not possible to make a class for bitmap and use this image as many times as you want.

    Looks like you need to use the class graphics capabilities, particularly beginBitmapFill() method.

    Here is the documentation of the Graphics class:

    http://help.Adobe.com/en_US/FlashPlatform/reference/ActionScript/3/Flash/display/graphics. HTML #beginBitmapFill)

    But first, you class CreateRow_Col will not work. You are referring to the scene in the constructor. Stadium is available ONLY when object is placed on the display list, UNLESS you have the reference to the scene when running.

    Anyway, if your need is to tiles with the same BitmapData Sprite - you don't need to jump through all these hoops. Try this code:

    package
    {
              import flash.display.Sprite;
              import flash.events.Event;
    
              public class CreateRow_Col extends Sprite
              {
                        public function CreateRow_Col()
                        {
                                  addEventListener(Event.ADDED_TO_STAGE, draw);
    
                        }
    
                        private function draw(e:Event):void
                        {
                                  removeEventListener(Event.ADDED_TO_STAGE, draw);
                                  graphics.beginBitmapFill(new Pattern1(), null, true, true);
                                  graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
                                  graphics.endFill();
                        }
              }
    }
    

    The use is the same as you showed in MainClass_Test.

    Post edited by: Andrei1

  • Cast of the SMS class

    Hello

    My App adds a new menu item that the user can select to the SMS folder and it will read the address of the SMS highlighted and that the user can reply\edit\fwd the SMS.

    I managed to add the element menu, but when my App is trying to read the SMS address it (I tried to throw for datagram class)

    Anyone know how I can get the SMS address?

    Just to clarify myself, I use the API of "ApplicationMenuItem", and when the user choose my object, my App. enetrs the function 'run '.

    and here, I try to read the address.

    Thank you.

    This context object is an instalnce of implementation of

    javax.wireless.messaging.TextMesssage

    interface.

    This interface extends

    javax.wireless.messaging.Message

    interface.

    You can do the following:

    MessageObject message = contextObject (Message);

    Address of string = messageObject.getAddress ();

    That's all.

  • Cannot convert oracle.jbo.domain.DBSequence to class java.lang.Integer

    Hello

    I have the following problem with my ADF application developed in JDeveloper 12.1.3:

    In my model, there are two entities MeterEO and MeterTypeEO with the following attributes:

    MeterEO

    TenantIdBigDecimalTENANT_IDNUMBER
    MeterCodeStringMETER_CODEVARCHAR2 (48)
    TypeIntegerTYPENUMBER

    MeterTypeEO

    IDDBSequenceIDNUMBER
    Name of the vendorStringNAME OF THE VENDORVARCHAR2 (32)
    TypeStringTYPEVARCHAR2 (16)

    Type of MeterEO reference Id in MeterTypeEO.

    Appropriate VO of the meter uses a MeterTypeVO LOV to create a list containing the provider and Type as well as the user's selection.

    In the ModelTester, everything works well when I try to change a counter, select a new type and validate my changes to the database.

    A JSFF, it looks quite different. Selection is made by SelectOneChoice with the LOV list containing the provider and Type. Of the LOV the appropriate values are selected for the (integer) to the meter, then the user gets a readable text instead a few cryptic. But when I change the value by selecting a new choice I always got the error ' Can' oracle.jbo.domain.DBSequence to class java.lang.Integer.

    Why it works without problems in the Modeltester but not on the page?

    Screenshot 2015-08-31 12.48.55.pngScreenshot 2015-08-31 12.49.09.png

    Please see the attached screenshots to make it clearer what I mean.

    Any hint is appreciated,

    Björn

    I solved my problem now in view objects. Maybe someone who has the same problem and is interested in the solution:

    In MeterTypeVO - which is the source for the LOV - I added a new transitional field called IntId of type Integer that refers to the field Id of type DbSequence by Expression. DbSequence is automatically converted at length which can be also automatically converted in full.

    At the counter, I changed the key of the LOV to IntId instead of code.

    It works like charm.

  • Cannot select more than one bitmap image in desktop Animate

    I can't select more than one bitmap image in desktop Animate. Always select the same object, what should I do?

    I guess these bitmaps are on the scene. They are all on the same layer? Who is always selected is large and, perhaps, on top of all the others?

    If the bitmaps are all on one layer, you can separate each in separate layers. Once you do this, you can lock / unlock layers individually so that you can work with one image at a time.

  • Object generic casting/conversion of custom class

    I know that the right way to do what I want is to use the ORM and type all my objects in the database that I have, but it's a little late for this approach.

    So, I have an arrayCollection collection that is returned from ColdFusion. I have a custom class, call the MyClass. What is the best way, assuming that the properties match 1-1, to copy all the properties of the generic object in the collection arrayCollection in an instance of myClass with the same properties. I tried "MyClass" and not of chance (that would be nice. I happen to hit on a syntax to use 'foreach' so if you have an example or other suggestions, I would be happy.

    At this point, I add any parameters to the MyClass constructor if there is an object passed, it copies the properties of an instance, but who feels 'dirty' in the sense of duty hardcode this mapping:

    public var GUID:String;
    public var frameName:String;
    public var frameType:String;
    public var helpTitle:String;
    public var helpText:String;
    public var baseMovieGUID:String;
    public var notes: String;
    public var hotspots: ArrayCollection collection;
    public var JSONHotspots:String;
    public var baseMovieURL:String;

    public void MyClass(obj:Object_=_null):void {}
    If (obj! = null) {}
    GUID = obj. GUID;
    frameName = obj.frameName
    frameType = obj.frameType
    helpTitle = obj.helpTitle
    helpText = obj.helpText
    baseMovieGUID = obj.baseMovieGUID
    Notes = obj.notes
    points = hot obj.hotspots
    JSONHotspots = obj. JSONHotspots
    baseMovieURL = obj.baseMovieURL
    }
    }
    }

    Does that help? http://forums.Adobe.com/message/2928367

  • cannot access the properties of the AS3 class stage

    Please take a look at the attached code. It is throwing this compilation error:

    1120: access of undefined property scene

    no idea why?


    cool SymTsb, who works a treat. question: why not the documentation makes this clear? or I didn't just rush-set-read it?

    I have a getter in my main Application class which returns the root mc as a 'context', so I can't ride the thing, this line works perfectly:

    MyMainApplicationClass.context.stage.frameRate;

    I greet you all SymTsb

    :)

  • Compaq mini: cannot access has cast BIOS

    My compaq asking ME password I forgot, I have a lot of important work it tells me error code CNU90533LP and system

    Hello

    Enter: e9lo1qffk2 (3rd character is a lowercase L)

    Kind regards

    DP - K

  • How to draw text bordered on Bitmap usgin class Graphics?

    Hi guys.

    I'm drawing text on a line graph.

    Here is the example.

    The text color is black. Border is white (edge of letters).

    How to draw like this?

    Thanks in advance.

    If you are interested in a vaguely similar effect, but without all the subtle shadows, I have a suggestion. Draw the white text, several times, gap between the nominal position of a pixel or two in different directions and then draw the text in black at the nominal position. The idea is that white copies create an enlargement of each letter which becomes an overview when you draw the black letter on it. You may need to do this a letter at a time, allowing more space between the letters, rather than draw the entire chain at the same time.

  • How he handles the labview to more generic class

    It's just a matter for my own knowledge of curious nerd. If you, say, have a cluster that contains a string, a Boolean value, and a digital control, a common method to reference the controls in the cluster is to create a cluster of reference and then to get the array of control from a property node. So let's say I wanted to put the Boolean value true, you can auto control array index and cast in more specific class boolean and set value via the property node (see below).

    Now my question is, to place controls of different types in a table must be returned by the property node, they must all be of the same class. How LabVIEW manages it? He cast as a more generic class backstage? If so, how this work because it is generally dangerous to come back from a class derived from a base class because the data can or will be lost.

    Furthermore, a standard molded type takes just a binary model and interperates as differently it based on the data type. So how is "of a more specific class" able to raise an error if a generic control reference cannot be transformed into a class more specific. For example, in the attached photo, a control string reference would be mistake out there, but how? They are all classes of generic control when they get out of the property node. Is there some type of indicator in the generic control reference indicating the type? Maybe I think about this fundemtally wrong. All I can think is that the more specific / are more generic vi no type casting (which I guess they are not because it has separate type cast feature).

    Can someone explain how this all works. Inquiring minds want to know.

    for (imstuck) wrote:

    Now my question is, to place controls of different types in a table must be returned by the property node, they must all be of the same class. How LabVIEW manages it? He cast as a more generic class backstage? If so, how this work because it is generally dangerous to come back from a class derived from a base class because the data can or will be lost.

    Furthermore, a standard molded type takes just a binary model and interperates as differently it based on the data type. So how is "of a more specific class" able to raise an error if a generic control reference cannot be transformed into a class more specific. For example, in the attached photo, a control string reference would be mistake out there, but how? They are all classes of generic control when they get out of the property node. Is there some type of indicator in the generic control reference indicating the type? Maybe I think about this fundemtally wrong. All I can think is that the more specific / are more generic vi no type casting (which I guess they are not because it has separate type cast feature).

    Can someone explain how this all works. Inquiring minds want to know.

    I don't know all the details, but I would say you got it mostly right - there is an implicit conversion to a more generic type.  You will see this in several places in LabVIEW, for example, you can wire references to different types of controls in "table to build" to get a picture of their more specific common parent.  Because you're only casting reference - not the data that it contains, there is no loss of data.  A LabVIEW reference is just an I32 is (I assume) an index into a lookup table somewhere.  The value of this I32 does not change when it is converted into a more generic reference.  When you do "to more specific Type", LabVIEW raises this reference in the table and uses the data it found to determine if she can make the cast.  Who help me?

  • ClassCastException in the custom class loader

    I created a custom class Leon.

    CCL ClassLoaderDemo = new ClassLoaderDemo(); assume that it works very well
    CLAS class = ccl.loadClass ('com '' ' MyObject');

    com MyObjectSuperClass o1 = (com. MyObjectSuperClass) clas.newInstance ();

    Now I want to get the object responsible for MyObjectSuperClass which is super class if MyObject. But I'm getting the following exception

    Exception in thread "main" java.lang.ClassCastException: com. Com cannot be cast to MyObject. MyObjectSuperClass

    Help, please.

    821458 wrote:
    My requirement is the class MyObject needs to be loaded by my client class loader. If you say that let the superclass (MyObjectSuperClass) be in the class path and let the class system charge charger, then usually it be a problem

    No, it's exactly what you want.

    MyObject loaded by the custom class loader, its super class loaded by the system class loader, I will be able to cast then.

    Yes, you will be able to cast to the upper class, then.

    It is not similar to the statement "MyObject loaded by the class loader and custom class system are different and we cannot throw.

    No, it isn't. your confusion is due to the fact that you don't seem to understand that you can have a class hierarchy that spans the Chargers of classes. This should be obvious because each object hierarchy extends eventually object, which is always in the system class loader. Therefore, you can always convert any instance of any class loader "Object". in the same way, you can have MyObjectClass in your chargers personalized classes and MyObjectSuperClass in the system class loader. You can instantiate an instance of MyObjectClass to aid reflection on your custom class loaders and assign it to a reference of the type MyObjectSuperClass. This is how pretty much any plugin system is implemented (the API is in the 'main' class loader and the implementation is in a nested class or custom ClassLoader).

Maybe you are looking for

  • Why save a Mac

    If everything I do on my Mac is on the cloud, why would I need to save to an external drive. I'm about to buy one and I was wondering if it is necessary

  • Need to earn 8 drivers for Qosmio X 300 - 14 X (PQX31E)

    Hello I had to format my laptop and I need some drivers for 64bits Windows8.Is someone can give me those? Device name: Coprocessore Hardware IDPCI\VEN_10DE & DEV_0AA3 & SUBSYS_FF001179 & REV_B1PCI\VEN_10DE & DEV_0AA3 & SUBSYS_FF001179PCI\VEN_10DE & D

  • Qosmio F60 - 00Y has an optical output of the Audio (toslink\spdif)?

    The Australian model of Toshiba Qosmio F60 has an optical audio output?

  • HP pavilion g7: gpt partition

    I format the c drive try to install 8.1 partition butwindowsdvde dvd on the drive selected for installation are not in the recommended order. For more information on the installation of GPT disks, go in search of TPG Microsoft (www.microsoft.com ) We

  • WAG310G drops wireless

    Hello My WAG310G quite often (about once per day) loses wireless connectivity. In other words, the 2 computers that I have connected via radio lose their connections. 3 computers, I've connected on net cables not have these problems. The only way to