【发布时间】:2010-04-11 15:58:22
【问题描述】:
我正在使用嵌入在我的 swf 中的以下脚本创建一个新站点。但我在所有页面上不断收到此错误:错误 #1063:com.flashden::MenuItem() 上的参数计数不匹配。预期 1,得到 0。
package com.flashden
{
import flash.display.MovieClip;
import flash.text.*;
import flash.events.MouseEvent;
import flash.events.*;
import flash.net.URLRequest;
import flash.display.Loader;
public class MenuItem extends MovieClip
{
private var scope;
public var closedX; :Number
public static const OPEN_MENU = "openMenu";
public function MenuItem(scope)
{
// set scope to talk back to -------------------------------//
this.scope = scope;
// disable all items not to be clickable -------------------//
txt_label.mouseEnabled = false;
menuItemShine.mouseEnabled = false;
menuItemArrow.mouseEnabled = false;
// make background clip the item to be clicked (button) ----//
menuItemBG.buttonMode = true;
// add click event listener to the header background -------//
menuItemBG.addEventListener(MouseEvent.CLICK, clickHandler);
}
private function clickHandler (e:MouseEvent)
{
scope.openMenuItem(this);
}
public function loadContent (contentURL:String)
{
var loader:Loader = new Loader();
configureListeners(loader.contentLoaderInfo);
var request:URLRequest = new URLRequest(contentURL);
loader.load(request);
// place x position of content at the bottom of the header so the top is not cut off ----//
loader.x = 30;
// we add the content at level 1, because the background clip is at level 0 ----//
addChildAt(loader, 1);
}
private function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
dispatcher.addEventListener(Event.INIT, initHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
dispatcher.addEventListener(Event.OPEN, openHandler);
dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
dispatcher.addEventListener(Event.UNLOAD, unLoadHandler);
}
private function completeHandler(event:Event):void {
//trace("completeHandler: " + event);
// remove loader animation ----------------//
removeChild(getChildByName("mc_preloader"));
}
private function httpStatusHandler(event:HTTPStatusEvent):void {
// trace("httpStatusHandler: " + event);
}
private function initHandler(event:Event):void {
//trace("initHandler: " + event);
}
private function ioErrorHandler(event:IOErrorEvent):void {
//trace("ioErrorHandler: " + event);
}
private function openHandler(event:Event):void {
//trace("openHandler: " + event);
}
private function progressHandler(event:ProgressEvent):void {
//trace("progressHandler: bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal);
}
private function unLoadHandler(event:Event):void {
//trace("unLoadHandler: " + event);
}
}
}
【问题讨论】:
-
@Suzanne:如果您在这里发帖,人们通常会理解您需要帮助。添加帮助!问题的开头会分散您所问的内容。建议您尝试缩短主题,以便具有该领域专业知识的人一眼就知道您要问什么。
-
@Suzanne:如果您的主题中的文字多于帖子正文(减去代码),那么您绝对应该将主题总结为几句话并解释在您的问题正文中。
-
@Suzanne:请通过在编辑器中选择您的代码来正确格式化您的代码,然后输入 Control-K 或单击带有 0 和 1 的按钮。
-
对不起,我是这个网站的新手。一位经常使用它的朋友向我推荐了这里。我昨天写了同样的帖子(忽略了帮助)并且没有收到任何答案。如何编辑帖子?它说约翰是你编辑的。