AS2

2017-11-07 14 views
0

私は、FlashファイルのためのActionScript 2を使用していたが、ActionScriptの2は、任意のブラウザでサポートされていないので、私がしようとしたとき、私は、ActionScript 3へAS2

を私のActionScript 2のコードを変更する必要がありますAdobe Animateを使用して変換すると、プリローダー、初期設定、縦横の配置などで画像読み込みにエラーが表示され始めました。

コードとエラーメッセージは以下の通りである:

//Controls Default 
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
controls.zo.useHandCursor = false; 
controls.zi.useHandCursor = false; 
controls.br.useHandCursor = false; 
controls.bl.useHandCursor = false; 
controls.bu.useHandCursor = false; 
controls.bd.useHandCursor = false; 
controls.bres.useHandCursor = false; 
resized_ = false; 
cursor._visible = panWithinBoundary ? false : true; 
//Image loading with preloader (if the settings made to load the image dynamically) 
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
if (image ne undefined and image ne "" and image ne null) { 
    //If image path specified: 
    controls._visible = false; 
    mcl = new MovieClipLoader(); 
    tempMc = content_clip.inner_clip.ImageHolder.Content.createEmptyMovieClip("temp", 1); 
    mcl.loadClip(image, tempMc); 
    mcl.onLoadStart = function() { 
     //Image loading progress 
     loader.start_(tempMc); 
    }; 
    mcl.onLoadInit = function(mc) { 
     //After loading the image: 
     if (imageSmoothing and image.substr(image.lastIndexOf(".")+1) ne "swf") { 
      //If imageSmoothing is set 'true' and the content is not swf, we need to capture the bitmap data 
      //for better look:If imageSmoothing is set 'false' or the content is not an image (but swf), 
      //we should show the content 'as is' without bitmap capture. 
      myBmp = new flash.display.BitmapData(mc._width, mc._height, true, 0x00CCCCCC); 
      myBmp.draw(mc); 
      removeMovieClip(mc); 
      content_clip.inner_clip.ImageHolder.Content.attachBitmap(myBmp, 0, "auto", true); 
     } 
     loader.unloadMovie(); 
     bgShade.unloadMovie(); 
     init(); 
     run(); 
    }; 
} else { 
    //If image path not specified, then assuming image is placed directly to the library: 
    loader.unloadMovie(); 
    bgShade.unloadMovie(); 
    init(); 
    run(); 
} 
//Initial settings 
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
function init() { 
    recent = 0; 
    posx = posy=0; 
    canvasSize(); 
    iw = cW; 
    ih = cH; 
    mask_._width = hit._width=iw; 
    mask_._height = hit._height=ih; 
    cr_width = iw; 
    cr_height = ih; 
    ease = ease<1 ? 1 : ease; 
    zoomFactor = zoomFactor<.3 ? .3 : zoomFactor; 
    panSpeed = panSpeed<1 ? 1 : panSpeed; 
    mSP = 1; 
    mPX=_xmouse, mPY=_ymouse; 
    //Aligning Control box+++++++++++++++++++++++++++++++++++++++++++++ 
    //Vertical Align 
    controls._visible = true; 
    if (controlBoxVAlign.toLowerCase() eq "top") { 
     controls._y = controlBoxSpace; 
    } else if (controlBoxVAlign.toLowerCase() eq "middle" or controlBoxVAlign.toLowerCase() eq "center" or controlBoxVAlign.toLowerCase() eq "centre") { 
     controls._y = (ih/2)-(controls._height/2); 
    } else { 
     controls._y = ih-controls._height-controlBoxSpace; 
    } 
    //Horizontal Align 
    if (controlBoxHAlign.toLowerCase() eq "left") { 
     controls._x = controlBoxSpace; 
    } else if (controlBoxHAlign.toLowerCase() eq "middle" or controlBoxHAlign.toLowerCase() eq "center" or controlBoxHAlign.toLowerCase() eq "centre") { 
     controls._x = (iw/2)-(controls._width/2); 
    } else { 
     controls._x = iw-controls._width-controlBoxSpace; 
    } 
    //Initial Zoom level detection. By default, the image gets scaled to the variable value "sc" to fit it within stage atleast to one side 
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
    sc = (ih/content_clip.inner_clip.ImageHolder._height)*100; 
    if (!zoomOutToExtreme) { 
     if (content_clip.inner_clip.ImageHolder._width*(sc/100)<iw) { 
      sc = (iw/content_clip.inner_clip.ImageHolder._width)*100; 
     } 
    } else { 
     if (content_clip.inner_clip.ImageHolder._width*(sc/100)>iw) { 
      sc = (iw/content_clip.inner_clip.ImageHolder._width)*100; 
     } 
    } 

エラーメッセージは以下のとおりです。

Scene 1, Layer 'Actions', Frame 10, Line 14, Column 11 1084: Syntax error: expecting rightparen before ne. 
Scene 1, Layer 'Actions', Frame 10, Line 26, Column 22 1084: Syntax error: expecting rightparen before and. 
Scene 1, Layer 'Actions', Frame 10, Line 26, Column 63 1084: Syntax error: expecting semicolon before rightparen. 
Scene 1, Layer 'Actions', Frame 10, Line 67, Column 37 1084: Syntax error: expecting rightparen before eq. 
Scene 1, Layer 'Actions', Frame 10, Line 69, Column 44 1084: Syntax error: expecting rightparen before eq. 
Scene 1, Layer 'Actions', Frame 10, Line 69, Column 93 1008: Attribute is invalid. 
Scene 1, Layer 'Actions', Frame 10, Line 69, Column 102 1084: Syntax error: expecting rightbrace before or. 
Scene 1, Layer 'Actions', Frame 10, Line 71, Column 4 1083: Syntax error: else is unexpected. 

は、どのようにこれらの上記のエラーを修正するために知っておく必要がありますか?

+0

私の回答はあなたの8つのエラーを修正しましたか?手動で修正するにはあまりにも多くの場合、単語検索(検索/置換ツール)を使用してそれらの属性( 'ne'、' eq'など)をすばやく置き換えます。 –

答えて

1

エラーが発生したコード部分については、AS3 Operatorsを調査して使用する必要があります。

例えば、あなたのコードは次のようにマップするようだ:!=(参照:Not Equal)を

  • あなたneはAS3演算子と同等です。

  • eqは、AS3オペレータ:==EQuality参照)と同等です。

  • お客様のandは、AS3の演算子:&&AND参照)と同等です。

  • orは、AS3オペレータ:||OR参照)と同等です。

例1:(AS2コード):

if (image ne undefined and image ne "" and image ne null) 

が本当に(AS3)にすべきである:

if (image != undefined && image != "" && image != null) 


例#2:(AS2コード):

else if (controlBoxVAlign.toLowerCase() eq "middle" or controlBoxVAlign.toLowerCase() eq "center" or controlBoxVAlign.toLowerCase() eq "centre") { 

be(AS3):

else if (controlBoxVAlign.toLowerCase() == "middle" || controlBoxVAlign.toLowerCase() == "center" ||controlBoxVAlign.toLowerCase() == "centre") {