A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: actionscript effect?

  1. #1
    Member
    Join Date
    Mar 2004
    Location
    michigan
    Posts
    92

    actionscript effect?

    www.debrisgroup.com
    I was wondering is that something coded out on actionscipt or is it a move clip with different rollover areas that play different parts in the movieclip?
    If its strictly actionscript how can I achieve this.
    Thank you

  2. #2
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,930
    By looking at it, I'm guessing it's all done in AS.

    There's an onRollOver on the clip that does the startDrag and probably starts an onEnterFrame event that makes the clip tween to the mouse x and y with a bounce, and then, if the x or y are outside of the constraints, does a stopDrag and kills the onEnterFrame...

    Hope that helps!!
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

  3. #3
    Member
    Join Date
    Mar 2004
    Location
    michigan
    Posts
    92
    that does help out I'm fairly new with as and here's what I got
    http://getflashmedia.com/logotrial.swf
    here's my code
    var leftboundary:Number = 56.2;
    var rightboundary:Number = 604.1;
    var topboundary:Number = 57.5;
    var bottomboundary:Number = 352.4;
    this.onMouseMove = function(){
    if(_xmouse > leftboundary && _ymouse > topboundary &&
    _xmouse < rightboundary && _ymouse < bottomboundary){
    logo_mc.startDrag(true);
    }else{
    stopDrag();
    }
    }

    I'm not sure how to achieve the onenterframe for the movie clip or where to put it on the as.

    I'm assuming in the mc i need to start of with a stop action then, a frame label for the animation? But what would the code look like
    Last edited by detroitwhat; 08-10-2007 at 12:44 PM.

  4. #4
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,930
    This is a little different, it uses the Tween class and nested functions...seems to work pretty close to the sample you posted...

    Create a movie clip on the stage named clip_mc and put this on the same frame...I would post a sample file, but my forum reply form seems to be missing the manage attachments button...I think it has to do with the FK upgrade...



    Code:
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    clip_mc.onRollOver = function() {
    	this.onMouseMove = function() {
    		if (_root._xmouse>150 && _root._xmouse<400 && _root._ymouse>150 && _root._ymouse<250) {
    			var xTween = new Tween(this, "_x", Elastic.easeOut, this._x, _root._xmouse, 2, true);
    			var yTween = new Tween(this, "_y", Elastic.easeOut, this._y, _root._ymouse, 2, true);
    		}
    	};
    };

    Hope that helps!!
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

  5. #5
    Member
    Join Date
    Mar 2004
    Location
    michigan
    Posts
    92
    yes this is more like the example, to make it move a little more will I need to animate the mc? by the way thanks so much for your help

  6. #6
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,930
    You bet...glad to help...

    Yeah, you could have a little animation on the movieclip starting on frame 2, throw a stop() on frame 1 and have a rollOver to tell the movie to play. That should help with the jerkiness effect...

    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

  7. #7
    Member
    Join Date
    Mar 2004
    Location
    michigan
    Posts
    92
    having a little trouble, I made an invisible button with this for frame one on(rollOver){
    gotoAndPlay("2");
    }
    also with a stop action in frame one, however nothing has changed, and how will i get the logo back to the middle on the rollout?

  8. #8
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    I've got one better.

    http://www.alex-uhlmann.de/flash/animationpackage/

    something like 7 components that are just drag and drop. One of them will give you just that effect. And, they aren't that large! Oh, and they're free!
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  9. #9
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    Quote Originally Posted by mneil
    I've got one better.

    http://www.alex-uhlmann.de/flash/animationpackage/

    something like 7 components that are just drag and drop. One of them will give you just that effect. And, they aren't that large! Oh, and they're free!
    Nothing beats The Fuse Kit.

  10. #10
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,930
    Yep...Fuse rocks!! I just wanted to throw together something using the tween class that comes with flash...but it doesn't match up to fuse at all...

    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

  11. #11
    Member
    Join Date
    Mar 2004
    Location
    michigan
    Posts
    92
    i actually got the original script, but I don't understand it check it out
    onClipEvent (load)
    {
    k = 1;
    damp = 8.000000E-001;
    }
    onClipEvent (enterFrame)
    {
    if (_root._xmouse > 190 && _root._xmouse < 480 && _root._ymouse > 170 && _root._ymouse < 325)
    {
    ax = (_root._xmouse - _x - 250) * k;
    ay = (_root._ymouse - _y - 50) * k;
    vx = vx + ax;
    vy = vy + ay;
    vx = vx * damp;
    vy = vy * damp;
    setProperty("", _x, _x + vx);
    setProperty("", _y, _y + vy);
    }
    else
    {
    tx = 96;
    ty = 193;
    ax = (tx - _x) * k;
    ay = (ty - _y) * k;
    vx = vx + ax;
    vy = vy + ay;
    vx = vx * damp;
    vy = vy * damp;
    setProperty("", _x, _x + vx);
    setProperty("", _y, _y + vy);
    } // end else if
    }

  12. #12
    Member
    Join Date
    Mar 2004
    Location
    michigan
    Posts
    92
    can anyone give me a little explanation of this?

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