2013-03-05 22 views
0

我創建了一個射擊遊戲,它編譯好,但我每次運行測試錯誤需要諮詢的Flash ActionScript中創建了一個射擊遊戲3.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); 
} 

回答

1

錯誤是告訴你:

沒有庫被鏈接爲運行時共享,因爲您的發佈設置庫(RSL要求)

所以這就是你要做什麼樣錯誤。

一個或以上的課程都需要被編譯爲RLS像這樣 - >click here

如果錯誤是從你的片段,這些的一種或多種:

gunsound,ebulletsound,explosion1(順便說一句,你應該啓動一個大寫的類名,並且你的標題沒有解決問題)