trouble with movie

  • 7lorac
  • Novice
  • Novice
  • 7lorac
  • Posts: 15
  • Loc: New Jersey

Post 3+ Months Ago

Hi! I tried doing the tutorial for the photogallery:

http://www.kirupa.com/developer/mx/photogallery.htm\

I am not able to make it work for my movie!! I don't know what to do!! I'm so frustrated. Here's the code:
Code: [ Select ]
this.pathToPics = "images/";

this.pArray = ["001.jpeg", "002.jpeg", "003.jpeg", "004.jpeg"];
this.fadeSpeed = 20;
this.pIndex = 0;

loadMovie(this.pathToPics+this.pArray[0], _root.photo);
MovieClip.prototype.changePhoto = function(d) {
    
    this.pIndex = (this.pIndex+d)%this.pArray.length;
    if (this.pIndex<0) {
        this.pIndex += this.pArray.length;
    }
    this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
    if (this.photo._alpha>this.fadeSpeed) {
        this.photo._alpha -= this.fadeSpeed;
    } else {
        this.loadPhoto();
    }
};
MovieClip.prototype.loadPhoto = function() {

    var p = _root.photo;

    p._alpha = 0;
    p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
    this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
    var i, l, t;
    l = this.photo.getBytesLoaded();
    t = this.photo.getBytesTotal();
    if (t>0 && t == l) {
        this.onEnterFrame = fadeIn;
    } else {
        trace(l/t);
    }
};
MovieClip.prototype.fadeIn = function() {
    if (this.photo._alpha<100-this.fadeSpeed) {
        this.photo._alpha += this.fadeSpeed;
    } else {
        this.photo._alpha = 100;
        this.onEnterFrame = null;
    }
};
  1. this.pathToPics = "images/";
  2. this.pArray = ["001.jpeg", "002.jpeg", "003.jpeg", "004.jpeg"];
  3. this.fadeSpeed = 20;
  4. this.pIndex = 0;
  5. loadMovie(this.pathToPics+this.pArray[0], _root.photo);
  6. MovieClip.prototype.changePhoto = function(d) {
  7.     
  8.     this.pIndex = (this.pIndex+d)%this.pArray.length;
  9.     if (this.pIndex<0) {
  10.         this.pIndex += this.pArray.length;
  11.     }
  12.     this.onEnterFrame = fadeOut;
  13. };
  14. MovieClip.prototype.fadeOut = function() {
  15.     if (this.photo._alpha>this.fadeSpeed) {
  16.         this.photo._alpha -= this.fadeSpeed;
  17.     } else {
  18.         this.loadPhoto();
  19.     }
  20. };
  21. MovieClip.prototype.loadPhoto = function() {
  22.     var p = _root.photo;
  23.     p._alpha = 0;
  24.     p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
  25.     this.onEnterFrame = loadMeter;
  26. };
  27. MovieClip.prototype.loadMeter = function() {
  28.     var i, l, t;
  29.     l = this.photo.getBytesLoaded();
  30.     t = this.photo.getBytesTotal();
  31.     if (t>0 && t == l) {
  32.         this.onEnterFrame = fadeIn;
  33.     } else {
  34.         trace(l/t);
  35.     }
  36. };
  37. MovieClip.prototype.fadeIn = function() {
  38.     if (this.photo._alpha<100-this.fadeSpeed) {
  39.         this.photo._alpha += this.fadeSpeed;
  40.     } else {
  41.         this.photo._alpha = 100;
  42.         this.onEnterFrame = null;
  43.     }
  44. };

Can anyone help me?? I'd really appreciate it!

Thanks!!!

Carol
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • JLM
  • Newbie
  • Newbie
  • JLM
  • Posts: 5
  • Loc: Oxford

Post 3+ Months Ago

Well the code looks OK, it may take awhile to check it out so here is something similar I made

Code: [ Select ]
MovieClip.prototype.scaleTo=function(m){
  with(this){
  _xscale=_yscale=100;
  var p=new Object({H:_height/m._height,W:_width/m._width});
  p=(p.H>p.W) ? p.H : p.W;
  _yscale=_xscale=100/p;
  _x=m._x-_width/2, _y=m._y-_height/2;  
}};

Number.prototype.Rnd=function(){
  var num=this
  var newRnd=Math.round(Math.random()*(num-1)-(-1));
  while((newRnd==this.Rnd.old)||(newRnd==this.Rnd.varyold)){
      newRnd=Math.round(Math.random()*(num-1)-(-1));
    }
    trace( this.Rnd.veryold+ " "+this.Rnd.old+" "+newRnd);
  this.Rnd.veryold=this.Rnd.old;
  this.Rnd.old=newRnd;
  return(newRnd);
};

//need some pictures Picture1.jpg, Picture2.jpg, Picture3.jpg
//and a movieClip that is _visible==false to scale to "myMask".
//and a movieClip to act as a button

_global.noPictures=3;

