moving movie clips

  • roarmeow
  • Professor
  • Professor
  • User avatar
  • Posts: 861
  • Loc: BKNY

Post 3+ Months Ago

yo... this should be real simple... but it's not working...

i've got two MCs with dynamically loaded images in 'em...
i want to set it up so that, sliding together, they give the illusion of an endless loop of images... simple, right?

alright, so here's the situation:
thumbnails is MC numba one
thumbnails2 is MC numba two - a clone of thumbnails lagging a little behind for that loop illustion
imagewidth is a variable set to the total size of the movieclip (it's generated when the MC loads up all the images)

now, on frame 75, i've got this script:
Code: [ Select ]
if(_root.thumbnails2._x<271){
    _root.thumbnails._x=269.9;
    _root.thumbnails2._x=(269.9+imagewidth);
}else{
_root.thumbnails._x=_root.thumbnails._x-2;
_root.thumbnails2._x=_root.thumbnails2._x-2;}
  1. if(_root.thumbnails2._x<271){
  2.     _root.thumbnails._x=269.9;
  3.     _root.thumbnails2._x=(269.9+imagewidth);
  4. }else{
  5. _root.thumbnails._x=_root.thumbnails._x-2;
  6. _root.thumbnails2._x=_root.thumbnails2._x-2;}


and on frame 77, i've got:
Code: [ Select ]
gotoAndPlay(75);


i want it so that, when "thumbnails2" reaches the point where "thumbnails" began, it puts them back where they started...
it works fine up until that point... they slowly meander across the screen...
then, when it comes time for them to go back to their original places and thus produce the 'loop' effect, it just freezes...
anyone got any ideas?

i'd love to hear 'em...

peace,
puck
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Abelius
  • Proficient
  • Proficient
  • User avatar
  • Posts: 260
  • Loc: Miami Beach, FL, USA

Post 3+ Months Ago

You should use onEnterFrame() and you should use the += or -= for the change of the _x property intead of fixed amounts...

:)
  • roarmeow
  • Professor
  • Professor
  • User avatar
  • Posts: 861
  • Loc: BKNY

Post 3+ Months Ago

thanks for the tip, abelius, it certainly cuts down on the amount of script... which is really nice...
but still no dice... it just gets stuck for some reason... bouncing back and forth between frames 76 and 77 with nothing else happening... any other ideas?
  • roarmeow
  • Professor
  • Professor
  • User avatar
  • Posts: 861
  • Loc: BKNY

Post 3+ Months Ago

aight... this is what i ended up doing...
Code: [ Select ]
var tw=_root.thumbnails._width;
onEnterFrame=function(){if(_root.thumbnails2._x<271){
    setProperty("thumbnails2",_x,Number(tw+269.9));
    setProperty("thumbnails",_x,269.9);
    }else{
_root.thumbnails._x-=2;
_root.thumbnails2._x-=2;}}
  1. var tw=_root.thumbnails._width;
  2. onEnterFrame=function(){if(_root.thumbnails2._x<271){
  3.     setProperty("thumbnails2",_x,Number(tw+269.9));
  4.     setProperty("thumbnails",_x,269.9);
  5.     }else{
  6. _root.thumbnails._x-=2;
  7. _root.thumbnails2._x-=2;}}


yeah... if anyone else wants to set up a loop of dynamically generated movieclips full of images (or anytthing else where the the width is variable)... this'll work...

good night and thanks for all the fish... time to go kick it... saturday night, bay-bee....

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 8 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.