# addChild mouseClick

**URL:** <https://forum.kirupa.com/t/addchild-mouseclick/315617>\
**Category:** flash\
**Created:** [October 30, 2010, 1:02pm UTC](https://forum.kirupa.com/t/addchild-mouseclick/315617 "2010-10-30T13:02:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jagguy](https://avatars.discourse-cdn.com/v4/letter/j/b487fb/32.png) [@jagguy](https://forum.kirupa.com/u/jagguy)\
**Post date:** [October 30, 2010, 1:02pm UTC](https://forum.kirupa.com/t/addchild-mouseclick/315617/1 "2010-10-30T13:02:26Z")

</div>

[LEFT]If I want to have a mouseEvent and add an image to a sprite I need to add the image in the class and not after ?  
See where I have used addChild?

[//main.as](https://main.as)

myintro= **new** ClassIntro(IntroCanvas,0,0);[/LEFT]

myintro.addEventListener ( **“introClicked”** ,intro\_Handler);

\*\*\*IntroCanvas.addChild(myintro); //doesnt work but why cant I add this line?\*\*\*~

[LEFT]////ClassIntro

[/LEFT]

**private**  **function** imageLoaded(event:Event): **void**  
[LEFT]{

[/LEFT]

**var** image:Bitmap = **new** Bitmap(event.target.content.bitmapData); [LEFT]  
IntroCanvas.addChild(image);  
IntroCanvas.x = 0;  
IntroCanvas.y = 0;[/LEFT]  
**IntroCanvas.addEventListener(MouseEvent.CLICK ,doSomething); //for this to work i must add the image to the sprite**
