home *** CD-ROM | disk | FTP | other *** search
/ FCE Gold Plus / GOLD.iso / pc / main.swf / scripts / frame_1 / DoAction.as
Text File  |  2007-11-02  |  13KB  |  457 lines

  1. function initGAB()
  2. {
  3.    var _loc3_ = new MovieClipLoader();
  4.    var _loc5_ = new Object();
  5.    _loc5_.activityFile = "xml/blank.xml";
  6.    _loc5_.parent = this;
  7.    _global.startTime = getTimer();
  8.    _loc5_.onLoadInit = function(mc)
  9.    {
  10.       mc._visible = false;
  11.       mc._lockroot = true;
  12.       mc.activityFile = this.activityFile;
  13.       mc.eventListeners = [{type:"onActivityLoaded",listener:this.parent},{type:"onCallFunction",listener:this.parent},{type:"onScores",listener:this.parent}];
  14.    };
  15.    _loc3_.addListener(_loc5_);
  16.    var _loc4_ = _global.OS != "Mac" ? "swf/preview.swf" : "swf/preview.swf";
  17.    _loc3_.loadClip(_loc4_,unitData.theGABmc);
  18.    playerType = "GAB";
  19. }
  20. function onFileClicked(fileData)
  21. {
  22.    trace("broadcasted");
  23.    Dump.dumpThis(fileData);
  24.    previousFileObject = currentFileObject;
  25.    currentFileObject = fileData;
  26.    unitData.activityOnLoad(fileData);
  27.    headerActive = false;
  28.    if(fileData.link.url == "test.swf")
  29.    {
  30.       trace("test.swf");
  31.       if(_global.OS == "Windows")
  32.       {
  33.          trace("win");
  34.          mdm.System.exec(mdm_appdir + "fscommand\\shell.exe");
  35.       }
  36.       else if(bLinuxSystem)
  37.       {
  38.          blue._visible = true;
  39.          loadMovieNum("shell.swf",20,"GET");
  40.       }
  41.       else
  42.       {
  43.          trace("mac");
  44.          mdm.exec(_level0.mdm_appdir + "fscommand:shell.osx");
  45.       }
  46.    }
  47. }
  48. function drawBaseNav()
  49. {
  50.    if(currentFileObject != undefined)
  51.    {
  52.       unitData.activityLoadComplete(currentFileObject);
  53.    }
  54. }
  55. function onActivityLoaded(eventObject)
  56. {
  57.    cv.swapDepths(0);
  58.    cv.removeMovieClip();
  59.    checkVisible = _root.createEmptyMovieClip("cv",_root.getNextHighestDepth());
  60.    checkVisible.count = 0;
  61.    checkVisible.onEnterFrame = function()
  62.    {
  63.       trace(this.count++);
  64.       if(this.count > 2)
  65.       {
  66.          drawBaseNav();
  67.          delete this.onEnterFrame;
  68.       }
  69.    };
  70.    loading_mc._visible = false;
  71. }
  72. function onScores(eventObject)
  73. {
  74.    trace("onScores: " + eventObject.totalCorrect + "/" + eventObject.totalAvailable);
  75.    unitData.onScores(eventObject.totalCorrect,eventObject.totalAvailable);
  76. }
  77. function onCallFunction(eventObject)
  78. {
  79.    trace("onCallFunction: ");
  80.    trace("functionName: " + eventObject.functionName);
  81.    trace("params: " + eventObject.params);
  82. }
  83. function loadActivities(fileData)
  84. {
  85.    if(fileData.link.url == "activities.swf")
  86.    {
  87.       unitData.createActivityNav(fileData.arrActivities,fileData.nodePath);
  88.    }
  89.    else if(fileData.link.url == "preview.swf")
  90.    {
  91.       loadGABPlayerFile(fileData.link.activityFile);
  92.    }
  93.    else if(fileData.link.url == "Grammar.swf")
  94.    {
  95.       loadGrammarSWF(fileData.link.activityFile);
  96.    }
  97.    else if(fileData.link.url == "grammar.swf")
  98.    {
  99.       loadGrammar(fileData.link.pdf[0].unit);
  100.    }
  101.    else if(fileData.link.url == "phonetic.swf")
  102.    {
  103.       loadPhoneticChart();
  104.    }
  105.    else if(fileData.link.url == "crossword.swf")
  106.    {
  107.       loadCrossword(fileData.link.activityFile);
  108.    }
  109.    else if(fileData.link.url == "pelmanism.swf")
  110.    {
  111.       loadPelmanism(fileData.link.activityFile);
  112.    }
  113.    else if(fileData.link.url == "wordsearch.swf")
  114.    {
  115.       loadWordSearch(fileData.link.activityFile);
  116.    }
  117.    else if(fileData.link.url == "html.swf")
  118.    {
  119.       loadHTML(fileData.link.activityFile);
  120.    }
  121.    else if(fileData.link.url == "matching.swf")
  122.    {
  123.       loadMatching(fileData.link.activityFile);
  124.    }
  125.    else if(fileData.link.url == "cando.swf")
  126.    {
  127.       loadPhoneticChart;
  128.       activityHeader._visible = false;
  129.       loadCando(fileData.link.activityFile);
  130.    }
  131.    else if(fileData.link.url == "phonetic_chart.swf")
  132.    {
  133.       loadPhoneticChart();
  134.    }
  135.    else if(fileData.link.url == "minidict.swf" || fileData.dictionary == true)
  136.    {
  137.       loadMiniDictionary();
  138.    }
  139.    else if(fileData.link.url == "DiaryMain.swf")
  140.    {
  141.       loadDiary(fileData.link.activityFile,fileData.nodePath[1]);
  142.    }
  143.    else if(fileData.link.url.indexOf("Mod") != -1)
  144.    {
  145.       loadSWF(fileData.link.url);
  146.    }
  147. }
  148. function loadGABPlayerFile(link)
  149. {
  150.    printObj = {};
  151.    printObj.scale = 80;
  152.    printObj.gab = true;
  153.    printObj.path = unitData.theGABmc;
  154.    loading_mc._visible = true;
  155.    unitData.theGABmc.activityFile = "xml/" + link;
  156. }
  157. function loadPhoneticChart()
  158. {
  159.    printObj = {};
  160.    printObj.path = unitData.theNonGABmc;
  161.    printObj.scale = 80;
  162.    printObj.gab = false;
  163.    var _loc2_ = new Object();
  164.    var _loc1_ = new MovieClipLoader();
  165.    _loc2_.onLoadInit = function(target_mc)
  166.    {
  167.       trace("movie loaded");
  168.       target_mc._xscale = 95;
  169.       target_mc._yscale = 95;
  170.    };
  171.    _loc1_.addListener(_loc2_);
  172.    _loc1_.loadClip("swf/phonetic_chart.swf",unitData.theNonGABmc);
  173.    playerType = "External";
  174. }
  175. function loadMiniDictionary()
  176. {
  177.    printObj = {};
  178.    printObj.path = unitData.theNonGABmc;
  179.    printObj.scale = 80;
  180.    printObj.gab = false;
  181.    var _loc2_ = new Object();
  182.    var _loc1_ = new MovieClipLoader();
  183.    _loc2_.onLoadInit = function(target_mc)
  184.    {
  185.       trace("movie loaded");
  186.       unitData.theNonGABmc._visible = true;
  187.       target_mc._lockroot = true;
  188.       target_mc._x -= 25;
  189.       target_mc._y -= 35;
  190.    };
  191.    _loc1_.addListener(_loc2_);
  192.    _loc1_.loadClip("swf/minidict.swf",unitData.theNonGABmc);
  193.    playerType = "External";
  194. }
  195. function loadCrossword(link)
  196. {
  197.    printObj = {};
  198.    printObj.path = unitData.theNonGABmc;
  199.    printObj.scale = 80;
  200.    printObj.gab = false;
  201.    var _loc2_ = new Object();
  202.    var _loc1_ = new MovieClipLoader();
  203.    _loc2_.onLoadInit = function(target_mc)
  204.    {
  205.       trace("movie loaded");
  206.       unitData.activityLoadComplete(currentFileObject);
  207.       target_mc._lockroot = true;
  208.       target_mc._xscale = 85;
  209.       target_mc._yscale = 85;
  210.       target_mc._x += 10;
  211.       target_mc._y -= 5;
  212.       trace("loading file: xml/" + link);
  213.       target_mc.myXml.load("xml/" + link);
  214.    };
  215.    _loc1_.addListener(_loc2_);
  216.    _loc1_.loadClip("swf/crossword.swf",unitData.theNonGABmc);
  217.    playerType = "External";
  218. }
  219. function loadPelmanism(link)
  220. {
  221.    printObj = {};
  222.    printObj.path = unitData.theNonGABmc;
  223.    printObj.scale = 80;
  224.    printObj.gab = false;
  225.    trace("loading pelmanism");
  226.    var _loc2_ = new Object();
  227.    var _loc1_ = new MovieClipLoader();
  228.    _loc2_.onLoadInit = function(target_mc)
  229.    {
  230.       trace("movie loaded");
  231.       unitData.activityLoadComplete(currentFileObject);
  232.       target_mc._lockroot = true;
  233.       target_mc._x += 20;
  234.       target_mc._y += 55;
  235.       target_mc._xscale = 65;
  236.       target_mc._yscale = 65;
  237.       trace("loading file: xml/" + link);
  238.       target_mc.xmlPath = "xml/" + link;
  239.    };
  240.    _loc1_.addListener(_loc2_);
  241.    _loc1_.loadClip("swf/pelmanism.swf",unitData.theNonGABmc);
  242.    playerType = "External";
  243. }
  244. function loadWordSearch(link)
  245. {
  246.    printObj = {};
  247.    printObj.path = unitData.theNonGABmc;
  248.    printObj.scale = 80;
  249.    printObj.gab = false;
  250.    var _loc3_ = new Object();
  251.    var _loc2_ = new MovieClipLoader();
  252.    _loc3_.onLoadInit = function(target_mc)
  253.    {
  254.       trace("movie loaded");
  255.       unitData.activityLoadComplete(currentFileObject);
  256.       target_mc._lockroot = true;
  257.       target_mc.parent = _root;
  258.       target_mc._x += 12;
  259.       target_mc._y += 10;
  260.       target_mc.xOffSet = target_mc._parent._x + 12;
  261.       target_mc.yOffSet = target_mc._parent._y + 10;
  262.       trace("loading file: xml/" + link);
  263.       target_mc.wordSearchXml.load("xml/" + link);
  264.    };
  265.    _loc2_.addListener(_loc3_);
  266.    _loc2_.loadClip("swf/wordsearch.swf",unitData.theNonGABmc);
  267.    playerType = "External";
  268. }
  269. function loadHTML(link)
  270. {
  271.    printObj = {};
  272.    printObj.path = unitData.theNonGABmc;
  273.    printObj.scale = 80;
  274.    printObj.gab = false;
  275.    var _loc2_ = new Object();
  276.    _loc2_.movieClip = this;
  277.    var _loc3_ = new MovieClipLoader();
  278.    _loc2_.onLoadInit = function(target_mc)
  279.    {
  280.       trace("movie loaded");
  281.       target_mc._lockroot = true;
  282.       target_mc.movieClip = this.movieClip;
  283.       target_mc._y -= 8;
  284.       trace("loading file: xml/" + link);
  285.       target_mc.htmlXML.load("xml/" + link);
  286.    };
  287.    _loc3_.addListener(_loc2_);
  288.    _loc3_.loadClip("swf/html.swf",unitData.theNonGABmc);
  289.    playerType = "External";
  290. }
  291. function loadMatching(link)
  292. {
  293.    printObj = {};
  294.    printObj.path = unitData.theNonGABmc;
  295.    printObj.scale = 80;
  296.    printObj.gab = false;
  297.    var _loc3_ = new Object();
  298.    _loc3_.movieClip = this;
  299.    var _loc4_ = new MovieClipLoader();
  300.    _loc3_.onLoadInit = function(target_mc)
  301.    {
  302.       trace("movie loaded");
  303.       unitData.activityLoadComplete(currentFileObject);
  304.       target_mc._lockroot = true;
  305.       target_mc.parent = _root;
  306.       target_mc._x += 10;
  307.       target_mc._y -= 35;
  308.       target_mc.xOffSet = target_mc._parent._x + 10;
  309.       target_mc.yOffSet = target_mc._parent._y - 35;
  310.       target_mc.wordsXml.load("xml/" + link);
  311.    };
  312.    _loc4_.addListener(_loc3_);
  313.    _loc4_.loadClip("swf/matching.swf",unitData.theNonGABmc);
  314.    playerType = "External";
  315. }
  316. function loadCando(link)
  317. {
  318.    printObj = {};
  319.    printObj.path = unitData.theNonGABmc;
  320.    printObj.scale = 80;
  321.    printObj.gab = false;
  322.    var _loc2_ = new Object();
  323.    var _loc1_ = new MovieClipLoader();
  324.    _loc2_.onLoadInit = function(target_mc)
  325.    {
  326.       trace("movie loaded");
  327.       target_mc._lockroot = true;
  328.       target_mc._xscale = 100;
  329.       target_mc._yscale = 100;
  330.       target_mc.candoXML.load("xml/" + link);
  331.       trace("xml/" + link);
  332.    };
  333.    _loc1_.addListener(_loc2_);
  334.    _loc1_.loadClip("swf/cando.swf",unitData.theNonGABmc);
  335.    playerType = "External";
  336. }
  337. function loadSWF(file)
  338. {
  339.    printObj = {};
  340.    printObj.path = unitData.theNonGABmc;
  341.    printObj.scale = 80;
  342.    printObj.gab = false;
  343.    unitData.theNonGABmc._lockroot = true;
  344.    trace("loading movie: swf/" + file);
  345.    unitData.theNonGABmc.loadMovie("swf/" + file);
  346.    unitData.theNonGABmc._y += 25;
  347.    playerType = "External";
  348. }
  349. function loadDiary(link, unitNo)
  350. {
  351.    printObj = {};
  352.    printObj.path = unitData.theNonGABmc;
  353.    printObj.scale = 80;
  354.    printObj.gab = false;
  355.    var _loc2_ = new Object();
  356.    _loc2_.unitNo = unitNo;
  357.    var _loc3_ = new MovieClipLoader();
  358.    _loc2_.onLoadInit = function(target_mc)
  359.    {
  360.       trace("movie loaded");
  361.       unitData.activityLoadComplete(currentFileObject);
  362.       target_mc._lockroot = true;
  363.       target_mc.xmlObject.load("xml/" + link);
  364.       target_mc.unitNum = Number(this.unitNo);
  365.       trace("xml/" + link);
  366.    };
  367.    _loc3_.addListener(_loc2_);
  368.    _loc3_.loadClip("swf/DiaryMain.swf",unitData.theNonGABmc);
  369.    playerType = "External";
  370. }
  371. function loadGrammar(unit, sub)
  372. {
  373.    trace("LOADING GRAMMAR: " + unit + "," + sub);
  374.    printObj = {};
  375.    var _loc2_ = new Object();
  376.    _loc2_.movieClip = this;
  377.    var _loc3_ = new MovieClipLoader();
  378.    _loc2_.unit = unit;
  379.    _loc2_.sub = sub;
  380.    _loc2_.onLoadInit = function(target_mc)
  381.    {
  382.       trace("movie loaded");
  383.       unitData.activityLoadComplete(currentFileObject);
  384.       target_mc._lockroot = true;
  385.       target_mc.movieClip = this.movieClip;
  386.       target_mc._y -= 8;
  387.       target_mc.loadGrammar(this.unit,this.sub);
  388.    };
  389.    _loc3_.addListener(_loc2_);
  390.    _loc3_.loadClip("swf/grammar.swf",unitData.theNonGABmc);
  391.    playerType = "External";
  392. }
  393. function loadGrammarSWF(file)
  394. {
  395.    printObj = {};
  396.    printObj.path = unitData.theNonGABmc;
  397.    printObj.scale = 80;
  398.    printObj.gab = false;
  399.    var _loc2_ = new Object();
  400.    var _loc1_ = new MovieClipLoader();
  401.    _loc2_.onLoadInit = function(target_mc)
  402.    {
  403.       trace("movie loaded");
  404.       unitData.activityLoadComplete(currentFileObject);
  405.       target_mc._xscale = 90;
  406.       target_mc._yscale = 90;
  407.       target_mc.audiopath = "audio/";
  408.       target_mc.grammarXML.load("grammar/" + file);
  409.    };
  410.    _loc1_.addListener(_loc2_);
  411.    _loc1_.loadClip("swf/grammar.swf",unitData.theNonGABmc);
  412.    playerType = "External";
  413. }
  414. stop();
  415. var my_cm = new ContextMenu();
  416. my_cm.hideBuiltInItems();
  417. my_cm.builtInItems.print = true;
  418. this.menu = my_cm;
  419. mdm.setwindowtitle("GOLD FCE");
  420. mdm.setapplicationtitle("GOLD FCE");
  421. var bLinuxSystem = false;
  422. _root.txt_linux = _global.OS;
  423. _root.txt_linux = System.capabilities.os;
  424. if(System.capabilities.os.indexOf("Linux") != -1)
  425. {
  426.    bLinuxSystem = true;
  427.    _root.topNav.quitBtn._visible = false;
  428. }
  429. blue._visible = false;
  430. var lineColour = 5221062;
  431. var bgColour = 16777215;
  432. var headerTypeColour = "FFFFFF";
  433. var drawBNInt;
  434. var unitData = new UnitData(_root.activity_holder.createEmptyMovieClip("activity",1),_root.activity_holder1.createEmptyMovieClip("activity",1));
  435. var navigation = new Friends_navigation(nav);
  436. var printObj;
  437. var currentFileObject;
  438. var printcontent;
  439. var currentHolder;
  440. var headerActive;
  441. var previousFileObject;
  442. var currentLoadedActivity;
  443. embed._visible = false;
  444. printCov._visible = false;
  445. loading_mc._visible = false;
  446. playerType = undefined;
  447. var navXML = new XML();
  448. navXML.ignoreWhite = true;
  449. navXML.onLoad = function()
  450. {
  451.    navigation.parseXML(this);
  452.    languageActivator();
  453.    unitData.parseXML(unitXML);
  454. };
  455. navXML.load("xml/Navigation.xml");
  456. initGAB();
  457.