私が取り組んでいるプロジェクトでは、ゆっくりと上にスクロールする大規模な背景イメージ(幅800ピクセルx高さ2585ピクセル)があります。Flash CS5/ActionScript 3の遅延読み込み無限スクロールバックグラウンド
、私がコードを使用していた前に:http://www.ilike2flash.com/2010/08/endless-scrolling-background-in-as3.html
Iは、上方にスクロールするためのコードを変更し、時折残像及びループ前画素トール空白行を表示する奇妙な断続バグを有することに加えて次に、動的ロードをうまく処理できないように見える(いくつかの異なるプリローダースクリプトを試してみたが、それらはすべて破損している)、初期実装では問題にならなかったかもしれないが、巨大な画像を使用しています。
したがって、私の質問:
a。レイジーローディングバックグラウンドオブジェクトをサポートしているFlashベースの無限のスクロールコードが浮かんでいますか?(既存の背景は6で切り刻まれています)
b。もしそうでなければ、どのように私は上記のリンクを変更することができますか?
ありがとうございます!次のように私のAS3は次のとおりです。 リンクは、コードの約15行を持っているændrew
stop();
//The speed of the scroll movement.
var scrollSpeed:uint = 2;
//This adds two instances of the movie clip onto the stage.
var s1:ScrollBg = new ScrollBg();
var s2:ScrollBg = new ScrollBg();
addChild(s1);
addChild(s2);
setChildIndex(s1, 0);
setChildIndex(s2, 0);
//This positions the second movieclip next to the first one.
s1.y = 0;
s2.y = s1.height;
//Adds an event listener to the stage.
stage.addEventListener(Event.ENTER_FRAME, moveScroll);
//This function moves both the images to top. If the first and second
//images goes past the top stage boundary then it gets moved to
//the other side of the stage.
function moveScroll(e:Event):void{
s1.y -= scrollSpeed;
s2.y -= scrollSpeed;
if(s1.y <= -s1.height){
s1.y = s1.height - scrollSpeed;
}else if(s2.y <= -s2.height){
s2.y = s2.height - scrollSpeed;
}
}
こんにちは!あなたが提案した編集はバグを修正しなかった - それは2回の繰り返しの後にまだ1行または2つのスペースを追加する。彼はデモページで同じ問題を出すようには思われません - 私は完全なコードで私の質問を更新しました。 – aendrew
また、これらの条件文の両方でscrollSpeedの値を減算しました.1回の反復後にバグが発生したようです。私はスペースを正確にscrollSpeed量と推測しています。 – aendrew