J'ai 2 classes avec une fonction de dessin, mes classes Background et VideoDisplay. Je n'ai pas fini avec la classe VideoDisplay, mais j'ai mis des traces simples à tester. J'appelle à la fois l'arrière-plan et VideoDisplay de la même manière dans ma classe de document, mais lorsque j'essaie d'appeler la fonction draw de la classe VideoDisplay, j'obtiens cette erreur:Pourquoi ai-je cette erreur? Erreur # 1006: draw n'est pas une fonction
Erreur # 1006: draw n'est pas une fonction.
Mon document Code de classe:
//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);
}
Fondamentalement, le code ci-dessus est le même! Donc, je ne sais pas pourquoi la ligne de vd.draw Je reçois que # 1006 erreur
Le code de la fonction de tirage au sort dans ma classe VideoDisplay:
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();
}
La fenêtre de sortie complète trace/erreur 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()
J'utilise Flash, mais j'essaierai de renommer ma classe maintenant :) –
Ah, hey les gars, j'ai découvert que l'un de mes MovieClips avait un nom de classe de VideoDisplay! Je l'ai changé, maintenant je reçois une nouvelle erreur: 1024: Surcharge d'une fonction qui n'est pas marquée pour le remplacement. –
La nouvelle erreur est-elle sur la même ligne? Si oui, allez pour renommer la fonction. – iandisme