# Advanced Symbol Linkage Understanding

**URL:** https://forum.kirupa.com/t/advanced-symbol-linkage-understanding/253156
**Category:** flash
**Created:** [February 27, 2008, 5:29pm UTC](https://forum.kirupa.com/t/advanced-symbol-linkage-understanding/253156 "2008-02-27T17:29:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![trilec](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@trilec](https://forum.kirupa.com/u/trilec)
#### Post date: [February 27, 2008, 5:29pm UTC](https://forum.kirupa.com/t/advanced-symbol-linkage-understanding/253156/1 "2008-02-27T17:29:46Z")

</div>

Im tring to understand the linkage limitations as perhaps im using it wrong?  
if anyone has used it in this manner please reply.  
\*my goal is to control a symbol from another class instance;  
\*  
under the Linkage values of a movieclip symbol (in the designer) I enter:

\*\*Class: MyNewClip  
BaseClase: com.trilec.ui.myMovieClip  
export to ActionScript: on  
export in FirstFrame: on  
\*\*  
I then edit the MyNewClip symbol and enter the following action script(frame1):  
(see myMovieClip for class details bellow)

\*\*override function draw() {  
trace(“override draw”);  
}  
override function layout() {  
trace(“override layout”);  
}  
\*\*  
then create a red box in the symbol for testing  
Next create the myMovieClip class

contains:

\*\*package com.trilec.ui  
{  
import flash.text.TextField;  
import flash.display.MovieClip;  
public class myMovieClip extends MovieClip {  
public var internalW:uint = 10;  
public var internalH:uint = 10;

```
//Contruction.
function ****myMovieClip**** (cw:uint, ch:uint) {   

```

internalW=cw;  
internalH=ch;  
createChildren();  
draw();  
layout();  
}  
function createChildren():void {  
}  
function draw():void {  
}  
function layout():void {  
}  
function setSize(cw:Number,ch:Number):void {  
internalW=cw;  
internalH=ch;  
draw();  
layout();  
}  
}//class  
}\*\*

I then create the instance and run using this function:  
this is so a name can be used to access the symbol clip in the main fla (or whereever)

\*\*public function getMyMovieInstance( val:String,cx:int,cy:int):\*\*\*\*myMovieClip \*\*\*\*{  
var classDef:Object = null;  
var instance:\*\*\*\*myMovieClip \*\*\*\*=null;  
var skin:Object = val;  
try {  
classDef = getDefinitionByName(skin.toString());//get from fla file  
instance = new classDef();  
} catch(e:Error) { } //do nothing  
if (instance == null) {  
instance = new \*\*\*\*myMovieClip \*\*\*\*(cx,cy);  
}  
return instance as \*\*\*\*myMovieClip \*\***; //return it as a DisplayObject  
}**

and so in my main code:

\*\* var myClipSkin:myMovieClip;  
myClipSkin = getCeMovieInstance( “MyNewClip”); //included in fla as above  
addChild(myClipSkin);\*\*

now you would think this would work giving a red box with a trace  
…but…noooooo…

Interesting issues:  
compiler errors:  
**1203: No default constructor found in base class com.trilec.ui::myMovieClip.**

hmm, ok ill add one.

function MyNewClip (cx:int,cy:int){  
}  
compiler errors:

adding a \*\*constructor to the \*\*\*\*MyNewClip symbol  
1021: Duplicate function definition.

\*\*hmm turning export in FirstFrame: **off**  
so I turn off  
no errors but no red box and no trace

take out constructor again.  
no change.

hmmm…wtf
