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

发布于 2024-12-08 11:22:29 字数 2339 浏览 0 评论 0原文

我使用attachMovie 在舞台上连续调用影片剪辑。我使用前进按钮来滑动它们,但是当我想以相同的顺序返回时,一切都会变得混乱。 您可以在此处看到正在播放的 swf,

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 );
}

I use attachMovie to call movie clips succesively on the stage. I use a forward button to slide them in progression but when I want to go back in the same order everything gets messed up.
You can see the swf playing here,

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

I numbered each frame so you can see when clicking on back button it gets messed up.

// 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 );
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏天碎花小短裙 2024-12-15 11:22:29
var new_page = content_mc.attachMovie( **next_page**, "Video1A_" + page_count, page_count );

粗体部分是错误的,您附加的影片剪辑是传递过来的 next_page 参数,

prev_page( "Video1A_" + page_count);

如果您要将 page_count 设为全局变量并具有用于转到下一页和用于转到上一页的单独函数,为什么这样做你甚至在函数中使用参数?

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

the bolded part is wrong, the movie clip you are attaching is the next_page argument as passed on from

prev_page( "Video1A_" + page_count);

if you're going to make page_count a global variable and have separate functions for going to the next and for going for the previous page, why do you even use arguments in the function?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文