home *** CD-ROM | disk | FTP | other *** search
Wrap
class com.argosy.VamMain extends com.argosy.ui.baseUI { var content_mc; var quizWarning; var module_array; var welcome_str; var tree_menu; var breadcrumb_bar; var volume_control; var mask; var xml_loader; var background_mc; var help_url; var credit_url; var title_tf; var copyright_tf; var menu_bar; var menu_intv; var selected_menu; var menu_timeout; var title_bar; var top_links_tf; static var normal_style; static var over_style; static var selected_style; function VamMain() { super(); } function go_home_helper(flag) { trace("hover_menu_selection_helper: " + arguments); if(flag) { this.content_mc.isComplete = true; this.content_mc.warnSummary = false; this.goHome(); } } function goHome() { trace("home"); if(this.content_mc.isComplete == false) { this.quizWarning.setContent("Warning","If you exit this activity, all your answers will be lost. Do you still want to exit?<br/><br/>Press \"EXIT\" to stop working on the activity and discard your work.<br/>Press \"CANCEL\" to continue working on this activity.","EXIT","CANCEL",this,"go_home_helper"); } else if(this.content_mc.warnSummary != undefined && this.content_mc.warnSummary == true) { this.quizWarning.setContent("Warning","If you exit this summary page, all your answers will be lost. Do you still want to exit?<br/><br/>Press \"EXIT\" to discard your answers.<br/>Press \"CANCEL\" to continue reviewing your work.","EXIT","CANCEL",this,"go_home_helper"); } else { this.content_mc.removeMovieClip(); this.setMenuSelection(null); this.tree_menu.setContent(this.module_array,this.welcome_str); this.breadcrumb_bar.clearContent(); this.setTopLinks("toplevel"); } this.volume_control.closeMenu(); } function hover_menu_selection_helper(evt, flag) { trace("hover_menu_selection_helper: " + arguments); if(flag) { this.content_mc.isComplete = true; this.content_mc.warnSummary = false; this.hover_menu_selection(evt); } } function hover_menu_selection(evt) { if(this.content_mc.isComplete == false) { this.quizWarning.setContent("Warning","If you exit this activity, all your answers will be lost. Do you still want to exit?<br/><br/>Press \"EXIT\" to stop working on the activity and discard your work.<br/>Press \"CANCEL\" to continue working on this activity.","EXIT","CANCEL",this,"hover_menu_selection_helper",evt); } else if(this.content_mc.warnSummary != undefined && this.content_mc.warnSummary == true) { this.quizWarning.setContent("Warning","If you exit this summary page, all your answers will be lost. Do you still want to exit?<br/><br/>Press \"EXIT\" to discard your answers.<br/>Press \"CANCEL\" to continue reviewing your work.","EXIT","CANCEL",this,"hover_menu_selection_helper",evt); } else { trace("hover_menu_selection: " + arguments); if(evt.target.type == "menu") { this.content_mc.removeMovieClip(); this.breadcrumb_bar.setContent(evt.target.pop_menu); this.tree_menu.setContent(evt.target.pop_menu.menu_items,evt.target.pop_menu.instructions); } else if(evt.target.type == "activity") { this.load_activity(evt.target.activity_type,evt.target.activity_url); this.breadcrumb_bar.setContent(evt.target); this.tree_menu.clearContent(); } evt.lastOwner.show(false); this.setMenuSelection(evt.lastOwner._parent); this.setTopLinks("lowerLevel"); } } function tree_selection_helper(evt, flag) { trace("tree_selection_helper: " + arguments); if(flag) { this.content_mc.isComplete = true; this.content_mc.warnSummary = false; this.tree_selection(evt); } } function tree_selection(evt) { trace("highlight:" + evt.target.mc_ref.pop_menu.top_parent); _global.Xray.trace(evt); if(this.content_mc.isComplete == false) { this.quizWarning.setContent("Warning","If you exit this activity, all your answers will be lost. Do you still want to exit?<br/><br/>Press \"EXIT\" to stop working on the activity and discard your work.<br/>Press \"CANCEL\" to continue working on this activity.","EXIT","CANCEL",this,"tree_selection_helper",evt); } else if(this.content_mc.warnSummary != undefined && this.content_mc.warnSummary == true) { this.quizWarning.setContent("Warning","If you exit this summary page, all your answers will be lost. Do you still want to exit?<br/><br/>Press \"EXIT\" to discard your answers.<br/>Press \"CANCEL\" to continue reviewing your work.","EXIT","CANCEL",this,"tree_selection_helper",evt); } else { evt.target.mc_ref.pop_menu.top_parent != undefined ? this.setMenuSelection(evt.target.mc_ref.pop_menu.top_parent) : this.setMenuSelection(evt.target.mc_ref.top_parent); if(evt.target.type == "menu" || evt.target.type == "topmenu") { this.content_mc.removeMovieClip(); this.breadcrumb_bar.setContent(evt.target.mc_ref.pop_menu); this.tree_menu.setContent(evt.target.pop_menu.menu_items,evt.target.pop_menu.instructions); } else if(evt.target.type == "activity") { this.load_activity(evt.target.activity_type,evt.target.activity_url); this.breadcrumb_bar.setContent(evt.target.mc_ref); this.tree_menu.clearContent(); } this.setTopLinks("lowerLevel"); } this.volume_control.closeMenu(); } function bread_selection_helper(evt, flag) { trace("bread_selection_helper: " + arguments); if(flag) { this.content_mc.isComplete = true; this.content_mc.warnSummary = false; this.bread_selection(evt); } } function bread_selection(evt) { if(this.content_mc.isComplete == false) { this.quizWarning.setContent("Warning","If you exit this activity, all your answers will be lost. Do you still want to exit?<br/><br/>Press \"EXIT\" to stop working on the activity and discard your work.<br/>Press \"CANCEL\" to continue working on this activity.","EXIT","CANCEL",this,"bread_selection_helper",evt); } else if(this.content_mc.warnSummary != undefined && this.content_mc.warnSummary == true) { this.quizWarning.setContent("Warning","If you exit this summary page, all your answers will be lost. Do you still want to exit?<br/><br/>Press \"EXIT\" to discard your answers.<br/>Press \"CANCEL\" to continue reviewing your work.","EXIT","CANCEL",this,"bread_selection_helper",evt); } else { var _loc2_ = evt.target; this.content_mc.removeMovieClip(); this.breadcrumb_bar.setContent(_loc2_); this.tree_menu.setContent(_loc2_.menu_items,_loc2_.instructions); this.setMenuSelection(evt.target.top_parent); } this.volume_control.closeMenu(); } function load_activity(type, url) { trace("load_activity: " + arguments); this.content_mc.stop_timer(); this.content_mc.removeMovieClip(); if(type == "self_review") { this.content_mc = this.attachMovie("LabelViewer","content_mc",100,{_x:this.mask._x,_y:this.mask._y,width:this.mask._width,height:this.mask._height}); this.content_mc.warnSummary = false; this.content_mc.loadContent(url); } else if(type == "self_study") { this.content_mc = this.attachMovie("QuestionViewer","content_mc",100,{_x:this.mask._x,_y:this.mask._y,width:this.mask._width,height:this.mask._height}); this.content_mc.warnSummary = false; this.content_mc.loadContent(url); } else if(type == "lab_practical") { this.content_mc = this.attachMovie("QuestionViewer","content_mc",100,{_x:this.mask._x,_y:this.mask._y,width:this.mask._width,height:this.mask._height}); this.content_mc.warnSummary = false; this.content_mc.loadContent(url); } this.volume_control.closeMenu(); } function xml_loaded(success) { if(success && this.xml_loader.status == 0) { this.background_mc.loadImage(this.xml_loader.firstChild.attributes.background); var _loc3_ = 0; while(_loc3_ < this.xml_loader.firstChild.childNodes.length) { var _loc2_ = this.xml_loader.firstChild.childNodes[_loc3_]; switch(_loc2_.nodeName) { case "title": this.help_url = _loc2_.attributes.help; this.credit_url = _loc2_.attributes.credit; this.title_tf.htmlText = "<p><title>" + _loc2_.firstChild.nodeValue + "</title></p>"; break; case "welcome": this.welcome_str = "<p>" + _loc2_.firstChild.nodeValue + "</p>"; break; case "copyright": this.copyright_tf.htmlText = "<p><copyright>" + _loc2_.firstChild.nodeValue + "</copyright></p>"; break; case "content": this.buildMenu(_loc2_); } _loc3_ = _loc3_ + 1; } } else { trace("xml error: " + this.xml_loader.status); } } function buildMenu(node) { this.module_array = []; var _loc6_ = (Stage.width - 10) / node.childNodes.length; var _loc5_ = 0; while(_loc5_ < node.childNodes.length) { var _loc3_ = node.childNodes[_loc5_]; var _loc7_ = this.menu_bar.getNextHighestDepth(); var _loc2_ = this.menu_bar.createEmptyMovieClip("menu_" + _loc7_,_loc7_); _loc2_.id = _loc3_.attributes.id; _loc2_.color = _loc3_.attributes.color; _loc2_.image_url = _loc3_.attributes.icon; _loc2_.sideimage = _loc3_.attributes.sideimage; _loc2_.title = _loc3_.attributes.title; _loc2_.type = "topmenu"; _loc2_.label_tf = _loc2_.createTextField("title",10,0,10,_loc6_,12); _loc2_.label_tf.selectable = false; _loc2_.label_tf.html = true; _loc2_.label_tf.embedFonts = true; _loc2_.label_tf.styleSheet = com.argosy.VamMain.normal_style; _loc2_.label_tf.htmlText = "<p>" + _loc2_.title + "</p>"; _loc2_.pop_menu = _loc2_.attachMovie("PopMenu","pop_menu",100); _loc2_.pop_menu.addEventListener("selection",this,"hover_menu_selection"); _loc2_.pop_menu.top_parent = _loc2_; _loc2_.pop_menu._y = 35; _loc2_.pop_menu.width = _loc6_; _loc2_._x = 5 + _loc6_ * _loc5_; _loc2_.pop_menu.stage_x = _loc2_._x; _loc2_.pop_menu.setContent(_loc3_); _loc2_.bg = _loc2_.createEmptyMovieClip("bg",1); _loc2_.bg.lineStyle(0,16711680,0); _loc2_.bg.beginFill(16711680,0); _loc2_.bg.lineTo(_loc6_,0); _loc2_.bg.lineTo(_loc6_,35); _loc2_.bg.lineTo(0,35); _loc2_.bg.lineTo(0,0); _loc2_.bg.endFill(); if(this.module_array.length > 0) { _loc2_.bg.lineStyle(2,16777215,100,true,"normal","square","miter",2); _loc2_.bg.moveTo(0,6); _loc2_.bg.lineTo(0,_loc2_.bg._height); } _loc2_.bg.onRollOver = ascb.util.Proxy.create(this,this.menuOver,_loc2_); _loc2_.bg.onRollOut = ascb.util.Proxy.create(this,this.menuOut,_loc2_); _loc2_.bg.onPress = ascb.util.Proxy.create(this,this.menuPress,_loc2_); _loc2_.bg.onRelease = _loc2_.bg.onReleaseOutside = ascb.util.Proxy.create(this,this.menuRelease,_loc2_); _loc2_.activity_text = []; var _loc4_ = 0; while(_loc4_ < _loc3_.childNodes.length) { if(_loc3_.childNodes[_loc4_].nodeName == "activityText") { _loc2_.activity_text[_loc3_.childNodes[_loc4_].attributes.type] = _loc3_.childNodes[_loc4_].firstChild.nodeValue; } _loc4_ = _loc4_ + 1; } this.module_array.push(_loc2_); _loc5_ = _loc5_ + 1; } this.layout(); this.tree_menu.setContent(this.module_array,this.welcome_str); } function setMenuOver(mc) { clearInterval(this.menu_intv); for(var _loc3_ in this.module_array) { this.module_array[_loc3_].pop_menu.show(false); if(this.module_array[_loc3_] != this.selected_menu) { this.module_array[_loc3_].label_tf.styleSheet = com.argosy.VamMain.normal_style; this.module_array[_loc3_].label_tf.htmlText = "<p>" + this.module_array[_loc3_].title + "</p>"; } } if(mc == undefined) { this.breadcrumb_bar.enableHover(); } else { this.breadcrumb_bar.disableHover(); } mc.pop_menu.show(true); mc.label_tf.styleSheet = com.argosy.VamMain.over_style; mc.label_tf.htmlText = "<p><font color=\'#" + mc.color + "\'>" + mc.title + "</font></p>"; this.selected_menu.label_tf.styleSheet = com.argosy.VamMain.selected_style; this.selected_menu.label_tf.htmlText = "<p><font color=\'#" + this.selected_menu.color + "\'>" + this.selected_menu.title + "</font></p>"; } function recursiveHitTest(mc, x, y, flag) { var _loc3_ = false; for(var _loc7_ in mc) { if(typeof mc[_loc7_] == "movieclip" && mc[_loc7_]._visible) { if(_loc7_.toLowerCase().indexOf("parent") != -1) { continue; } if(this.recursiveHitTest(mc[_loc7_],x,y,flag)) { return true; } if(mc[_loc7_].hitTest(x,y,flag) && !_loc3_ && _loc7_.toLowerCase().indexOf("bg") != -1) { _loc3_ = true; return true; } } } return _loc3_; } function checkMenuOver(mc) { var _loc2_ = this.recursiveHitTest(mc,this._xmouse,this._ymouse,true); if(!_loc2_) { clearInterval(this.menu_intv); this.setMenuOver(null); } } function checkMenuTimeOut(mc) { if(mc.hitTest(this._xmouse,this._ymouse,true)) { this.setMenuOver(mc); } clearInterval(this.menu_timeout); } function setMenuSelection(mc) { clearInterval(this.menu_intv); for(var _loc2_ in this.module_array) { this.module_array[_loc2_].pop_menu.show(false); this.module_array[_loc2_].label_tf.styleSheet = com.argosy.VamMain.normal_style; this.module_array[_loc2_].label_tf.htmlText = "<p>" + this.module_array[_loc2_].title + "</p>"; } mc.label_tf.styleSheet = com.argosy.VamMain.selected_style; mc.label_tf.htmlText = "<p><font color=\'#" + mc.color + "\'>" + mc.title + "</font></p>"; this.selected_menu = mc; this.setTopLinks("lowerlevel"); } function menuOver(mc) { clearInterval(this.menu_timeout); this.menu_timeout = setInterval(this,"checkMenuTimeOut",100,mc); } function menuOut(mc) { clearInterval(this.menu_intv); clearInterval(this.menu_timeout); this.menu_intv = setInterval(this,"checkMenuOver",100,mc); } function menuPress(mc) { this.volume_control.closeMenu(); } function menuRelease_helper(mc, flag) { trace("bread_selection_helper: " + arguments); if(flag) { this.content_mc.isComplete = true; this.content_mc.warnSummary = false; this.menuRelease(mc); } } function menuRelease(mc) { trace("menuRelease: " + mc + " " + mc.title); if(this.content_mc.isComplete == false) { this.quizWarning.setContent("Warning","If you exit this activity, all your answers will be lost. Do you still want to exit?<br/><br/>Press \"EXIT\" to stop working on the activity and discard your work.<br/>Press \"CANCEL\" to continue working on this activity.","EXIT","CANCEL",this,"menuRelease_helper",mc); } else if(this.content_mc.warnSummary != undefined && this.content_mc.warnSummary == true) { this.quizWarning.setContent("Warning","If you exit this summary page, all your answers will be lost. Do you still want to exit?<br/><br/>Press \"EXIT\" to discard your work.<br/>Press \"CANCEL\" to continue reviewing your answers.","EXIT","CANCEL",this,"menuRelease_helper",mc); } else { this.content_mc.removeMovieClip(); this.tree_menu.setContent(mc.pop_menu.menu_items,mc.pop_menu.instructions); this.breadcrumb_bar.setContent(mc.pop_menu); this.setMenuSelection(mc); } } function init() { this.xml_loader = new XML(); this.xml_loader.ignoreWhite = true; this.xml_loader.onLoad = ascb.util.Proxy.create(this,this.xml_loaded); var _loc4_ = _root.activity_xml == undefined ? "pal.xml" : _root.activity_xml; this.xml_loader.load(_loc4_); if(com.argosy.VamMain.normal_style == undefined) { com.argosy.VamMain.normal_style = new TextField.StyleSheet(); com.argosy.VamMain.normal_style.setStyle("p",{fontFamily:"Frutiger Bold",fontSize:"12",color:"#FFFFFF",textAlign:"center",textDecoration:"none",kerning:"true",letterSpacing:"0"}); com.argosy.VamMain.normal_style.setStyle("title",{fontFamily:"RotisSemiSerif",fontSize:"18",color:"#000000",textAlign:"left"}); com.argosy.VamMain.normal_style.setStyle("copyright",{fontFamily:"Frutiger Bold",fontSize:"9",color:"#77787b",textAlign:"center"}); com.argosy.VamMain.normal_style.setStyle("link",{fontFamily:"Frutiger Bold",fontSize:"14",color:"#000000",textAlign:"right"}); com.argosy.VamMain.normal_style.setStyle("a:link",{color:"#000000"}); com.argosy.VamMain.normal_style.setStyle("a:hover",{color:"#77787b"}); com.argosy.VamMain.over_style = new TextField.StyleSheet(); com.argosy.VamMain.over_style.setStyle("p",{fontFamily:"Frutiger Bold",fontSize:"12",color:"#438CB8",textAlign:"center",textDecoration:"none",kerning:"true",letterSpacing:"0"}); com.argosy.VamMain.selected_style = new TextField.StyleSheet(); com.argosy.VamMain.selected_style.setStyle("p",{fontFamily:"Frutiger Bold",fontSize:"12",color:"#0172A0",textAlign:"center",textDecoration:"none",kerning:"true",letterSpacing:"0"}); } super.init(); } function createChildren() { this.tree_menu = com.argosy.ui.TreeMenu(this.attachMovie("TreeMenu","tree_menu",3)); this.tree_menu.addEventListener("selection",this,"tree_selection"); this.breadcrumb_bar = com.argosy.ui.BreadcrumbMenu(this.attachMovie("BreadcrumbMenu","breadcrumb_bar",4)); this.breadcrumb_bar.addEventListener("selection",this,"bread_selection"); this.title_bar = this.createEmptyMovieClip("title_bar",5); this.menu_bar = this.createEmptyMovieClip("menu_bar",1000); this.title_tf = this.createTextField("title_tf",this.getNextHighestDepth(),this.mask._x + 60,10,this.mask._width,20); this.title_tf.selectable = false; this.title_tf.html = true; this.title_tf.embedFonts = true; this.title_tf.styleSheet = com.argosy.VamMain.normal_style; this.title_tf.htmlText = "<p><title></title></p>"; this.copyright_tf = this.createTextField("copyright_tf",this.getNextHighestDepth(),this.mask._x,Stage.height - 30,this.mask._width,20); this.copyright_tf.selectable = false; this.copyright_tf.html = true; this.copyright_tf.embedFonts = true; this.copyright_tf.styleSheet = com.argosy.VamMain.normal_style; this.copyright_tf.htmlText = "<p><copyright></copyright></p>"; this.top_links_tf = this.createTextField("top_links_tf",this.getNextHighestDepth(),this.mask._x + this.mask._width,10,1,20); this.top_links_tf.autoSize = true; this.top_links_tf.selectable = false; this.top_links_tf.html = true; this.top_links_tf.embedFonts = true; this.top_links_tf.styleSheet = com.argosy.VamMain.normal_style; this.volume_control = com.argosy.ui.VolumeControl(this.attachMovie("VolumeControl","volume_control",this.getNextHighestDepth())); this.quizWarning = this.attachMovie("AlertBox","quizWarning",this.getNextHighestDepth()); this.setTopLinks("toplevel"); this.layout(); } function setTopLinks(flag) { if(flag == "toplevel") { this.top_links_tf.htmlText = "<p><link>| <a href=\'asfunction:externalLink,overview.html\'>PAL Overview</a> | <a href=\'asfunction:externalLink,credits.html\'>Credits</a> | <a href=\'asfunction:externalLink,help.html\'>Help</a></link></p>"; } else { this.top_links_tf.htmlText = "<p><link>| <a href=\'asfunction:goHome\'>Home</a> | <a href=\'asfunction:externalLink,help.html\'>Help</a></link></p>"; } this.top_links_tf._x = this.mask._x + this.mask._width - this.top_links_tf._width; this.volume_control._x = this.top_links_tf._x - 25; this.volume_control.closeMenu(); } function externalLink(url) { this.getURL(url,"_blank"); } function layout() { var _loc2_ = new flash.geom.Matrix(); _loc2_.createGradientBox(Stage.width,45,-1.5707963267948966,0,0); this.title_bar.lineStyle(1,16711680,0); this.title_bar.beginGradientFill("linear",[7369332,2039584],[100,100],[0,255],_loc2_,"pad"); this.title_bar.moveTo(0,0); this.title_bar.lineTo(Stage.width,0); this.title_bar.lineTo(Stage.width,35); this.title_bar.lineTo(0,35); this.title_bar.lineTo(0,0); this.title_bar.endFill(); this.title_bar.lineStyle(1,11185325,100); this.title_bar.moveTo(0,35); this.title_bar.lineTo(Stage.width,35); this.title_bar._y = 45; this.menu_bar._y = this.title_bar._y; this.breadcrumb_bar._y = this.title_bar._y + this.title_bar._height; this.breadcrumb_bar.height = 25; this.breadcrumb_bar.width = this.width; this.tree_menu._x = 0; this.tree_menu._y = this.mask._y; this.tree_menu.width = Stage.width; this.tree_menu.height = this.mask._height; this.volume_control._y = 10; } }