A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: movement without tweening?

  1. #1

    Post

    Does anyone know if it's possible to create movement (or any change of state) without tweening across the timeline?

    This seems to be my biggest barrier to creating v. small swf sizes.

    For instance, if I wanted to move a symbol across my background on a button click, say, could I script the clip to change the x and y positions over a number of frames rather than 'either/or'? At the moment, I'm having to use tweening and the timeline which is fine but I'm sure that if I could script it instead - my file sizes would be much smaller.

    many thanks in advance

    onedot

  2. #2
    Senior Member
    Join Date
    Mar 2000
    Posts
    235

    Talking

    what you need to do is set up a small routine, either across to frame or within a MC this routine should lbe based on this principle;

    Set Variable: "i" = 1
    Set Variable: "step" = 10
    If (i < 15)

    Set Variable: "xpos" = GetProperty ( "/movie", _x )
    Set Property ("/movie", X Position) = xpos + step
    Set Variable: "i" = i + 1
    End If

    the next frame should then have a goto function to play the routine again.

    I hope this helps

    CheerZ
    rosie

  3. #3
    Senior Member
    Join Date
    Mar 2000
    Posts
    235

    Post

    Ooops!

    Set Variable: "i" = 1
    should be on a frame previous to the routine

    CheerZ
    rosie

  4. #4

    Post

    Thanks Rosie, I'll give it a bash.

  5. #5

    Post

    I made this work (thanks Rosie)

    You can change the speed this works at and how far the thing moves etc. by adjusting the 'step' number and the 'i' variable. As well as what you do with it by changing 'xpos' to 'xscale', for instance.

    I don't know, but would like to, if you can also adjust the acceleration using this method.

    I would imagine that this system is able to cut down drastically the file sizes, depending on what your doing with it.

    regards,

    neil

    [This message has been edited by onedot (edited 27 March 2000).]

  6. #6
    Junior Member
    Join Date
    Mar 2000
    Posts
    12

    Post

    can you animate also in a 3d circel ? not only left and right

  7. #7
    Junior Member
    Join Date
    Mar 2000
    Posts
    19

    Post

    does using actionscript in this situation make a smaller file to download, and also, what speed does it go across, is there a way to set how fast the actionscript run?

    Sorry, just new to the actionscript thing.
    Thanks in advance.

  8. #8
    Senior Member
    Join Date
    Mar 2000
    Posts
    235

    Post

    to change the acceleration you can set the step variable to a variable rather than an integer, so the user can then determine the speed by determining this variable.

    If you want to achieve the IN/OUT function of tweening you can replace the routine with this:

    Set Variable: "finalx" = 400 <-- this is where you want to end up!
    Set Variable: "posx" = GetProperty ( "MC", _x )
    if (posx < finalx)
    Set Variable: "xdif" = posx - finalx
    Set Variable: "xStp" = xdif /40
    Set Property ("MC", x Position) = posx + xStp

    hope this helps

    CheerZ
    rosie

  9. #9

    Post

    Rosie, this is all fantastic stuff!! How did you learn it all? Are you a programmer first, designer second or vica versa? Or did you just learn it all trial and error?

    On that last bit of code, am I right in thinking that everything enclosed in "" is simply a name that you tell Flash to call a variable by?

    regards,

    onedot


  10. #10
    Senior Member
    Join Date
    Mar 2000
    Posts
    235

    Post

    I'm a designer first, but had to teach myself programming as and when i've needed it.

    the principal i find best is find a sample flash that is similar to what you need, then take it apart piece by piece, printing out all the actionscripting. Then wade through the script translating what it does into plain english, learning how to do it in the process

    The rest is pure trial and error!!!

    Keep at it!

    CheerZ
    rosie

    my latest work is;
    http://www.littlebirdy.co.uk/crosby

  11. #11
    Senior Member
    Join Date
    Mar 2000
    Posts
    235

    Post

    oops!

    sorry i didn't answer your question.

    yes the "" just signify a variable name

    CheerZ
    rosie

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