So I am trying to add a variable from my library to the stage. My variable is a chunk of text saved as a movie clip titled KatText. The issue is I can add it straight onto the stage via this code:
this.addChild(KatText ());
However when I try to add it as a variable so I can position the text I get the error
1067: Implicit coercion of a value of type Class to an unrelated type flash.display: DisplayObject.
This is the code I am trying to use to define the varible from the library:
var katText:Object = new KatText();
this.addChild(KatText);
Here is all of the code just in case its needed:
import flash.display.BlendMode;
import flash.events.MouseEvent;
import flash.utils.Timer;
//Tweener files
import caurina.transitions.*;
import caurina.transitions.properties.ColorShortcuts;
ColorShortcuts.init();//Required Param for Color Transform
/////////////////////////
/////////////////////////
/////////////////////////
/////////////////////////
//Positions
const NUM_PORTBUTTONS:uint = 11; //how many buttons will exist
const NUM_PORTBUTTONS2:uint = 20;
const LEFT_MARGIN:uint = 100;
const SPACER:uint = 10;
const TOP_MARGIN:uint = 475;
//Colors
const WHITE:Object = 0xFFFFFF;
initPos();
var codyLg:Loader = new Loader();
codyLg.load(new URLRequest("codyLg.jpg"));
var katLg:Loader = new Loader();
katLg.load(new URLRequest("katrinaLg2.jpg"));
/*var kevLg:Loader = new Loader();
kevLg.load(new URLRequest("kevLg.jpg"));
*/
///////functions for gallery buttons//////
function initPos():void {
trace("initialized NavBar");
//on click (working)
katrinaThumb.addEventListener(MouseEvent.ROLL_OVER, katrina);
codyThumb.addEventListener(MouseEvent.ROLL_OVER, cody);
//kevinThumb.addEventListener(MouseEvent.ROLL_OVER, kevin);
//vincentThumb.addEventListener(MouseEvent.CLICK, vincent);
//katrinaThumb.addEventListener(MouseEvent.ROLL_OUT, katrinaOut);
}
function katrina (event:MouseEvent):void{
trace("katrina function");
addChild(katLg);
var katText:Object = new KatText();
this.addChild(KatText);
katLg.x=350;
katLg.y=100;
//KatText.x=10;
// KatText.y=10;
}
/*function katrinaOut (event:MouseEvent):void{
trace("katrina function out");
removeChild(katLg);
removeChild(KatText);
}*/
function cody (event:MouseEvent):void{
trace("cody function");
addChild(codyLg);
codyLg.x=350;
codyLg.y=100;
}
/* function kevin (event:MouseEvent):void{
trace("kevin function");
addChild(kevLg);
codyLg.x=350;
codyLg.y=100;
}*/