Synchronous operations in AS3?
i'm in process of porting ancient dos application flash/as3.the old application able use synchronous approach fit problem well, i'm getting bit of headache trying convert event driven, @ least in elegant way.
i have events occur in sequence want display minimal fuss. here's pseudo-code shows want:
function start_clicked(e:event):void { mylabel.text = "five second countdown!"; fillprogressbar(5); // fill bar on 5 second period mylabel.text = "pausing..."; delaysec(2); mylabel.text = "thank patience."; okbutton.enabled = true; }
hopefully intention clear, here. each line of code should start after last 1 completes. fillprogressbar() example; there several such operations take time , signal completion via event. in reality, there little bit of if/then/else control flow well.
i know how use timer_complete events kick off next action, , in general fine, lengthy sequences best represented control flow, it's getting unwieldy. i've tried keeping nextaction:function var , stuffing (or pulling action queue), nothing seems satisfying. there more common , elegant idiom this?
i'm using flashbuilder 4.7 + flex, if there's flex-specific handling this, let me know , happily ask in forum well, moment, believe more general as3 question.
thanks!
either use timer class or settimeout. in general, settimeout easier use it's easy lose scope when using settimeout.
More discussions in ActionScript 3
adobe
Comments
Post a Comment