# Simple noob question about methods

**URL:** https://forum.kirupa.com/t/simple-noob-question-about-methods/288286
**Category:** flash
**Created:** [May 13, 2009, 6:21pm UTC](https://forum.kirupa.com/t/simple-noob-question-about-methods/288286 "2009-05-13T18:21:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![isk015](https://avatars.discourse-cdn.com/v4/letter/i/958977/32.png) [@isk015](https://forum.kirupa.com/u/isk015)
#### Post date: [May 13, 2009, 6:21pm UTC](https://forum.kirupa.com/t/simple-noob-question-about-methods/288286/1 "2009-05-13T18:21:00Z")

</div>

Hi all,

I am really needing some help with packages. It’s just driving me nuts. I searched everywhere but i simple just get the same error message over and over: 1180 - call to a possibly undefined object.

Here’s the code (I just extracted the most important things of the code…):

# ==================== ===== file path: teste1.fla

import scripts.objetos;

var obj\_array:Array = new Array();

…

var obj:Sprite=new Sprite();  
obj.name=‘testname’;  
obj.z=0;  
obj\_array.push(new criaObjeto(obj.name, obj.z));

# ========================== ===== file path: scripts/objetos.as

package {

```
public class criaObjeto{

    private var name:String;
    private var sortz:Number;

public function criaObjeto(nome:String, sortz:Number) {
    this.nome = nome;
    this.sortz = sortz;
}

public function getZ():Number {
    return sortz;
}

public function toString():String {
    return " " + name + ":" + sortz;
}

```

}  
}

* * *

I am using this code to sstore the z position and the child name of each obj.

Thanks for any help!

😃
