A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: Is actionscript better at tweening?

  1. #1
    Senior Member
    Join Date
    Jun 2002
    Location
    California
    Posts
    277

    Lightbulb

    I've heard a few comments that using actionscript to have objects move may be smoother or less processor intense than using tweening? The BIG question, is that true?

    IF it is true, how do I tell an object in frame 5 to move from x =100, y=100 to go to x=250, y=250 going from frame 5 to frame 10?


    Thanks!

  2. #2
    it is not true...Untill someone give me a prouf that i'm wrong...motion in actionscript and motion in tweening is about the same for the processor ... But as it is for weigth actionscript is much lighter then tweening.

    Motion in actionscript is usefull when you have something to moove that as many possible direction depending of user choice.

    Second question you do not moove thing in actionscript depending of the frame. All you need is two frame that you loop.

    -------------first frame script frame label (loop)

    //we moove the movie named (content) from left to right with this script...
    //
    //here we set the actual position of the movieclip we are going to moove (content)
    acpos=content._x;
    //here you determine the speed of the moovement or basically how many pixel it is -
    //going to moove it this loop. You can adjust the speed by increasing or decreasing the -
    //last number of the following line in this case the number is (5).
    speed=(endpos-acpos)/5;
    //the endpos variables represent the end position of the moovement wish is set on the -
    //buton, have a look at the button action.
    //Here we check if we are close to the end when your speed is smaller then 0.05 you can -
    //end the moovement and apply to your movie clip the end position. If the speed is higher -
    //then you go through the apply moovement script.
    if(speed > 0.05 or speed < -0.05){
    //here is where you apply the moovement you add the speed to the actual position.
    content._x=acpos+speed;
    }else{
    //here you set the x position of your movie to is endposition.
    content._x=endpos;
    //and you stop everything...
    gotoAndStop("stop");
    }

    -----------------second frame script no label needed

    gotoAndPlay("loop")


    ---------------------

    you should add this line to your first frame

    endpos=350;

    if you want your movie to stop at ._x 350

    hope you understand if not i'll email you something that would help

  3. #3
    B.T.W in the script thta i have give you your moving a movie Clip having as instance name (content).

  4. #4
    Senior Member
    Join Date
    Jun 2002
    Location
    California
    Posts
    277
    Thanks for your response although you could help me out some more by telling me another answer. You said it doesn't do anything to help the processor. Does it in any way make it move smother? I'm moving a large box drawn in flash with a 50% alpha - it takes up about 70% of the screen - it has to move pretty quickly from top to bottom but it seems jerky.

    Will the actionscript help?

    Thanks!
    [Edited by boe_d on 08-12-2002 at 04:26 PM]

  5. #5
    Does your box contain any image....?

    Image are high process demanding when mooving.


    What is your frame rate...?

    The higher the frame rate the smoother the animation the higher the process demanding...?


    There is no perfect answer since many factor could make your animation go jerky.

    Try to put your frame rate at 24....

    Try to use a script to moove your box...

    Experiment ...

    Good luck...



  6. #6
    Senior Member
    Join Date
    Jun 2002
    Location
    California
    Posts
    277
    Does your box contain any image....?
    this one just has an alpha'd blue box.

    What is your frame rate...?
    45fps


    Thanks

  7. #7
    45 fps seems a litle hight to me...

    I usually use about 24 to 30 frame second...

    Remember that the higher the frame rate the more process you need per second...

    Animation should go smooth at 30 frame per second unless you have a very slow computer ...

    Have you tried to use scripting ... ?

    If not and don't want to loose your time trying send me a .fla of your box an is animation i'll transform the anim in actionscript and send it back to you ...

  8. #8
    oups...

    here is my email

    flashkit@totalcaps.com

  9. #9
    Senior Member
    Join Date
    Jun 2002
    Location
    California
    Posts
    277
    That is very kind of you! I just sent a file, if you have any issues with it, don't hesitate to e-mail boe_d@hotmail.com
    [Edited by boe_d on 08-13-2002 at 02:03 PM]

  10. #10
    ok just manage to get time to open your movie...

    It is huge ... in size i mean... maybe that is why it is so jerky. i'll try the actionscript issue and send it back...

  11. #11
    ok ... sorry it took so long but i have a real work to do also...

    here is the result

    http://www.totalcaps.com/test/

    i had difficulties understanding your movie so i had put button that make your box moove ... you may have to copy the action somewhere in your frame ...

    i'm going to send you the file

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