# Passing MovieClips through Classes

**URL:** <https://forum.kirupa.com/t/passing-movieclips-through-classes/223650>\
**Category:** flash\
**Created:** [April 24, 2007, 5:07pm UTC](https://forum.kirupa.com/t/passing-movieclips-through-classes/223650 "2007-04-24T17:07:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pedro\_paulo](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pedro_paulo/32/2017_2.png) [@pedro\_paulo](https://forum.kirupa.com/u/pedro_paulo)\
**Post date:** [April 24, 2007, 5:07pm UTC](https://forum.kirupa.com/t/passing-movieclips-through-classes/223650/1 "2007-04-24T17:07:41Z")

</div>

Hello, folks!

I have a hard difficult using classes in Flash. The question is: How can I attach movie clips through classes ?

For example: I have a class to do a clip like an excel table:

So, I have a Cell class (Celula.as), a Columm (Coluna.as) and the final table (Tabela.as).

Here they are:

Cell:

```auto

class Celula {
 
 private var superID:Number;
 private var grupo:String;
 private var texto:String;
 private var conteiner:MovieClip;
 
 
 function Celula() {
  superID = new Number();
  grupo = new String();
  texto = new String();
  conteiner = new MovieClip();
 }
 
 // setters:
 public function setDataProvider(id:Number, g:String, t:String):Void {
  this.superID = id;
  this.grupo = g;
  this.texto = t;
  trace("superID: "+this.superID + newline + "grupo: "+this.grupo + newline + "texto: "+this.texto + newline + "--------------");
 }
 
 
 
 // getters:
 public function getSuperID():Number {
  return this.superID;
 }
 public function getGrupo():String {
  return this.grupo;
 }
 public function getTexto():String {
  return this.texto;
 }
 
 private function getClip():MovieClip {
  var mc:MovieClip = this.conteiner.attachMovie("celula_mc", "celula"+superID, superID);
  mc.rotulo_txt.htmlText = this.getTexto();
  return mc;
 }

}

```

Columm, wich imports the Cell class…

```auto

import Celula;
class Coluna {
 
 
 
 private var grupo:String;
 private var celula:Celula;
 private var arrCel:Array;
 private var conteiner:MovieClip;
 
 
  
 function Coluna() {
  this.grupo = new String();
  this.celula = new Celula();
  this.arrCel = new Array();
 }
 
 
 public function setColuna(g:String, no:XMLNode):Void {
  this.createColuna(g,no);
 }
 
 public function getCelulas():Array {
  return this.arrCel;
 }
 
 public function getCelulaAt(i:Number):Celula {
  return this.arrCel*;
 }
 public function getGrupo():String {
  return this.grupo;
 }
 public function getClip():MovieClip {
  return this.conteiner; 
 }
 private function createColuna(grupo:String, noColuna:XMLNode):Void {
  var count:Number = noColuna.childNodes.length;
  for(var i:Number = 0; i < count ; i++){
   var celula:Celula = new Celula();
   celula.setDataProvider(i, grupo, noColuna.childNodes*.childNodes[0].firstChild.nodeValue) 
   arrCel.push(celula);
   this.conteiner.attachMovie(this.arrCel*.conteiner, "cel"+i, (i));
  }
 }
}
 

```

And, finally, the Table wich imports the Coluna.as Class

```auto

import Coluna;
class Tabela {
 
 private var numColunas:Number;
 private var larguraMaxima:Number;
 private var arrColunas:Array;
 private var conteiner:MovieClip;
 private var coluna:Coluna;
 // 
 // construtor:
 function Tabela() {
  numColunas = new Number();
  larguraMaxima = new Number();
  arrColunas = new Array();
  coluna = new Coluna();
 }
 //
 // setters:
 public function setTabela(noXML:XMLNode):Void {
  var totalColunas:Number = noXML.childNodes.length;
  this.numColunas = totalColunas;
  this.conteiner = _root.createEmptyMovieClip(noXML.attributes.nome, _root.getNextHighestDepth());
  for (var i:Number = 0; i < totalColunas; i++) {
   var cl:Coluna = new Coluna();
   cl.setColuna(noXML.childNodes*.attributes.grupo, noXML.childNodes*);
   this.arrColunas.push(cl);
   var mc:MovieClip = this.conteiner.attachMovie("celula_mc", "col"+i, this.conteiner.getNextHighestDepth());
  }  
  
 }
 public function attach():Void {
  _root.createEmptyMovieClip("tabela", _root.getNextHighestDepth());
 }
 public function setLargMax(w:Number):Void {
  this.larguraMaxima = w;
 }
 //
 // getters:
 public function getNumColunas():Number {
  return this.numColunas;
 }
 public function getTabela():Tabela {
  return this;
 }
 public function getArrColunas():Array {
  return this.arrColunas;
 }
 public function getConteiner():MovieClip {
  return this.conteiner;
 }
}

```

So, my problem is: I do not know how to insert the Celula.as object into the Coluna.as object and insert the Coluna.as objects into the Tabela.as object.

Some one can help me with this?

Sorry for my poor english.

Tks!

pp
