Why am I getting 'Argument count mismatch' error here?
Posted
by Leon
on Stack Overflow
See other posts from Stack Overflow
or by Leon
Published on 2010-04-11T19:50:09Z
Indexed on
2010/04/11
19:53 UTC
Read the original article
Hit count: 312
I have a Document class, Intro class and Nav class.
The Intro class runs first, then sends a custom dispatch event to run the Nav class, but I'm getting this error:
removed Intro
ArgumentError: Error #1063: Argument count mismatch on com.secrettowriting.StanPlayer.ui::Navigation/addNav(). Expected 0, got 1.
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.secrettowriting.StanPlayer.display::Intro/removeIntro()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
The addNav function in the Navigation class should expect 0 arguments/variables and I'm not sending any arguments/variables to it, which is why I'm confused as to why it's saying I'm getting 1.
My Document Class:
public function HomePlayer():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
// Use when Live
//videoURL = this.loaderInfo.parameters.theVIDEO; // Get the Video URL from HTML
// Remove when video testing ready
videoURL = "videos/WhatDifferentiatesUs.flv";
drawNav();
drawIntro();
}
private function drawIntro():void
{
intro = new Intro();
intro.drawIntro();
intro.addEventListener("onComplete", nav.addNav);
stage.addChild(intro);
}
private function drawNav():void
{
nav = new Navigation();
nav.drawNav();
stage.addChild(nav);
}
Intro Class:
Public function Intro():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
}
public function drawIntro():void
{
introMov = new IntroMov();
introMov.alpha = 0;
addChild(introMov);
TweenLite.to(introMov, 3, {alpha:1});
// Timer
introFader = new Timer(INTRO_DELAY);
introFader.addEventListener(TimerEvent.TIMER, fadeIntro);
introFader.start();
introRemover = new Timer(INTRO_DELAY);
introRemover.addEventListener(TimerEvent.TIMER, removeIntro);
}
private function fadeIntro(e:TimerEvent):void
{
if (i < 30){
i++
} else if (i == 30){
TweenLite.to(introMov, 1.5, {alpha:0});
introFader.removeEventListener(TimerEvent.TIMER, fadeIntro);
introRemover.start();
}
}
private function removeIntro(e:TimerEvent):void
{
if (n < 10){
n++
} else if (n == 10){
introRemover.removeEventListener(TimerEvent.TIMER, removeIntro);
removeChild(introMov);
trace("removed Intro");
dispatchEvent (new CustomEvent(CustomEvent.COMPLETE, {})); // ? Intro to Navigation
}
}
Navigation Class functions:
public function drawNav():void
{
weAreA = new WeAreA();
weAreA.alpha = 0;
weAreA.x = 20;
weAreA.y = 35;
introText = new IntroText();
introText.alpha = 0;
introText.x = 20;
introText.y = 124;
chooseAVideo = new ChooseAVideo();
chooseAVideo.alpha = 0;
chooseAVideo.x = 20;
chooseAVideo.y = 336;
}
public function addNav():void
{
addChild(weAreA);
addChild(introText);
addChild(chooseAVideo);
TweenLite.to(weAreA, 2, {alpha:1});
TweenLite.to(introText, 3, {alpha:1});
TweenLite.to(introText, 3, {alpha:1});
}
© Stack Overflow or respective owner