Aider! La liste déroulante et preloader ne fonctionne pas

  • gany9
  • Born
  • Born
  • No Avatar
  • Inscription: Sep 08, 2009
  • Messages: 4
  • Status: Offline

Message Septembre 8th, 2009, 6:43 pm

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:
Code: [ Select ]
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);
}
  1. var loader_mcl = new MovieClipLoader();
  2. loader_mcl.addListener(this);
  3. function startPreload(url){
  4.     
  5.     // use loadMovie to load the swf url into container_mc
  6.     loader_mcl.loadClip(url, container_mc);
  7. }
  8. //calling the preloader animation to specific location
  9. function onLoadStart(target){
  10.     attachMovie("preloader anim","preloader_mc",500,{_x:500, _y:500});
  11. }
  12. function onLoadProgress(target, bytes_loaded, bytes_total){
  13.     // stop and hide movie
  14.     target.stop();
  15.     target._visible = false;
  16.     
  17.     // assign value to preloader
  18.     preloader_mc.value = bytes_loaded/bytes_total;
  19. }
  20. // when loading is complete for loader_mcl
  21. function onLoadComplete(target){
  22.     // show and play loaded clip
  23.     target.play();
  24.     target._visible = true;
  25.     
  26.     // remove the preloader animation
  27.     preloader_mc.removeMovieClip();
  28. }
  29. // if there is an error, this event handler will
  30. // be called and the preloader will be removed
  31. function onLoadError(target, error_code){
  32.     preloader_mc.removeMovieClip();
  33.     trace(error_code);
  34. }


J'ai essayé ces deux méthodes pour les boutons dans le menu déroulant:
1.) En ActionScript Masters
Code: [ Select ]
AppSolMC.btn1.onPress = function() {
    startPreload("ContentBox.swf");
}
  1. AppSolMC.btn1.onPress = function() {
  2.     startPreload("ContentBox.swf");
  3. }

2.) Cela ne fonctionne pas alors j'ai essayé le bouton lui-même
Code: [ Select ]
on (press) {
    startPreload("ContentBox.swf");
}
  1. on (press) {
  2.     startPreload("ContentBox.swf");
  3. }
  • Anonymous
  • Bot
  • No Avatar
  • Inscription: 25 Feb 2008
  • Messages: ?
  • Loc: Ozzuland
  • Status: Online

Message Septembre 8th, 2009, 6:43 pm

  • gany9
  • Born
  • Born
  • No Avatar
  • Inscription: Sep 08, 2009
  • Messages: 4
  • Status: Offline

Message Septembre 8th, 2009, 7:33 pm

gany9 a écrit:
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:
Code: [ Select ]
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);
}
  1. var loader_mcl = new MovieClipLoader();
  2. loader_mcl.addListener(this);
  3. function startPreload(url){
  4.     
  5.     // use loadMovie to load the swf url into container_mc
  6.     loader_mcl.loadClip(url, container_mc);
  7. }
  8. //calling the preloader animation to specific location
  9. function onLoadStart(target){
  10.     attachMovie("preloader anim","preloader_mc",500,{_x:500, _y:500});
  11. }
  12. function onLoadProgress(target, bytes_loaded, bytes_total){
  13.     // stop and hide movie
  14.     target.stop();
  15.     target._visible = false;
  16.     
  17.     // assign value to preloader
  18.     preloader_mc.value = bytes_loaded/bytes_total;
  19. }
  20. // when loading is complete for loader_mcl
  21. function onLoadComplete(target){
  22.     // show and play loaded clip
  23.     target.play();
  24.     target._visible = true;
  25.     
  26.     // remove the preloader animation
  27.     preloader_mc.removeMovieClip();
  28. }
  29. // if there is an error, this event handler will
  30. // be called and the preloader will be removed
  31. function onLoadError(target, error_code){
  32.     preloader_mc.removeMovieClip();
  33.     trace(error_code);
  34. }


