I have 2 classes with a draw function in them, my Background class and VideoDisplay class. I'm not done with the VideoDisplay class, but I put simple traces in it to test. I call both the Background and VideoDisplay the same way in my document class, but when I try to call the draw function of the VideoDisplay class I get this error:
Error #1006: draw is not a function.
My Document class code:
//this is inside of onBulkLoadComplete which is called from init
drawBackground();
drawVideo();
}
private function drawBackground():void
{
trace("\r"+"drawBackground(); ---------- called");
bg = new Background();
bg.draw(globalWidth, globalHeight, firstTitle);
stage.addChild(bg);
}
private function drawVideo():void
{
trace("\r"+"drawVideo(); ---------- called");
vd = new VideoDisplay();
vd.draw(globalWidth, globalHeight, videoName); //<-- problem
stage.addChild(vd);
}
Basically the code above is the same! So I dunno why on the vd.draw line I'm getting that #1006 error
The code for the draw function in my VideoDisplay class:
public function draw(w, h, flvUrl):void
{
sizeW = w;
sizeH = h;
flvSource = flvUrl;
trace("VideoDisplay.sizeW = "+sizeW);
trace("VideoDisplay.sizeH = "+sizeh);
trace("VideoDisplay.flvSource = "+flvSource);
backing.graphics.beginFill(bgColor);
backing.graphics.lineStyle(borderSize, borderColor);
backing.graphics.drawRoundRect(position, position, sizeW-9, sizeH-9, cornerRadius);
backing.graphics.endFill();
}
The full output window trace/error message:
drawBackground(); ---------- called
Background.sizeW = 520
Background.sizeH = 510
Background.mainTitle = Video Title
drawVideo(); ---------- called
TypeError: Error #1006: draw is not a function.
at com.leongaban.TEN::TEN/drawVideo()
at com.leongaban.TEN::TEN/onBulkLoadComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at br.com.stimuli.loading::BulkLoader/_onAllLoaded()
at br.com.stimuli.loading::BulkLoader/_onItemComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at br.com.stimuli.loading.loadingtypes::LoadingItem/onCompleteHandler()
at br.com.stimuli.loading.loadingtypes::XMLItem/onCompleteHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()