Action Script 2.0中带有下一个/前进按钮的附加电影控件

时间:2011-10-04 22:31:43

标签: flash actionscript-2

我使用attachMovie在舞台上连续调用影片剪辑。我使用前进按钮来进行滑动,但是当我想以相同的顺序返回时,一切都搞砸了。 你可以在这里看到瑞士法郎,

http://www.taltin.net/FILES_WEBDESIGN/Fluid1_1.swf

我为每一帧编号,以便您在点击后退按钮时可以看到它变得混乱。

// Each of the button functions here call the add_page() function and 
// pass the Identifier of the page that they will display
b_0.onRelease = function() {
next_page( "Video1A_" + page_count);
};

b_1.onRelease = function() {
prev_page( "Video1A_" + page_count);
};

// This function manages the page clips that are attached to content_mc. 
// The variable page_count is used to make sure that each page gets a unique 
// name and depth. It also gives us a way to get the instance name of the 
// last page clip that was created.
var page_count = 1;

// The add_page() function takes the Linkage identifier of the new page to be 
// created as a parameter. 
function next_page( next_page ) {
// Make the name of the last page attached
var old_page = content_mc[ "Video1A_" + page_count ];
// If that page exists remove it by sliding off out of the visible area. 
if ( old_page != undefined ) {
    old_page.slideTo( '-600', '0', 1, '', 0, old_page + '.removeMovieClip()' );
}

// Up page count by 1
page_count ++;

// Attach the new page to content_mc
var new_page = content_mc.attachMovie( next_page, "Video1A_" + page_count,     page_count );
// Position the new page below the visible area
new_page._x = 600;
// slide the new page into the visible area. 
new_page.slideTo( '-600', 0, 2 );
}



// The add_page() function takes the Linkage identifier of the new page to be 
// created as a parameter. 
function prev_page( next_page ) {
// Make the name of the last page attached
var old_page = content_mc[ "Video1A_" + page_count ];

// If that page exists remove it by sliding off out of the visible area. 
if ( old_page != undefined ) {
    old_page.slideTo( '600', '0', 2, '', 0, old_page + '.removeMovieClip()' );
}

// Up page count by 1
page_count --;

// Attach the new page to content_mc
var new_page = content_mc.attachMovie( next_page, "Video1A_" + page_count, page_count );
// Position the new page below the visible area
new_page._x = -600;
// slide the new page into the visible area. 
new_page.slideTo( '600', 0, 2 );
}

1 个答案:

答案 0 :(得分:0)

var new_page = content_mc.attachMovie( **next_page**, "Video1A_" + page_count, page_count );

粗体部分错误,您附加的影片剪辑是从

传递的next_page参数
prev_page( "Video1A_" + page_count);

如果你要使page_count成为一个全局变量并且具有单独的函数以便转到下一页并转到上一页,为什么你甚至在函数中使用参数?