Прикрепленный элемент управления фильма с помощью кнопки «Вперед / Вперед» в Action Script 2.0 - PullRequest
0 голосов
/ 05 октября 2011

Я использую 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 );
}

1 Ответ

0 голосов
/ 20 октября 2011
var new_page = content_mc.attachMovie( **next_page**, "Video1A_" + page_count, page_count );

выделенная жирным шрифтом часть неверна, прикрепляемый фрагмент ролика является аргументом next_page, переданным из

prev_page( "Video1A_" + page_count);

, если вы собираетесь сделать page_count глобальной переменной и иметь отдельные функциидля перехода на следующую и для перехода на предыдущую страницу, почему вы даже используете аргументы в функции?

...