# OOP - problem wíth getter method

**URL:** <https://forum.kirupa.com/t/oop-problem-with-getter-method/206817>\
**Category:** Uncategorized\
**Created:** [November 11, 2006, 8:05pm UTC](https://forum.kirupa.com/t/oop-problem-with-getter-method/206817 "2006-11-11T20:05:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnnyboy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/johnnyboy/32/1973_2.png) [@johnnyboy](https://forum.kirupa.com/u/johnnyboy)\
**Post date:** [November 11, 2006, 8:05pm UTC](https://forum.kirupa.com/t/oop-problem-with-getter-method/206817/1 "2006-11-11T20:05:08Z")

</div>

Hi guys

I’m experimenting a little with Flashr 0.5, but got stuck cause of my newbie knowledge of OOP 😕

My problem is, that my array - \_arrReturn traces fine in my private method, but in my getter method it returns undefined!?!

[AS]  
import com.kelvinluck.flashr.core.Flashr;  
import com.kelvinluck.flashr.core.FlashrResponse;  
import com.kelvinluck.flashr.core.Person;  
import com.kelvinluck.flashr.core.Photo;  
import com.dynamicflash.utils.Delegate;  
class com.jboy.slider.FlickrLoader  
{  
private var \_apiKey:String = “xxx”;  
private var \_userNsid:String = “[94146040@N00](mailto:94146040@N00)”;  
private var \_arr:Array;  
private var \_arrReturn:Array;

// Allow me to get the array of info  
public function get getCollection():Array  
{  
return \_arrReturn; // returns undefined!??  
}

// CONSTRUCTOR  
public function FlickrLoader()  
{  
var \_flickr:Flashr = Flashr.getFlashr();  
\_flickr.apiKey = \_apiKey;

var \_responseListener:FlashrResponse = new FlashrResponse();  
\_responseListener.setSuppressOutput(true);  
\_responseListener.onPeopleGetPublicPhotos = Delegate.create(this, onPeopleGetPublicPhotos);  
\_flickr.peopleGetPublicPhotos(\_userNsid, null, 12,1);  
}

// Add info to Array  
private function onPeopleGetPublicPhotos(p:Person):Void  
{  
var \_arrReturn:Array = new Array();  
var \_arr:Array = new Array();  
\_arr = p.getPhotos();

for (var i:Number=0; i\<\_arr.length; i++)  
{  
var pic:Photo = Photo(\_arr\*);  
\_arrReturn.push(pic.thumbnailUrl);  
}  
trace(\_arrReturn); // Works fine here!!  
}  
}  
[/AS]

Hope somebody can help me out here…

Thnx
