Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
package eventsFlow{
import mx.controls.Button;
import com.realaxy.actionScript.eventsFlow.util.EventsFlowContext;
import flash.utils.setTimeout;
import com.realaxy.actionScript.eventsFlow.util.EventQuery;
import flash.events.MouseEvent;
import flash.utils.Dictionary;
import com.realaxy.actionScript.collections.util.CollectionsLanguageUtil;
import flash.display.Sprite;
public class MillionaireGame extends Sprite {
private var errorFlag : Boolean ;
private var cancelFlag : Boolean ;
private var friendButton : Button ;
private var answerButton : Button ;
private var phoneButton : Button ;
public function MillionaireGame( ){
millionaire();
}
public function millionaire ( ) : void {
var __eventFlowUniqueId : int = EventsFlowContext.newFlow("1066125970159108107");
var __eventsFlowThis : MillionaireGame = this;
// millionaire game start
// expire(10000)
var counter_1066125970159109905 : int = EventsFlowContext.getBlockExecutedCount(__eventFlowUniqueId);
setTimeout( function ( ) : void {
if ( EventsFlowContext.getBlockExecutedCount(__eventFlowUniqueId) == counter_1066125970159109905 ) {
EventsFlowContext.destroyCurrentQueryListeners(__eventFlowUniqueId);
EventsFlowContext.executeNextCodeBlock(__eventFlowUniqueId);
{
EventsFlowContext.exit(__eventFlowUniqueId, "loose");
return ;
}
}
}, 10000);
EventsFlowContext.addCodeBlock(__eventFlowUniqueId, function ( ) : void {
{
EventsFlowContext.setNewQuery(__eventFlowUniqueId, new EventQuery("1684146993529417500", new Array(new EventQuery("1066125970159110632", new Array(new EventQuery("1066125970159193039", new Array(), com.realaxy.actionScript.eventsFlow.util.EventsQueryStrategy.CATCH), new EventQuery("1066125970159207118", new Array(), com.realaxy.actionScript.eventsFlow.util.EventsQueryStrategy.CATCH)), com.realaxy.actionScript.eventsFlow.util.EventsQueryStrategy.OR)), com.realaxy.actionScript.eventsFlow.util.EventsQueryStrategy.COMPOSITE));
(EventsFlowContext.catchEvent(__eventFlowUniqueId, friendButton, "click", function ( event_a0a0a0a1a0a6a0 : MouseEvent ) : void {
try {
var count_a0a0a0b0a0g0a : int = EventsFlowContext.getBlockExecutedCount(__eventFlowUniqueId);
{
EventsFlowContext.jump(__eventFlowUniqueId, "callToFriend");
return ;
}
} finally {
if ( count_a0a0a0b0a0g0a == EventsFlowContext.getBlockExecutedCount(__eventFlowUniqueId) ) {
EventsFlowContext.executeQueryById(__eventFlowUniqueId, "1066125970159193039");
}
}
}, "7581117113012050904", "1684146993529417500"), null);
(EventsFlowContext.catchEvent(__eventFlowUniqueId, answerButton, "click", function ( event_a1a0a0a1a0a6a0 : MouseEvent ) : void {
try {
var count_b0a0a0b0a0g0a : int = EventsFlowContext.getBlockExecutedCount(__eventFlowUniqueId);
if ( validateAnswer() ) {
{
EventsFlowContext.exit(__eventFlowUniqueId, "win");
return ;
}
}else{
EventsFlowContext.exit(__eventFlowUniqueId, "loose");
return ;
}
} finally {
if ( count_b0a0a0b0a0g0a == EventsFlowContext.getBlockExecutedCount(__eventFlowUniqueId) ) {
EventsFlowContext.executeQueryById(__eventFlowUniqueId, "1066125970159207118");
}
}
}, "7581117113012050911", "1684146993529417500"), null);
return ;
}
}, "");
EventsFlowContext.addCodeBlock(__eventFlowUniqueId, function ( ) : void {
{
EventsFlowContext.jump(__eventFlowUniqueId, "callToFriend");
return ;
}
EventsFlowContext.executeNextCodeBlock(__eventFlowUniqueId);
}, "");
EventsFlowContext.addCodeBlock(__eventFlowUniqueId, function ( ) : void {
// state: callToFriend
// expire(30000)
var counter_1066125970159230851 : int = EventsFlowContext.getBlockExecutedCount(__eventFlowUniqueId);
setTimeout( function ( ) : void {
if ( EventsFlowContext.getBlockExecutedCount(__eventFlowUniqueId) == counter_1066125970159230851 ) {
EventsFlowContext.destroyCurrentQueryListeners(__eventFlowUniqueId);
EventsFlowContext.executeNextCodeBlock(__eventFlowUniqueId);
{
EventsFlowContext.exit(__eventFlowUniqueId, "loose");
return ;
}
}
}, 30000);
{
EventsFlowContext.setNewQuery(__eventFlowUniqueId, new EventQuery("1684146993529417506", new Array(new EventQuery("1684146993529417503", new Array(new EventQuery("1066125970159230867", new Array(), com.realaxy.actionScript.eventsFlow.util.EventsQueryStrategy.CATCH)), com.realaxy.actionScript.eventsFlow.util.EventsQueryStrategy.AND)), com.realaxy.actionScript.eventsFlow.util.EventsQueryStrategy.COMPOSITE));
(EventsFlowContext.catchEvent(__eventFlowUniqueId, phoneButton, "click", function ( event_a0a0a0f0b0a0i0a : MouseEvent ) : void {
EventsFlowContext.executeQueryById(__eventFlowUniqueId, "1066125970159230867");
}, "1066125970159230867", "1684146993529417506"), null);
return ;
}
}, "callToFriend");
EventsFlowContext.addCodeBlock(__eventFlowUniqueId, function ( ) : void {
{
EventsFlowContext.jump(__eventFlowUniqueId, "answer");
return ;
}
{
EventsFlowContext.jump(__eventFlowUniqueId, "answer");
return ;
}
EventsFlowContext.executeNextCodeBlock(__eventFlowUniqueId);
}, "");
EventsFlowContext.addCodeBlock(__eventFlowUniqueId, function ( ) : void {
// state: answer
if ( validateAnswer() ) {
{
EventsFlowContext.exit(__eventFlowUniqueId, "win");
return ;
}
}else{
EventsFlowContext.exit(__eventFlowUniqueId, "loose");
return ;
}
EventsFlowContext.exit(__eventFlowUniqueId, null);
}, "answer");
EventsFlowContext.executeNextCodeBlock(__eventFlowUniqueId);
}
public function validateAnswer ( ) : Boolean {
return false ;
}
}
}
state callToFriend {
if (validateAnswer()) {
exit win;
} else {
exit loose;
}
}
Демонстрация работы Realaxy Editor Events Flow Language