# 1061: Call to a possibly undefined method addChild through a reference with static ty

**URL:** https://forum.kirupa.com/t/1061-call-to-a-possibly-undefined-method-addchild-through-a-reference-with-static-ty/294290
**Category:** flash
**Created:** [August 12, 2009, 3:18am UTC](https://forum.kirupa.com/t/1061-call-to-a-possibly-undefined-method-addchild-through-a-reference-with-static-ty/294290 "2009-08-12T03:18:43Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![dkean](https://avatars.discourse-cdn.com/v4/letter/d/4bbf92/32.png) [@dkean](https://forum.kirupa.com/u/dkean)
#### Post date: [August 12, 2009, 3:18am UTC](https://forum.kirupa.com/t/1061-call-to-a-possibly-undefined-method-addchild-through-a-reference-with-static-ty/294290/1 "2009-08-12T03:18:43Z")

</div>

I am a newbee and just starting to learn about AS3. Copied some ideas and tried to paint a single particle on the stage for starters. No success! I get this…

**[COLOR=Red]1061: Call to a possibly undefined method addChild through a reference with static type flash.display:DisplayObject.[/COLOR]**

In an “Particle.as” file I have this code…

\*\*[COLOR=Blue]package  
{

```
import flash.display.*;

public class Particle extends MovieClip
{

    public function Particle ( spriteclass : Class, targetclip : DisplayObject, xpos : Number, ypos : Number)
    {

    // instantiate a new particle graphic
    if(spriteclass) {
    
    clip = new spriteclass();
    
    // and add it to the stage
    targetclip.addChild(clip);
    
    // and set its position
    clip.x = xpos;
    clip.y = ypos;

    }
    public function setVel(xvel:Number,yvel:Number)
    {
        xVel = xvel;
        yVel = yvel;
    }
    public function update()
    {
        clip.x = xVel;
        clip.y = yVel;
    }
    public function destroy():void
    {
        clip.parent.removeChild(clip);
    }
}

```

}[/COLOR]\*\*

Also, on the stage layer 1 frame 1 I have this code…

[COLOR=Indigo]\*\*var particle = new Particle(spark, this, 275,200);  
\*\*[/COLOR]  
What is wrong here? And keep in mind that I am a just starting up with AS3…

TIA

DKean
