0

我创建了一个射击游戏,它编译得很好,但是每次我运行测试时都会出错

“警告:由于您的发布设置,没有库被链接为运行时共享库​​ (RSL):AIR for Android [SWF] alienshooter14.swf - 解压后 4132761 字节”

出现,当我尝试播放 .fla 文件时,除了外星对象之外的所有组件都在运行。如果您能够确定问题,我将附上脚本。我很感激你的帮助。谢谢

import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;

var btn_downIsDown:Boolean;
var btn_upIsDown:Boolean;
var KeyUp:Boolean;
var KeyDown:Boolean;
var Space:Boolean;

var score = 0;
var livesLost:Number = 3;

var gs:gunsound = new gunsound();
var ebs:ebulletsound = new ebulletsound();

btn_up.addEventListener(MouseEvent.MOUSE_DOWN,upDown);
btn_up.addEventListener(MouseEvent.MOUSE_UP,upUp);
btn_down.addEventListener(MouseEvent.MOUSE_UP,downUp);
btn_down.addEventListener(MouseEvent.MOUSE_DOWN,downDown);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyIsDown);
stage.addEventListener(KeyboardEvent.KEY_UP, keyIsUp);

stage.addEventListener(Event.ENTER_FRAME,pulse);
stage.addEventListener(Event.ENTER_FRAME,Gunpulse);
btn_fire.addEventListener(MouseEvent.MOUSE_DOWN,shoot);

function upDown(evt:MouseEvent){btn_upIsDown=true;}
function upUp(evt:MouseEvent){btn_upIsDown=false;}
function downDown(evt:MouseEvent){btn_downIsDown=true;}
function downUp(evt:MouseEvent){btn_downIsDown=false;}

function keyIsDown(evt:KeyboardEvent)
 {
    if(evt.keyCode==40) KeyDown=true;
    if(evt.keyCode==38) KeyUp=true;
    if(evt.keyCode==32) Space=true;
 }

function keyIsUp(evt:KeyboardEvent)
 {
    if(evt.keyCode==40) KeyDown=false;
    if(evt.keyCode==38) KeyUp=false;
    if(evt.keyCode==32) Space=false;
}


function pulse(evt:Event)
{
    if (btn_upIsDown && !mc_gun.hitTestObject(tb_scores)) mc_gun.y-=5;
    if (btn_downIsDown && !mc_gun.hitTestObject(btn_down)) mc_gun.y+=5;
    if (btn_upIsDown && !mc_barrel.hitTestObject(tb_scores)) mc_barrel.y-=5;
    if (btn_downIsDown && !mc_barrel.hitTestObject(btn_down)) mc_barrel.y+=5;

    if (KeyUp)
    {   
        if (!mc_gun.hitTestObject(tb_scores)) {mc_gun.y-=5;}
        if (!mc_barrel.hitTestObject(tb_scores)) {mc_barrel.y-=5;}
        mc_barrel.y=mc_gun.y;

    }

    if (KeyDown)
    {
        if(KeyDown)
        if (!mc_gun.hitTestObject(btn_up)) {mc_gun.y+=5;}
        if (!mc_barrel.hitTestObject(btn_up)) {mc_barrel.y+=5;}
        mc_barrel.y=mc_gun.y;

    }

    if (Space)
    {
        if (bulletCounter<0) bulletCounter++;
        else bulletCounter=0;

        shootmc(bulletArray[bulletCounter]);  

        gs.play();
    }
    checkForHits();
 }



function checkForHits()
 {
    for (var i:Number=0; i<bulletArray.length; i++)
    for (var d:Number=0; d<numChildren; d++)
    {
        if (getChildAt(d) is enemybullet)
        {
            var ab:enemybullet = enemybullet(getChildAt(d));
            if (getChildAt(d).hitTestObject(mc_barrel) && ab.currentFrame==1)
            {
                mc_gun.gotoAndStop(mc_gun.currentFrame+1);
                ab.gotoAndStop(2);
                ab.visible = false
                livesLost-=1;
                ebs.play();
            }
            if (getChildAt(d).hitTestObject(bulletArray[i]) && ab.currentFrame==1)
            {
                var exp1:explosion1 = new explosion1();
                stage.addChild(exp1);
                exp1.x = ab.x;
                exp1.y = ab.y;
                bulletArray[i].x=-1000;
                ab.x=-1000;
            }
        }
    }
}

var bulletArray:Array = new Array();
bulletArray.push(mc_bullet1);
bulletArray.push(mc_bullet2);
bulletArray.push(mc_bullet3);
bulletArray.push(mc_bullet4);

var bulletCounter:Number = 0;

function Gunpulse(evt:Event)
{
    for(var i:Number=0; i<bulletArray.length; i++)
    {
        tb_lives.text = "" + livesLost;
        tb_scores.text = "" + score;

        if (mc_alien1.hitTestObject(bulletArray[i]))
        {
            bulletArray[i].y=-650;
            mc_alien1.y = 450;
            score+=20;
            mc_alien1.mySpeed();
        }
        if (mc_alien2.hitTestObject(bulletArray[i])) 
        {
            bulletArray[i].y=-650;
            score+=40;
            mc_alien2.y = 450;
            mc_alien2.mySpeed();
        }
        if (mc_alien3.hitTestObject(bulletArray[i])) 
        {  
            bulletArray[i].y=-650;
            score+=60;
            mc_alien3.y = 450;
            mc_alien3.mySpeed();
        }
        if (livesLost>=3) mc_gun.gotoAndStop(1);
        if (livesLost==2) mc_gun.gotoAndStop(2);
        if (livesLost==1) mc_gun.gotoAndStop(3);
        if (livesLost==0) endGame();

        return;
    }
}
function shoot(evt:MouseEvent)

{
    if (bulletCounter<3) bulletCounter++;
    else bulletCounter=0;

    shootmc(bulletArray[bulletCounter]);  

}

function shootmc(mc_gun:MovieClip)

{
    mc_gun.visible = true;
    mc_gun.x = mc_barrel.x;
    mc_gun.y = mc_barrel.y;
    mc_gun.gotoAndPlay(2);
}

function endGame()
{   
    stage.removeEventListener(Event.ENTER_FRAME,Gunpulse);
    btn_fire.removeEventListener(MouseEvent.MOUSE_DOWN,shoot);
    stage.removeEventListener(Event.ENTER_FRAME,pulse);
    mc_alien1.killMe();
    mc_alien2.killMe();
    mc_alien3.killMe();
    gotoAndStop(4);
}
4

1 回答 1

1

该错误告诉您:

由于您的发布设置,没有库被链接为运行时共享库​​ (RSL)

所以这就是你错了。

您的一个或多个类需要像这样编译为 RLS ->单击此处

如果错误来自您的代码段,则为以下一项或多项:

gunsound , ebulletsound , explode1 (顺便说一句,您应该以大写开头的 Classnames,而您的标题并不能解决问题)

于 2013-03-06T04:38:57.537 回答