私はバナーを作成しています。バナーには、アクション スクリプトでライブラリからリンクし、「mcHelmet」を呼び出すムービー クリップがあります。x軸上のランダムな位置に表示する必要があり、上から下に移動します(雨のように)。
問題は、25 秒後に別のフレーム (10) に移動し、「mcHelmet」が消えることです。「mcHelmet」がどのコードを使用しても消えることを拒否することを除いて、すべて正常に動作します。delete 、remoceMovieClip、関数を使用しても何も機能しません。
私は助けが必要です。
これは私が使用するコードです:
onEnterFrame = function (){
url_btn.onRollOver = btn.onDragOver = function (){
startDrag(mc_girl,true,10,186,270,131);
mc_girl._x = _xmouse;
if(_xmouse < mc_girl.width /2){
mc_girl._x = 0;
}
if(_xmouse > stage.width - mc_girl.width /2){
mc_girl._x =Stage.width - mc_girl._width;
}
if(mc_girl._x <= 0){
mc_girl._x += mainSpeed;
}
if(mc_girl._x >= Stage.width - mc_girl._width){
mc_girl._x -= mainSpeed;
}
StopTimer();
}
//this function will run every frame (needed for moving the character
HelmetTime++;
//incrementing time for enemy
if (HelmetTime == HelmetLimit)
{
//if enough time has elapsed
_root.attachMovie('mcHelmet','en' + HelmetTotal,_root.getNextHighestDepth());
//then add the enemy
//setting it's coordinates
_root['en' + HelmetTotal]._x = int(Math.random() * Stage.width);
//randomly within the boundaries
_root['en' + HelmetTotal]._y = -50;
//sets this offstage at first
_root['en' + HelmetTotal].onEnterFrame = function()
{
//then give it some functions
this._y += 4;
}
HelmetTime = 0;
//reset the time
HelmetTotal++;
//add 1 more to the amount of enemies total
}
}