开发者

Adobe LCCS: How to wait until two sharedProperties are synchronised?

I have two sharedProperties in an app, one of them is in addition a batonProperty. It is easy if I only want one of them to be synched, I just add an eventlistener to the sync event. If I have two though, I can still attach event listeners to both to check when each syncs, but how would I wait for both of them to be synched?

Any code samples I can test are much apprec开发者_开发知识库iated.


I haven't worked with sharedProperties, but for any situation where you need to wait for more than one event, where you don't know in what order they will occur, you can use something in the lines of this pretty basic setup:

var event1occurred:Boolean;
var event2occurred:Boolean;

function onEvent1(e:Event):void {
    event1occurred = true;
    checkIfAllEventsOccurred();
}

function onEvent2(e:Event):void {
    event2occurred = true;
    checkIfAllEventsOccurred();
}

function checkIfAllEventsOccurred():void {
    if(event1occurred && event2occurred) {
        // Do stuff here
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