# Embedding an image in a class and calling the function in Main.as

**URL:** <https://forum.kirupa.com/t/embedding-an-image-in-a-class-and-calling-the-function-in-main-as/326201>\
**Category:** Uncategorized\
**Created:** [November 29, 2011, 11:20am UTC](https://forum.kirupa.com/t/embedding-an-image-in-a-class-and-calling-the-function-in-main-as/326201 "2011-11-29T11:20:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesebert1](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jamesebert1](https://forum.kirupa.com/u/jamesebert1)\
**Post date:** [November 29, 2011, 11:20am UTC](https://forum.kirupa.com/t/embedding-an-image-in-a-class-and-calling-the-function-in-main-as/326201/1 "2011-11-29T11:20:36Z")

</div>

I’m sure that this is simple and I’m gona feel stupid once some one answers it for me but i can’t find an answer on the net. the hero.as class is as follows.

public class Hero  
{  
public var health:int;

```
    [Embed(source="Resources/Images/ship1.png")]
    private var layer0Class:Class;
    private var layer0:Bitmap = new layer0Class();
    
    public function Hero(health:int=1) 
    {
        this.health = health;
        trace("hero");
    }
    public function render():void
    {
        trace("hero is rendered");
        addChild(layer0);
    }

 }

```

when I call the render function in the Main.as, it doesn’t render the picture, i’m brand new to this and no matter how i’ve tried to change things around I haven’t been able to hit on it. If anyone can tell me what I need to change, and why this doesn’t work, that would be a huge help. Sorry if this has been asked before, I didn’t see a thread on it.
