Convert DisplayObject to Class

Friday, July 13th, 2007

I and my friend as well have same AS3.0 question: Is it possible convert (or somehow get) DisplayObject to Class?

This is our situations:

  • How do i cast loader.content to type Class ? I dynamically load image bytes into a loader for the tree component. But the tree expects type Class not DisplayObject. What should I do?
  • I want create dynamic icon for Button. I have BitmapData but how can I obtain Class for skin or icon?

Does anyone know the answer? Some hints?
Thanks

AddThis Feed Button

This is some text prior to the author information. You can change this text from the admin section of WP-Gravatar  I'm living in Bratislava, Slovakia. I'm Senior Flex, AIR Developer for my own company Flexets. Read more from this author


tagged under:

ABOUT THIS AUTHOR

I'm living in Bratislava, Slovakia. I'm Senior Flex, AIR Developer for my own company Flexets.

Get a Trackback link

4 Comments


  1. Ash
    Visit Site
    July 13th, 2007

    I think in both cases the components create a new instance of the class, which is intended for embedded images rather than dynamic ones.
    You may have to create a new item renderer for the tree which grabs the bitmapdata from the dataprovider or a central repository.

    Unless theres an easier way I’m missing. I didnt look at the documentation :)


  2. Weyert de Boer
    Visit Site
    July 14th, 2007

    A friend has tackled the latest question earlier this week for me. You need to derive from the Button class and use a event to update the drawing (on request). Works like charm for me.

    Once again thanks Champbell Anderson :)

    (you can ask him or me if you need sample code)


  3. Administrator
    Visit Site
    July 14th, 2007

    Yes, it would be very nice to have sample code :)
    Thanks Weyert


  4. Administrator
    Visit Site
    July 16th, 2007

    This is Campbell Anderson’s answer (example with source included)

    Intro and Answer

    Thanks Campbell

Live Preview

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="">

This site is using OpenAvatar based on
Images is enhanced with WordPress Lightbox JS by Zeo
Clicky Web Analytics