Skip navigation
Currently Being Moderated

Basic Question about Structure

Aug 16, 2012 3:01 AM

I have some logic in a function that moves movieclips around using x and y coordinates.  How can I incorporate the FPS/events/Frames to slow these moves down?  Thanks.

 
Replies
  • Currently Being Moderated
    Aug 16, 2012 4:46 AM   in reply to beamycruns

    I am not sure what you mean in saying you want to use FPS/events/Frames to slow the movieclips down.  What is the logic/code that is moving them around?

     

    If the movement is based on the frame rate, then you could try lowering the frame rate.  You could also try getting the frame rate out of the movement logic if you want more flexibility in controlling the speed of movement.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 16, 2012 4:47 AM   in reply to beamycruns

    Look at the EnterFrame event and the Timer object. EnterFrame can be used to call a function once each frame, so the timing corresponds to the frame rate. A Timer object can be used to call a function at a rate that you set.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 16, 2012 1:38 PM   in reply to beamycruns

    Most new users of Flash start animating using the timeline. You can use it or not, when the .swf file is compiled everything is converted to code in any case. If you are comfortable building a timer as a control for your animation, then use that. You will have more flexibility.

     

    If you can create your artwork as vector rather than bitmap, you'll save file size for the download. Flash can more efficiently animate vectors than it can bitmaps. If you use bitmap images you may find that using gif or jpeg file types may save you some file size. You can use Photoshop's "Save for Web and Devices" option to get the most compact file size while maintaining image quality.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 17, 2012 6:44 AM   in reply to beamycruns

    The complexity of the vector greatly matters in saying that a vector is less overhead on a mobile device than a bitmap. Size-wise it is far more efficient but certainly not always in performance cost.

     

    In almost all cases (especially text), vectors will kill your processor. I'm presuming you're not getting into any Stage3D or really utilizing the GPU. With the CPU, bitmaps are almost always faster because it's just copying areas of memory, not calculating. The only case to be made is setting a complex vectors cacheAsBitmap to true and then you have a bitmap in memory anyhow.

     

    If you've built websites before, try to use the cutting techniques you've learned to break the interface up into the smallest bitmaps possible. For instance if you have an interface that surrounds all edges of the screen with the center transparent, it's more memory efficient to cut the bitmap into pieces while removing the transparent area rather than render a single bitmap with transparency.

     

    Mobile devices greatly lack on CPU and you should always think of everything except the latest generation of quad core tablets as basically glorified phones. You're much more used to desktop programming and performance and mobile performance without utilizing Stage3D will certainly suprise you, for the worse.

     

    A Timer is better than Event.ENTER_FRAME. You can't guarantee the framerate during a game on mobile devices which goes up and down. Event.ENTER_FRAME is very expensive so use it a little as possible. Timers are much less expensive and logic executes more reliably over uneven frame rates.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points