Announcement

Collapse
No announcement yet.

CoolDown

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    CoolDown

    hi everyone,


    I have a question, I'm working on the mmo game type and I want to add a cooldown option to the inventoryDemo.fla ( AS2) , my question is -> to keep the best performance, what's the best solution? handle the timer with AS2 or unrealScript ?


    thx

    #2
    It depends on how you want it to be represented in game.

    Performance wise you don't want to use action script to run a timer, but if you want to show a bar refilling back up you don't want to pass actionscript an updated value from unreascript every frame.

    Fastest performance wise would be to run a timeline framed animation.

    Have unrealscript start the animation and perhaps sets a flag, isCoolingDown, then have an externalinterface call on the last frame to call a method on unrealscript to let it know it's done.

    Also I'd avoid SetInterval like the plague it'll only lead to scope head aches and memory leaks.

    Comment


      #3
      re:

      hi , thx for your answer,

      the cooldown result :

      http://bernard18.free.fr/Inventory.swf

      I'm totaly agree with you i can't and i don't want pass a value each cycle of the cooldown from actionscript to unrealscript but I'm afraid because you said "Also I'd avoid SetInterval like the plague" and i use it to handle the cooldown. Thus, does it existe another alternative?

      thx

      Comment


        #4
        Looks great man, nice one

        As long as you can get it working you should be fine.

        The memory leaks come from the movie being removed from memory before you get chance to clear the interval, so you get a dangling reference to the interval.


        If you were super paranoid then you could use an enterFrame event with a counter, sounds basic but it's the safest, although really i'm probably being over cautious.

        Glad it worked anyway

        Comment

        Working...
        X