Hey there,
Im presque terminé un projet et je suis tombé sur ce problème. J'ai un "maître" de fichier qui a tous les boutons de cette dernière de manière à appeler un clip preloader pour charger un fichier SWF externe. Cela fonctionne très bien avec des boutons simples. Toutefois, lorsque j'essaie de coder les boutons à l'intérieur mon déroulant clip elle ne remet pas, ni le preloader charge le swf externe à tous. Son goût le menu déroulant clip ne comprend pas le code dans le fichier maître. Toute idée sur la façon de résoudre ce problème?
Heres mon code à ce jour:
Dans les fichiers maîtres de la couche d'ActionScript:
var loader_mcl = new MovieClipLoader();
loader_mcl.addListener(this);
function startPreload(url){
// use loadMovie to load the swf url into container_mc
loader_mcl.loadClip(url, container_mc);
}
//calling the preloader animation to specific location
function onLoadStart(target){
attachMovie("preloader anim","preloader_mc",500,{_x:500, _y:500});
}
function onLoadProgress(target, bytes_loaded, bytes_total){
// stop and hide movie
target.stop();
target._visible = false;
// assign value to preloader
preloader_mc.value = bytes_loaded/bytes_total;
}
// when loading is complete for loader_mcl
function onLoadComplete(target){
// show and play loaded clip
target.play();
target._visible = true;
// remove the preloader animation
preloader_mc.removeMovieClip();
}
// if there is an error, this event handler will
// be called and the preloader will be removed
function onLoadError(target, error_code){
preloader_mc.removeMovieClip();
trace(error_code);
}
- var loader_mcl = new MovieClipLoader();
- loader_mcl.addListener(this);
- function startPreload(url){
-
- // use loadMovie to load the swf url into container_mc
- loader_mcl.loadClip(url, container_mc);
- }
- //calling the preloader animation to specific location
- function onLoadStart(target){
- attachMovie("preloader anim","preloader_mc",500,{_x:500, _y:500});
- }
- function onLoadProgress(target, bytes_loaded, bytes_total){
- // stop and hide movie
- target.stop();
- target._visible = false;
-
- // assign value to preloader
- preloader_mc.value = bytes_loaded/bytes_total;
- }
- // when loading is complete for loader_mcl
- function onLoadComplete(target){
- // show and play loaded clip
- target.play();
- target._visible = true;
-
- // remove the preloader animation
- preloader_mc.removeMovieClip();
- }
- // if there is an error, this event handler will
- // be called and the preloader will be removed
- function onLoadError(target, error_code){
- preloader_mc.removeMovieClip();
- trace(error_code);
- }
J'ai essayé ces deux méthodes pour les boutons dans le menu déroulant:
1.) En ActionScript Masters
AppSolMC.btn1.onPress = function() {
startPreload("ContentBox.swf");
}
- AppSolMC.btn1.onPress = function() {
- startPreload("ContentBox.swf");
- }
2.) Cela ne fonctionne pas alors j'ai essayé le bouton lui-même
on (press) {
startPreload("ContentBox.swf");
}
- on (press) {
- startPreload("ContentBox.swf");
- }
Heres le code que j'ai mis dans la liste déroulante clip à lui faire utiliser la fonction de préchargement et de reconnaître les conteneur_mc
var loader_mcl = new MovieClipLoader();
loader_mcl.addListener(this);
function startPreload(url){
// use loadMovie to load the swf url into container_mc and it must have "_root." to refer to assets outside of it
loader_mcl.loadClip(url, _root.container_mc);
}
function onLoadProgress(target, bytes_loaded, bytes_total){
// stop and hide movie
target.stop();
target._visible = false;
// assign value to preloader - you must have the "_root." to refer
//to the main movie's assets b/c there's nothing in this movie clip
//to refer to
_root.preloader_mc.value = bytes_loaded/bytes_total;
}
// when loading is complete for loader_mcl
function onLoadComplete(target){
// show and play loaded clip
target.play();
target._visible = true;
// remove the preloader animation
//you must have the "_root." to refer
//to the main movie's assets b/c there's nothing in this movie clip
//to refer to
_root.preloader_mc.removeMovieClip();
}
// if there is an error, this event handler will
// be called and the preloader will be removed
function onLoadError(target, error_code){
_root.preloader_mc.removeMovieClip();
trace(error_code);
}