assessLoad = function(clip, loadFunc,myMask) {
      if ((clip.getBytesLoaded()/clip.getBytesTotal() == 1)&&(clip._width>4)) {
         clip[loadFunc](myMask);
         clip._alpha=1;
         clip.onEnterFrame=function(){
             if(this._alpha<100){
                this._alpha+=5;
            } else {
                this._alpha=100;
                delete this.onEnterFrame;
            }
         }
         clearInterval(loadInterval);
      }
};
newPic_btn.onRelease=function(){newPic(this,"clip")};
function newPic(clip){
  _root["clip"+this.status].swapDepths(50);
  this.status=!this.status;
  var genNum=noPictures.Rnd(noPictures);
  var pic = "Picture"+genNum+".jpg";
  trace(pic);
  var clip=_root.createEmptyMovieClip("clip"+this.status*1,100);
  clip._x=1000;
  clip._y=1000;
  clip.loadMovie(pic);
  if(loadInterval!=undefined){
    clearInterval(_root.loadInterval);
  }
  _root.loadInterval = setInterval(_root, "assessLoad", 40, clip, "scaleTo", _root.myMask);
};
size.onPress=function(){
this.startDrag();
this.onEnterFrame=function(){
rescale(this,_root.myMask);
}
}
size.onRelease=function(){
this.stopDrag();
rescale(this,_root.myMask);
this.onEnterFrame=null;
}
function rescale(mc,masc){
    masc._width=2*Math.abs(mc._x-masc._x);
    masc._height=2*Math.abs(mc._y-masc._y);
    s=_root.newPic.status;
    _root["clip"+s*1].scaleTo(masc);
    _root["clip"+!s*1].scaleTo(masc);
}
rescale(size,_root.myMask);
newPic(newPic_btn,"clip");
  1. MovieClip.prototype.scaleTo=function(m){
  2.   with(this){
  3.   _xscale=_yscale=100;
  4.   var p=new Object({H:_height/m._height,W:_width/m._width});
  5.   p=(p.H>p.W) ? p.H : p.W;
  6.   _yscale=_xscale=100/p;
  7.   _x=m._x-_width/2, _y=m._y-_height/2;  
  8. }};
  9. Number.prototype.Rnd=function(){
  10.   var num=this
  11.   var newRnd=Math.round(Math.random()*(num-1)-(-1));
  12.   while((newRnd==this.Rnd.old)||(newRnd==this.Rnd.varyold)){
  13.       newRnd=Math.round(Math.random()*(num-1)-(-1));
  14.     }
  15.     trace( this.Rnd.veryold+ " "+this.Rnd.old+" "+newRnd);
  16.   this.Rnd.veryold=this.Rnd.old;
  17.   this.Rnd.old=newRnd;
  18.   return(newRnd);
  19. };
  20. //need some pictures Picture1.jpg, Picture2.jpg, Picture3.jpg
  21. //and a movieClip that is _visible==false to scale to "myMask".
  22. //and a movieClip to act as a button
  23. _global.noPictures=3;
  24. assessLoad = function(clip, loadFunc,myMask) {
  25.       if ((clip.getBytesLoaded()/clip.getBytesTotal() == 1)&&(clip._width>4)) {
  26.          clip[loadFunc](myMask);
  27.          clip._alpha=1;
  28.          clip.onEnterFrame=function(){
  29.              if(this._alpha<100){
  30.                 this._alpha+=5;
  31.             } else {
  32.                 this._alpha=100;
  33.                 delete this.onEnterFrame;
  34.             }
  35.          }
  36.          clearInterval(loadInterval);
  37.       }
  38. };
  39. newPic_btn.onRelease=function(){newPic(this,"clip")};
  40. function newPic(clip){
  41.   _root["clip"+this.status].swapDepths(50);
  42.   this.status=!this.status;
  43.   var genNum=noPictures.Rnd(noPictures);
  44.   var pic = "Picture"+genNum+".jpg";
  45.   trace(pic);
  46.   var clip=_root.createEmptyMovieClip("clip"+this.status*1,100);
  47.   clip._x=1000;
  48.   clip._y=1000;
  49.   clip.loadMovie(pic);
  50.   if(loadInterval!=undefined){
  51.     clearInterval(_root.loadInterval);
  52.   }
  53.   _root.loadInterval = setInterval(_root, "assessLoad", 40, clip, "scaleTo", _root.myMask);
  54. };
  55. size.onPress=function(){
  56. this.startDrag();
  57. this.onEnterFrame=function(){
  58. rescale(this,_root.myMask);
  59. }
  60. }
  61. size.onRelease=function(){
  62. this.stopDrag();
  63. rescale(this,_root.myMask);
  64. this.onEnterFrame=null;
  65. }
  66. function rescale(mc,masc){
  67.     masc._width=2*Math.abs(mc._x-masc._x);
  68.     masc._height=2*Math.abs(mc._y-masc._y);
  69.     s=_root.newPic.status;
  70.     _root["clip"+s*1].scaleTo(masc);
  71.     _root["clip"+!s*1].scaleTo(masc);
  72. }
  73. rescale(size,_root.myMask);
  74. newPic(newPic_btn,"clip");


http://www.justinfront.net/examples/piclken2.swf
http://www.justinfront.net/examples/piclken2.fla

JLM
  • 7lorac
  • Novice
  • Novice
  • 7lorac
  • Posts: 15
  • Loc: New Jersey

Post 3+ Months Ago

Thanks!!! I'll try it!

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 14 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.