Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-27-2009, 11:55 AM   #1
andy killer
Registered User
Join Date: Jun 2008
Posts: 6
Default Class doesn't recognize extra arguments

What up people?!

I have this "small" problem.
I'm building a small website. It's external class based and the ideia is to load the menus and content externally, by XML.

I'm using as base code an example from "Learning Actionscript 3.0 Book", from Rich Shupe and Zevan Rosser.

My class structure, I believe, is working well, but somehow one of the classes is not working properly.

The problem happens in line 21 and line 27. The error is the following:

NavigationBar: line 21 (and 27);
1136: Incorrect number of arguments. Expected 0.
source: var menuBtn:MenuButtonMain = new MenuButtonMain( _navData.button[i].@label);

This is my AS3 class. It intereacts with more classes, so if you need the other classes to check, feel free to ask.

ActionScript Code:
package app.gui{     import flash.display.Sprite;     import flash.filters.DropShadowFilter;     public class NavigationBar extends Sprite {         private var _app:Sprite;         private var _buttonSpacing:int;         private var _hline:HLineThick;         private var _navData:XMLList;         public function NavigationBar(app:Sprite, navData:XMLList) {             _app = app;             _navData = navData;             _buttonSpacing = _navData.@spacing;             build();         }         private function build():void {             for (var i:int; i < _navData.button.length(); i++) {                 var menuBtn:MenuButtonMain = new MenuButtonMain( _navData.button[i].@label);                 menuBtn.x = 20 + (menuBtn.width + _buttonSpacing) *i;                 menuBtn.y = 75;                 var subMenuButtonNum:uint = _navData.button[i].project.length();                 for (var j:uint = 0; j < subMenuButtonNum; j++) {                     var subMenuButton:MenuButtonSub= new MenuButtonSub( _app, _navData.button[i].project[j]);                     subMenuButton.y = ((subMenuButton.height -2) * j);                     menuBtn.subMenu.addChild(subMenuButton);                 }                 addChild(menuBtn);             }             _hline = new HLineThick();             _hline.y=100;             _hline.mouseEnabled=false;             addChild(_hline);             var ds:DropShadowFilter = new DropShadowFilter();             ds.angle=45;             ds.distance=5;             ds.alpha=0.5;             filters=[ds];         }     } }

Thanks for the help ;-)
andy killer is offline   Reply With Quote
Old 10-27-2009, 02:46 PM   #2
Senior Member
Join Date: Apr 2009
Location: Nova Scotia, Canada
Posts: 193

What this error is saying to me is that the MenuButtonMain class is not expecting you to pass it the variable for the label. I'm guessing without being able to see that classes structure. What if you tried this:

var menuBtn:MenuButtonMain = new MenuButtonMain( );
menuBtn.label = _navData.button[i].@label;
xty is offline   Reply With Quote
Old 10-27-2009, 03:38 PM   #3
andy killer
Registered User
Join Date: Jun 2008
Posts: 6

Thanks xty.

I already solved the problem. The problem was in another class. The getter and setter functions for the extra arguments of "MenuButtonMain" were marked as private instead of public.

Thanks anyway
andy killer is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 07:39 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.