J'ai essayé ces deux méthodes pour les boutons dans le menu déroulant:
1.) En ActionScript Masters
Code: [ Select ]
AppSolMC.btn1.onPress = function() {
    startPreload("ContentBox.swf");
}
  1. AppSolMC.btn1.onPress = function() {
  2.     startPreload("ContentBox.swf");
  3. }

2.) Cela ne fonctionne pas alors j'ai essayé le bouton lui-même
Code: [ Select ]
on (press) {
    startPreload("ContentBox.swf");
}
  1. on (press) {
  2.     startPreload("ContentBox.swf");
  3. }


Hey all!

I figured it out, tous en ont besoin est une référence au conteneur sur _root

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
Code: [ Select ]
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);
}
  1. var loader_mcl = new MovieClipLoader();
  2. loader_mcl.addListener(this);
  3. function startPreload(url){
  4.   
  5.   // use loadMovie to load the swf url into container_mc and it must have "_root." to refer to assets outside of it
  6.   loader_mcl.loadClip(url, _root.container_mc);
  7. }
  8. function onLoadProgress(target, bytes_loaded, bytes_total){
  9.     // stop and hide movie
  10.     target.stop();
  11.     target._visible = false;
  12.     
  13.     // assign value to preloader - you must have the "_root." to refer
  14.     //to the main movie's assets b/c there's nothing in this movie clip
  15.     //to refer to
  16.     _root.preloader_mc.value = bytes_loaded/bytes_total;
  17. }
  18. // when loading is complete for loader_mcl
  19. function onLoadComplete(target){
  20.     // show and play loaded clip
  21.     target.play();
  22.     target._visible = true;
  23.     
  24.     // remove the preloader animation
  25.     //you must have the "_root." to refer
  26.     //to the main movie's assets b/c there's nothing in this movie clip
  27.     //to refer to
  28.     _root.preloader_mc.removeMovieClip();
  29. }
  30. // if there is an error, this event handler will
  31. // be called and the preloader will be removed
  32. function onLoadError(target, error_code){
  33.     _root.preloader_mc.removeMovieClip();
  34.     trace(error_code);
  35. }
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • Avatar de l’utilisateur
  • Inscription: Déc 20, 2002
  • Messages: 8922
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Message Septembre 8th, 2009, 7:46 pm

Glad you figured it out si rapide et merci pour avoir publié la solution.
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • gany9
  • Born
  • Born
  • No Avatar
  • Inscription: Sep 08, 2009
  • Messages: 4
  • Status: Offline

Message Septembre 9th, 2009, 9:52 pm

Bah! J'ai parlé trop vite.

Appare notly le code que j'ai inscrit va supprimer le clip de la preloader mais le preloader ne parvient toujours pas de charge pour ces fonds d'Etat - des idées sur comment l'appeler?
  • IceCold
  • Guru
  • Guru
  • Avatar de l’utilisateur
  • Inscription: Nov 05, 2004
  • Messages: 1254
  • Loc: Ro
  • Status: Offline

Message Septembre 14th, 2009, 12:42 am

man oh man,
savez-vous quel est ce code fais?
_root.preloader_mc.removeMovieClip ();
Oui, vous l'avez deviné, il supprime le preloader.
Pensez-vous créer / joindre de nouveau?
Si non, comment voulez-vous apparaître?
Donc, ma suggestion est de le cacher au lieu de le supprimer.
Il suffit d'aller:
_root.preloader_mc._visible = false;

Et dans la fonction startPreload, la montrer:
_root.preloader_mc. _visible = true;

Sinon, si vous le retirez, comme vous le faites maintenant, fixez ensuite auprès de la bibliothèque dans la fonction startPreload:
attachMovie ( "preloaderLibraryId", "preloader_mc", 1000);
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”

Afficher de l'information

  • Total des messages de ce sujet: 5 messages
  • Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 75 invités
  • Vous ne pouvez pas poster de nouveaux sujets
  • Vous ne pouvez pas répondre aux sujets
  • Vous ne pouvez pas éditer vos messages
  • Vous ne pouvez pas supprimer vos messages
  • Vous ne pouvez pas joindre des fichiers
 
 

© 2011 Unmelted, LLC. Ozzu® est une marque déposée de Unmelted, LLC