A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: Create slight movement with movie clip???

  1. #1
    Member
    Join Date
    Jan 2008
    Posts
    38

    Create slight movement with movie clip???

    Hi I have a movie clip which is exactly W: 1100 H: 750

    All i need is to add is mouse movement so when you scroll up down left right the movie clip moves about 50pixels in each direction.....any tutorial script I have found does not add a width and height restriction making me drag the movie off the screen. I've seen this a lot in websites so thought it would be simple enough to find but I haven't been lucky so any help/tutorial link etc will be great

    Eddie

  2. #2
    Senior Member
    Join Date
    Jun 2002
    Posts
    105
    mouse movement so when you scroll....

    what are you trying to say man...

    scroll as in when you click scroll buttons the movie clip moves
    scroll as in when you scroll your mouse wheel the movie clip moves
    scroll as in according to your mouse position within _x and _y restraints the movie clip moves...

  3. #3
    Member
    Join Date
    Jan 2008
    Posts
    38
    scroll as in when you scroll your mouse wheel the movie clip moves but will will not move off the screen so there needs to be something in place which says you cannot move past this point.....hope that clears things up

    thanks

    Eddie

  4. #4
    Senior Member
    Join Date
    Jun 2002
    Posts
    105
    movieclip you want to scroll instance name = "clipName"

    Code:
    var moveAmount:Number = 50;
    
    var mouseListener:Object = new Object();
    mouseListener.onMouseWheel = function(delta) {
    
    	if(delta < 0){
    		moveDown();
    	} else if (delta > 0){
    		moveUp();
    	}
    }
    Mouse.addListener(mouseListener);
    
    function moveUp():Void {
    	if(clipName._y <=0){
    		// tween clipName._y to + moveAmount
    	}
    }
    
    function moveDown():Void {
    	if(clipName._y >= -565){
    		// tween clipName._y to - moveAmount
    	}
    }

  5. #5
    Senior Member
    Join Date
    Jun 2002
    Posts
    105
    if(clipName._y <=0 ){ // this is the "you cannot move higher than this point"

    if(clipName._y >= -565){ // "you cannot move below this point"

  6. #6
    Member
    Join Date
    Jan 2008
    Posts
    38
    My main movie is at work but I quickly created a movie clip with the instance name specified and inputted your script in a keyframe directly above the MC but nothing is happening when I move my mouse?

    cheers

    Eddie

  7. #7
    Senior Member
    Join Date
    Jun 2002
    Posts
    105
    test the movie outside of flash.
    ie. run the .swf file in using standalone flash player not through flash movie export

  8. #8
    Member
    Join Date
    Jan 2008
    Posts
    38
    I've tested .swf movie using a standalone flash player and even uploaded the file to my server but nothing happens to the movie clip once the mouse is being moved around the screen?

    I'm using flash CS4 and AS2 if this has any effect......maybe you could send a link to a working .fla you have to see if there's anything I'm not doing?

    Thanks

    Eddie

  9. #9
    Senior Member
    Join Date
    Jun 2002
    Posts
    105
    the example i sent you was for cs4 and as2 as well.. i dont have a computer w flash till monday . ill help if u cant figure it out by then.

    -g

  10. #10
    Member
    Join Date
    Jan 2008
    Posts
    38
    still no joy so yeh if you can put up a working example that would be great.

    thanks

    Eddie

  11. #11
    Senior Member
    Join Date
    Jun 2002
    Posts
    105

    .fla <nt>

    ...
    Attached Files Attached Files

  12. #12
    Member
    Join Date
    Jan 2008
    Posts
    38
    Hey

    thanks for file but I'm still not see anythign work with this? I exported file and inserted in dreamWeaver and have put on server but no joy......link is here so you can see for yourself.

    http://www.directionfirst.com/temp/test.html

    So not sure why I'm not seeing anythign if your seeing it work on your side? :-S

    Cheers

    Eddie

  13. #13
    Senior Member
    Join Date
    Jun 2002
    Posts
    105
    no clue man. the one i did a while ago was for pc-side only so i guess it doesn't work with macs?

    uploaded and tested through mac . didnt work. worked on pc side.
    ah well.

  14. #14
    Member
    Join Date
    Jan 2008
    Posts
    38
    I'm using a PC to test this...hmm

    anyway thanks for trying to help me.

    Eddie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center