【问题标题】:Error: Incorrect number of arguments. Expected no more than 5. in nexusShop\NexusShopPopupView.as(47): col: 115错误:参数数量不正确。预计不超过 5. 在 nexusShop\NexusShopPopupView.as(47): col: 115
【发布时间】:2018-09-16 00:28:23
【问题描述】:

我想为此构建一个 swf 文件,我正在使用 FlashDevelop Flex SDK 4.6 这工作,直到我开始收到此错误:“错误:参数数量不正确。预计不超过 5 个。 在 nexusShop\NexusShopPopupView.as(47): col: 115" 我想要一些建议。谢谢。

public class NexusShopPopupView extends ModalPopup 
{

    public static const TITLE:String = "Purchase";
    public static const WIDTH:int = 300;
    public static const HEIGHT:int = 170;

    private var availableInventoryNumber:int;
    private var owner_:SellableObject;
    public var buyItem:Signal;
    public var buttonWidth:int;
    public var descriptionLabel:UILabel;
    public var itemLabel:UILabel;
    private var quantity_:int = 1;
    private var buySectionContainer:Sprite;
    public var buyButton:ShopBuyButton;
    public var spinner:FixedNumbersSpinner;
    private var buyButtonBackground:SliceScalingBitmap;

    public function NexusShopPopupView(_arg_1:Signal, _arg_2:SellableObject, _arg_3:Number, _arg_4:int)
    {
        super(WIDTH, HEIGHT, TITLE, DefaultLabelFormat.defaultSmallPopupTitle, new Rectangle(0, 0, 525, 230), 0);
        this.buyItem = _arg_1;
        this.owner_ = _arg_2;
        this.buttonWidth = _arg_3;
        this.availableInventoryNumber = _arg_4;
        this.descriptionLabel = new UILabel();
        DefaultLabelFormat.infoTooltipText(this.descriptionLabel, 0x999999);
        this.descriptionLabel.text = "Are you sure that you want to buy this item?";
        addChild(this.descriptionLabel);
        this.descriptionLabel.x = ((WIDTH / 2) - (this.descriptionLabel.width / 2));
        this.descriptionLabel.y = 10;
        this.addItemContainer();
        this.addBuyButton();
        this.filters = FilterUtil.getStandardDropShadowFilter();
    }

    private function addItemContainer():void
    {
        var _local_1:ItemWithTooltip;
        if (this.owner_.getSellableType() != -1)
        {
            _local_1 = new ItemWithTooltip(this.owner_.getSellableType(), 80);
        };
        _local_1.x = ((WIDTH / 2) - (_local_1.width / 2));
        _local_1.y = (((HEIGHT / 2) - _local_1.height) + 5);
        addChild(_local_1);
        this.itemLabel = new UILabel();
        DefaultLabelFormat.petYardUpgradeRarityInfo(this.itemLabel);
        this.itemLabel.text = this.owner_.soldObjectName();
        addChild(this.itemLabel);
        this.itemLabel.x = ((WIDTH / 2) - (this.itemLabel.width / 2));
        this.itemLabel.y = (_local_1.y + 55);
    }

    private function addBuyButton():void
    {
        var _local_2:int;
        this.buySectionContainer = new Sprite();
        this.buySectionContainer.alpha = 1;
        this.buyButton = new ShopBuyButton(this.owner_.price_, this.owner_.currency_);
        this.buyButton.width = 95;
        this.buyButtonBackground = TextureParser.instance.getSliceScalingBitmap("UI", "buy_button_background", (this.buyButton.width + 60));
        var _local_1:Vector.<int> = new Vector.<int>();
        if (this.availableInventoryNumber != 0)
        {
            _local_2 = 1;
            while (_local_2 <= this.availableInventoryNumber)
            {
                _local_1.push(_local_2);
                _local_2++;
            };
        }
        else
        {
            _local_1.push(1);
            this.buyButton.disabled = true;
        };
        this.spinner = new FixedNumbersSpinner(TextureParser.instance.getSliceScalingBitmap("UI", "spinner_up_arrow"), 0, _local_1, "x");
        this.buySectionContainer.addChild(this.buyButtonBackground);
        this.buySectionContainer.addChild(this.spinner);
        this.buySectionContainer.addChild(this.buyButton);
        this.buySectionContainer.x = 100;
        this.buySectionContainer.y = (HEIGHT - 45);
        this.buyButton.x = ((this.buyButtonBackground.width - this.buyButton.width) - 6);
        this.buyButton.y = 4;
        this.spinner.y = -2;
        this.spinner.x = 32;
        addChild(this.buySectionContainer);
        this.buySectionContainer.x = Math.round(((WIDTH - this.buySectionContainer.width) / 2));
        this.spinner.upArrow.addEventListener(MouseEvent.CLICK, this.countUp);
        this.spinner.downArrow.addEventListener(MouseEvent.CLICK, this.countDown);
        this.refreshArrowDisable();
    }

    private function refreshArrowDisable():void
    {
        this.spinner.downArrow.alpha = ((this.quantity_ == 1) ? 0.5 : 1);
        if (this.availableInventoryNumber != 0)
        {
            this.spinner.upArrow.alpha = ((this.quantity_ == this.availableInventoryNumber) ? 0.5 : 1);
        }
        else
        {
            this.spinner.upArrow.alpha = 0.5;
        };
    }

    private function countUp(_arg_1:MouseEvent):void
    {
        if (this.quantity_ < this.availableInventoryNumber)
        {
            this.quantity_ = (this.quantity_ + 1);
        };
        this.refreshValues();
    }

    private function countDown(_arg_1:MouseEvent):void
    {
        if (this.quantity_ > 1)
        {
            this.quantity_ = (this.quantity_ - 1);
        };
        this.refreshValues();
    }

    private function refreshValues():void
    {
        this.refreshArrowDisable();
        this.buyButton.price = (this.owner_.price_ * this.quantity_);
    }

    public function get getBuyButton():ShopBuyButton
    {
        return (this.buyButton);
    }

    public function get getBuyItem():Signal
    {
        return (this.buyItem);
    }

    public function get getOwner():SellableObject
    {
        return (this.owner_);
    }

    public function get getQuantity():int
    {
        return (this.quantity_);
    }


}

}//包io.decagames.rotmg.nexusShop

【问题讨论】:

    标签: actionscript-3 flex4 flashdevelop


    【解决方案1】:

    问题不在于你共享的这个类,它发生在你正在使用和实例化它的地方。查看构造函数:

    NexusShopPopupView(_arg_1:Signal, _arg_2:SellableObject, _arg_3:Number, _arg_4:int)
    

    它得到4个输入参数。在您实例化此类的代码中的某处,您向构造函数传递了错误数量的参数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-29
      • 1970-01-01
      • 1970-01-01
      • 2018-02-20
      • 2021-04-19
      • 2017-05-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多