PDA

View Full Version : Incorrect number of arguments, line 23


ACKtion
11-06-2009, 04:31 AM
Hey guys, I am stuck. I keep getting the same error I have been stuck on this for hours. :confused:

here's my error:
1136: Incorrect number of arguments. Expected 0.

here's my code:

the error is supposedly on line 24 which is: volSlider = new VolumeSlider(this, volume_mc);



package com.wide.audio
{
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;

public class Player extends MovieClip
{
public var channel:SoundChannel;
public var sound:Sound;
public var progDisplay:ProgressDisplay;
public var volSlider:VolumeSlider;

public function Player()

{
//constructor function
play_mc.buttonMode = true;
pause_mc.buttonMode = true;
pause_mc.visible = false;
progDisplay = new ProgressDisplay(this, prog_mc.drag_mc, prog_mc.bar_mc, time_txt);
volSlider = new VolumeSlider(this, volume_mc);
play_mc.addEventListener(MouseEvent.CLICK, playSong);
pause_mc.addEventListener(MouseEvent.CLICK, pauseSong);
}

public function playSong(event:MouseEvent = null):void
{
/*ranelin_tribe_live_nature_boy.m4a*/
//rocky theme.mp3
var soundFile:String = "this_one_trane.mp3";
if(channel)
{
channel.stop();
}
sound = new Sound();
sound.load(new URLRequest(soundFile));
channel = sound.play(progDisplay.resumeTime);
progDisplay.init();
play_mc.visible = false;
pause_mc.visible = true;
}
public function pauseSong(event:MouseEvent = null):void
{
progDisplay.resumeTime = channel.position;
progDisplay.disable();
channel.stop();
play_mc.visible = true;
pause_mc.visible = false;
}
}
}

RogerClark
11-06-2009, 04:52 AM
It looks like the constructor function for you VolumeSlider class does not take any arguments.

look in VolumeSlider.as and you'll probably see some code reads something like

public function VolumeSlider()
{

If it doesn't look like this you're probably not instantiating the class you think your are, i.e. Flash may have made a dummy class for you if VolumeSlider is a symbol in the library which is not correctly linked to your AS file

ACKtion
11-06-2009, 05:15 AM
Thanks for getting back to me so soon.
I have a volume slider function. here is my volume slier class code.

package com.wide.audio
{
//soundclass
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.media.*;
import gs.*;

public class VolumeSlider
{
public var vol:MovieClip;
public var volDrag:MovieClip;
public var volBar:MovieClip;
public var volBarX:Number;
public var player:Player;

public function VolumeSlider(p:Player, v:MovieClip)
{
player = p;
vol = v;
vol.slider_mc.mask = vol.mask_mc;
volDrag = vol.slider_mc.drag_mc;
volBar = vol.slider_mc.bar_mc;
volBarX = volBar.x;
vol.buttonMode = true;
}

}

}

RogerClark
11-06-2009, 09:14 AM
My guess is that you have some pathing or package problem.

Is the class attached to a symbol in the library?