A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Animating using Actionscripting/3D useage

  1. #1
    Member
    Join Date
    Aug 2000
    Posts
    44
    Hi Everyone

    Im trying to animate using actionscripting, not through tweening.

    For example:

    On press
    Make mymovieclip goto posotion x.y.

    It's easy to do it by tweening, but how would i do it in actionscripting???

    Also, was wondering how many people use flash and 3D (not swift, i mean real 3D like Maya or softimage)

    Just curious!

    thanks all!

  2. #2
    Senior Member
    Join Date
    May 2001
    Location
    Peoria, Arizona
    Posts
    1,889
    Actually people use Swift 3D alot, however, not for the program, but because of the conversion factor. You can convert 3D Max and other files to SWF and then import them into Flash.


    To change a x or y value of a moive clip:

    _root.movieclip1._x = 100;

    _root.movieclip2._y = 230;

    movieclip67._x = (someVar + otherVar)/2;

  3. #3
    Member
    Join Date
    Aug 2000
    Posts
    44
    I know, i use swift 3D too for that evry same factor (although id wish they brought out a Maya Plug in!!)

    What i meant was, are there many people out there who use Flash and 3D, but use 3D and keep the 3D in 3D and not use it for flash in any way! Not combined. I am just curious to see what percentage of Flash people use 3D(not flash 3D).

    How many people using Flash would like to get into 3D, like motion picture, advertising, gaming etc

    Cheers

  4. #4
    Member
    Join Date
    Aug 2000
    Posts
    44
    As for the code, it works great.

    Using

    _root.movieclip1._x=100 makes the movie goto that x coordinate. But instead of popping up in that x coordinate, i want it to 'move/tween' to that coordinate.

    Any suggestions?

  5. #5
    FK M.D. pheck's Avatar
    Join Date
    Jul 2001
    Location
    MN
    Posts
    807
    you don't want timeline A/S, you want MC A/S.

    click on your MC and add this A/S to it.

    Code:
    onClipEvent(enterframe){
      if(this._x<100)
        this._x++; //this is the same as this._x=this._x+1
    }
    This will move it from wherever it is below 100 to 100 horizontally. You can get fancier and accelerate it, give it a bounce, etc.

    Good luck

  6. #6
    flash mangler drunkenmaster2000's Avatar
    Join Date
    Apr 2001
    Location
    England
    Posts
    156
    for acceleration/deceleration, I use Robert Penner's easing functions, they are fantastic.

    http://www.robertpenner.com/

    I'd write my own, if my brain were big enough...

  7. #7
    Senior Member
    Join Date
    Jan 2002
    Posts
    368
    Originally posted by pheck
    you don't want timeline A/S, you want MC A/S.

    click on your MC and add this A/S to it.

    Code:
    onClipEvent(enterframe){
      if(this._x<100)
        this._x++; //this is the same as this._x=this._x+1
    }
    This will move it from wherever it is below 100 to 100 horizontally. You can get fancier and accelerate it, give it a bounce, etc.

    Good luck
    actually, time line AS is preferable. it keeps your code centralized. with the new mx event handlers, you get the best of both worlds:

    Code:
    movieClip.onEnterFrame=function(){
      if(this._x<100)
        this._x++; }

  8. #8
    uhm
    Join Date
    Nov 2000
    Location
    Leeds(ish), UK
    Posts
    99
    if you want a smoother animation you can stick this code on the movieclip of the object you wanna move:

    onClipEvent (load) {
    _root.goX = _x;
    _root.goY = _y;
    }
    onClipEvent (enterFrame) {
    _x = _x+(_root.goX-_x)/15;
    _y = _y+(_root.goY-_y)/15;
    }

    then when you wanna move the object, set the variables _root.goX and _root.goY to the X and Y co-ords you want it to go to.
    speed up/slow down the easing with the '/15' bit.

  9. #9
    FK M.D. pheck's Avatar
    Join Date
    Jul 2001
    Location
    MN
    Posts
    807
    Originally posted by bit-101
    Originally posted by pheck
    you don't want timeline A/S, you want MC A/S.

    click on your MC and add this A/S to it.

    Code:
    onClipEvent(enterframe){
      if(this._x<100)
        this._x++; //this is the same as this._x=this._x+1
    }
    This will move it from wherever it is below 100 to 100 horizontally. You can get fancier and accelerate it, give it a bounce, etc.

    Good luck
    actually, time line AS is preferable. it keeps your code centralized. with the new mx event handlers, you get the best of both worlds:

    Code:
    movieClip.onEnterFrame=function(){
      if(this._x<100)
        this._x++; }

    he's right! forgot about that.

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