Convert DisplayObject to Class
Friday, July 13th, 2007I 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
tagged under:





4 Comments
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
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)
Administrator
• Visit Site
July 14th, 2007
Yes, it would be very nice to have sample code
Thanks Weyert
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