Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2017
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.    
  3.    
  4.  
  5.  
  6. var produto:String = new String("");
  7. var imageLoaded:Boolean = false;
  8.  
  9.  
  10.  
  11. carregarProduto();
  12.  
  13. /*----------- Loader section*/
  14.  
  15.     function carregarProduto(){
  16.    
  17.     if(currentFrame == 1){
  18.         produto = "produto01.png";
  19.     }
  20.     else if(currentFrame == 2){
  21.         produto = "produto02.png";
  22.     }
  23.     else if(currentFrame == 3){
  24.         produto = "produto03.png";
  25.     }
  26.     else if(currentFrame == 4){
  27.         produto = "produto04.png";
  28.     }
  29.     else if(currentFrame == 5){
  30.         produto = "produto01.png";
  31.     }
  32.         go();
  33.        
  34.        
  35.     }
  36. /*------------*/
  37.     function go(){
  38.     var request:URLRequest = new URLRequest(produto);
  39.     var loader:Loader = new Loader();
  40.    
  41.     if(loader != null && contains(loader)){
  42.     removeChild(loader);}
  43.     loader.load(request);
  44.    
  45.     addChild(loader);
  46.        
  47.    
  48.        
  49.     }
  50.    
  51.  
  52.  
  53. /*------------- Timer section*/
  54.  
  55. var myTimer:Timer = new Timer(1000);
  56.  
  57. myTimer.addEventListener(TimerEvent.TIMER, timerFunction);
  58.  
  59. function timerFunction(event:TimerEvent):void
  60. {
  61.     if(this.currentFrame < 5 ){
  62.     nextFrame();
  63.     carregarProduto();
  64.  
  65.     }
  66.    
  67.     else
  68.     gotoAndStop(2);
  69. }
  70.  
  71. myTimer.start();
  72.  
  73.  
  74.    
  75.  
  76. stop();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement