Flash CS5:AS3:奇怪的XML错误?

时间:2011-05-17 02:34:01

标签: xml flash actionscript-3

我正在使用CS5中的一个预制模板,即“高级幻灯片演示文稿”,突然之间我去了一个发布预览版,它吐了一大堆xml错误,我不熟悉用。

SlidesMovieClip_2, Line 14  1104: invalid xml name
SlidesMovieClip_2, Line 253 1084: Syntax error: expecting xmltagendend before end of program.
SlidesMovieClip_2, Line 253 1100: Syntax error: XML does not have matching begin and end tags.
SlidesMovieClip_2, Line 253 1100: Syntax error: XML does not have matching begin and end tags.
SlidesMovieClip_2, Line 253 1100: Syntax error: XML does not have matching begin and end tags.
SlidesMovieClip_2, Line 253 1084: Syntax error: expecting rightparen before end of program.
SlidesMovieClip_2, Line 253 1084: Syntax error: expecting rightbrace before end of program.
SlidesMovieClip_2, Line 253 1073: Syntax error: expecting a catch or a finally clause.

据我所知,“SlideshowMovieClip_2”甚至不存在?我不确定发生了什么,但我会留下代码,希望你们能找到一些东西!

代码:

import fl.transitions.*;

// USER CONFIG SETTINGS
var buttonsOn:Boolean = true; // true, false
var pageNumberOn:Boolean = true; // true, false
var transitionOn:Boolean = true; // true, false
var transitionType:String = "Fade"; // Blinds, Fade, Fly, Iris, Photo, PixelDissolve, Rotate, Squeeze, Wipe, Zoom, Random
// END USER CONFIG SETTINGS

// EVENTS
stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_changeSlideKeyboard);
prev_btn.addEventListener(MouseEvent.CLICK, fl_prevSlideButton);
next_btn.addEventListener(MouseEvent.CLICK, fl_nextSlideButton);
function fl_changeSlideKeyboard(evt:KeyboardEvent):void
{
    if(evt.keyCode == 37) // LEFT
    {
        fl_prevSlide();
    }
    else if (evt.keyCode == 39 || evt.keyCode == 32) // RIGHT OR SPACE
    {
        fl_nextSlide();
    }
}
function fl_prevSlideButton(evt:MouseEvent):void
{
    fl_prevSlide();
}
function fl_nextSlideButton(evt:MouseEvent):void
{
    fl_nextSlide();
}
// END EVENTS

// FUNCTIONS AND LOGIC
function fl_prevSlide():void
{
    if(slides_mc.currentFrame > 1)
    {
        slides_mc.gotoAndStop(slides_mc.currentFrame-1);
        if(transitionOn == true)
        {
            fl_doTransition();
        }
        if(pageNumberOn == false)
        {
            slideNumber_txt.text = "";
        } else {
            slideNumber_txt.text = String(slides_mc.currentFrame + "/" + slides_mc.totalFrames);
        }
    }
}
function fl_nextSlide():void
{
    if(slides_mc.currentFrame < slides_mc.totalFrames)
    {
        slides_mc.gotoAndStop(slides_mc.currentFrame+1);
        if(transitionOn == true)
        {
            fl_doTransition();
        }
        if(pageNumberOn == false)
        {
            slideNumber_txt.text = "";
        } else {
            slideNumber_txt.text = String(slides_mc.currentFrame + "/" + slides_mc.totalFrames);
        }
    }
}
function fl_doTransition():void
{
    if(transitionType == "Blinds")
    {
        TransitionManager.start(slides_mc, {type:Blinds, direction:Transition.IN, duration:0.25});
    } else if (transitionType == "Fade")
    {
        TransitionManager.start(slides_mc, {type:Fade, direction:Transition.IN, duration:0.25});
    } else if (transitionType == "Fly")
    {
        TransitionManager.start(slides_mc, {type:Fly, direction:Transition.IN, duration:0.25});
    } else if (transitionType == "Iris")
    {
        TransitionManager.start(slides_mc, {type:Iris, direction:Transition.IN, duration:0.25});
    } else if (transitionType == "Photo")
    {
        TransitionManager.start(slides_mc, {type:Photo, direction:Transition.IN, duration:0.25});
    } else if (transitionType == "PixelDissolve")
    {
        TransitionManager.start(slides_mc, {type:PixelDissolve, direction:Transition.IN, duration:0.25});
    } else if (transitionType == "Rotate")
    {
        TransitionManager.start(slides_mc, {type:Rotate, direction:Transition.IN, duration:0.25});
    } else if (transitionType == "Squeeze")
    {
        TransitionManager.start(slides_mc, {type:Squeeze, direction:Transition.IN, duration:0.25});
    } else if (transitionType == "Wipe")
    {
        TransitionManager.start(slides_mc, {type:Wipe, direction:Transition.IN, duration:0.25});
    } else if (transitionType == "Zoom")
    {
        TransitionManager.start(slides_mc, {type:Zoom, direction:Transition.IN, duration:0.25});
    } else if (transitionType == "Random")
    {
        var randomNumber:Number = Math.round(Math.random()*9) + 1;
        switch (randomNumber) {
            case 1:
                TransitionManager.start(slides_mc, {type:Blinds, direction:Transition.IN, duration:0.25});
                break;
            case 2:
                TransitionManager.start(slides_mc, {type:Fade, direction:Transition.IN, duration:0.25});
                break;
            case 3:
                TransitionManager.start(slides_mc, {type:Fly, direction:Transition.IN, duration:0.25});
                break;
            case 4:
                TransitionManager.start(slides_mc, {type:Iris, direction:Transition.IN, duration:0.25});
                break;
            case 5:
                TransitionManager.start(slides_mc, {type:Photo, direction:Transition.IN, duration:0.25});
                break;
            case 6:
                TransitionManager.start(slides_mc, {type:PixelDissolve, direction:Transition.IN, duration:0.25});
                break;
            case 7:
                TransitionManager.start(slides_mc, {type:Rotate, direction:Transition.IN, duration:0.25});
                break;
            case 8:
                TransitionManager.start(slides_mc, {type:Squeeze, direction:Transition.IN, duration:0.25});
                break;
            case 9:
                TransitionManager.start(slides_mc, {type:Wipe, direction:Transition.IN, duration:0.25});
                break;
            case 10:
                TransitionManager.start(slides_mc, {type:Zoom, direction:Transition.IN, duration:0.25});
                break;
        }
    } else
    {
        trace("error - transitionType not recognized");
    }
}

if(buttonsOn == false)
{
    prev_btn.visible = false;
    next_btn.visible = false;
}
slides_mc.gotoAndStop(1);
stage.scaleMode = StageScaleMode.SHOW_ALL;
// END FUNCTIONS AND LOGIC

stop();

1 个答案:

答案 0 :(得分:0)

抱歉,此处缺少相关信息。您发布的代码看起来与您的错误无关。

我看到'无效的xml名称'错误 - 您是否重命名了任何xml变量,移动文件或以其他方式更改xml文件?如果是这样,请回溯您的步骤并撤消您所做的任何事情。

至于错误的第二组,看起来你错误地删除了一个括号。你将不得不深入挖掘并找到驱动'slidesMovieClip_2'的代码并找到缺失的支撑。

希望能引导你走向正确的方向---