# Novice trying OOP for the first time

**URL:** <https://forum.kirupa.com/t/novice-trying-oop-for-the-first-time/137624>\
**Category:** Uncategorized\
**Created:** [February 16, 2005, 7:49am UTC](https://forum.kirupa.com/t/novice-trying-oop-for-the-first-time/137624 "2005-02-16T07:49:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marc0047](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@marc0047](https://forum.kirupa.com/u/marc0047)\
**Post date:** [February 16, 2005, 7:49am UTC](https://forum.kirupa.com/t/novice-trying-oop-for-the-first-time/137624/1 "2005-02-16T07:49:15Z")

</div>

I’m trying to build my first class based on what I’ve read so far, and off to an ok start. However,…

I’m starting a Portfolio class, and I am having a snag on a prototype method that I would like to trace back an array set. I was able to create a simple prototype findArray(), which worked to return the correct results. However, the prototype rightButton() returns a proper trace with “I work”, but it returns an “undefined” for the ‘\_parent.theItems’.

I’m sure this is a targeting problem, and I have also tried ‘\_parent.\_parent.theItems’, and that didn’t seem to work. I was wondering if anyone knew what I’m doing wrong, or if I’m going about this the _completely_ wrong way. 😉

Thanks. The following is the code:

\_global.Portfolio = function(itemsArray) {  
this.theItems = itemsArray;  
}

Portfolio.prototype.findArray = function() {  
trace (this.theItems);  
}

Portfolio.prototype.rightButton = function(clip) {  
clip.onRelease = function() {  
trace(“I work”);  
trace (\_parent.theItems);  
}  
}

boxes = [“box1”, “box2”, “box3”, “box4”, “box5”];  
portfolio1 = new Portfolio(boxes);  
portfolio1.findArray();  
portfolio1.rightButton(rightMovieClip); // returns “I work” and “undefined”
