# Question from an AS3 beginner

**URL:** https://forum.kirupa.com/t/question-from-an-as3-beginner/277251
**Category:** flash
**Created:** [December 9, 2008, 11:30pm UTC](https://forum.kirupa.com/t/question-from-an-as3-beginner/277251 "2008-12-09T23:30:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![agifford](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@agifford](https://forum.kirupa.com/u/agifford)
#### Post date: [December 9, 2008, 11:30pm UTC](https://forum.kirupa.com/t/question-from-an-as3-beginner/277251/1 "2008-12-09T23:30:30Z")

</div>

I am trying to create a page completely with Action Script 3.0 and OOP. I have an object class named Grid, which extends the Movie Clip class. Inside the class definition I have my constructor function, also called “Grid,” which has an Enter\_Frame listener that calls a public function called “loadAssets”. This function creates a new sprite and uses “this.addChild(imageSprite);” to add the sprite object/instance to the Grid object. Now I want to add a Loader object INSIDE the sprite, as its child, into which I will load an image. Can I call a function that loads images and pass it the new sprite object as a parameter and have it add a Loader to it? CAN AN OBJECT BE PASSED TO A FUNCTION (it can in C++)? If so, I am not quite sure what the syntax of that would be - I’ve had a hard time trying to find a reference to this syntax.

If this is not possible, then can I have the function create a Loader object, but not add it as a child, but pass this object back as a return to the loadAssets function where it can then be added as a child of the sprite object? If so what would the syntax of this be?

Lastly, what is the syntax for specifying to add a child to a Sprite object that has been added to the Grid class I’ve been talking about.
