diff --git a/.project b/.project
new file mode 100644
index 0000000..9e4caa9
--- /dev/null
+++ b/.project
@@ -0,0 +1,11 @@
+
+
----------
]]>High School Lessons
---------------------------------------------------------------------------------------------
Lesson 10- How The Industrial Revolution Raised Living Standards
World History: Focus on Economics
The teacher conducts a brief simulation that illustrates how specialization and division of labor and improvements in capital goods increase productivity. The teacher displays a visual that shows other sources of increases in productivity. Students work in groups to find examples of different ways of increasing productivity in a reading about Josiah Wedgwood and the Industrial Revolution and how it affected the pottery industry.
---------------------------------------------------------------------------------------------
Unit 7: Lesson 19 - How Many Children Can Mother Earth Stand?
Economics and the Environment
Population statistics are introduced to students, presenting examples students can relate to their own lives (living space and family size).
View more High School lessons >>
Middle School Lessons
---------------------------------------------------------------------------------------------
Lesson 8 - Ideas That Changed the World
Middle School World Geography: Focus on Economics
In this lesson, the students learn about productivity and its connection to the standard of living. They learn about inventions that changed the world. The students make predictions about recent inventions and the impact of these inventions on productivity, standard of living and quality of life.
View more Middle School lessons >>
Elementary Lessons
---------------------------------------------------------------------------------------------
Unit 3: Lesson 9 - What Results When People Use Improved Physical Capital Resources?
Choices & Changes: In Life, School, & Work - Grades 5-6 - Teacher's Resource Manual
Students learn that using technologies increase production during a business simulation.
View more Elementary lessons >>
Tip #1
One way to show how technology improves productivity is to solve simple math problems with and without a calculator. Give the students 10 math problems and have them solve the problems without a calculator. Then give the students 10 more problems and let them use a calculator. In both cases, have the students keep track of the time it took and their accuracy. How did technology improve productivity?
---------------------------------------------------------------------------------------------
Tip #2
Many people incorrectly believe that technology increases unemployment. This is known as the lump of labor fallacy. In fact, technology creates jobs and increases a nation's standard of living. Of course, other jobs are lost, but overall employment increases. In 1900, 20,000,000 people were employed. Today over 130,000,000 people are employed. How many new jobs were created in the automobile, plastics, airplane, television, computer, medical and electronics industries because of improved technologies?
---------------------------------------------------------------------------------------------
]]>This is a line of text. " + + "This line of text is colored blue.
"; + */ + + /************************************************************************************* + * FUNCTIONS: SHOW THE CURRENT SELECTED CONCEPT IN LESSON PAGE + ************************************************************************************/ + public function showConceptView(event: TextEvent): void { + var id: int = new int(event.text); + //trace("---SHOW CONCEPT VIEW = " + id); + gotoConceptLessons(retrieveConceptItem(id)); + } + + /************************************************************************************* + * FUNCTION: RETRIEVE CONCEPT ITEM + ************************************************************************************/ + private function retrieveConceptItem(_theid: int): ConceptItem { + var myobj: ConceptItem; + var myArr: Array = catList[activeCat].conceptArray; + for (var i = 0; i < myArr.length; i++) { + if (myArr[i].conceptID == _theid) { + myobj = myArr[i]; + } + } + return myobj; + } + + /************************************************************************************* + * FUNCTIONS: GO TO CONCEPT VIEW + ************************************************************************************/ + public function gotoConceptView(id: Number) { + if (id) { + currentConcept = id; + } + var item: ConceptItem = catList[this.activeCat]; + //conceptCopy_txt.htmlText = ""+ item.@name+"
" + ""+definition+"
" ; } } } return item_str; } /************************************************************************************* * FUNCTIONS:GET FULL GLOSSARY TERMS ************************************************************************************/ public function getFullGlossary( ):XMLList { var item:XML; var full_str:String = ""; for each(item in glossXmlList) { var definition:String = item.def; full_str += ""+ item.@name+"
" + ""+definition+"
" ; } //return full_str; //<--Original - Test HMD 2/1/11 Now send full list back return glossXmlList; } /************************************************************************************* * FUNCTION: PRINT GLOSSARY TERMS ************************************************************************************/ private function printGlossary(ev:MouseEvent):void { /////////////////////////////// // this.glossary_mc.terms_txt.htmlText= ""; } } // Main class } //end package /* //////////////////////////BACKUP////////////////////////////////// public function defineGlossaryTerm( str:String ):String{ var item_str:String; if(str!=null) { var item:XML; for each(item in glossXmlList) { if( item.@name == str ){ //this.glossary_mc.terms_txt.htmlText= item; //WORK //this.glossary_mc.terms_txt.htmlText= item.toXMLString(); //ALSO WORK var definition:String = item.def; //definition = definition.replace(""+ item.@name+"
" + ""+definition+"
" ; } } } return item_str; } */ \ No newline at end of file diff --git a/com/digitec/cee/HCustomEvent.as b/com/digitec/cee/HCustomEvent.as new file mode 100644 index 0000000..f7e7e14 --- /dev/null +++ b/com/digitec/cee/HCustomEvent.as @@ -0,0 +1,28 @@ +package com.digitec.cee { + import flash.events.Event; + + /** + * ... + * @author hDady + */ + + public class HCustomEvent extends Event { + public static const ADD_GLOSSARY:String = "addGlossary"; + + private var _data:Object; + + public function HCustomEvent(type:String, data:Object = null, bubbles:Boolean=true, cancelable:Boolean=false) { + super(type, bubbles, cancelable); + this.data = data; + } + + + public function get data():Object { return _data; } + + public function set data(value:Object):void { + _data = value; + } + + } + +} \ No newline at end of file diff --git a/com/digitec/cee/HTMLContentTables.as b/com/digitec/cee/HTMLContentTables.as new file mode 100644 index 0000000..db02a29 --- /dev/null +++ b/com/digitec/cee/HTMLContentTables.as @@ -0,0 +1,96 @@ +/*********************************************************** * @author Maria A. Zamora * @company Digitec Interactive Inc. * @version 0.1 * @date 1/19/2011 * *HTMLContentTables class for conceptsFrame3 movie of the CEE application * CS5 version of com.digitec.cee.HTMLContentTables **********************************************************/ +package com.digitec.cee { + import flash.net.URLLoader; + import flash.net.URLRequest; + import flash.events.*; + import flash.text.StyleSheet; + import flash.net.NetConnection; + import flash.net.NetStream; + import flash.errors.IllegalOperationError; + + + public class HTMLContentTables { + private var htmlXmlList: XMLList; + private var XML_PATH: String = MainConstants.PUBLICATION_HTML; //private var XML_PATH:String = "data/publicationsHTML.xml" //MainConstants.PUBLICATION_HTML; // //private var CSS_PATH:String ="data/glossary.css";// MainConstants.CSS_GLOSSARY_FULLPATH; // //private var pubHTMLarr:Array; //ARRAY THAT CONTAINS ALL THE TABLE OF COTENT HTML IFOR EACH PUBLICATION ISBN //private var htmlTableArr:Array = new Array(); //Array of HTMLtable elements + private var dwpassstate: String; //private var tableContent:String; + private var $nc: NetConnection; + private var $ns: NetStream; + private var $streampath: String; + private var $streamurl: String = MainConstants.CEE_SERVER; + private var dwpasspub: String; + private var dwpasspubpath: String; + public function HTMLContentTables(filePath: String, passpath) { + dwpasspubpath = passpath; + loadHTML(filePath); + } + /*********************************************************************************** * FUNCTION: LOAD HTML ***********************************************************************************/ + private function loadHTML(filepath: String): void { + trace("filepath " + filepath); + dwpassstate = filepath; + var dwpasstemp = MainConstants.XMLPATH + dwpassstate; //trace("dwpassstate "+dwpassstate); + var streamtemp = $streamurl + dwpassstate; + var htmlLoadertemp: URLLoader = new URLLoader(); + htmlLoadertemp.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandlerHTML); + htmlLoadertemp.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); + var htmlUrltemp: URLRequest = new URLRequest(streamtemp); + htmlLoadertemp.load(htmlUrltemp); + } + private function ioErrorHandler(event: IOErrorEvent): void { + trace("ioErrorHandler: " + event); + } + private function httpStatusHandlerHTML(event: HTTPStatusEvent): void { + trace("httpStatusHandler: -----------------------------------" + event); + trace("status: " + event.status); + if (event.status == 0) { //var vidpicpath = Object(parent).getDpath(); + trace("local"); + trace(dwpasspubpath + MainConstants.XMLPATH + dwpassstate); //loadHTML2(vidpicpath+ "_VE4DATA/"+MainConstants.XMLPATH + dwpassstate); + loadHTML2(dwpasspubpath + MainConstants.XMLPATH + dwpassstate); + } else { + trace("internet"); + + loadHTML2(MainConstants.CEE_SERVER + dwpassstate); + + + } //loadLibraryFinal(MainConstants.XMLPATH + dwpasspub); + } + private function loadHTML2(filepath: String): void { + trace("filepath pb " + filepath); + + var htmlUrl: URLRequest = new URLRequest(filepath); + var htmlLoader: URLLoader = new URLLoader(); + + htmlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); + + htmlLoader.load(htmlUrl); + htmlLoader.addEventListener(Event.COMPLETE, htmlLoaded); + + function htmlLoaded(e: Event): void { + var _xml: XML = new XML(htmlLoader.data); + htmlXmlList = new XMLList(_xml.tablecontent); + } + } + /*********************************************************************************** * FUNCTION: USE PUB ISBN TO EXTRACT TABLE CONTENT FROM HTML ***********************************************************************************/ + private function $securityErrorHandler(_e: NetStatusEvent): void { + trace('$securityErrorHandler'); + } + private function $asyncErrorHandler(_e: AsyncErrorEvent): void { + trace('$asyncErrorEvent'); + } + public function getTableContentFromHTML(_isbn: String): String { + var item_str: String; //trace("_isbn"+_isbn); + if (_isbn != null) { + var item: XML; + for each(item in htmlXmlList) { //trace("item.isbn"+item.isbn); + if (item.isbn == _isbn) { + var tablecontent: String = item.ptable; //trace(item.ptable); + item_str = "" + tablecontent + "
"; + } + } + } + return item_str; + } + } // Main class +} //end package // var re:RegExp = /,/g; // var results:Array = str.split(re); +/* var matchPub:RegExp =/"+ conItem.conceptName+ "
\n"; + str += "\n"; + //str += ""+ item.desc+"
"; + //btnAnswerId_arr[index] = _answers[index].AnswerId;////////////////////////////////////////////////////Id asssociated with the button (answer) + //btnAnswerTxt_arr[index] = _answers[index].Answer; + //trace( "btnAnswerId_arr[index]=========="+ btnAnswerId_arr[index] ); + //trace( "btnAnswerId_arr[index]=========="+ btnAnswerTxt_arr[index] ); + + //previousAnswerTextFields_arr.push(questionField);//////////////////////////////////////// + + + //this["textBckg_" + lettersArr[index] ].answer_txt.text = _answers[index]; + } + currentQuestionTxt = currentQuestionTxt + "" + e.data.titleText + "
" + e.data.contentText + "
"+ item.@title+"
" + ""+definition+"
" ; + full_str += ""+ item.@title+"
" + ""+definition+"
" ; + } + return full_str; + } + + /************************************************************************************* + * FUNCTION: PRINT PUBLICATION + ************************************************************************************/ + private function printPublication(ev:MouseEvent):void + { + // this.glossary_mc.terms_txt.htmlText= ""; + } + + + } // Main class + +} //end package + + + +/* +//////////////////////////BACKUP////////////////////////////////// +public function defineGlossaryTerm( str:String ):String{ + var item_str:String; + if(str!=null) { + var item:XML; + for each(item in glossXmlList) { + if( item.@name == str ){ + //this.glossary_mc.terms_txt.htmlText= item; //WORK + //this.glossary_mc.terms_txt.htmlText= item.toXMLString(); //ALSO WORK + var definition:String = item.def; + //definition = definition.replace(""+ item.@name+"
" + ""+definition+"
" ; + } + } + } return item_str; +} +*/ + + + + + + + diff --git a/com/digitec/cee/PublicationItem.as b/com/digitec/cee/PublicationItem.as new file mode 100644 index 0000000..30ad96c --- /dev/null +++ b/com/digitec/cee/PublicationItem.as @@ -0,0 +1,127 @@ +/*********************************************************** + * @author Maria A. Zamora + * @company Digitec Interactive Inc. + * @version 0.1 + * @date 1/14/2011 + * + *PublicationItem class for conceptsFrame3 movie of the CEE application + * CS5 version of com.digitec.cee.PublicationItem +**********************************************************/ +package com.digitec.cee +{ + public class PublicationItem + { + //PUBS + private var _id:String = ""; + private var _type:String = ""; + private var _lang:String = ""; + private var _isbn:String = ""; + private var _title:String = ""; + private var _parentof:String = ""; + private var _childof:String = ""; + private var _gradedisplay:String = ""; + private var _gradelevel:String = ""; + private var _desc:String = ""; + private var _img:String = ""; + private var _storeurl:String = ""; + + private var familyArr:Array = new Array(); + + public function PublicationItem( _xml:XML ) + { + if( _xml.@id ){ _id =_xml.@id.toString();} + if( _xml.@pubtype ){ _type = _xml.@pubtype.toString();} + if(_xml.@_lang ){ _lang = _xml.@lang.toString();} + if(_xml.@_isbn != null ){ _isbn = _xml.@isbn.toString();} + if( _xml.title != null ){ _title = _xml.title.toString();} + if( _xml.parentof ){ _parentof = _xml.parentof.toString();} + if( _xml.childof ){ _childof =_xml.childof.toString(); } + if( _xml.gradedisplay ){ _gradedisplay = _xml.gradedisplay.toString();} + if( _xml.gradelevel ){ _gradelevel = _xml.gradelevel.toString(); } + if( _xml.desc != null ){ _desc = _xml.desc.toString(); } + if( _xml.img ){ _img = _xml.img.toString();} + if( _xml.storeurl ){ _storeurl = _xml.storeurl.toString();} + } + + + /******************************************************************* + * GET FUNCTIONS + *******************************************************************/ + public function get pid():String{ return _id; } + + public function get ptype():String { return _type; } + + public function get plang():String{ return _lang; } + + public function get isbn():String { return _isbn; } + + public function get ptitle():String { return _title; } + + public function get parentof():String { return _parentof; } + + public function get childof():String { return _childof; } + + public function get gradedisplay():String{ return _gradedisplay; } + + public function get gradelevel():String{ return _gradelevel; } + + public function get desc():String { return _desc; } + + public function get img():String { return _img; } + + public function get storeurl():String { return _storeurl; } + + + } // Main class + +} //end package + + + +/************************************************************************************************************************** XML STRUCTURE + + +" + pub.ptitle + "
"; + pubtitle_txt.setTextFormat(title_format4); + pubtitle_txt.embedFonts = true; + //pubtitle_txt.embedFonts = true; + + isbn_txt.text = "The current document is from:"; + //isbn_txt.embedFonts = true; + isbn_txt.setTextFormat(title_format4); + + //CHANGE FONT TO SIZE 16 if string length < 72 characters else size 12 + /* + title_format = title_tf.getTextFormat(); + title_tf2.text=""; + title_format.size = 32; + title_format.bold = false; + title_tf.text = "Table of Contents"; + title_tf.setTextFormat(title_format); + title_tf.embedFonts = true; + */ + var str: String = "" + lessonitem.title; + + title_format = title_tf.getTextFormat(); + title_format.size = 32; + title_format.bold = false; + title_tf.text = ""; + title_tf.text = "Lesson Details"; //""+ lessonitem.title; //Table of Contents + title_tf.setTextFormat(title_format); + title_tf.embedFonts = true; + //CHECK FOR RELATED DOCUMENTS + var str_block1: String = ""; + + if (lessonitem.altversions == "" || lessonitem.altversions == null) { + this_tf.text = ""; + } else { + trace("lessonitem.altversions" + lessonitem.altversions); + str_block1 = ""; + this_tf.text = ""; + + this_tf.text = "Related Documents:"; + trace("related docs"); + try { + trace("error 1"); + //var altVersionArr:Array = HelperFunctions.getArrayAltVersion(lessonitem.altversions);// return array of strings= "Teacher - Lesson 11,15898" + + var altVersionArr: Array = getArrayAltVersion(lessonitem.altversions); + trace("altVersionArr.length======" + altVersionArr.length); + trace("altVersionArr " + altVersionArr); + for (var a: int = 0; a < altVersionArr.length; a++) { + var arr: Array = HelperFunctions.getArrayCommaDelimeter(altVersionArr[a]); // return array of 2= [0] = "Teacher - Lesson 11" [1] = "15898" + //var arr:Array = getArrayCommaDelimeter( altVersionArr[a] ); + var lessonid: String = arr[1]; + str_block1 += ""; + + + } + } catch (e: Error) { + trace(e.message); + } + //" + descript + "
" + "" + table + "
"; + // + pubTextArea.addEventListener(TextEvent.LINK, linkListener); + if (table == null) { + pubTextArea.htmlText = "Can't load data!!!!!"; + } else { + pubTextArea.htmlText = tableContent; + } + + //CHANGE FONT TO SIZE 32 + title_format = title_tf.getTextFormat(); + title_tf2.text = ""; + title_format.size = 32; + title_format.bold = false; + title_tf.text = "Table of Contents"; + title_tf.setTextFormat(title_format); + title_tf.embedFonts = true; + + + //POSITION THE TEXT FIELDS + isbn_txt.x = 12; + isbn_txt.y = 233; + pubtitle_txt.htmlText = "" + orderArray[0].ptitle + "
"; + isbn_txt.text = orderArray[0].isbn; + + //this_tf.text = "This publication is part of a set that includes:"; + this_tf.text = ""; + + //GET THE THUMB IMAGE + var pubThumb: String = orderArray[0].img; + var storeLink: String = orderArray[0].storeurl; + setThumbPub(pubThumb, storeLink); + + //CLEAN THE BLOCK OF TEXT + blocktxt_1.htmlText = ""; + blocktxt_2.htmlText = ""; + + //MOVE TEXT FIELD BLOCKS + blocktxt_1.y = 300; + blocktxt_2.y = 375; + title_format5 = new TextFormat(); + title_format5.font = myFont.fontName; + trace("orderArray.length+++++++++++++++++++++++++" + orderArray.length); + trace(orderArray[0].ptitle); + if (orderArray.length == 2) { + this_tf.text = "This publication is part of a set that includes:"; + blocktxt_1.htmlText = ""; + blocktxt_1.setTextFormat(title_format5); + blocktxt_1.embedFonts = true; + //blocktxt_1.embedFonts = true; + } + if (orderArray.length == 3) { + this_tf.text = "This publication is part of a set that includes:"; + blocktxt_1.htmlText = ""; + blocktxt_1.setTextFormat(title_format5); + blocktxt_1.embedFonts = true; + //blocktxt_1.embedFonts = true; + blocktxt_2.htmlText = ""; + blocktxt_2.setTextFormat(title_format5); + blocktxt_2.embedFonts = true; + } + vScrollBar2.visible = true; + vScrollBar2.update(); + } + + + /************************************************************************************* + * FUNCTIONS: EVENT HANDLER FOR TEXT LINKS IN "Click here to view the table of contents for this publication" + ************************************************************************************/ + private function linkEvent(e: TextEvent): void { + var linkContent: Array = e.text.split(","); + var functionName: String = linkContent[0]; + var args: String = linkContent[1]; + trace(args); + switch (functionName) { + case "viewTable": + trace("go table"); + // try{ + // htmlTable = Object(parent).getContentTable(); + //} catch(e:Error) { trace(e.message); } + //trace(orderArray[0].pid); + //var lessonId:String = lessonItem.id; + //Object(parent).setLastPDFlessonId2(lessonItem.id, isBrowsingByLessons); + internaljump = true; + trace("reading arguments= " + args); + displayPublication(args); + break; + case "changePub": + itemClick = orderArray[args]; + trace("itemClick " + orderArray[0].pid); + + orderArray[args] = orderArray[0]; + orderArray[0] = itemClick; + //setLastPubId + internaljump = true; + populate(); + break; + case "viewLesson": + trace("go lesson"); + // Object(parent).setLastPubId2(orderArray[0].pid, isBrowsingByLessons); + this.viewLesson(args); + break; + default: + trace("function not found"); + } + } + + /************************************************************************************* + * FUNCTIONS:VIEW LESSONS + ************************************************************************************/ + private function viewLesson(str: String): void { + trace(str); + if (str != null) { + //var lessonitem:LessonItem = getLessonPerId( id ); + //pdfFile = lessonitem.pdf_url; + removePDF(); + trace("did this trigger"); + Object(parent).setLastPDFlessonId(str, isBrowsingByLessons); //remember last pdf + Object(parent).setPDFLesson(str, isBrowsingByLessons); + + } + } + + + private function setThumbPub(img: String, url: String): void { + //SET CURRENT PUBLICATION STORE LINK + //1-56183-546-3.jpg //http://ve.ncee.net/store/link.php?isbn=1-56183-546-3 + pubStoreLink = url; + + //LOAD THUMB IMAGE IN HOLDER + var vidpicpath = Object(parent).getDpath(); + var urlThumb: String = "" + vidpicpath + "_VE50DATA/" + thumbPath + img; + var fl_Loader: Loader = new Loader(); + fl_Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete); + fl_Loader.load(new URLRequest(urlThumb)); + + //thumbHolder.addChild(fl_Loader); + } + private function loadProdComplete(e: Event): void { + var bit: Bitmap = e.target.content; + if (bit != null) { + bit.smoothing = true; + bit.width = 85; + bit.height = 110; + } + + thumbHolder.addChild(e.target.content); + } + //OPEN CURRENT PUBLICATION STORE LINK WHEN CLICK NCEE STORE BUTTON + private function ClickToOpenStoreLink(event: MouseEvent): void { + //if(pubStoreLink != null) { + navigateToURL(new URLRequest(pubStoreLink), "_blank"); + } + + /******************************************************************* + * FUNCTION: TEXT EVENT LISTENER FOR TABLE OF CONTENT + * CHECK FIRST FOR INTERNET CONNECTION, THEN GET DOCUMENT IN THEIR SERVER + * ELSE DISPLAY DOCUMENT LOCALLY + *******************************************************************/ + private function linkListener(e: TextEvent): void { + var linkContent: Array = e.text.split(","); + var operationName: String = linkContent[0]; + var argument: String = linkContent[1]; + + if (operationName == "displayPDF") { + trace("here pdf link"); + //Object(parent).setLastPubId2(orderArray[0].pid, isBrowsingByLessons); + displayPDF(argument); + } + } + + private function displayPDF(args: String): void { + //args = "documents/1-56183-566-8_front.pdf" + + //if(connection to server) load file args from there + //else + trace("stgw2 " + stgw + "stgh2 " + stgh); + var stgw = background_size.width; + var stgh = background_size.height; + var url: String = args.substring(10); //starting in index = 10, ending in args.length + pdfFlag = true; + trace("url ===" + url); + var lessonItem: LessonItem = publication.getLessonItemPerURL(url); + var lessonId: String = lessonItem.id; + //Object(parent).setPDFLesson(lessonId); + //new Feb25 maz + /* + if (pdfFlag==true){ + removePDF(); + }*/ + Object(parent).setPDFLesson(lessonId, isBrowsingByLessons); + Object(parent).setLastPDFlessonId(lessonId, isBrowsingByLessons); //remember last pdf + } + + + + /********************************************************************************** DISPLAY*****************************************************************************************************/ + /******************************************************************* + * FUNCTION:REMOVE PDF + *******************************************************************/ + + private function removePDF() { + trace("go click"); + //trace("pdfFlag"+pdfFlag); + if (pdfFlag) { + pdfFlag = false; + + //pdfholder.viewPDF.removeEventListener(); + //pdfholder.savePDF.removeEventListener(); + removeChild(pdfholder); + } + } + public function openPDFExternal(evt: MouseEvent): void { + var myPDF: File = new File(pdfFullPathLink); + //myPDF=myPDF.url(pdfFullPathLink); + trace("myTrainingFile.exists = " + myPDF.exists); // true + try { + myPDF.openWithDefaultApplication(); + } catch (e: Error) { + trace(e.message); + } + } + public function savePDFExternal(evt: MouseEvent): void { + var myPDF: File = new File(pdfFullPathLink); + //myPDF=myPDF.url(pdfFullPathLink); + // trace("myTrainingFile.exists = "+myPDF.exists); // true + try { + myPDF.browseForSave("Save As"); + myPDF.addEventListener(Event.SELECT, saveData); + } catch (e: Error) { + trace(e.message); + } + } + function saveData(event: Event): void { + trace(event.target); + var newFile: File = event.target as File; + var sourceFile: File = new File(pdfFullPathLink); + try { + sourceFile.copyTo(newFile, true); + } catch (error: Error) { + trace("Error:", error.message); + } + // var str:String = "Hello."; + // if (!newFile.exists) + // { + // var stream:FileStream = new FileStream(); + // stream.open(newFile, FileMode.WRITE); + // stream.writeUTFBytes(str); + // stream.close(); + // } + } + //OVERRIDE FUNCTIONS + override public function gotoLastFrm(evt: MouseEvent): void { + trace("go click 1"); + + dwstoproll = 0; + Object(parent).gotoLastPage(); + } + override public function gotoHomeFrm(evt: MouseEvent): void { + trace("go click 2"); + + dwstoproll = 0; + Object(parent).gotoPage(HOMEPAGE); + } + override public function gotoAboutFrm(evt: MouseEvent): void { + trace("go click 3"); + + dwstoproll = 0; + Object(parent).gotoPage(ABOUT); + } + override public function gotoConceptsFrm(evt: MouseEvent): void { + trace("go click 4"); + + dwstoproll = 0; + Object(parent).gotoPage(CONCEPTS); + } + override public function gotoSearchFrm(evt: MouseEvent): void { + trace("go click 5"); + + dwstoproll = 0; + Object(parent).gotoPage(SEARCH); + } + + + /******************************************************************* + * FUNCTIONS: SET UP ALL BUTTONS AND TEXTFIELDS + *******************************************************************/ + private function setup(): void { + var stgw = background_size.width; + var stgh = background_size.height; + trace("stgw " + stgw + "stgh " + stgh); + + this.close_button.buttonMode = true; + this.close_button.mouseChildren = false; + this.close_button.useHandCursor = true; + /* + this.about_button.buttonMode = true; + this.about_button.mouseChildren = false; + this.about_button.useHandCursor = true; + */ + this.close_button.addEventListener(MouseEvent.MOUSE_OVER, onCloseOver); + this.close_button.addEventListener(MouseEvent.MOUSE_OUT, onCloseOut); + this.close_button.addEventListener(MouseEvent.CLICK, onCloseClick); + + //this.about_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoAboutFrm); + this.about2_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoAboutFrm); + this.nav_back_button.addEventListener(MouseEvent.MOUSE_OVER, onNavBackOver); + this.nav_back_button.addEventListener(MouseEvent.MOUSE_OUT, onNavBackOut); + this.nav_back_button.addEventListener(MouseEvent.CLICK, gotoLastFrm); + + this.nav_home_button.addEventListener(MouseEvent.MOUSE_OVER, onNavHomeOver); + this.nav_home_button.addEventListener(MouseEvent.MOUSE_OUT, onNavHomeOut); + this.nav_home_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoHomeFrm); + + this.nav_concepts_button.addEventListener(MouseEvent.MOUSE_OVER, onNavConceptsOver); + this.nav_concepts_button.addEventListener(MouseEvent.MOUSE_OUT, onNavConceptsOut); + this.nav_concepts_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoConceptsFrm); + + this.nav_lessons_button.addEventListener(MouseEvent.MOUSE_OVER, onNavLessonsOver); + this.nav_lessons_button.addEventListener(MouseEvent.MOUSE_OUT, onNavLessonsOut); + this.nav_lessons_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoSearchFrm); + } + + + /******************************************************************* + * FUNCTIONS: BUTTONS ROLL OVER & OUT + *******************************************************************/ + private function onCloseOver(evt: MouseEvent): void { + this.close_button.gotoAndStop(2); + } + private function onCloseOut(evt: MouseEvent): void { + this.close_button.gotoAndStop(1); + } + private function onNavBackOver(evt: MouseEvent): void { + this.back_icon_roll.gotoAndStop(2); + } + private function onNavBackOut(evt: MouseEvent): void { + this.back_icon_roll.gotoAndStop(1); + } + private function onNavHomeOver(evt: MouseEvent): void { + this.house_mc.gotoAndStop(2); + } + private function onNavHomeOut(evt: MouseEvent): void { + this.house_mc.gotoAndStop(1); + } + private function onNavConceptsOver(evt: MouseEvent): void { + if (dwstoproll != 2) { + this.nav_concepts_roll.gotoAndStop(2); + } + } + private function onNavConceptsOut(evt: MouseEvent): void { + if (dwstoproll != 2) { + this.nav_concepts_roll.gotoAndStop(1); + } + } + private function onNavLessonsOver(evt: MouseEvent): void { + if (dwstoproll != 1) { + this.nav_lessons_roll.gotoAndStop(2); + } + } + private function onNavLessonsOut(evt: MouseEvent): void { + if (dwstoproll != 1) { + this.nav_lessons_roll.gotoAndStop(1); + } + } + + + } // Main class + +} //end package \ No newline at end of file diff --git a/com/digitec/cee/Question.as b/com/digitec/cee/Question.as new file mode 100644 index 0000000..3182a08 --- /dev/null +++ b/com/digitec/cee/Question.as @@ -0,0 +1,192 @@ +/************************************************************************************* + * @author Maria A. Zamora + * @company Digitec Interactive Inc. + * @version 0.1 + * @date 12/23/2010 + * + * This is the Question class for the CEE application + * CS5 version of com.digitec.cee.Question + * + * An example of the XML used is displayed it at the end of this file +******************************************************************************************/ +package com.digitec.cee +{ + import flash.display.MovieClip; + import flash.display.Sprite; + + + public class Question + { + private var question_str:String; + private var correctAnswer_str:String; + private var correctFeedback_str:String; + private var incorrectFeedback_str:String; + private var incorrectAnswers_arr:Array; + private var allAnswers_arr:Array; + private var posCorrectAnswer:int; + private var answersRandom:Boolean; + private var num_answers:int; + private var num_incorrect_answers:int; + + private var questionId:String; + private var correctAnswerId:String; + private var incorrectAnswersId_arr:Array = new Array(); + //private var allAnswersId_arr:Array; + + public function Question( _xml:XML, maxAnswers:int ) + { + // trace(_xml); + // WANT ANSWERS IN RANDOM ORDER? + if( _xml.random_answers.toString() == "true" || _xml.random_answers.toString() == "yes" ) { answersRandom = true; } + else{ answersRandom = false; } + + //GET THE QUESTION FROM XML PIECE + question_str = _xml.question.toString(); + questionId = _xml.question.@id; //////////////////////////////////////// + trace( "_xml.question.@id xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ _xml.question.@id); + + //GET CORRECT ANSWER AND FEEDBACK STRINGS FROM XML PIECE + correctAnswer_str = _xml.correct_answer.toString(); + correctAnswerId = _xml.correct_answer.@id; /////////////////////////////////////////////// + trace( "_xml.correct_answer.@id xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ _xml.correct_answer.@id); + + correctFeedback_str = _xml.correct_question_fb.toString(); + incorrectFeedback_str = _xml.incorrect_question_fb.toString(); + + //GET THE ANSWERS FOR THE answer NODES IN THE XML + //INCORRECT + 1 (CORRECT) HAVE TO BE <= ANSWER DISPLAY OBJECTS + num_incorrect_answers = _xml.elements("answer").length(); + + //SET INCORRECT ANSWERS TO A MAX OF 4 + if( num_incorrect_answers > maxAnswers - 1) { num_incorrect_answers = maxAnswers - 1; } + + //CREATE AN ARRAY WITH THE INCORRECT ANSWERS + //trace("incorrectAnswers_arr[i] = " + incorrectAnswers_arr[i] ); + incorrectAnswers_arr = new Array(); + for( var i:int=0; i < num_incorrect_answers; i++ ) + { + //trace(_xml.answer[i].@id.toString()); + incorrectAnswers_arr[i] = _xml.answer[i].toString(); + incorrectAnswersId_arr[i] = _xml.answer[i].@id; ///////////////////////////////////// + trace( "" ); + //incorrectAnswers_arr[i].push(_xml.answer[i].toString()); + //incorrectAnswersId_arr[i].push(_xml.answer[i].@id); + } + + //CREATE AN ARRAY WITH CORRECT & INCORRECT ANSWERS + allAnswers_arr = createAllAnswerArray(); + } + + /******************************************************************* + * SET FUNCTIONS + *******************************************************************/ + public function set correctAnswer( correctAnswer:String ):void{ correctAnswer_str = correctAnswer; } + + public function set incorrectAnswers( incorrectAnswers:Array ):void { incorrectAnswers_arr =incorrectAnswers; } + + public function set correctFeedback( correct:String ):void { correctFeedback_str =correct; } + + public function set incorrectFeedback( incorrect:String ):void { incorrectFeedback_str =incorrect; } + + + /******************************************************************* + * GET FUNCTIONS + *******************************************************************/ + public function get question():String{ return question_str; } + + public function get thequestionId():String{ return questionId; } + + public function get correctAnswer():String{ return correctAnswer_str; } + + public function get correctFeedback():String { return correctFeedback_str; } + + public function get incorrectFeedback():String { return incorrectFeedback_str; } + + public function get incorrectAnswers():Array { return incorrectAnswers_arr; } + + //for(var i:int = 0; i< allAnswers_arr.length; i++){trace("allAnswers_arr = " + allAnswers_arr[i]);} + public function get answers():Array { return allAnswers_arr; } + + public function get correctAnswerPosition():int { return posCorrectAnswer; } + + + /******************************************************************* + * FUNCTIONCREATE AN ARRAY WITH CORRECT & INCORRECT ANSWERS + * AND RETURN THE POSITION OF THE CORRECT ANSWER + *******************************************************************/ + private function createAllAnswerArray():Array + { + //CREATE ANSWER ARRAY PUSHING CORRECT ANSWER + //IN LAST ARRAY POSITION + allAnswers_arr = new Array(); + for(var i:int=0; i < incorrectAnswers_arr.length; i++) + { + allAnswers_arr.push( {Answer:incorrectAnswers_arr[i].toString(), AnswerId:incorrectAnswersId_arr[i].toString() } ); + //allAnswersId_arr.push( incorrectAnswersId_arr[i] );///////////////////////////////////////////////////////////// + } + //allAnswers_arr = incorrectAnswers_arr; + //allAnswersId_arr = incorrectAnswersId_arr; ///////////////////////////////////////////////////////////// + + allAnswers_arr.push({ Answer:correctAnswer_str.toString(), AnswerId:correctAnswerId.toString() }); + //allAnswersId_arr.push(correctAnswerId_str.toString()); + + posCorrectAnswer = allAnswers_arr.length - 1; + + //IF WANT ANSWERS IN RANDOM ORDER + if(answersRandom == true) { allAnswers_arr = randomAnswers( allAnswers_arr ); } + //else { posCorrectAnswer = allAnswers_arr.length - 1; } + + return allAnswers_arr; + } + + + + /******************************************************************* + * FUNCTION RETURNS ALL ANSWERS ARRAY & PLACE + * CORRECT ANSWER IN RANDOM POSITION + *******************************************************************/ + private function randomAnswers( answers_arr:Array):Array + { + if(allAnswers_arr != null) + { + //var randomInt:int = Math.floor(Math.random()*(allAnswers_arr.length+1)); + var randomInt:int = Math.floor(Math.random()*(allAnswers_arr.length)); + var temp:Object = allAnswers_arr[randomInt]; + //put correct answer in random pos + allAnswers_arr[randomInt] = allAnswers_arr[posCorrectAnswer]; + //put temp in old correct position + allAnswers_arr[posCorrectAnswer] = temp; + //new array position of correct answer + posCorrectAnswer = randomInt; + } + return allAnswers_arr; + } + + + } // Main class + +} //end package + + +/******************************************************************* +* PART OF XML FILE EXAMPLE +*******************************************************************/ +/***************************************************************************************************** +"+ item.desc+"
"; btnAnswerId_arr[index] = _answers[index].AnswerId;////////////////////////////////////////////////////Id asssociated with the button (answer) btnAnswerTxt_arr[index] = _answers[index].Answer; trace( "btnAnswerId_arr[index]=========="+ btnAnswerId_arr[index] ); trace( "btnAnswerId_arr[index]=========="+ btnAnswerTxt_arr[index] ); this["textBckg_" + lettersArr[index] ].addChild(questionField); previousAnswerTextFields_arr.push(questionField);//////////////////////////////////////// this["textBckg_" + lettersArr[index] ].visible = true; //this["textBckg_" + lettersArr[index] ].answer_txt.text = _answers[index]; } currCorrectAnswer = _questionObj.correctAnswerPosition; currCorrectAnswerText = _questionObj.correctAnswer; } //FUNCTION TO POPULATE THE ARRAY OF RESPONSE THAT WILL BE SEND IT TO SERVER //THIS ARRAY CONTAINS AN OBJECT OF STRING PAIRS FOR QUESTION ID AND THE SELECTED ANSWER ID private function populateResponseArray():void { questionIdObj_arr.push({QuestionId:currentQuestionId, AnswerId:btnAnswerId_arr[currSelectedAnswer]});////////////////////////////////////////// questionAnsObj_arr.push({question_str:currentQuestionTxt,AnswerTxt:btnAnswerTxt_arr[currSelectedAnswer],correctAnswer_str:currCorrectAnswerText}); trace("QuestionId========="+currentQuestionId+", AnswerId========"+btnAnswerId_arr[currSelectedAnswer] ); trace("QuestionId========="+question_txt.text+", AnswerId========"+btnAnswerTxt_arr[currSelectedAnswer] ); } /******************************************************************* * FUNCTION: SET QUESTION- 1ST TIME SCREEN 2 *******************************************************************/ private function startQuiz(evt:MouseEvent):void { this.gotoAndStop(2); //SET BUTTONS DISPLAY PROPERTIES trace("lettersArr "+lettersArr); trace(lettersArr.length); for(var letter:int=0; letter"+ item.desc+"
"; + btnAnswerId_arr[index] = _answers[index].AnswerId;////////////////////////////////////////////////////Id asssociated with the button (answer) + btnAnswerTxt_arr[index] = _answers[index].Answer; + trace( "btnAnswerId_arr[index]=========="+ btnAnswerId_arr[index] ); + trace( "btnAnswerId_arr[index]=========="+ btnAnswerTxt_arr[index] ); + this["textBckg_" + lettersArr[index] ].addChild(questionField); + previousAnswerTextFields_arr.push(questionField);//////////////////////////////////////// + + this["textBckg_" + lettersArr[index] ].visible = true; + //this["textBckg_" + lettersArr[index] ].answer_txt.text = _answers[index]; + } + + currCorrectAnswer = _questionObj.correctAnswerPosition; + currCorrectAnswerText = _questionObj.correctAnswer; + } + + + //FUNCTION TO POPULATE THE ARRAY OF RESPONSE THAT WILL BE SEND IT TO SERVER + //THIS ARRAY CONTAINS AN OBJECT OF STRING PAIRS FOR QUESTION ID AND THE SELECTED ANSWER ID + private function populateResponseArray():void + { + questionIdObj_arr.push({QuestionId:currentQuestionId, AnswerId:btnAnswerId_arr[currSelectedAnswer]});////////////////////////////////////////// + questionAnsObj_arr.push({question_str:currentQuestionTxt,AnswerTxt:btnAnswerTxt_arr[currSelectedAnswer],correctAnswer_str:currCorrectAnswerText}); + trace("QuestionId========="+currentQuestionId+", AnswerId========"+btnAnswerId_arr[currSelectedAnswer] ); + trace("QuestionId========="+question_txt.text+", AnswerId========"+btnAnswerTxt_arr[currSelectedAnswer] ); + + } + + /******************************************************************* + * FUNCTION: SET QUESTION- 1ST TIME SCREEN 2 + *******************************************************************/ + private function startQuiz(evt:MouseEvent):void + { + this.gotoAndStop(2); + + //SET BUTTONS DISPLAY PROPERTIES + trace("lettersArr "+lettersArr); + trace(lettersArr.length); + for(var letter:int=0; letter" + item.desc + "
"; + //rowsArr[i].textHolder.embedFonts = true; + rowsArr[i].textHolder.addEventListener(Event.SCROLL, checkScrl); + //rowsArr[i].textHolder.addEventListener(MouseEvent.MOUSE_WHEEL, checkScrl, true); + function checkScrl(e: Event) { + + e.target.scrollV = 0; + e.stopPropagation(); + } + rowsArr[i].textHolder.setTextFormat(myFormat3); + rowsArr[i].textHolder.embedFonts = true; + rowsArr[i].textHolder.addEventListener(TextEvent.LINK, linkEvent); + rowsArr[i].textHolder.mouseWheelEnabled = false; + rowsArr[i].gradeHolder.htmlText = "" + item.gradedisplay + "
"; + //rowsArr[i].gradeHolder.embedFonts = true; + rowsArr[i].gradeHolder.setTextFormat(myFormat3); + rowsArr[i].gradeHolder.embedFonts = true; + rowsArr[i].pubHolder.htmlText = "" + pubTitle + "
"; + //rowsArr[i].pubHolder.embedFonts = true; + rowsArr[i].pubHolder.setTextFormat(myFormat3); + rowsArr[i].pubHolder.embedFonts = true; + } + } + key_Panel.internetcon_txt.text = internetcontext; + if (internetcontext == "Unable to locate internet connection") { + key_Panel.warningicon.gotoAndStop(2); + } + + key_Panel.numDisplay_txt.text = "displaying " + arr.length + " lessons"; + key_Panel.displayoutline.gotoAndPlay(2); + sp.source = containerKey; + + existsContainerKey = true; + displayCheckboxStatus("key", key_chkboxArr); + //CLEAN FILTERS + loadingmc_clip.play(); + setChildIndex(loadingmc_clip, numChildren - 1); + key_gradeFilterArr = new Array(); + } + /////////////////////////////////////////////////////////////////////////////////////////// + private function populateFind(arr: Array): void { + containerFind = new Sprite(); + var Xpos: int = 0; + var Ypos: int = 0; + //trace("arr populate "+arr); + var rowsArr: Array = new Array(); + for (var i: uint = 0; i < arr.length; i++) { + var item: LessonItem = arr[i]; + //trace(); + //trace("item.display "+item.display); + //trace("item.type "+item.type); + if (item.display == "TRUE" || item.type == "online") { + //trace("make this"); + rowsArr[i] = new RowAreaKeywords(); + rowsArr[i].x = Xpos; + rowsArr[i].y = Ypos; + //key_Panel.containerPub.addChild(key_rowsArr[i] ); + containerFind.addChild(rowsArr[i]); + Ypos += 10 + rowsArr[i].height; + rowsArr[i].textHolder.wordWrap = true; + //rowsArr[i].textHolder.mouseWheelEnabled = false; + var myFormat4: TextFormat = new TextFormat(); + myFormat4.font = myFont1.fontName; + var pubTitle: String; + if (item.type == "online") { + pubTitle = item.source; + } else { + pubTitle = getPublicationTitle(item.publication); + + } + rowsArr[i].textHolder.htmlText = "" + "" + item.desc + "
"; + rowsArr[i].textHolder.addEventListener(Event.SCROLL, checkScrl); + //rowsArr[i].textHolder.addEventListener(MouseEvent.MOUSE_WHEEL, checkScrl, true); + function checkScrl(e: Event) { + + e.target.scrollV = 0; + e.stopPropagation(); + } + rowsArr[i].textHolder.setTextFormat(myFormat4); + rowsArr[i].textHolder.embedFonts = true; + rowsArr[i].textHolder.addEventListener(TextEvent.LINK, linkEvent); + rowsArr[i].textHolder.mouseWheelEnabled = false; + //rowsArr[i].textHolder.embedFonts = true; + // + rowsArr[i].gradeHolder.htmlText = "" + item.gradedisplay + "
"; + //rowsArr[i].gradeHolder.embedFonts = true; + rowsArr[i].gradeHolder.setTextFormat(myFormat4); + rowsArr[i].gradeHolder.embedFonts = true; + rowsArr[i].pubHolder.htmlText = "" + pubTitle + "
"; + //rowsArr[i].pubHolder.embedFonts = true; + rowsArr[i].pubHolder.setTextFormat(myFormat4); + rowsArr[i].pubHolder.embedFonts = true; + } + } + find_Panel.numDisplay_txt.text = "displaying " + arr.length + " lessons"; + + find_Panel.internetcon_txt.text = internetcontext; + if (internetcontext == "Unable to locate internet connection") { + find_Panel.warningicon.gotoAndStop(2); + } + fsp.source = containerFind; + + find_Panel.belowis_txt.text = "" + strBelowis1 + strBelowis2; + + //existsContainerKey = true; + //trace("find_chkboxArr"+find_chkboxArr); + displayCheckboxStatus("find", find_chkboxArr); + //CLEAN FILTERS + loadingmc_clip.play(); + setChildIndex(loadingmc_clip, numChildren - 1); + find_gradeFilterArr = new Array(); + } + + /******************************************************************* + * FUNCTION: CREATE PUBITEMS ARRAYS + *******************************************************************/ + private function tableByPub(): void { + var arr: Array = new Array(); + for (var i: uint = 0; i < pubItemsArray.length; i++) { + var item: PublicationItem = pubItemsArray[i]; + //trace(item.img+" "+item.pid+" "+item.ptitle+" "+item.desc+" "+item.gradelevel); + arr.push({ + Image: item.img, + Id: item.pid, + Title: item.ptitle, + Description: item.desc, + Grade: item.gradelevel + }); + } + populateByPub(arr); + } + + private function populateByPub(arr: Array): void { + + trace("length o'my array " + arr.length); + containerPub = new Sprite(); + var rowsArr: Array = new Array(); + var thumbLoader: Loader; + var Xpos: int = 8; + var Ypos: int = 8; + for (var i: uint = 0; i < arr.length; i++) { + rowsArr[i] = new RowArea(); + + rowsArr[i].x = Xpos; + rowsArr[i].y = Ypos; + + Ypos += 10 + rowsArr[i].height; + //pub_Panel.containerPub.addChild(rowsArr[i] ); + containerPub.addChild(rowsArr[i]); + + var myFormat5: TextFormat = new TextFormat(); + myFormat5.font = myFont1.fontName; + thumbLoader = new Loader(); + thumbLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); + thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete); + var fullpubpath = Object(parent).getDpath(); + thumbLoader.load(new URLRequest(fullpubpath + "_VE50DATA/" + "data/pubs/" + arr[i].Image)); + + rowsArr[i].holder.addChild(thumbLoader); + + + rowsArr[i].textHolder.htmlText = "" + arr[i].Description + "
"; + //rowsArr[i].textHolder.embedFonts = true; + rowsArr[i].textHolder.addEventListener(Event.SCROLL, checkScrl); + //rowsArr[i].textHolder.addEventListener(MouseEvent.MOUSE_WHEEL, checkScrl, true); + function checkScrl(e: Event) { + + e.target.scrollV = 0; + e.stopPropagation(); + } + rowsArr[i].textHolder.setTextFormat(myFormat5); + rowsArr[i].textHolder.embedFonts = true; + rowsArr[i].textHolder.addEventListener(TextEvent.LINK, linkEvent); + rowsArr[i].textHolder.mouseWheelEnabled = false; + rowsArr[i].gradeHolder.htmlText = arr[i].Grade; + //rowsArr[i].gradeHolder.embedFonts = true; + rowsArr[i].gradeHolder.setTextFormat(myFormat5); + rowsArr[i].gradeHolder.embedFonts = true; + } + pub_Panel.numDisplay_txt.text = "displaying " + arr.length + " publications"; + pub_Panel.internetcon_txt.text = internetcontext; + if (internetcontext == "Unable to locate internet connection") { + pub_Panel.warningicon.gotoAndStop(2); + } + pub_Panel.displayoutline.gotoAndPlay(2); + //pub_Panel.addChild(containerPub); + psp.source = containerPub; + displayCheckboxStatus("pub", pub_chkboxArr); + //CLEAN FILTER + if (arr.length > 0) { + loadingmc_clip.play(); + } + setChildIndex(loadingmc_clip, numChildren - 1); + pub_gradeFilterArr = new Array(); + } + private function loadProdComplete(e: Event): void { + var bit: Bitmap = e.target.content; + if (bit != null) { + bit.smoothing = true; + bit.width = 39; + bit.height = 50; + } + } + /******************************************************************* + * FUNCTIONS: EVENT HANDLER FOR LINKS + *******************************************************************/ + private function linkEvent(e: TextEvent): void { + var linkContent: Array = e.text.split(","); + var functionName: String = linkContent[0]; + var args: String = linkContent[1]; + switch (functionName) { + //running code here in the user event to ensure more success with navigateToURL + case "viewLesson": + if (args != null) { + var weburl: String = isLessonOnline(args); + //check for online type + //trace(args); + //trace(weburl); + if (weburl == "") { + Object(parent).setPDFLesson(args, true); //isLessonBrowse type = true + Object(parent).setLastPDFlessonId(args, true); + } else { + try { + navigateToURL(new URLRequest(weburl), "_blank"); + } catch (e: Error) { + trace(e.message); + } + } + } + break; + case "viewPublication": + this.viewPublication(args); + break; + case "findLessonByStandard": + //trace("args state"+args); + this.findLessonByStandard(args); + Object(parent).setLastStateSearch("sstate", args, isBrowsigSearch); + break; + case "gotoWebPage": + this.gotoWebPage(args); + break; + case "loadstandard": + loadStateStandard("standards/" + args); + Object(parent).setLastStateSearch("sstate", "standards/" + args, isBrowsigSearch); + // this.loadStandardd(args); + break; + default: + trace("function not found"); + } + } + + private function viewPublication(str: String): void { + if (str != null) { + Object(parent).setPublicationLesson(str, true); + } + Object(parent).setLastPubId(str, true); + } //isLessonBrowse type = true + + public function findLessonByStandard(str: String): void { + + if (str != null) { + //FIND IN SAME XML CORRELATIONS + var arr: Array = HelperFunctions.getArrayAltVersion(str); + //trace("arr "+arr); + //var checkboxtemparray:Array = []; + //for(var iii:uint = 1; iii < arr.length; iii++){ + //trace("trace array"+arr[iii]); + find_chkboxArr = []; + if (arr[1] == "true") { + find_chkboxArr.push({ + Name: "chk1_mc", + On: true, + Position: "1", + Grades: "K-2" + }); + } else if (arr[1] == "false") { + find_chkboxArr.push({ + Name: "chk1_mc", + On: false, + Position: "1", + Grades: "K-2" + }); + } + if (arr[2] == "true") { + find_chkboxArr.push({ + Name: "chk2_mc", + On: true, + Position: "2", + Grades: "3-5" + }); + } else if (arr[2] == "false") { + find_chkboxArr.push({ + Name: "chk2_mc", + On: false, + Position: "2", + Grades: "3-5" + }); + } + if (arr[3] == "true") { + find_chkboxArr.push({ + Name: "chk3_mc", + On: true, + Position: "3", + Grades: "6-8" + }); + } else if (arr[3] == "false") { + find_chkboxArr.push({ + Name: "chk3_mc", + On: false, + Position: "3", + Grades: "6-8" + }); + } + if (arr[4] == "true") { + find_chkboxArr.push({ + Name: "chk4_mc", + On: true, + Position: "4", + Grades: "9-12" + }); + } else if (arr[4] == "false") { + find_chkboxArr.push({ + Name: "chk4_mc", + On: false, + Position: "4", + Grades: "9-12" + }); + } + + + //trace("trace on"+find_chkboxArr.On[iii]) + //} else { + //trace("false") + //trace(iii+10); + //checkboxtemparray = createCheckBoxArray(iii+10); + + //} + //} + var arrLessons: Array; + + var item: XML; + for each(item in xmlCorrelations) { + if (item.@id == arr[0]) { + arrLessons = HelperFunctions.getArrayCommaDelimeter(item); + } + } + + var arr2: Array = new Array(); + for (var i: uint = 0; i < lessonItemsArray.length; i++) { + var item2: LessonItem = lessonItemsArray[i]; + for (var ii: uint = 0; ii < arrLessons.length; ii++) { + if (item2.id == arrLessons[ii]) { + arr2.push(item2); + } + } + } + currentFindLessonsArr = arr2; //current array of lesson items for FIND + //trace("arr2 "+arr2); + populateFind(arr2); + findLessonsPanel(); + } + } + + private function gotoWebPage(str: String): void { + try { + navigateToURL(new URLRequest(str), "_blank"); + } catch (e: Error) { + trace(e.message); + } + } + + /******************************************************************* + * FUNCTION: TO LOAD STANDARDS STATES XML FILE + *******************************************************************/ + public function loadStateStandard(stream: String): void { + dwpassstate = stream; + //trace("dwpasspub "+dwpasspub); + //trace("dwpassstate "+dwpassstate); + //trace("$streamurl "+ $streamurl+ dwpassstate); + var streamtemp = $streamurl + dwpassstate + + var STATELoadertemp: URLLoader = new URLLoader(); + STATELoadertemp.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandlerSTATE); + STATELoadertemp.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); + //pubsLoadertemp.addEventListener(Event.COMPLETE,pubsLoaded); + var STATEUrltemp: URLRequest = new URLRequest(streamtemp); + STATELoadertemp.load(STATEUrltemp); + + //$nc = new NetConnection(); + // $nc.addEventListener(NetStatusEvent.NET_STATUS, $netStatusHandlerPub); + // $nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, $securityErrorHandler); + // $nc.connect(null); + } + private function httpStatusHandlerSTATE(event: HTTPStatusEvent): void { + //trace("httpStatusHandler: -----------------------------------" + event); + //trace("status: " + event.status); + var xmlfullpath = Object(parent).getDpath(); + if (event.status == 0) { + internetcontext = "Unable to locate internet connection"; + //var xmlfullpath = Object(parent).getDpath(); + //trace("state xml path"+xmlfullpath+ "_VE4DATA/"+MainConstants.XMLPATH + dwpassstate); + loadConceptList(xmlfullpath + "_VE50DATA/" + MainConstants.XMLPATH + dwpassstate); + } else { + + //trace("state xml path"+xmlfullpath+ "_VE4DATA/"+MainConstants.XMLPATH + dwpassstate); + //loadConceptList(xmlfullpath+ "_VE4DATA/"+MainConstants.XMLPATH + dwpassstate); + loadConceptList("http://ve.councilforeconed.org/" + dwpassstate); + //trace("online state "+"http://ve.councilforeconed.org/"+ dwpassstate); + } + //loadLibraryFinal(MainConstants.XMLPATH + dwpasspub); + } + private function $netStatusHandler(_e: NetStatusEvent): void { + + // trace('$netStatusHandler:'+_e.info.code); + // loadConceptList(MainConstants.XMLPATH + dwpassstate); + + for (var _i in _e.info) { + trace(_i + ':' + _e.info[_i]); + } + switch (_e.info.code) { + case "NetConnection.Connect.Success": + trace('Success!!!!'); + //loadXML($streamurl); + //trace("$streamurl "+ "http://ve.councilforeconed.org/"+ dwpassstate); + loadConceptList(MainConstants.XMLPATH + dwpassstate); + //loadConceptList("http://ve.councilforeconed.org/"+ dwpassstate); + //loadXML(xmlQuiz); + break; + case "NetStream.Play.StreamNotFound": + internetcontext = "Unable to locate internet connection"; + //trace("Unable to locate video"); + //trace("local"+MainConstants.XMLPATH + dwpassstate); + loadConceptList(MainConstants.XMLPATH + dwpassstate); + //loadXML(MainConstants.XMLPATH + MainConstants.XMLCONCEPTS_LIST); + break; + } + + } + private function $securityErrorHandler(_e: NetStatusEvent): void { + trace('$securityErrorHandler'); + } + private function $asyncErrorHandler(_e: AsyncErrorEvent): void { + trace('$asyncErrorEvent'); + } + public function checkUrl(urlString: String): void {} + + private function onHttpStatus(event: HTTPStatusEvent): void { + var httpStatus: int = event.status; + if (httpStatus < 100) { + trace("flashError"); + } else if (httpStatus < 200) { + trace("informational"); + } else if (httpStatus < 300) { + trace("successful"); + } else if (httpStatus < 400) { + trace("redirection"); + } else if (httpStatus < 500) { + trace("clientError"); + } else if (httpStatus < 600) { + trace("serverError"); + } + //trace(this.httpStatusType); + } + + //ul.load(new URLRequest(urlString)); + // ul.load("http://google.com/not.html"); + + + private function loadConceptList(stream: String): void { + var loader: URLLoader = new URLLoader(); + loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHttpStatus); + loader.load(new URLRequest(stream)); + key_Panel.visible = false; + pub_Panel.visible = false; + sta_Panel.visible = true; + find_Panel.visible = false; + usmap.visible = false; + //trace("STATE stream "+stream); + loader.addEventListener(Event.COMPLETE, loadData); + function loadData(evt: Event): void { + var _xml: XML = new XML(loader.data); + /**************************************************************************** + * REPLACE 'asfunction:' FOR 'event:function=' TO TRANSLATE HTML USED FOR AS2 TO AS3 + ***************************************************************************/ + var myPattern: RegExp = /asfunction:/g; //g is global, replace all instances + //trace(_xml.title); + var str: String = _xml.content.text(); //return all text of xml file including the html tags, but not the xml tags and [DATA + //str = str.replace( myPattern, "event:function="); //replace "Asfunction:" for "event:function=" in HTML that way we dont have to update about 50 xml old files + str = str.replace(myPattern, "event:"); //replace "Asfunction:" for "event:function=" in HTML that way we dont have to update about 50 xml old files + statetitletxt = String(_xml.title); + //trace("statetitletxt"+statetitletxt); + sta_Panel.state_txt.text = "" + statetitletxt; + sta_textField.htmlText = str; //return as a web page + vScrollBar.update(); + vScrollBar.scrollPosition = 0; + //sta_textField.scroll = 0; + //FOR findLessonByStandard + xmlCorrelations = new XMLList(_xml.correlations.standard); + //trace(xmlCorrelations); + } + } + + /************************************************************************************* + * FUNCTION: FIND LESSONS BY STANDARDS + ************************************************************************************/ + private function findLessonsPanel(): void { + loadingmc_clip.visible = true; + usmap.visible = false; + key_Panel.visible = false; + pub_Panel.visible = false; + sta_Panel.visible = false; + find_Panel.visible = true; + } + + /************************************************************************************* + * FUNCTION: SEARCH BY STANDARDS + ************************************************************************************/ + private function standardSearch(ev: MouseEvent): void { + usmap.visible = true; + tabStd_mc.gotoAndStop(2); + tabPub_mc.gotoAndStop(1); + tabKeyword_mc.gotoAndStop(1); + loadingmc_clip.visible = false; + key_Panel.visible = false; + pub_Panel.visible = false; + sta_Panel.visible = false; + find_Panel.visible = false; + //Object(parent).trackSearch = "sstate"; + //Object(parent).setLastPubId(str, false); + Object(parent).setLastStateSearch("sstate", "main", isBrowsigSearch); + + } + + /************************************************************************************* + * FUNCTION: SEARCH BY PUBLICATIONS + ************************************************************************************/ + private function byPubSearch(ev: MouseEvent): void { + sta_Panel.visible = false; + loadingmc_clip.visible = true; + usmap.visible = false; + key_Panel.visible = false; + find_Panel.visible = false; + pub_Panel.visible = true; + tabStd_mc.gotoAndStop(1); + tabPub_mc.gotoAndStop(2); + tabKeyword_mc.gotoAndStop(1); + //IF FIRST TIME PUBLICATION PANEL IS DISPLAYED + //Object(parent).trackSearch = "spublication"; + Object(parent).setLastSearch("spublication", isBrowsigSearch); + if (firstTimePublication == true) { + tableByPub(); + firstTimePublication = false; + } + } + + /************************************************************************************* + * FUNCTION: SEARCH BY KEYWORD TAB + ************************************************************************************/ + private function byKeywordSearch(ev: MouseEvent): void { + loadingmc_clip.visible = true; + tabStd_mc.gotoAndStop(1); + tabPub_mc.gotoAndStop(1); + tabKeyword_mc.gotoAndStop(2); + sta_Panel.visible = false; + usmap.visible = false; + pub_Panel.visible = false; + find_Panel.visible = false; + key_Panel.visible = true; + Object(parent).setLastSearch("skeyword", isBrowsigSearch); + //Object(parent).trackSearch = "skeyword"; + } + /************************************************************************************* + * FUNCTION: SEARCH BY STANDARDS + ************************************************************************************/ + public function standardSearch2(): void { + usmap.visible = true; + loadingmc_clip.visible = true; + tabStd_mc.gotoAndStop(2); + tabPub_mc.gotoAndStop(1); + tabKeyword_mc.gotoAndStop(1); + key_Panel.visible = false; + pub_Panel.visible = false; + sta_Panel.visible = false; + find_Panel.visible = false; + //Object(parent).trackSearch = "sstate"; + //Object(parent).setLastPubId(str, false); + // Object(parent).setLastSearch("sstate", isBrowsigSearch); + } + + /************************************************************************************* + * FUNCTION: SEARCH BY PUBLICATIONS + ************************************************************************************/ + public function byPubSearch2(): void { + sta_Panel.visible = false; + loadingmc_clip.visible = true; + usmap.visible = false; + key_Panel.visible = false; + find_Panel.visible = false; + pub_Panel.visible = true; + tabStd_mc.gotoAndStop(1); + tabPub_mc.gotoAndStop(2); + tabKeyword_mc.gotoAndStop(1); + //IF FIRST TIME PUBLICATION PANEL IS DISPLAYED + //Object(parent).trackSearch = "spublication"; + //Object(parent).setLastSearch("spublication", isBrowsigSearch); + if (firstTimePublication == true) { + tableByPub(); + firstTimePublication = false; + } + } + + /************************************************************************************* + * FUNCTION: SEARCH BY KEYWORD TAB + ************************************************************************************/ + public function byKeywordSearch2(): void { + tabStd_mc.gotoAndStop(1); + loadingmc_clip.visible = true; + tabPub_mc.gotoAndStop(1); + tabKeyword_mc.gotoAndStop(2); + sta_Panel.visible = false; + usmap.visible = false; + pub_Panel.visible = false; + find_Panel.visible = false; + key_Panel.visible = true; + //Object(parent).setLastSearch("skeyword", isBrowsigSearch); + //Object(parent).trackSearch = "skeyword"; + } + public function byKeywordSearch3(): void { + tabStd_mc.gotoAndStop(1); + loadingmc_clip.visible = true; + tabPub_mc.gotoAndStop(1); + tabKeyword_mc.gotoAndStop(2); + sta_Panel.visible = false; + usmap.visible = false; + pub_Panel.visible = false; + find_Panel.visible = false; + key_Panel.visible = true; + Object(parent).setLastSearch("skeyword", isBrowsigSearch); + //Object(parent).trackSearch = "skeyword"; + } + /************************************************************************************* + * FUNCTION:ENTER A WORD IN TXTFIELD AND SEARCH BY KEYWORD, PRESSING BUTTON OR ENTER KEY + ************************************************************************************/ + private function searchByKeyword(ev: MouseEvent): void { + searchLessonsByKeyword(); + } + private function pressEnterKey(evt: KeyboardEvent): void { + if (evt.keyCode == 13) { + searchLessonsByKeyword(); + } + } //KeyCode = 13 is ENTER key + + private function searchLessonsByKeyword(): void { + // var arr:Array = new Array(); + + var keyword: String = key_Panel.search_txt.text; + //trace("keyword "+keyword); + if (keyword == "" || keyword == null) { + key_wordFilter = null; + } else { + var dtArray: Array = []; + var dtreplace: Array = []; + for (var i23: int = 0; i23 < keyword.length; i23++) { + //Create an array of grades to filter lessons + var dkeychar = keyword.charAt(i23); + //trace("dkeychar "+dkeychar); + switch (dkeychar) { + case "[": + //trace(i23); + dtArray.push(i23); + dtreplace.push("[") + break; + case "]": + //trace(i23); + dtArray.push(i23); + dtreplace.push("]") + break; + case "$": + //trace(i23); + dtArray.push(i23); + dtreplace.push("$") + break; + case "^": + //trace(i23); + dtArray.push(i23); + dtreplace.push("^") + break; + case ".": + //trace(i23); + dtArray.push(i23); + dtreplace.push(".") + break; + case ",": + //trace(i23); + dtArray.push(i23); + dtreplace.push(",") + break; + case "?": + //trace(i23); + dtArray.push(i23); + dtreplace.push("?") + break; + case "+": + //trace(i23); + dtArray.push(i23); + dtreplace.push("+") + break; + case "(": + //trace(i23); + dtArray.push(i23); + dtreplace.push("(T") + break; + case ")": + //trace(i23); + dtArray.push(i23); + dtreplace.push("t)") + break; + default: + } + + } + //trace(dtArray.length); + var dwcheck = 0; + for (var i24: int = 0; i24 < dtArray.length; i24++) { + //if (dtArray.length>1){ + //for(var i25:int = 0; i25 < dtArray.length; i25++){ + //trace(dtArray[i25]); + var dtempEnd2: Number = dtArray[i24]; + //var dtempThis=dtreplace[i25]; + //trace(dtempEnd2); + keyword = keyword.slice(0, dtempEnd2 + dwcheck) + "\\" + keyword.slice(dtempEnd2 + dwcheck, keyword.length) + //trace("keyword loop "+keyword); + //keyword.replace(dtempEnd2+dwcheck, "\\"+dtempThis); + //} + dwcheck = dwcheck + 1; + //trace("keyword again "+keyword); + //trace("here2"); + //var dtemp ='/' + /* } else { + trace("here3"); + var dtempEnd:Number=dtArray[i24]; + trace ("i dunno "+keyword.slice(0,dtempEnd)+"\\"+keyword.slice(dtempEnd+1,keyword.length)); + keyword=keyword.slice(0,dtempEnd)+"\\"+keyword.slice(dtempEnd,keyword.length) + }*/ + //Create an array of grades to filter lessons + //var dkeychar = keyword.charAt(i23); + + //trace(dtArray[i24]); + } + key_wordFilter = new RegExp(keyword, "i"); + //trace (key_wordFilter); + } + + //SET FILTERS + var gradeArr: Array = new Array(); + var str: String; + for (var i: uint = 0; i < key_chkboxArr.length; i++) { + //Create an array of grades to filter lessons + if (key_chkboxArr[i].On == true && i < 4) { + gradeArr.push("" + key_chkboxArr[i].Grades); + } + } + if (key_chkboxArr.length == 5) { + if (key_chkboxArr[4].On == true) { + online = true; + } else { + online = false; + } + } + //trace(gradeArr); + key_gradeFilterArr = gradeArr; + appliedFiltersKeyPanel(); + } + + /************************************************************************************* + * FUNCTION: OPEN STATE + ************************************************************************************/ + private function showState(ev: MouseEvent): void { + var clicked: Object = ev.target; + var str: String = "" + clicked.name; + var stateAbr_str: String = str.replace("_btn", ""); + var stateName_str: String; + //IF JUMPSTART OR NCEE, ELSE SEARCH FOR STATE NAME + if (stateAbr_str == "jumpstart" || stateAbr_str == "ncee") { + stateName_str = stateAbr_str; + } else { + for (var ind: int = 0; ind < statesAbrv.length; ind++) { + if (statesAbrv[ind] == stateAbr_str) { + stateName_str = statesName[ind]; + } + } + } + usmap.visible = false; + key_Panel.visible = false; + pub_Panel.visible = false; + find_Panel.visible = false; + sta_Panel.visible = true; + //sta_Panel.state_txt.text = ""+ statetitletxt; + currentState = "" + stateName_str; //keep the name of the current state + loadStateStandard("standards/standards_" + stateAbr_str + "_ve50.xml"); + dssabrv = stateAbr_str; + + Object(parent).setLastStateSearch("sstate", "standards/standards_" + stateAbr_str + "_ve50.xml", isBrowsigSearch); + } + + //Click here to go to web page + + + + private function overState(ev: MouseEvent): void { + //addEventListener(Event.ENTER_FRAME, followCursor); + detailer_btn.alpha = 100; + // Mouse.hide(); + detailer_btn.mouseEnabled = false; + detailer_btn.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor); + + var statebtn: Object = ev.target; + setStateColor(statebtn, "rollover"); + + var btnName: String = "" + statebtn.name; + var stateAcro: String = btnName.replace("_btn", ""); + + detailer_btn.detail_mc.tooltip.text = getTooltip(stateAcro); //check XML for year + detailer_btn.detail_mc.state.htmlText = "" + getStateName(stateAcro) + ""; + } + + + + private function outState(ev: MouseEvent): void { + detailer_btn.alpha = 0; + // Mouse.show(); + detailer_btn.mouseEnabled = true; + detailer_btn.removeEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor); + // detailer_btn.x = 900; + // detailer_btn.y = 900; + //stage.removeChild(this.usmap.detailer_btn); + var statebtn: Object = ev.target; + setStateColor(statebtn, "rollout"); + } + + private function getStateName(stateAbr_str: String): String { + var stateName_str: String; + //IF JUMPSTART OR NCEE, ELSE SEARCH FOR STATE NAME + if (stateAbr_str == "jumpstart" || stateAbr_str == "ncee") { + stateName_str = stateAbr_str; + } else { + for (var ind: int = 0; ind < statesAbrv.length; ind++) { + if (statesAbrv[ind] == stateAbr_str) { + stateName_str = statesName[ind]; + } + } + } + return stateName_str; + } + + private function fl_CustomMouseCursor(event: Event) { + detailer_btn.x = stage.mouseX - 40; + detailer_btn.y = stage.mouseY - 15; + } + + + + /************************************************************************************* + * FUNCTION: HIDE STANDARD + ************************************************************************************/ + private function hideStandard(ev: MouseEvent): void { + key_Panel.visible = false; + find_Panel.visible = false; + pub_Panel.visible = false; + sta_Panel.visible = true; + usmap.visible = false; + Object(parent).setLastStateSearch("sstate", "standards/standards_" + dssabrv + "_ve50.xml", isBrowsigSearch); + //trace("currentState ++++++++ "+currentState); //keep the name of the current state + + //Object(parent).setLastStateSearch("sstate", "main", isBrowsigSearch); + + } + private function hideStandard2(ev: MouseEvent): void { + + key_Panel.visible = false; + find_Panel.visible = false; + pub_Panel.visible = false; + sta_Panel.visible = false; + usmap.visible = true; + Object(parent).setLastStateSearch("sstate", "main", isBrowsigSearch); + } + /************************************************************************************* + * FUNCTION: GET PUBLICATION TITLE PER ID + ************************************************************************************/ + private function getPublicationTitle(id_str: String): String { + var strtitle: String = ""; + if (id_str == null || id_str == "") { + strtitle = "N/A" + } else { + for (var i: uint = 0; i < pubItemsArray.length; i++) { + var item: PublicationItem = pubItemsArray[i]; + if (item.pid == id_str) { + strtitle = item.ptitle; + } + } + } + return strtitle; + } + + + /******************************************************************* + * FUNCTION:CREATE AN ARRAY THAT CONTAINS OBJECTS OF PROPERTIES FOR EACH CHECKBOX + *******************************************************************/ + private function createCheckBoxArray(numboxes: int): Array { + var arr: Array = new Array(); + arr.push({ + Name: "chk1_mc", + On: true, + Position: "1", + Grades: "K-2" + }); + arr.push({ + Name: "chk2_mc", + On: true, + Position: "2", + Grades: "3-5" + }); + arr.push({ + Name: "chk3_mc", + On: true, + Position: "3", + Grades: "6-8" + }); + arr.push({ + Name: "chk4_mc", + On: true, + Position: "4", + Grades: "9-12" + }); + /* + if( numboxes == 1 ){ + arr.push( { Name:"chk1_mc", On:true, Position:"1", Grades:"K-2"} ); + } else if( numboxes == 2 ){ + arr.push( { Name:"chk2_mc", On:true, Position:"2", Grades:"3-5"} ); + } else if( numboxes == 3 ){ + + arr.push( { Name:"chk3_mc", On:true, Position:"3", Grades:"6-8"} ); + + }else if( numboxes == 4 ){ + + arr.push( { Name:"chk4_mc", On:true, Position:"4", Grades:"9-12"} ); + } else if( numboxes == 11 ){ + arr.push( { Name:"chk1_mc", On:false, Position:"1", Grades:"K-2"} ); + } else if( numboxes == 12 ){ + arr.push( { Name:"chk2_mc", On:false, Position:"2", Grades:"3-5"} ); + } else if( numboxes == 13 ){ + arr.push( { Name:"chk3_mc", On:false, Position:"3", Grades:"6-8"} ); + + }else if( numboxes == 14 ){ + arr.push( { Name:"chk4_mc", On:false, Position:"4", Grades:"9-12"} ); + } + */ + return arr; + } + + /******************************************************************* + * FUNCTION:CREATE AN ARRAY THAT CONTAINS OBJECTS OF PROPERTIES FOR EACH CHECKBOX + *******************************************************************/ + private function displayCheckboxStatus(str: String, arr: Array): void { + var panel: String = str + "_Panel"; //key_Panel or pub_Panel + + for (var i: uint = 0; i < arr.length; i++) { + var pos: String = arr[i].Position; + //trace("arr[i].On "+arr[i].On); + switch (pos) { + case "1": + if (arr[i].On == true) { + this[panel].chk1_mc.x_mc.visible = true; + } else { + this[panel].chk1_mc.x_mc.visible = false; + } + break; + case "2": + if (arr[i].On == true) { + this[panel].chk2_mc.x_mc.visible = true; + } else { + this[panel].chk2_mc.x_mc.visible = false; + } + break; + case "3": + if (arr[i].On == true) { + this[panel].chk3_mc.x_mc.visible = true; + } else { + this[panel].chk3_mc.x_mc.visible = false; + } + break; + case "4": + if (arr[i].On == true) { + this[panel].chk4_mc.x_mc.visible = true; + } else { + this[panel].chk4_mc.x_mc.visible = false; + } + break; + /*case "5": + if( arr[i].On == true ){ this[panel].chk5_mc.x_mc.visible = true; } + else{ this[panel].chk5_mc.x_mc.visible = false; } + break;*/ + default: + trace("no checkbox"); + } + } + } + + /******************************************************************* + * FUNCTION: TURN CHECKBOX CLICKED ON - OFF + *******************************************************************/ + private function checkboxClicked(evt: MouseEvent): void { + var arr: Array; + var gradeArr: Array = new Array(); + alreadyfound = []; + //CHECK IN WHICH PANEL IS THE CHECKBOX CLICKED + //IF THE PARENT OF THE CHECKBOX IS A INSTANCE OF 'searchMenu_movie' + //THEN THE CHECKBOX IS IN THE 'key_Pane'l ELSE IS IN THE 'pub_Panel' + var panelName: String = evt.currentTarget.parent.toString(); //[object searchMenu_movie] + panelName = panelName.substring(8, panelName.length - 1); //searchMenu_movie + if (panelName == "searchMenu_movie") { + arr = key_chkboxArr; + } + //else { arr = pub_chkboxArr; } + else if (panelName == "searchPubMenu_movie") { + arr = pub_chkboxArr; + } else { + arr = find_chkboxArr; + } + + var chkName: String = evt.currentTarget.name; //chk1_mc + var checkObj: Object = evt.currentTarget; + var str: String; + for (var i: uint = 0; i < arr.length; i++) { + //Set to TRUE or FALSE the ON property of the checkbox in the array + if (arr[i].Name == chkName) { + if (arr[i].On == true) { + arr[i].On = false; + } else { + arr[i].On = true; + } + } + //Create an array of grades to filter lessons + if (arr[i].On == true && i < 4) { + gradeArr.push("" + arr[i].Grades); + } //dont push online flag in grade filter + } + //CHECK FOR ONLINE LESSONS + if (arr.length == 5 && panelName == "searchMenu_movie") { + if (arr[4].On == true) { + online = true; + } else { + online = false; + } + } + if (arr.length == 5 && panelName == "SearchStandard_movie") { + if (arr[4].On == true) { + findonline = true; + } else { + findonline = false; + } + } + //SET CHECK ARRAY FILTER FOR PANEL + if (panelName == "searchMenu_movie") { + key_gradeFilterArr = gradeArr; + appliedFiltersKeyPanel(); + } else if (panelName == "searchPubMenu_movie") { + pub_gradeFilterArr = gradeArr; + appliedFiltersPubPanel(); + } else { + find_gradeFilterArr = gradeArr; + appliedFiltersFindPanel(); + } + } + + /******************************************************************* + * FUNCTION: TURN CHECKBOX CLICKED ON - OFF + *******************************************************************/ + private function checkWordFilter(key_wordFilter: RegExp, _title: String, _desc: String, _concept: String): Boolean { + var goodItem: Boolean = false; + var str: String = "" + _title + _desc + _concept; + + //key_Panel.search_txt.text + if (("" + _title) == "Front Material" || ("" + _title) == "Back Material") { + goodItem = false; + } else { + //trace("key word 2"+key_wordFilter); + //trace(str); + + //if( key_wordFilter == null ){ goodItem = true; } + if (key_Panel.search_txt.text == null || key_Panel.search_txt.text == "") { + goodItem = true; + } else if (str.search(key_wordFilter) > -1) { + goodItem = true; + } else { + goodItem = false; + } + } + return goodItem; + } + + /******************************************************************* + * FUNCTION: CHECK IF FILTER IS ONLINE + *******************************************************************/ + private function IsOnline(flag: Boolean, type: String): Boolean { + //var goodItem:Boolean = true; + var goodItem: Boolean = false; + if (flag == true && type == "online") { + goodItem = true; + } + //if(flag == true ){ + //if(type == "online" ){ goodItem = true;} + //else{goodItem = false; } + //goodItem = true; + //} + //else{ + //if(type == "online" ){ goodItem = false;} + //else{goodItem = true; } + //} + return goodItem; + } + + /******************************************************************* + * FUNCTION: CHECK IF GRADE FILTER + *******************************************************************/ + private function checkGradeFilter(grade: String): Boolean { + //trace("------------------------------------------------------------filter run------------------------------------------------"); + var goodItem: Boolean = false; + //trace("grade "+grade); + for (var i: uint = 0; i < key_gradeFilterArr.length; i++) { + //trace(key_gradeFilterArr[i]); + var dfront; + var dfront2; + if (grade != null) { + dfront = key_gradeFilterArr[i].charAt(0); + if (dfront == "K") { + dfront = 0; + } + dfront = Number(dfront); + //trace("dfront "+dfront); + dfront2 = Number(grade.charAt(0)); + //trace("dfront2 "+dfront2); + } else { + dfront = 99; + dfront2 = 1; + } + var drear1c; + //trace(key_gradeFilterArr[i].length); + if (key_gradeFilterArr[i].length > 3) { + var drear1a = key_gradeFilterArr[i].length; + drear1c = Number(key_gradeFilterArr[i].slice((drear1a) - 2)); + } else if (key_gradeFilterArr[i].length < 4 && key_gradeFilterArr[i].length > 0) { + drear1c = Number(key_gradeFilterArr[i].charAt(2)); + } + var drear2c; + //trace(grade.length); + if (grade.length > 3) { + var drear2a = grade.length; + drear2c = Number(grade.slice((drear2a) - 2)); + //trace(Number(grade.slice((drear2a)-2))); + } else if (grade.length < 4 && grade.length > 0) { + drear2c = Number(grade.charAt(2)); + } + //trace("dfront "+dfront+" dfront2 "+dfront2); + //trace("drear1c "+drear1c+" drear2c "+drear2c); + if (dfront >= dfront2 && drear2c >= drear1c) { + goodItem = true; + } + //if(dfront == dfront2 && drear2c == drear1c){ + //goodItem = true; + //} else if(grade == key_gradeFilterArr[0]){ + //goodItem = true; + + //} + } + return goodItem; + + } + private function checkGradeFilterFind(grade: String): Boolean { + var goodItem: Boolean = false; + //trace("grade "+grade); + for (var i: uint = 0; i < find_gradeFilterArr.length; i++) { + //trace(key_gradeFilterArr[i]); + var dfront; + var dfront2; + if (grade != null) { + dfront = find_gradeFilterArr[i].charAt(0); + if (dfront == "K") { + dfront = 0; + } + dfront = Number(dfront); + //trace("dfront "+dfront); + dfront2 = Number(grade.charAt(0)); + //trace("dfront2 "+dfront2); + } else { + dfront = 99; + dfront2 = 1; + } + var drear1c; + //trace("key "+key_gradeFilterArr[i].length); + //trace("find "+find_gradeFilterArr[i].length); + + if (find_gradeFilterArr[i].length > 3) { + var drear1a = find_gradeFilterArr[i].length; + drear1c = Number(find_gradeFilterArr[i].slice((drear1a) - 2)); + } else if (find_gradeFilterArr[i].length < 4 && find_gradeFilterArr[i].length > 0) { + drear1c = Number(find_gradeFilterArr[i].charAt(2)); + } + var drear2c; + //trace(grade.length); + if (grade.length > 3) { + var drear2a = grade.length; + drear2c = Number(grade.slice((drear2a) - 2)); + //trace(Number(grade.slice((drear2a)-2))); + } else if (grade.length < 4 && grade.length > 0) { + drear2c = Number(grade.charAt(2)); + } + //trace("dfront "+dfront+" dfront2 "+dfront2); + //trace("drear1c "+drear1c+" drear2c "+drear2c); + if (dfront >= dfront2 && drear2c >= drear1c) { + goodItem = true; + } + //if(dfront == dfront2 && drear2c == drear1c){ + //goodItem = true; + //} else if(grade == key_gradeFilterArr[0]){ + //goodItem = true; + + //} + } + return goodItem; + } + + /******************************************************************* + * FUNCTION: APPLIED ALL FILTERS TO FIND LESSONS BY STANDARD + *******************************************************************/ + private function appliedFiltersFindPanel(): void { + var arr: Array = new Array(); + //trace("currentFindLessonsArr filter"+currentFindLessonsArr.length); + for (var ii: uint = 0; ii < currentFindLessonsArr.length; ii++) { + var item: LessonItem = currentFindLessonsArr[ii]; + //trace("filter item"+item.gradelevel); + //if( checkGradeFilterFind(item.gradelevel) && IsOnline(findonline, item.type) ) + //if( checkGradeFilterFind(item.gradelevel) || IsOnline(findonline, item.type) ) + if (checkGradeFilterFind(item.gradelevel) || IsOnline(findonline, item.type)) { + arr.push(item); + } + } + fsp.source = null; + //trace("arr "+arr.length); + populateFind(arr); + } + //findonline + + /******************************************************************* + * FUNCTION: APPLIED ALL FILTERS TO BY KEYWORD PANEL + *******************************************************************/ + private function appliedFiltersKeyPanel(): void { + var arr: Array = new Array(); + for (var ii: uint = 0; ii < lessonItemsArray.length; ii++) { + var item: LessonItem = lessonItemsArray[ii]; + //trace(item); + //if( checkGradeFilter(item.gradelevel) && checkWordFilter(key_wordFilter, item.title, item.desc, item.concepts) && IsOnline(online,item.type) ) + if (checkGradeFilter(item.gradelevel) && checkWordFilter(key_wordFilter, item.title, item.desc, item.concepts) || IsOnline(online, item.type)) { + arr.push(item); + } + } + sp.source = null; + populateByKeywords(arr); + } + + /******************************************************************* + * FUNCTION: APPLIED ALL FILTERS TO BY PUBLICATION PANEL + *******************************************************************/ + private function appliedFiltersPubPanel(): void { + //trace("----------------------------------------------filter--------------------------------------------"); + var arr: Array = new Array(); + var dwcheck: Boolean = false; + var myfilterArray: Array = new Array(); + //trace("PUB GRADE FILTER:"+pub_gradeFilterArr); + var fstart; + var filterArr: Array = new Array(); + //HMD 3.22.11 Revisions for publications with filtering + //Built Filter for the items that are in the checked boxes + for (var i: uint = 0; i < pub_gradeFilterArr.length; i++) { + + fstart = pub_gradeFilterArr[i].split("-") + //trace("FSTART:"+fstart) + //Put first item in Array + var fitem + if (fstart[0] == "K") { + fitem = 0 + } else { + fitem = Number(fstart[0]) + } + + //If there's no second item, add in the same which will only popoulate once + if (fstart.length == 1) { + fstart.push(fstart[0]) + } + + //Now pull the last item and see what in between needs to be added + for (var ct = fitem; ct <= Number(fstart[1]); ct++) { + //trace(ct); + filterArr.push(ct); + } + + } + //trace("FILTER ITEMS:"+filterArr); + + //Go through each item to see if it falls into the filter + + for (var ii: uint = 0; ii < pubItemsArray.length; ii++) { + var item: PublicationItem = pubItemsArray[ii]; + //trace("Item Grade Level"+item.gradelevel); + var gl: Array = new Array(); + + //var itemGrade:Array=new Array(); + var startGrade + var endGrade + + if (item.gradelevel != null) { + + gl = item.gradelevel.split("-") + + if (gl[0] == "K") { + startGrade = 0 + } else { + startGrade = Number(gl[0]) + } + + if (gl.length > 0) { + endGrade = Number(gl[1]) + } else { + endGrade = startGrade; + } + + } else { + startGrade = 0 + endGrade = 99 + } + + //Now that we have the array that contains which grades are avaialble in the filter and info to tell us the starting and stopping grades, we can now look through and see what matches can be found + + //First thing - see if it already exists + var found = false; + var isMatch: Boolean = false; + for (var iiii: int = 0; iiii <= alreadyfound.length; iiii++) { + //trace("iii "+iii); + //trace("alreadyfound.length"+alreadyfound.length); + //trace("alreadyfound"+alreadyfound); + //trace("alreadyfound[iii]"+alreadyfound[0]); + //trace("item.id "+item.pid); + if (alreadyfound[iiii] == item.pid) { + //trace("Already in there"); + found = true; + } + } + + if (!found) { + //search to see if it exists + //trace (_testArray.indexOf(7)); + for (ct = startGrade; ct <= endGrade; ct++) { + if (filterArr.indexOf(ct) != -1) { + //trace("Found a match"); + isMatch = true + } + } + + } + + if (isMatch && !found) { + //Now to add it in if isMatch is still true + var dtemp: String = item.pid; + //trace(dtemp); + alreadyfound.push(dtemp); + arr.push({ + Image: item.img, + Id: item.pid, + Title: item.ptitle, + Description: item.desc, + Grade: item.gradelevel + }); + } + + } + + /* + //Older code below + for(var i:uint= 0; i < pub_gradeFilterArr.length; i++){ + + for(var ii:uint = 0; ii < pubItemsArray.length; ii++){ + var item:PublicationItem = pubItemsArray[ii]; + //trace(item); + + var dfront; + var dfront2; + trace("Item Grade Level"+item.gradelevel); + if (item.gradelevel !=null){ + //Show starting grade level + dfront = pub_gradeFilterArr[i].charAt(0); + if (dfront == "K"){ + dfront = 0; + } + dfront = Number(dfront); + //trace("dfront "+dfront); + + //show ending grade level + dfront2 = item.gradelevel.charAt(0); + if (dfront2 == "K"){ + dfront2 = 0; + } + dfront2 = Number(dfront2); + //trace("dfront2 "+dfront2); + trace("Grade range:"+dfront+" : "+dfront2); + + } else { + dfront = 99; + dfront2 = 1; + trace("Grade range in Filter:"+dfront+" : "+dfront2); + } + + + var drear1c; + //trace(pub_gradeFilterArr[i].length); + if (pub_gradeFilterArr[i].length > 3){ + var drear1a = pub_gradeFilterArr[i].length; + drear1c = Number(pub_gradeFilterArr[i].slice((drear1a)-2)); + } else if (pub_gradeFilterArr[i].length < 4 && pub_gradeFilterArr[i].length > 0){ + drear1c = Number(pub_gradeFilterArr[i].charAt(2)); + } + + + var drear2c; + //trace(item.gradelevel.length); + if (item.gradelevel.length > 3){ + var drear2a = item.gradelevel.length; + drear2c = Number(item.gradelevel.slice((drear2a)-2)); + //trace(Number(item.gradelevel.slice((drear2a)-2))); + } else if (item.gradelevel.length < 4 && item.gradelevel.length > 0){ + drear2c = Number(item.gradelevel.charAt(2)); + } + trace("Grade range of this item:"+drear1c+" : "+drear2c); + + for(var iii:int = 0; iii <= alreadyfound.length; iii++){ + //trace("iii "+iii); + //trace("alreadyfound.length"+alreadyfound.length); + //trace("alreadyfound"+alreadyfound); + //trace("alreadyfound[iii]"+alreadyfound[0]); + //trace("item.id "+item.pid); + if (alreadyfound[iii]==item.pid){ + trace("Already in there"); + dwcheck=true; + } + } + + //trace(dtemp); + //Here is the check + //dfront is the starting grade of the item + //dfront2 is the ending grade of the item + //drear1c is the starting grade of the item + //drear2c is the ending grade of the item + + //if the item starting grade is >=filter start and ending grade is less <==filter end + + if(!dwcheck){ + //if(dfront >= dfront2 && drear2c >= drear1c && dwcheck!= true){ + if(drear1c >= dfront && drear2c <= dfront2 && dwcheck!= true){ + var dtemp:String = item.pid; + //trace(dtemp); + alreadyfound.push(dtemp); + arr.push( { Image:item.img, Id:item.pid, Title:item.ptitle, Description:item.desc, Grade:item.gradelevel } ); + trace("------------------------"); + trace("Adding:"+item.ptitle); + trace("------------------------"); + + } + } + + } + } + //End of filter + */ + psp.source = null; + populateByPub(arr); + } + + /******************************************************************* + * FUNCTION: APPLIED ALL FILTERS TO BY PUBLICATION PANEL + *******************************************************************/ + private function clearSearch(evt: MouseEvent): void { + key_wordFilter = null; + //trace("clear did happen?"); + key_Panel.search_txt.text = ""; + //trace("key_chkboxArr.length "+key_chkboxArr.length); + for (var i: uint = 0; i < (key_chkboxArr.length); i++) { + key_chkboxArr[i].On = true; + } + //key_chkboxArr[4].On = true; //online lessons are out by default + displayCheckboxStatus("key", key_chkboxArr); + sp.source = null; + tableByKeywords(); + } + + + /******************************************************************* + * FUNCTION: CHECK IF THE LESSON IS ONLINE BASED IN THE ID + *******************************************************************/ + private function isLessonOnline(idstr: String): String { + var onlineurl: String; + + for (var i: uint = 0; i < lessonItemsArray.length; i++) { + var item: LessonItem = lessonItemsArray[i]; + if ((item.type == "online") && (item.id == idstr)) { + onlineurl = item.pdf_url; + } //in online Lessons is an web url + else if ((item.type == "print") && (item.id == idstr)) { + onlineurl = ""; + } + } + return onlineurl; + } + + + + /******************************************************************* + * FUNCTION: LOAD XML FOR MAP TOOLTIP + *******************************************************************/ + private function loadXMLtooltips(stream): void { + dwpassTips = stream; + //trace("dwpasspub "+dwpasspub); + trace("dwpassstate " + dwpassTips); + trace("$streamurl " + $streamurl + dwpassTips); + var streamtemp = $streamurl + dwpassTips + + var TIPSLoadertemp: URLLoader = new URLLoader(); + TIPSLoadertemp.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandlerTIPS); + TIPSLoadertemp.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); + var TIPSUrltemp: URLRequest = new URLRequest(streamtemp); + //pubsLoadertemp.addEventListener(Event.COMPLETE,pubsLoaded); + TIPSLoadertemp.load(TIPSUrltemp); + //$nc = new NetConnection(); + // $nc.addEventListener(NetStatusEvent.NET_STATUS, $netStatusHandlerPub); + // $nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, $securityErrorHandler); + // $nc.connect(null); + } + private function httpStatusHandlerTIPS(event: HTTPStatusEvent): void { + //trace("httpStatusHandler: -----------------------------------" + event); + //trace("status: " + event.status); + if (event.status == 0) { + internetcontext = "Unable to locate internet connection"; + + var xmlfullpath = Object(parent).getDpath(); + loadXMLtooltipsXML(xmlfullpath + "_VE50DATA/" + MainConstants.XMLPATH + "usmap-econ.xml"); + } else { + loadXMLtooltipsXML($streamurl + "usmap-econ.xml"); + } + //loadLibraryFinal(MainConstants.XMLPATH + dwpasspub); + } + private function ioErrorHandler(event: IOErrorEvent): void { + trace("ioErrorHandler: " + event); + } + private function loadXMLtooltipsXML(stream): void { + var url: URLRequest = new URLRequest(stream); + //trace("xmlTooltipPath "+stream); + var loader: URLLoader = new URLLoader(); + loader.addEventListener(Event.COMPLETE, loadToolTips); + loader.load(url); + function loadToolTips(evt: Event): void { + var _xml: XML = new XML(loader.data); + tooltipXmlList = new XMLList(_xml.tooltips.tooltip); + //trace(tooltipXmlList); + } + + } + + /******************************************************************* + * FUNCTION: GET TOOLTIP FOR THE USA MAP STATES + *******************************************************************/ + private function getTooltip(acron: String): String { + var tip: String = ""; + if (tooltipXmlList.length() > 0) { + var item: XML; + for each(item in tooltipXmlList) { + if (item.@id == acron) { + tip = "" + item; + } + } + + } + return tip; + } + + + /******************************************************************* + * FUNCTIONS: SET UP ALL BUTTONS AND TEXTFIELDS + *******************************************************************/ + private function setup(): void { + this.tabStd_mc.buttonMode = true; + this.tabStd_mc.mouseChildren = false; + this.tabStd_mc.useHandCursor = true; + //this.loadingmc_clip.gotoAndStop(2); + this.tabPub_mc.buttonMode = true; + this.tabPub_mc.mouseChildren = false; + this.tabPub_mc.useHandCursor = true; + + this.tabKeyword_mc.buttonMode = true; + this.tabKeyword_mc.mouseChildren = false; + this.tabKeyword_mc.useHandCursor = true; + + this.tabStd_mc.addEventListener(MouseEvent.CLICK, standardSearch); + this.tabPub_mc.addEventListener(MouseEvent.CLICK, byPubSearch); + this.tabKeyword_mc.addEventListener(MouseEvent.CLICK, byKeywordSearch); + tabKeyword_mc.gotoAndStop(2); + tabPub_mc.gotoAndStop(2); + this.close_button.buttonMode = true; + this.close_button.mouseChildren = false; + this.close_button.useHandCursor = true; + + /*this.about_button.buttonMode = true; + this.about_button.mouseChildren = false; + this.about_button.useHandCursor = true; + */ + this.close_button.addEventListener(MouseEvent.MOUSE_OVER, onCloseOver); + this.close_button.addEventListener(MouseEvent.MOUSE_OUT, onCloseOut); + this.close_button.addEventListener(MouseEvent.CLICK, onCloseClick); + + //this.about_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoAboutFrm); + this.about2_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoAboutFrm); + + this.nav_back_button.addEventListener(MouseEvent.MOUSE_OVER, onNavBackOver); + this.nav_back_button.addEventListener(MouseEvent.MOUSE_OUT, onNavBackOut); + this.nav_back_button.addEventListener(MouseEvent.CLICK, gotoLastFrm); + + this.nav_home_button.addEventListener(MouseEvent.MOUSE_OVER, onNavHomeOver); + this.nav_home_button.addEventListener(MouseEvent.MOUSE_OUT, onNavHomeOut); + this.nav_home_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoHomeFrm); + + this.nav_concepts_button.addEventListener(MouseEvent.MOUSE_OVER, onNavConceptsOver); + this.nav_concepts_button.addEventListener(MouseEvent.MOUSE_OUT, onNavConceptsOut); + this.nav_concepts_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoConceptsFrm); + + this.nav_lessons_button.addEventListener(MouseEvent.MOUSE_OVER, onNavLessonsOver); + this.nav_lessons_button.addEventListener(MouseEvent.MOUSE_OUT, onNavLessonsOut); + this.nav_lessons_button.addEventListener(MouseEvent.MOUSE_DOWN, gotoSearchFrm); + + //this.pagejump_btn_3.addEventListener(MouseEvent.MOUSE_DOWN, gotoLessonsFrm); //(frame 3) + } + + + /******************************************************************* + * FUNCTIONS: BUTTONS ROLL OVER & OUT + *******************************************************************/ + private function onCloseOver(evt: MouseEvent): void { + close_button.gotoAndStop(2); + } + private function onCloseOut(evt: MouseEvent): void { + close_button.gotoAndStop(1); + } + private function onNavBackOver(evt: MouseEvent): void { + back_icon_roll.gotoAndStop(2); + } + private function onNavBackOut(evt: MouseEvent): void { + back_icon_roll.gotoAndStop(1); + } + private function onNavHomeOver(evt: MouseEvent): void { + house_mc.gotoAndStop(2); + } + private function onNavHomeOut(evt: MouseEvent): void { + house_mc.gotoAndStop(1); + } + private function onNavConceptsOver(evt: MouseEvent): void { + nav_concepts_roll.gotoAndStop(2); + } + private function onNavConceptsOut(evt: MouseEvent): void { + nav_concepts_roll.gotoAndStop(1); + } + private function onNavLessonsOver(evt: MouseEvent): void { + nav_lessons_roll.gotoAndStop(2); + } + private function onNavLessonsOut(evt: MouseEvent): void { + nav_lessons_roll.gotoAndStop(1); + } + + } // Main class + +} //end package + +/* +TextArea.createChildren()
+ * method to use a StyledUITextField object instead of
+ * a UITextField object.
+ */
+ override protected function createChildren():void
+ {
+ textField = new StyledUITextField();
+
+ textField.autoSize = TextFieldAutoSize.NONE;
+ textField.enabled = enabled;
+ textField.ignorePadding = true;
+ textField.multiline = true;
+ textField.selectable = true;
+ textField.styleName = this;
+ textField.tabEnabled = true;
+ textField.type = TextFieldType.INPUT;
+ textField.useRichTextClipboard = true;
+ textField.wordWrap = true;
+
+ addChild(textField);
+
+ super.createChildren();
+ }
+ }
+}
+
diff --git a/com/digitec/cee/StyledUITextField.as b/com/digitec/cee/StyledUITextField.as
new file mode 100644
index 0000000..72a3551
--- /dev/null
+++ b/com/digitec/cee/StyledUITextField.as
@@ -0,0 +1,22 @@
+package com.digitec.cee
+{
+ import flash.text.TextFormat;
+ import mx.core.UITextField;
+
+
+ /**
+ * This class provides a simple workaround to let you set
+ * the UITextField.getTextStyles()
+ * method to retrieve the current TextFormat object.
+ */
+ override public function getTextStyles():TextFormat
+ {
+ return getTextFormat();
+ }
+ }
+}
diff --git a/com/digitec/cee/VideoBox.as b/com/digitec/cee/VideoBox.as
new file mode 100644
index 0000000..0f3473c
--- /dev/null
+++ b/com/digitec/cee/VideoBox.as
@@ -0,0 +1,175 @@
+package com.digitec.cee
+{
+ import fl.controls.*;
+ import fl.events.SliderEvent;
+
+ import flash.display.MovieClip;
+ import flash.display.Sprite;
+ import flash.events.Event;
+ import flash.events.MouseEvent;
+ import flash.events.NetStatusEvent;
+ import flash.events.TimerEvent;
+ import flash.media.SoundTransform;
+ import flash.media.Video;
+ import flash.net.NetConnection;
+ import flash.net.NetStream;
+ import flash.net.URLLoader;
+ import flash.net.URLRequest;
+ import flash.utils.Timer;
+
+ public class VideoBox extends Sprite
+ {
+ // client object to use for NetStream object.
+ private var client:Object;
+ //A copy of the current video's metadata object.
+ private var meta:Object;
+ private var nc:NetConnection;
+ private var ns:NetStream;
+ private var playlist:XML;
+ private var t:Timer;
+ private var uldr:URLLoader;
+ private var vid:Video;
+ //SoundTransform object used to set volume for NetStream.
+ private var volumeTransform:SoundTransform;
+
+ public function VideoBox()
+ {
+ main();
+ }
+
+ private function main():void
+ {
+ volumeTransform = new SoundTransform();
+
+ // Create client obj for NetStream, & setup a callback handler for onMetaData event.
+ client = new Object();
+ client.onMetaData = metadataHandler;
+
+ nc = new NetConnection();
+ nc.connect(null);
+
+ // Initialize NetSteam object, add a listener for netStatus event, and set client for NetStream.
+ ns = new NetStream(nc);
+ ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
+ ns.client = client;
+
+ // Initialize the Video object, attach the NetStram, and add the Video
+ // object to the display list.
+ vid = new Video();
+ vid.x = 20;
+ vid.y = 75;
+ vid.attachNetStream(ns);
+ addChild(vid);
+
+ // Begin playback of the first video.
+ playVideo();
+
+ // Configure positionBar ProgressBar instance and set the mode to MANUAL.
+ //Progress bar values will be explicitly set using the setProgress() method.
+ positionBar.mode = ProgressBarMode.MANUAL;
+
+ // Configure the volumeSlider Slider component instance. The maximum
+ // value is set to 1 because the volume in the SoundTransform object
+ // is set to a number between 0 and 1. The snapInterval and tickInterval
+ // properties are set to 0.1 which allows users to set the volume to
+ // 0, 0.1 - 0.9, 1.0 which allows users to increment or decrement the
+ // volume by 10%.
+ volumeSlider.value = volumeTransform.volume;
+ volumeSlider.minimum = 0;
+ volumeSlider.maximum = 1;
+ volumeSlider.snapInterval = 0.1;
+ volumeSlider.tickInterval = volumeSlider.snapInterval;
+
+ // Setting the liveDragging property to true causes the Slider
+ // instance's change event to be dispatched whenever the slider is
+ // moved, rather than when the user releases the slider thumb.
+ volumeSlider.liveDragging = true;
+ volumeSlider.addEventListener(SliderEvent.CHANGE, volumeChangeHandler);
+
+ // Configure the various Button instances. Each Button instance uses
+ // the same click handler.
+ playButton.addEventListener(MouseEvent.CLICK, buttonClickHandler);
+ pauseButton.addEventListener(MouseEvent.CLICK, buttonClickHandler);
+ stopButton.addEventListener(MouseEvent.CLICK, buttonClickHandler);
+ }
+
+ // Event listener for volumeSlider instance. Called when user changes the value of the volume slider.
+ private function volumeChangeHandler(event:SliderEvent):void {
+ // Set the volumeTransform's volume property to the current value of the
+ // Slider and set the NetStream object's soundTransform property.
+ volumeTransform.volume = event.value;
+ ns.soundTransform = volumeTransform;
+ }
+
+ // Event listener for the ns object. Called when the net stream's status changes.
+ private function netStatusHandler(event:NetStatusEvent):void {
+ try {
+ switch (event.info.code) {
+ case "NetStream.Play.Start" :
+ case "NetStream.Play.StreamNotFound" :
+ case "NetStream.Play.Stop" :
+ break;
+ }
+ } catch (error:TypeError) {
+ // Ignore any errors.
+ }
+ }
+
+ // Event listener for ns object's client property. called when net stream obj receives metadata information for a video.
+ private function metadataHandler(metadataObj:Object):void {
+ // Store the metadata information in the meta object.
+ meta = metadataObj;
+ // Resize the Video instance on the display list with the video's width
+ // and height from the metadata object.
+ vid.width = meta.width;
+ vid.height = meta.height;
+ // Reposition and resize the positionBar progress bar based on the
+ // current video's dimensions.
+ positionBar.move(vid.x, vid.y + vid.height);
+ positionBar.width = vid.width;
+ }
+
+
+ // Play the currently selected video.
+ private function playVideo():void {
+ var url:String = "http://www.helpexamples.com/flash/video/sheep.flv";//getVideo();
+ ns.play(url);
+ }
+
+ // Click handler for each of the video playback buttons.
+ private function buttonClickHandler(event:MouseEvent):void {
+ // Use a switch statement to determine which button was clicked.
+ switch (event.currentTarget) {
+ case playButton :
+ // If the play button was clicked, resume the video playback.
+ // If the video was already playing, this has no effect.
+ ns.resume();
+ break;
+ case pauseButton :
+ // If the pause button was clicked, pause the video playback.
+ // If the video was already playing, the video will be paused.
+ // If the video was already paused, the video will be resumed.
+ ns.togglePause();
+ break;
+ case stopButton :
+ // If the stop button was clicked, pause the video playback
+ // and reset the playhead back to the beginning of the video.
+ ns.pause();
+ ns.seek(0);
+ break;
+ }
+ }
+
+ // Event handler for timer object. This method is called every PLAYHEAD_UPDATE_INTERVAL_MS milliseconds as long as timer is running.
+ private function timerHandler(event:TimerEvent):void {
+ try {
+ // Update the progress bar and label based on the amount of video
+ // that has played back.
+ positionBar.setProgress(ns.time, meta.duration);
+ positionLabel.text = ns.time.toFixed(1) + " of " + meta.duration.toFixed(1) + " seconds";
+ } catch (error:Error) {
+ // Ignore this error.
+ }
+ }
+ }
+}
diff --git a/com/digitec/cee/XMLLoader.as b/com/digitec/cee/XMLLoader.as
new file mode 100644
index 0000000..92fcc3e
--- /dev/null
+++ b/com/digitec/cee/XMLLoader.as
@@ -0,0 +1 @@
+/******************************************
* @author Maria A. Zamora
* @company Digitec Interactive Inc.
* @version 0.1
* @date 12/14/2010
*
* xml file loader that dispatch an event when xml is loaded
* CS5 version of com.digitec.cee.XMLLoader
*
*******************************************/
package com.digitec.cee
{
import flash.events.EventDispatcher;
import flash.net.URLLoader;
import flash.events.Event;
import flash.net.URLRequest;
public class XMLLoader extends EventDispatcher
{
private var urlLoader:URLLoader;
private var urlRequest:URLRequest;
private var xmlpath2:String;
public var _xml:XML;
private var counter:int=0;
private var xmlRequestArr:Array
public function XMLLoader():void
{
this.xmlRequestArr=new Array()
}
public function loadXML(filepath:String, xmlRef:String):void
{
this.xmlpath2=filepath;
this.xmlRequestArr.push(xmlRef)
this.urlLoader = new URLLoader();
this.urlRequest=new URLRequest(this.xmlpath2);
this.urlLoader.addEventListener(Event.COMPLETE, completeHandler);
this.urlLoader.load(this.urlRequest);
}
private function completeHandler(evt:Event)
{
this._xml=new XML(evt.target.data);
this.dispatchEvent(new CustomEvent(CustomEvent.XMLLoaded,this.xmlRequestArr[this.counter],this._xml));
this.counter++
}
//private function xmlLoadError(e:Event):void {}
} //class
} //package
\ No newline at end of file
diff --git a/com/digitec/cee/XMLReader.as b/com/digitec/cee/XMLReader.as
new file mode 100644
index 0000000..e16b45e
--- /dev/null
+++ b/com/digitec/cee/XMLReader.as
@@ -0,0 +1,129 @@
+/******************************************
+ * @author Maria A. Zamora
+ * @company Digitec Interactive Inc.
+ * @version 0.1
+ * @date 12/14/2010
+ *
+ * This is the xml reader for the CEE application
+ * CS5 version of com.digitec.cee.XMLReader
+ *
+*******************************************/
+package com.digitec.cee
+{
+ import flash.errors.IllegalOperationError;
+
+ public class XMLReader
+ {
+ private var itemArray:Array;
+ private var timeleft:String;
+ private var tabName:String = "";
+ private var moreThan6min:Boolean = true;
+
+ /******************************************************************************************
+ *CONSTRUCTOR - parami
+ ******************************************************************************************/
+ public function XMLReader(){ }
+
+ /******************************************************************************************
+ *READ A XML FILE
+ ******************************************************************************************/
+ public function readXML(itemXML:XML, nholders:int){
+ itemArray = new Array();
+ itemXML.ignoreWhitespace = true;
+ var currentItemNode:XMLList = itemXML.children();
+ var i:Number = 0;
+ var childNode:XML;
+
+ for each (childNode in currentItemNode) {
+ if(childNode.localName() == "Item"){
+ itemArray[i] = new Item();
+ var node:XML;
+ for each (node in childNode.children()) {
+ if (node.localName() == "ItemID") {
+ try{itemArray[i].setID(node.text());
+ }catch(error:IllegalOperationError){ trace("
+ * EaseLookup.find("Strong.easeOut")
+ * EaseLookup.find("strongEaseOut")
+ * EaseLookup.find("strongeaseout")
+ *
+ * You can translate Strings directly when tweening, like this:
+ * TweenLite.to(mc, 1, {x:100, ease:EaseLookup.find(myString)});
+ *
+ * @param $name The name of the easing function, with or without the period and case insensitive (i.e. "Strong.easeOut" or "strongEaseOut")
+ * @return The easing function associated with the name
+ */
+ public static function find($name:String):Function {
+ if (_lookup == null) {
+ buildLookup();
+ }
+ return _lookup[$name.toLowerCase()];
+ }
+
+ /** @private **/
+ private static function buildLookup():void {
+ _lookup = {};
+
+ addInOut(Back, ["back"]);
+ addInOut(Bounce, ["bounce"]);
+ addInOut(Circ, ["circ", "circular"]);
+ addInOut(Cubic, ["cubic"]);
+ addInOut(Elastic, ["elastic"]);
+ addInOut(Expo, ["expo", "exponential"]);
+ addInOut(Linear, ["linear"]);
+ addInOut(Quad, ["quad", "quadratic"]);
+ addInOut(Quart, ["quart","quartic"]);
+ addInOut(Quint, ["quint", "quintic", "strong"]);
+ addInOut(Sine, ["sine"]);
+
+ _lookup["linear.easenone"] = _lookup["lineareasenone"] = Linear.easeNone;
+ }
+
+ /** @private **/
+ private static function addInOut($class:Class, $names:Array):void {
+ var name:String;
+ var i:int = $names.length;
+ while (i-- > 0) {
+ name = $names[i].toLowerCase();
+ _lookup[name + ".easein"] = _lookup[name + "easein"] = $class.easeIn;
+ _lookup[name + ".easeout"] = _lookup[name + "easeout"] = $class.easeOut;
+ _lookup[name + ".easeinout"] = _lookup[name + "easeinout"] = $class.easeInOut;
+ }
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/gs/easing/Elastic.as b/gs/easing/Elastic.as
new file mode 100644
index 0000000..ab50719
--- /dev/null
+++ b/gs/easing/Elastic.as
@@ -0,0 +1,28 @@
+package gs.easing {
+ public class Elastic {
+ private static const _2PI:Number = Math.PI * 2;
+
+ public static function easeIn (t:Number, b:Number, c:Number, d:Number, a:Number = 0, p:Number = 0):Number {
+ var s:Number;
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (!a || a < Math.abs(c)) { a=c; s = p/4; }
+ else s = p/_2PI * Math.asin (c/a);
+ return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*_2PI/p )) + b;
+ }
+ public static function easeOut (t:Number, b:Number, c:Number, d:Number, a:Number = 0, p:Number = 0):Number {
+ var s:Number;
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (!a || a < Math.abs(c)) { a=c; s = p/4; }
+ else s = p/_2PI * Math.asin (c/a);
+ return (a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*_2PI/p ) + c + b);
+ }
+ public static function easeInOut (t:Number, b:Number, c:Number, d:Number, a:Number = 0, p:Number = 0):Number {
+ var s:Number;
+ if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
+ if (!a || a < Math.abs(c)) { a=c; s = p/4; }
+ else s = p/_2PI * Math.asin (c/a);
+ if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*_2PI/p )) + b;
+ return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*_2PI/p )*.5 + c + b;
+ }
+ }
+}
\ No newline at end of file
diff --git a/gs/easing/Expo.as b/gs/easing/Expo.as
new file mode 100644
index 0000000..5364dec
--- /dev/null
+++ b/gs/easing/Expo.as
@@ -0,0 +1,16 @@
+package gs.easing {
+ public class Expo {
+ public static function easeIn(t:Number, b:Number, c:Number, d:Number):Number {
+ return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b - c * 0.001;
+ }
+ public static function easeOut(t:Number, b:Number, c:Number, d:Number):Number {
+ return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
+ }
+ public static function easeInOut(t:Number, b:Number, c:Number, d:Number):Number {
+ if (t==0) return b;
+ if (t==d) return b+c;
+ if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
+ return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
+ }
+ }
+}
\ No newline at end of file
diff --git a/gs/easing/Linear.as b/gs/easing/Linear.as
new file mode 100644
index 0000000..5ebd77d
--- /dev/null
+++ b/gs/easing/Linear.as
@@ -0,0 +1,16 @@
+package gs.easing {
+ public class Linear {
+ public static function easeNone (t:Number, b:Number, c:Number, d:Number):Number {
+ return c*t/d + b;
+ }
+ public static function easeIn (t:Number, b:Number, c:Number, d:Number):Number {
+ return c*t/d + b;
+ }
+ public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number {
+ return c*t/d + b;
+ }
+ public static function easeInOut (t:Number, b:Number, c:Number, d:Number):Number {
+ return c*t/d + b;
+ }
+ }
+}
\ No newline at end of file
diff --git a/gs/easing/Quad.as b/gs/easing/Quad.as
new file mode 100644
index 0000000..ec53d09
--- /dev/null
+++ b/gs/easing/Quad.as
@@ -0,0 +1,14 @@
+package gs.easing {
+ public class Quad {
+ public static function easeIn (t:Number, b:Number, c:Number, d:Number):Number {
+ return c*(t/=d)*t + b;
+ }
+ public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number {
+ return -c *(t/=d)*(t-2) + b;
+ }
+ public static function easeInOut (t:Number, b:Number, c:Number, d:Number):Number {
+ if ((t/=d/2) < 1) return c/2*t*t + b;
+ return -c/2 * ((--t)*(t-2) - 1) + b;
+ }
+ }
+}
\ No newline at end of file
diff --git a/gs/easing/Quart.as b/gs/easing/Quart.as
new file mode 100644
index 0000000..e5ce969
--- /dev/null
+++ b/gs/easing/Quart.as
@@ -0,0 +1,14 @@
+package gs.easing {
+ public class Quart {
+ public static function easeIn (t:Number, b:Number, c:Number, d:Number):Number {
+ return c*(t/=d)*t*t*t + b;
+ }
+ public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number {
+ return -c * ((t=t/d-1)*t*t*t - 1) + b;
+ }
+ public static function easeInOut (t:Number, b:Number, c:Number, d:Number):Number {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
+ return -c/2 * ((t-=2)*t*t*t - 2) + b;
+ }
+ }
+}
\ No newline at end of file
diff --git a/gs/easing/Quint.as b/gs/easing/Quint.as
new file mode 100644
index 0000000..497159a
--- /dev/null
+++ b/gs/easing/Quint.as
@@ -0,0 +1,14 @@
+package gs.easing {
+ public class Quint {
+ public static function easeIn (t:Number, b:Number, c:Number, d:Number):Number {
+ return c*(t/=d)*t*t*t*t + b;
+ }
+ public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number {
+ return c*((t=t/d-1)*t*t*t*t + 1) + b;
+ }
+ public static function easeInOut (t:Number, b:Number, c:Number, d:Number):Number {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
+ return c/2*((t-=2)*t*t*t*t + 2) + b;
+ }
+ }
+}
\ No newline at end of file
diff --git a/gs/easing/Sine.as b/gs/easing/Sine.as
new file mode 100644
index 0000000..ffe0db3
--- /dev/null
+++ b/gs/easing/Sine.as
@@ -0,0 +1,15 @@
+package gs.easing {
+ public class Sine {
+ private static const _HALF_PI:Number = Math.PI / 2;
+
+ public static function easeIn (t:Number, b:Number, c:Number, d:Number):Number {
+ return -c * Math.cos(t/d * _HALF_PI) + c + b;
+ }
+ public static function easeOut (t:Number, b:Number, c:Number, d:Number):Number {
+ return c * Math.sin(t/d * _HALF_PI) + b;
+ }
+ public static function easeInOut (t:Number, b:Number, c:Number, d:Number):Number {
+ return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
+ }
+ }
+}
\ No newline at end of file
diff --git a/gs/easing/Strong.as b/gs/easing/Strong.as
new file mode 100644
index 0000000..b39a2ad
--- /dev/null
+++ b/gs/easing/Strong.as
@@ -0,0 +1,14 @@
+package gs.easing {
+ public class Strong {
+ public static function easeIn(t:Number, b:Number, c:Number, d:Number):Number {
+ return c*(t/=d)*t*t*t*t + b;
+ }
+ public static function easeOut(t:Number, b:Number, c:Number, d:Number):Number {
+ return c*((t=t/d-1)*t*t*t*t + 1) + b;
+ }
+ public static function easeInOut(t:Number, b:Number, c:Number, d:Number):Number {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
+ return c/2*((t-=2)*t*t*t*t + 2) + b;
+ }
+ }
+}
diff --git a/gs/easing/easing_readme.txt b/gs/easing/easing_readme.txt
new file mode 100644
index 0000000..4b99688
--- /dev/null
+++ b/gs/easing/easing_readme.txt
@@ -0,0 +1,21 @@
+This readme file applies to all eases in this directory EXCEPT the CustomEase.
+
+============================================================================================
+ Easing Equations
+ (c) 2003 Robert Penner, all rights reserved.
+ This work is subject to the terms in http://www.robertpenner.com/easing_terms_of_use.html.
+============================================================================================
+
+TERMS OF USE - EASING EQUATIONS
+
+Open source under the BSD License.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/gs/events/TweenEvent.as b/gs/events/TweenEvent.as
new file mode 100644
index 0000000..29167fe
--- /dev/null
+++ b/gs/events/TweenEvent.as
@@ -0,0 +1,35 @@
+/*
+VERSION: 0.9
+DATE: 7/15/2008
+ACTIONSCRIPT VERSION: 3.0 (Requires Flash Player 9)
+DESCRIPTION:
+ Used for Event dispatching from the AS3 version of TweenMax (www.tweenmax.com)
+
+
+CODED BY: Jack Doyle, jack@greensock.com
+Copyright 2008, GreenSock (This work is subject to the terms at http://www.greensock.com/terms_of_use.html.)
+*/
+
+package gs.events {
+ import flash.events.Event;
+
+ public class TweenEvent extends Event {
+ public static const version:Number = 0.9;
+ public static const START:String = "start";
+ public static const UPDATE:String = "update";
+ public static const COMPLETE:String = "complete";
+
+ public var info:Object;
+
+ public function TweenEvent($type:String, $info:Object = null, $bubbles:Boolean = false, $cancelable:Boolean = false){
+ super($type, $bubbles, $cancelable);
+ this.info = $info;
+ }
+
+ public override function clone():Event{
+ return new TweenEvent(this.type, this.info, this.bubbles, this.cancelable);
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/gs/plugins/AutoAlphaPlugin.as b/gs/plugins/AutoAlphaPlugin.as
new file mode 100644
index 0000000..96b2295
--- /dev/null
+++ b/gs/plugins/AutoAlphaPlugin.as
@@ -0,0 +1,73 @@
+/*
+VERSION: 1.0
+DATE: 1/8/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Use autoAlpha instead of the alpha property to gain the additional feature of toggling
+ the "visible" property to false if/when alpha reaches 0. It will also toggle visible
+ to true before the tween starts if the value of autoAlpha is greater than zero.
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([AutoAlphaPlugin]); //only do this once in your SWF to activate the plugin (it is already activated in TweenLite and TweenMax by default)
+
+ TweenLite.to(mc, 1, {autoAlpha:0});
+
+BYTES ADDED TO SWF: 339 (0.3kb) (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+
+ import gs.*;
+
+ public class AutoAlphaPlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.0;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ protected var _tweenVisible:Boolean;
+ protected var _visible:Boolean;
+ protected var _tween:TweenLite;
+ protected var _target:Object;
+
+ public function AutoAlphaPlugin() {
+ super();
+ this.propName = "autoAlpha";
+ this.overwriteProps = ["alpha","visible"];
+ this.onComplete = onCompleteTween;
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ _target = $target;
+ _tween = $tween;
+ _visible = Boolean($value != 0);
+ _tweenVisible = true;
+ addTween($target, "alpha", $target.alpha, $value, "alpha");
+ return true;
+ }
+
+ override public function killProps($lookup:Object):void {
+ super.killProps($lookup);
+ _tweenVisible = !Boolean("visible" in $lookup);
+ }
+
+ public function onCompleteTween():void {
+ if (_tweenVisible && _tween.vars.runBackwards != true && _tween.ease == _tween.vars.ease) { //_tween.ease == _tween.vars.ease checks to make sure the tween wasn't reversed with a TweenGroup
+ _target.visible = _visible;
+ }
+ }
+
+ override public function set changeFactor($n:Number):void {
+ updateTweens($n);
+ if (_target.visible != true && _tweenVisible) {
+ _target.visible = true;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/BevelFilterPlugin.as b/gs/plugins/BevelFilterPlugin.as
new file mode 100644
index 0000000..d7cad27
--- /dev/null
+++ b/gs/plugins/BevelFilterPlugin.as
@@ -0,0 +1,62 @@
+/*
+VERSION: 1.0
+DATE: 1/8/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Tweens a BevelFilter. The following properties are available (you only need to define the ones you want to tween):
+ - distance : Number [0]
+ - angle : Number [0]
+ - highlightColor : uint [0xFFFFFF]
+ - highlightAlpha : Number [0.5]
+ - shadowColor : uint [0x000000]
+ - shadowAlpha :Number [0.5]
+ - blurX : Number [2]
+ - blurY : Number [2]
+ - strength : Number [0]
+ - quality : uint [2]
+ - index : uint
+ - addFilter : Boolean [false]
+ - remove : Boolean [false]
+
+ Set remove to true if you want the filter to be removed when the tween completes.
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([BevelFilterPlugin]); //only do this once in your SWF to activate the plugin in TweenLite (it is already activated in TweenMax by default)
+
+ TweenLite.to(mc, 1, {bevelFilter:{blurX:10, blurY:10, distance:6, angle:45, strength:1}});
+
+
+BYTES ADDED TO SWF: 166 (0.16kb) (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.filters.*;
+ import flash.display.*;
+
+ import gs.*;
+
+ public class BevelFilterPlugin extends FilterPlugin {
+ public static const VERSION:Number = 1.0;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ public function BevelFilterPlugin() {
+ super();
+ this.propName = "bevelFilter";
+ this.overwriteProps = ["bevelFilter"];
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ _target = $target;
+ _type = BevelFilter;
+ initFilter($value, new BevelFilter(0, 0, 0xFFFFFF, 0.5, 0x000000, 0.5, 2, 2, 0, $value.quality || 2));
+ return true;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/BezierPlugin.as b/gs/plugins/BezierPlugin.as
new file mode 100644
index 0000000..f5bffe6
--- /dev/null
+++ b/gs/plugins/BezierPlugin.as
@@ -0,0 +1,211 @@
+/*
+VERSION: 1.01
+DATE: 1/22/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Bezier tweening allows you to tween in a non-linear way. For example, you may want to tween
+ a MovieClip's position from the origin (0,0) 500 pixels to the right (500,0) but curve downwards
+ through the middle of the tween. Simply pass as many objects in the bezier array as you'd like,
+ one for each "control point" (see documentation on Flash's curveTo() drawing method for more
+ about how control points work).
+
+ Keep in mind that you can bezier tween ANY properties, not just x/y.
+
+ Also, if you'd like to rotate the target in the direction of the bezier path,
+ use the orientToBeizer special property. In order to alter a rotation property accurately,
+ TweenLite/Max needs 4 pieces of information:
+ 1) Position property 1 (typically "x")
+ 2) Position property 2 (typically "y")
+ 3) Rotational property (typically "rotation")
+ 4) Number of degrees to add (optional - makes it easy to orient your MovieClip properly)
+ The orientToBezier property should be an Array containing one Array for each set of these values.
+ For maximum flexibility, you can pass in any number of arrays inside the container array, one
+ for each rotational property. This can be convenient when working in 3D because you can rotate
+ on multiple axis. If you're doing a standard 2D x/y tween on a bezier, you can simply pass
+ in a boolean value of true and TweenLite/Max will use a typical setup, [["x", "y", "rotation", 0]].
+ Hint: Don't forget the container Array (notice the double outer brackets)
+
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([BezierPlugin]); //only do this once in your SWF to activate the plugin in TweenLite (it is already activated in TweenMax by default)
+
+ TweenLite.to(my_mc, 3, {bezier:[{x:250, y:50}, {x:500, y:0}]}); //makes my_mc travel through 250,50 and end up at 500,0.
+
+
+BYTES ADDED TO SWF: 1215 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import gs.*;
+ import gs.utils.tween.*;
+
+ public class BezierPlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.01;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ protected static const _RAD2DEG:Number = 180 / Math.PI; //precalculate for speed
+
+ protected var _target:Object;
+ protected var _orientData:Array;
+ protected var _orient:Boolean;
+ protected var _future:Object = {}; //used for orientToBezier projections
+ protected var _beziers:Object;
+
+ public function BezierPlugin() {
+ super();
+ this.propName = "bezier"; //name of the special property that the plugin should intercept/manage
+ this.overwriteProps = []; //will be populated in init()
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ if (!($value is Array)) {
+ return false;
+ }
+ init($tween, $value as Array, false);
+ return true;
+ }
+
+ protected function init($tween:TweenLite, $beziers:Array, $through:Boolean):void {
+ _target = $tween.target;
+ if ($tween.exposedVars.orientToBezier == true) {
+ _orientData = [["x", "y", "rotation", 0]];
+ _orient = true;
+ } else if ($tween.exposedVars.orientToBezier is Array) {
+ _orientData = $tween.exposedVars.orientToBezier;
+ _orient = true;
+ }
+ var props:Object = {}, i:int, p:String;
+ for (i = 0; i < $beziers.length; i++) {
+ for (p in $beziers[i]) {
+ if (props[p] == undefined) {
+ props[p] = [$tween.target[p]];
+ }
+ if (typeof($beziers[i][p]) == "number") {
+ props[p].push($beziers[i][p]);
+ } else {
+ props[p].push($tween.target[p] + Number($beziers[i][p])); //relative value
+ }
+ }
+ }
+ for (p in props) {
+ this.overwriteProps[this.overwriteProps.length] = p;
+ if ($tween.exposedVars[p] != undefined) {
+ if (typeof($tween.exposedVars[p]) == "number") {
+ props[p].push($tween.exposedVars[p]);
+ } else {
+ props[p].push($tween.target[p] + Number($tween.exposedVars[p])); //relative value
+ }
+ delete $tween.exposedVars[p]; //prevent TweenLite from creating normal tweens of the bezier properties.
+ for (i = $tween.tweens.length - 1; i > -1; i--) {
+ if ($tween.tweens[i].name == p) {
+ $tween.tweens.splice(i, 1); //delete any normal tweens of the bezier properties.
+ }
+ }
+ }
+ }
+ _beziers = parseBeziers(props, $through);
+ }
+
+ public static function parseBeziers($props:Object, $through:Boolean=false):Object { //$props object should contain a property for each one you'd like bezier paths for. Each property should contain a single Array with the numeric point values (i.e. props.x = [12,50,80] and props.y = [50,97,158]). It'll return a new object with an array of values for each property. The first element in the array is the start value, the second is the control point, and the 3rd is the end value. (i.e. returnObject.x = [[12, 32, 50}, [50, 65, 80]])
+ var i:int, a:Array, b:Object, p:String;
+ var all:Object = {};
+ if ($through) {
+ for (p in $props) {
+ a = $props[p];
+ all[p] = b = [];
+ if (a.length > 2) {
+ b[b.length] = [a[0], a[1] - ((a[2] - a[0]) / 4), a[1]];
+ for (i = 1; i < a.length - 1; i++) {
+ b[b.length] = [a[i], a[i] + (a[i] - b[i - 1][1]), a[i + 1]];
+ }
+ } else {
+ b[b.length] = [a[0], (a[0] + a[1]) / 2, a[1]];
+ }
+ }
+ } else {
+ for (p in $props) {
+ a = $props[p];
+ all[p] = b = [];
+ if (a.length > 3) {
+ b[b.length] = [a[0], a[1], (a[1] + a[2]) / 2];
+ for (i = 2; i < a.length - 2; i++) {
+ b[b.length] = [b[i - 2][2], a[i], (a[i] + a[i + 1]) / 2];
+ }
+ b[b.length] = [b[b.length - 1][2], a[a.length - 2], a[a.length - 1]];
+ } else if (a.length == 3) {
+ b[b.length] = [a[0], a[1], a[2]];
+ } else if (a.length == 2) {
+ b[b.length] = [a[0], (a[0] + a[1]) / 2, a[1]];
+ }
+ }
+ }
+ return all;
+ }
+
+ override public function killProps($lookup:Object):void {
+ for (var p:String in _beziers) {
+ if (p in $lookup) {
+ delete _beziers[p];
+ }
+ }
+ super.killProps($lookup);
+ }
+
+ override public function set changeFactor($n:Number):void {
+ var i:int, p:String, b:Object, t:Number, segments:uint, val:Number, neg:int;
+ if ($n == 1) { //to make sure the end values are EXACTLY what they need to be.
+ for (p in _beziers) {
+ i = _beziers[p].length - 1;
+ _target[p] = _beziers[p][i][2];
+ }
+ } else {
+ for (p in _beziers) {
+ segments = _beziers[p].length;
+ if ($n < 0) {
+ i = 0;
+ } else if ($n >= 1) {
+ i = segments - 1;
+ } else {
+ i = int(segments * $n);
+ }
+ t = ($n - (i * (1 / segments))) * segments;
+ b = _beziers[p][i];
+ if (this.round) {
+ val = b[0] + t * (2 * (1 - t) * (b[1] - b[0]) + t * (b[2] - b[0]));
+ neg = (val < 0) ? -1 : 1;
+ _target[p] = ((val % 1) * neg > 0.5) ? int(val) + neg : int(val); //twice as fast as Math.round()
+ } else {
+ _target[p] = b[0] + t * (2 * (1 - t) * (b[1] - b[0]) + t * (b[2] - b[0]));
+ }
+ }
+ }
+
+ if (_orient) {
+ var oldTarget:Object = _target, oldRound:Boolean = this.round;
+ _target = _future;
+ this.round = false;
+ _orient = false;
+ this.changeFactor = $n + 0.01;
+ _target = oldTarget;
+ this.round = oldRound;
+ _orient = true;
+ var dx:Number, dy:Number, cotb:Array, toAdd:Number;
+ for (i = 0; i < _orientData.length; i++) {
+ cotb = _orientData[i]; //current orientToBezier Array
+ toAdd = cotb[3] || 0;
+ dx = _future[cotb[0]] - _target[cotb[0]];
+ dy = _future[cotb[1]] - _target[cotb[1]];
+ _target[cotb[2]] = Math.atan2(dy, dx) * _RAD2DEG + toAdd;
+ }
+ }
+
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/BezierThroughPlugin.as b/gs/plugins/BezierThroughPlugin.as
new file mode 100644
index 0000000..f844bd8
--- /dev/null
+++ b/gs/plugins/BezierThroughPlugin.as
@@ -0,0 +1,68 @@
+/*
+VERSION: 1.0
+DATE: 1/8/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Identical to bezier except that instead of defining bezier control point values, you
+ define points through which the bezier values should move. This can be more intuitive
+ than using control points. Simply pass as many objects in the bezier Array as you'd like,
+ one for each point through which the values should travel. For example, if you want the
+ curved motion path to travel through the coordinates x:250, y:100 and x:50, y:200 and then
+ end up at 500, 100, you'd do:
+
+ TweenLite.to(mc, 2, {bezierThrough:[{x:250, y:100}, {x:50, y:200}, {x:500, y:200}]});
+
+ Keep in mind that you can bezierThrough tween ANY properties, not just x/y.
+
+ Also, if you'd like to rotate the target in the direction of the bezier path,
+ use the orientToBeizer special property. In order to alter a rotation property accurately,
+ TweenLite/Max needs 4 pieces of information:
+ 1) Position property 1 (typically "x")
+ 2) Position property 2 (typically "y")
+ 3) Rotational property (typically "rotation")
+ 4) Number of degrees to add (optional - makes it easy to orient your MovieClip properly)
+ The orientToBezier property should be an Array containing one Array for each set of these values.
+ For maximum flexibility, you can pass in any number of arrays inside the container array, one
+ for each rotational property. This can be convenient when working in 3D because you can rotate
+ on multiple axis. If you're doing a standard 2D x/y tween on a bezier, you can simply pass
+ in a boolean value of true and TweenLite/Max will use a typical setup, [["x", "y", "rotation", 0]].
+ Hint: Don't forget the container Array (notice the double outer brackets)
+
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([BezierThroughPlugin]); //only do this once in your SWF to activate the plugin in TweenLite (it is already activated in TweenMax by default)
+
+ TweenLite.to(mc, 2, {bezierThrough:[{x:250, y:100}, {x:50, y:200}, {x:500, y:200}]});
+
+BYTES ADDED TO SWF: 116 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import gs.*;
+
+ public class BezierThroughPlugin extends BezierPlugin {
+ public static const VERSION:Number = 1.0;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ public function BezierThroughPlugin() {
+ super();
+ this.propName = "bezierThrough"; //name of the special property that the plugin should intercept/manage
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ if (!($value is Array)) {
+ return false;
+ }
+ init($tween, $value as Array, true);
+ return true;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/BlurFilterPlugin.as b/gs/plugins/BlurFilterPlugin.as
new file mode 100644
index 0000000..447f7cf
--- /dev/null
+++ b/gs/plugins/BlurFilterPlugin.as
@@ -0,0 +1,54 @@
+/*
+VERSION: 1.0
+DATE: 1/8/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Tweens a BlurFilter. The following properties are available (you only need to define the ones you want to tween):
+ - blurX : Number [0]
+ - blurY : Number [0]
+ - quality : uint [2]
+ - index : uint
+ - addFilter : Boolean [false]
+ - remove : Boolean [false]
+
+ Set remove to true if you want the filter to be removed when the tween completes.
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([BlurFilterPlugin]); //only do this once in your SWF to activate the plugin in TweenLite (it is already activated in TweenMax by default)
+
+ TweenLite.to(mc, 1, {blurFilter:{blurX:10, blurY:10}});
+
+
+BYTES ADDED TO SWF: 156 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.filters.*;
+ import flash.display.*;
+ import gs.*;
+
+ public class BlurFilterPlugin extends FilterPlugin {
+ public static const VERSION:Number = 1.0;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ public function BlurFilterPlugin() {
+ super();
+ this.propName = "blurFilter";
+ this.overwriteProps = ["blurFilter"];
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ _target = $target;
+ _type = BlurFilter;
+ initFilter($value, new BlurFilter(0, 0, $value.quality || 2));
+ return true;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/ColorMatrixFilterPlugin.as b/gs/plugins/ColorMatrixFilterPlugin.as
new file mode 100644
index 0000000..5d5c16b
--- /dev/null
+++ b/gs/plugins/ColorMatrixFilterPlugin.as
@@ -0,0 +1,218 @@
+/*
+VERSION: 1.1
+DATE: 3/20/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ ColorMatrixFilter tweening offers an easy way to tween a DisplayObject's saturation, hue, contrast,
+ brightness, and colorization. The following properties are available (you only need to define the ones you want to tween):
+
+ - colorize : uint (colorizing a DisplayObject makes it look as though you're seeing it through a colored piece of glass whereas tinting it makes every pixel exactly that color. You can control the amount of colorization using the "amount" value where 1 is full strength, 0.5 is half-strength, and 0 has no colorization effect.)
+ - amount : Number [1] (only used in conjunction with "colorize")
+ - contrast : Number (1 is normal contrast, 0 has no contrast, and 2 is double the normal contrast, etc.)
+ - saturation : Number (1 is normal saturation, 0 makes the DisplayObject look black & white, and 2 would be double the normal saturation)
+ - hue : Number (changes the hue of every pixel. Think of it as degrees, so 180 would be rotating the hue to be exactly opposite as normal, 360 would be the same as 0, etc.)
+ - brightness : Number (1 is normal brightness, 0 is much darker than normal, and 2 is twice the normal brightness, etc.)
+ - threshold : Number (number from 0 to 255 that controls the threshold of where the pixels turn white or black)
+ - matrix : Array (If you already have a matrix from a ColorMatrixFilter that you want to tween to, pass it in with the "matrix" property. This makes it possible to match effects created in the Flash IDE.)
+ - index : Number (only necessary if you already have a filter applied and you want to target it with the tween.)
+ - addFilter : Boolean [false]
+ - remove : Boolean [false] (Set remove to true if you want the filter to be removed when the tween completes.)
+
+ HINT: If you'd like to match the ColorMatrixFilter values you created in the Flash IDE on a particular object, you can get its matrix like this:
+
+ import flash.display.*;
+ import flash.filters.*;
+
+ function getColorMatrix($mc:DisplayObject):Array {
+ var f:Array = $mc.filters, i:uint;
+ for (i = 0; i < f.length; i++) {
+ if (f[i] is ColorMatrixFilter) {
+ return f[i].matrix;
+ }
+ }
+ return null;
+ }
+
+ var myOriginalMatrix:Array = getColorMatrix(my_mc); //store it so you can tween back to it anytime like TweenMax.to(my_mc, 1, {colorMatrixFilter:{matrix:myOriginalMatrix}});
+
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([ColorMatrixFilterPlugin]); //only do this once in your SWF to activate the plugin in TweenLite (it is already activated in TweenMax by default)
+
+ TweenLite.to(mc, 1, {colorMatrixFilter:{colorize:0xFF0000}});
+
+
+BYTES ADDED TO SWF: 1447 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+ import flash.filters.*;
+
+ import gs.*;
+
+ public class ColorMatrixFilterPlugin extends FilterPlugin {
+ public static const VERSION:Number = 1.1;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ protected static var _idMatrix:Array = [1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];
+ protected static var _lumR:Number = 0.212671; //Red constant - used for a few color matrix filter functions
+ protected static var _lumG:Number = 0.715160; //Green constant - used for a few color matrix filter functions
+ protected static var _lumB:Number = 0.072169; //Blue constant - used for a few color matrix filter functions
+
+ protected var _matrix:Array;
+ protected var _matrixTween:EndArrayPlugin;
+
+ public function ColorMatrixFilterPlugin() {
+ super();
+ this.propName = "colorMatrixFilter";
+ this.overwriteProps = ["colorMatrixFilter"];
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ _target = $target;
+ _type = ColorMatrixFilter;
+ var cmf:Object = $value;
+ initFilter({remove:$value.remove, index:$value.index, addFilter:$value.addFilter}, new ColorMatrixFilter(_idMatrix.slice()));
+ _matrix = ColorMatrixFilter(_filter).matrix;
+ var endMatrix:Array = [];
+ if (cmf.matrix != null && (cmf.matrix is Array)) {
+ endMatrix = cmf.matrix;
+ } else {
+ if (cmf.relative == true) {
+ endMatrix = _matrix.slice();
+ } else {
+ endMatrix = _idMatrix.slice();
+ }
+ endMatrix = setBrightness(endMatrix, cmf.brightness);
+ endMatrix = setContrast(endMatrix, cmf.contrast);
+ endMatrix = setHue(endMatrix, cmf.hue);
+ endMatrix = setSaturation(endMatrix, cmf.saturation);
+ endMatrix = setThreshold(endMatrix, cmf.threshold);
+ if (!isNaN(cmf.colorize)) {
+ endMatrix = colorize(endMatrix, cmf.colorize, cmf.amount);
+ }
+ }
+ _matrixTween = new EndArrayPlugin();
+ _matrixTween.init(_matrix, endMatrix);
+ return true;
+ }
+
+ override public function set changeFactor($n:Number):void {
+ _matrixTween.changeFactor = $n;
+ ColorMatrixFilter(_filter).matrix = _matrix;
+ super.changeFactor = $n;
+ }
+
+
+//---- MATRIX OPERATIONS --------------------------------------------------------------------------------
+
+ public static function colorize($m:Array, $color:Number, $amount:Number = 1):Array {
+ if (isNaN($color)) {
+ return $m;
+ } else if (isNaN($amount)) {
+ $amount = 1;
+ }
+ var r:Number = (($color >> 16) & 0xff) / 255;
+ var g:Number = (($color >> 8) & 0xff) / 255;
+ var b:Number = ($color & 0xff) / 255;
+ var inv:Number = 1 - $amount;
+ var temp:Array = [inv + $amount * r * _lumR, $amount * r * _lumG, $amount * r * _lumB, 0, 0,
+ $amount * g * _lumR, inv + $amount * g * _lumG, $amount * g * _lumB, 0, 0,
+ $amount * b * _lumR, $amount * b * _lumG, inv + $amount * b * _lumB, 0, 0,
+ 0, 0, 0, 1, 0];
+ return applyMatrix(temp, $m);
+ }
+
+ public static function setThreshold($m:Array, $n:Number):Array {
+ if (isNaN($n)) {
+ return $m;
+ }
+ var temp:Array = [_lumR * 256, _lumG * 256, _lumB * 256, 0, -256 * $n,
+ _lumR * 256, _lumG * 256, _lumB * 256, 0, -256 * $n,
+ _lumR * 256, _lumG * 256, _lumB * 256, 0, -256 * $n,
+ 0, 0, 0, 1, 0];
+ return applyMatrix(temp, $m);
+ }
+
+ public static function setHue($m:Array, $n:Number):Array {
+ if (isNaN($n)) {
+ return $m;
+ }
+ $n *= Math.PI / 180;
+ var c:Number = Math.cos($n);
+ var s:Number = Math.sin($n);
+ var temp:Array = [(_lumR + (c * (1 - _lumR))) + (s * (-_lumR)), (_lumG + (c * (-_lumG))) + (s * (-_lumG)), (_lumB + (c * (-_lumB))) + (s * (1 - _lumB)), 0, 0, (_lumR + (c * (-_lumR))) + (s * 0.143), (_lumG + (c * (1 - _lumG))) + (s * 0.14), (_lumB + (c * (-_lumB))) + (s * -0.283), 0, 0, (_lumR + (c * (-_lumR))) + (s * (-(1 - _lumR))), (_lumG + (c * (-_lumG))) + (s * _lumG), (_lumB + (c * (1 - _lumB))) + (s * _lumB), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1];
+ return applyMatrix(temp, $m);
+ }
+
+ public static function setBrightness($m:Array, $n:Number):Array {
+ if (isNaN($n)) {
+ return $m;
+ }
+ $n = ($n * 100) - 100;
+ return applyMatrix([1,0,0,0,$n,
+ 0,1,0,0,$n,
+ 0,0,1,0,$n,
+ 0,0,0,1,0,
+ 0,0,0,0,1], $m);
+ }
+
+ public static function setSaturation($m:Array, $n:Number):Array {
+ if (isNaN($n)) {
+ return $m;
+ }
+ var inv:Number = 1 - $n;
+ var r:Number = inv * _lumR;
+ var g:Number = inv * _lumG;
+ var b:Number = inv * _lumB;
+ var temp:Array = [r + $n, g , b , 0, 0,
+ r , g + $n, b , 0, 0,
+ r , g , b + $n, 0, 0,
+ 0 , 0 , 0 , 1, 0];
+ return applyMatrix(temp, $m);
+ }
+
+ public static function setContrast($m:Array, $n:Number):Array {
+ if (isNaN($n)) {
+ return $m;
+ }
+ $n += 0.01;
+ var temp:Array = [$n,0,0,0,128 * (1 - $n),
+ 0,$n,0,0,128 * (1 - $n),
+ 0,0,$n,0,128 * (1 - $n),
+ 0,0,0,1,0];
+ return applyMatrix(temp, $m);
+ }
+
+ public static function applyMatrix($m:Array, $m2:Array):Array {
+ if (!($m is Array) || !($m2 is Array)) {
+ return $m2;
+ }
+ var temp:Array = [], i:int = 0, z:int = 0, y:int, x:int;
+ for (y = 0; y < 4; y++) {
+ for (x = 0; x < 5; x++) {
+ if (x == 4) {
+ z = $m[i + 4];
+ } else {
+ z = 0;
+ }
+ temp[i + x] = $m[i] * $m2[x] +
+ $m[i+1] * $m2[x + 5] +
+ $m[i+2] * $m2[x + 10] +
+ $m[i+3] * $m2[x + 15] +
+ z;
+ }
+ i += 5;
+ }
+ return temp;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/ColorTransformPlugin.as b/gs/plugins/ColorTransformPlugin.as
new file mode 100644
index 0000000..58dc9a7
--- /dev/null
+++ b/gs/plugins/ColorTransformPlugin.as
@@ -0,0 +1,100 @@
+/*
+VERSION: 1.01
+DATE: 1/29/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Ever wanted to tween ColorTransform properties of a DisplayObject to do advanced effects like overexposing, altering
+ the brightness or setting the percent/amount of tint? Or maybe you wanted to tween individual ColorTransform
+ properties like redMultiplier, redOffset, blueMultiplier, blueOffset, etc. This class gives you an easy way to
+ do just that.
+
+ PROPERTIES:
+ - tint (or color) : uint - Color of the tint. Use a hex value, like 0xFF0000 for red.
+ - tintAmount : Number - Number between 0 and 1. Works with the "tint" property and indicats how much of an effect the tint should have. 0 makes the tint invisible, 0.5 is halfway tinted, and 1 is completely tinted.
+ - brightness : Number - Number between 0 and 2 where 1 is normal brightness, 0 is completely dark/black, and 2 is completely bright/white
+ - exposure : Number - Number between 0 and 2 where 1 is normal exposure, 0, is completely underexposed, and 2 is completely overexposed. Overexposing an object is different then changing the brightness - it seems to almost bleach the image and looks more dynamic and interesting (subjectively speaking).
+ - redOffset : Number
+ - greenOffset : Number
+ - blueOffset : Number
+ - alphaOffset : Number
+ - redMultiplier : Number
+ - greenMultiplier : Number
+ - blueMultiplier : Number
+ - alphaMultiplier : Number
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([ColorTransformPlugin]); //only do this once in your SWF to activate the plugin (it is already activated in TweenLite and TweenMax by default)
+
+ TweenLite.to(mc, 1, {colorTransform:{tint:0xFF0000, tintAmount:0.5});
+
+
+BYTES ADDED TO SWF: 371 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+ import flash.geom.ColorTransform;
+
+ import gs.*;
+
+ public class ColorTransformPlugin extends TintPlugin {
+ public static const VERSION:Number = 1.01;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ public function ColorTransformPlugin() {
+ super();
+ this.propName = "colorTransform";
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ if (!($target is DisplayObject)) {
+ return false;
+ }
+ var end:ColorTransform = $target.transform.colorTransform;
+ if ($value.isTV == true) {
+ $value = $value.exposedVars; //for compatibility with TweenLiteVars and TweenMaxVars
+ }
+ for (var p:String in $value) {
+ if (p == "tint" || p == "color") {
+ if ($value[p] != null) {
+ end.color = int($value[p]);
+ }
+ } else if (p == "tintAmount" || p == "exposure" || p == "brightness") {
+ //handle this later...
+ } else {
+ end[p] = $value[p];
+ }
+ }
+
+ if (!isNaN($value.tintAmount)) {
+ var ratio:Number = $value.tintAmount / (1 - ((end.redMultiplier + end.greenMultiplier + end.blueMultiplier) / 3));
+ end.redOffset *= ratio;
+ end.greenOffset *= ratio;
+ end.blueOffset *= ratio;
+ end.redMultiplier = end.greenMultiplier = end.blueMultiplier = 1 - $value.tintAmount;
+ } else if (!isNaN($value.exposure)) {
+ end.redOffset = end.greenOffset = end.blueOffset = 255 * ($value.exposure - 1);
+ end.redMultiplier = end.greenMultiplier = end.blueMultiplier = 1;
+ } else if (!isNaN($value.brightness)) {
+ end.redOffset = end.greenOffset = end.blueOffset = Math.max(0, ($value.brightness - 1) * 255);
+ end.redMultiplier = end.greenMultiplier = end.blueMultiplier = 1 - Math.abs($value.brightness - 1);
+ }
+
+ if ($tween.exposedVars.alpha != undefined && $value.alphaMultiplier == undefined) {
+ end.alphaMultiplier = $tween.exposedVars.alpha;
+ $tween.killVars({alpha:1});
+ }
+
+ init($target as DisplayObject, end);
+
+ return true;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/DropShadowFilterPlugin.as b/gs/plugins/DropShadowFilterPlugin.as
new file mode 100644
index 0000000..82dea72
--- /dev/null
+++ b/gs/plugins/DropShadowFilterPlugin.as
@@ -0,0 +1,63 @@
+/*
+VERSION: 1.0
+DATE: 1/8/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Tweens a DropShadowFilter. The following properties are available (you only need to define the ones you want to tween):
+
+ - distance : Number [0]
+ - angle : Number [45]
+ - color : uint [0x000000]
+ - alpha :Number [0]
+ - blurX : Number [0]
+ - blurY : Number [0]
+ - strength : Number [1]
+ - quality : uint [2]
+ - inner : Boolean [false]
+ - knockout : Boolean [false]
+ - hideObject : Boolean [false]
+ - index : uint
+ - addFilter : Boolean [false]
+ - remove : Boolean [false]
+
+ Set remove to true if you want the filter to be removed when the tween completes.
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([DropShadowFilterPlugin]); //only do this once in your SWF to activate the plugin in TweenLite (it is already activated in TweenMax by default)
+
+ TweenLite.to(mc, 1, {dropShadowFilter:{blurX:5, blurY:5, distance:5, alpha:0.6}});
+
+
+BYTES ADDED TO SWF: 184 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.filters.*;
+ import flash.display.*;
+ import gs.*;
+
+ public class DropShadowFilterPlugin extends FilterPlugin {
+ public static const VERSION:Number = 1.0;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ public function DropShadowFilterPlugin() {
+ super();
+ this.propName = "dropShadowFilter";
+ this.overwriteProps = ["dropShadowFilter"];
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ _target = $target;
+ _type = DropShadowFilter;
+ initFilter($value, new DropShadowFilter(0, 45, 0x000000, 0, 0, 0, 1, $value.quality || 2, $value.inner, $value.knockout, $value.hideObject));
+ return true;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/EndArrayPlugin.as b/gs/plugins/EndArrayPlugin.as
new file mode 100644
index 0000000..5a2cef0
--- /dev/null
+++ b/gs/plugins/EndArrayPlugin.as
@@ -0,0 +1,80 @@
+/*
+VERSION: 1.01
+DATE: 1/10/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Tweens numbers in an Array.
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([EndArrayPlugin]); //only do this once in your SWF to activate the plugin (it is already activated in TweenLite and TweenMax by default)
+
+ var myArray:Array = [1,2,3,4];
+ TweenMax.to(myArray, 1.5, {endArray:[10,20,30,40]});
+
+
+BYTES ADDED TO SWF: 278 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+
+ import gs.*;
+ import gs.utils.tween.*;
+
+ public class EndArrayPlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.01;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ protected var _a:Array;
+ protected var _info:Array = [];
+
+ public function EndArrayPlugin() {
+ super();
+ this.propName = "endArray"; //name of the special property that the plugin should intercept/manage
+ this.overwriteProps = ["endArray"];
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ if (!($target is Array) || !($value is Array)) {
+ return false;
+ }
+ init($target as Array, $value);
+ return true;
+ }
+
+ public function init($start:Array, $end:Array):void {
+ _a = $start;
+ for (var i:int = $end.length - 1; i > -1; i--) {
+ if ($start[i] != $end[i] && $start[i] != null) {
+ _info[_info.length] = new ArrayTweenInfo(i, _a[i], $end[i] - _a[i]);
+ }
+ }
+ }
+
+ override public function set changeFactor($n:Number):void {
+ var i:int, ti:ArrayTweenInfo;
+ if (this.round) {
+ var val:Number, neg:int;
+ for (i = _info.length - 1; i > -1; i--) {
+ ti = _info[i];
+ val = ti.start + (ti.change * $n);
+ neg = (val < 0) ? -1 : 1;
+ _a[ti.index] = ((val % 1) * neg > 0.5) ? int(val) + neg : int(val); //twice as fast as Math.round()
+ }
+ } else {
+ for (i = _info.length - 1; i > -1; i--) {
+ ti = _info[i];
+ _a[ti.index] = ti.start + (ti.change * $n);
+ }
+ }
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/FastTransformPlugin.as b/gs/plugins/FastTransformPlugin.as
new file mode 100644
index 0000000..7931f71
--- /dev/null
+++ b/gs/plugins/FastTransformPlugin.as
@@ -0,0 +1,129 @@
+/*
+VERSION: 1.02
+DATE: 2/8/2009
+ACTIONSCRIPT VERSION: 3.0
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Slightly faster way to change a DisplayObject's x, y, width, height, scaleX, scaleY, and/or rotation value(s). You'd likely
+ only see a difference if/when tweening very large quantities of objects.
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([FastTransformPlugin]); //only do this once in your SWF to activate the plugin
+
+ TweenLite.to(mc, 1, {fastTransform:{x:50, y:300, width:200, height:30}});
+
+
+
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+
+ import gs.*;
+
+ public class FastTransformPlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.02;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ protected var _target:DisplayObject;
+ protected var xStart:Number;
+ protected var xChange:Number = 0;
+ protected var yStart:Number;
+ protected var yChange:Number = 0;
+ protected var widthStart:Number;
+ protected var widthChange:Number = 0;
+ protected var heightStart:Number;
+ protected var heightChange:Number = 0;
+ protected var scaleXStart:Number;
+ protected var scaleXChange:Number = 0;
+ protected var scaleYStart:Number;
+ protected var scaleYChange:Number = 0;
+ protected var rotationStart:Number;
+ protected var rotationChange:Number = 0;
+
+
+ public function FastTransformPlugin() {
+ super();
+ this.propName = "fastTransform";
+ this.overwriteProps = [];
+ }
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ _target = $target as DisplayObject;
+ if ("x" in $value) {
+ xStart = _target.x;
+ xChange = (typeof($value.x) == "number") ? $value.x - _target.x : Number($value.x);
+ this.overwriteProps[this.overwriteProps.length] = "x";
+ }
+ if ("y" in $value) {
+ yStart = _target.y;
+ yChange = (typeof($value.y) == "number") ? $value.y - _target.y : Number($value.y);
+ this.overwriteProps[this.overwriteProps.length] = "y";
+ }
+ if ("width" in $value) {
+ widthStart = _target.width;
+ widthChange = (typeof($value.width) == "number") ? $value.width - _target.width : Number($value.width);
+ this.overwriteProps[this.overwriteProps.length] = "width";
+ }
+ if ("height" in $value) {
+ heightStart = _target.height;
+ heightChange = (typeof($value.height) == "number") ? $value.height - _target.height : Number($value.height);
+ this.overwriteProps[this.overwriteProps.length] = "height";
+ }
+ if ("scaleX" in $value) {
+ scaleXStart = _target.scaleX;
+ scaleXChange = (typeof($value.scaleX) == "number") ? $value.scaleX - _target.scaleX : Number($value.scaleX);
+ this.overwriteProps[this.overwriteProps.length] = "scaleX";
+ }
+ if ("scaleY" in $value) {
+ scaleYStart = _target.scaleY;
+ scaleYChange = (typeof($value.scaleY) == "number") ? $value.scaleY - _target.scaleY : Number($value.scaleY);
+ this.overwriteProps[this.overwriteProps.length] = "scaleY";
+ }
+ if ("rotation" in $value) {
+ rotationStart = _target.rotation;
+ rotationChange = (typeof($value.rotation) == "number") ? $value.rotation - _target.rotation : Number($value.rotation);
+ this.overwriteProps[this.overwriteProps.length] = "rotation";
+ }
+ return true;
+ }
+
+ override public function killProps($lookup:Object):void {
+ for (var p:String in $lookup) {
+ if (p + "Change" in this && !isNaN(this[p + "Change"])) {
+ this[p + "Change"] = 0;
+ }
+ }
+ super.killProps($lookup);
+ }
+
+ override public function set changeFactor($n:Number):void {
+ if (xChange != 0) {
+ _target.x = xStart + ($n * xChange);
+ }
+ if (yChange != 0) {
+ _target.y = yStart + ($n * yChange);
+ }
+ if (widthChange != 0) {
+ _target.width = widthStart + ($n * widthChange);
+ }
+ if (heightChange != 0) {
+ _target.height = heightStart + ($n * heightChange);
+ }
+ if (scaleXChange != 0) {
+ _target.scaleX = scaleXStart + ($n * scaleXChange);
+ }
+ if (scaleYChange != 0) {
+ _target.scaleY = scaleYStart + ($n * scaleYChange);
+ }
+ if (rotationChange != 0) {
+ _target.rotation = rotationStart + ($n * rotationChange);
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/FilterPlugin.as b/gs/plugins/FilterPlugin.as
new file mode 100644
index 0000000..cf097bd
--- /dev/null
+++ b/gs/plugins/FilterPlugin.as
@@ -0,0 +1,120 @@
+/*
+VERSION: 1.03
+DATE: 1/24/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Base class for all filter plugins (like BlurFilter, colorMatrixFilter, etc.). Handles common routines.
+
+USAGE:
+ filter plugins extend this class.
+
+
+BYTES ADDED TO SWF: 672 (1kb) (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+ import flash.filters.*;
+
+ import gs.*;
+ import gs.utils.tween.TweenInfo;
+
+ public class FilterPlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.03;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ protected var _target:Object;
+ protected var _type:Class;
+ protected var _filter:BitmapFilter;
+ protected var _index:int;
+ protected var _remove:Boolean;
+
+ public function FilterPlugin() {
+ super();
+ }
+
+ protected function initFilter($props:Object, $default:BitmapFilter):void {
+ var filters:Array = _target.filters, p:String, i:int, colorTween:HexColorsPlugin;
+ _index = -1;
+ if ($props.index != null) {
+ _index = $props.index;
+ } else {
+ for (i = filters.length - 1; i > -1; i--) {
+ if (filters[i] is _type) {
+ _index = i;
+ break;
+ }
+ }
+ }
+ if (_index == -1 || filters[_index] == null || $props.addFilter == true) {
+ _index = ($props.index != null) ? $props.index : filters.length;
+ filters[_index] = $default;
+ _target.filters = filters;
+ }
+ _filter = filters[_index];
+
+ _remove = Boolean($props.remove == true);
+ if (_remove) {
+ this.onComplete = onCompleteTween;
+ }
+ var props:Object = ($props.isTV == true) ? $props.exposedVars : $props; //accommodates TweenLiteVars and TweenMaxVars
+ for (p in props) {
+ if (!(p in _filter) || _filter[p] == props[p] || p == "remove" || p == "index" || p == "addFilter") {
+ //ignore
+ } else {
+ if (p == "color" || p == "highlightColor" || p == "shadowColor") {
+ colorTween = new HexColorsPlugin();
+ colorTween.initColor(_filter, p, _filter[p], props[p]);
+ _tweens[_tweens.length] = new TweenInfo(colorTween, "changeFactor", 0, 1, p, false);
+ } else if (p == "quality" || p == "inner" || p == "knockout" || p == "hideObject") {
+ _filter[p] = props[p];
+ } else {
+ addTween(_filter, p, _filter[p], props[p], p);
+ }
+ }
+ }
+ }
+
+ public function onCompleteTween():void {
+ if (_remove) {
+ var i:int, filters:Array = _target.filters;
+ if (!(filters[_index] is _type)) { //a filter may have been added or removed since the tween began, changing the index.
+ for (i = filters.length - 1; i > -1; i--) {
+ if (filters[i] is _type) {
+ filters.splice(i, 1);
+ break;
+ }
+ }
+ } else {
+ filters.splice(_index, 1);
+ }
+ _target.filters = filters;
+ }
+ }
+
+ override public function set changeFactor($n:Number):void {
+ var i:int, ti:TweenInfo, filters:Array = _target.filters;
+ for (i = _tweens.length - 1; i > -1; i--) {
+ ti = _tweens[i];
+ ti.target[ti.property] = ti.start + (ti.change * $n);
+ }
+
+ if (!(filters[_index] is _type)) { //a filter may have been added or removed since the tween began, changing the index.
+ _index = filters.length - 1; //default (in case it was removed)
+ for (i = filters.length - 1; i > -1; i--) {
+ if (filters[i] is _type) {
+ _index = i;
+ break;
+ }
+ }
+ }
+ filters[_index] = _filter;
+ _target.filters = filters;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/FrameLabelPlugin.as b/gs/plugins/FrameLabelPlugin.as
new file mode 100644
index 0000000..0d667f9
--- /dev/null
+++ b/gs/plugins/FrameLabelPlugin.as
@@ -0,0 +1,58 @@
+/*
+VERSION: 1.01
+DATE: 2/23/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Tweens a MovieClip to a particular frame label
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([FrameLabelPlugin]); //only do this once in your SWF to activate the plugin in TweenLite (it is already activated in TweenMax by default)
+
+ TweenLite.to(mc, 1, {frameLabel:"myLabel"});
+
+
+BYTES ADDED TO SWF: 222 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+ import gs.*;
+ import gs.plugins.*;
+
+ public class FrameLabelPlugin extends FramePlugin {
+ public static const VERSION:Number = 1.01;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ public function FrameLabelPlugin() {
+ super();
+ this.propName = "frameLabel";
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ if (!$tween.target is MovieClip) {
+ return false;
+ }
+ _target = $target as MovieClip;
+ this.frame = _target.currentFrame;
+ var labels:Array = _target.currentLabels, label:String = $value, endFrame:int = _target.currentFrame, i:int;
+ for (i = labels.length - 1; i > -1; i--) {
+ if (labels[i].name == label) {
+ endFrame = labels[i].frame;
+ break;
+ }
+ }
+ if (this.frame != endFrame) {
+ addTween(this, "frame", this.frame, endFrame, "frame");
+ }
+ return true;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/FramePlugin.as b/gs/plugins/FramePlugin.as
new file mode 100644
index 0000000..2ce4752
--- /dev/null
+++ b/gs/plugins/FramePlugin.as
@@ -0,0 +1,58 @@
+/*
+VERSION: 1.01
+DATE: 2/23/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Tweens a MovieClip to a particular frame number
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([FrameLabelPlugin]); //only do this once in your SWF to activate the plugin (it is already activated in TweenLite and TweenMax by default)
+
+ TweenLite.to(mc, 1, {frame:125});
+
+
+BYTES ADDED TO SWF: 218 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+ import gs.*;
+
+ public class FramePlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.01;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ public var frame:int;
+ protected var _target:MovieClip;
+
+ public function FramePlugin() {
+ super();
+ this.propName = "frame";
+ this.overwriteProps = ["frame"];
+ this.round = true;
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ if (!($target is MovieClip) || isNaN($value)) {
+ return false;
+ }
+ _target = $target as MovieClip;
+ this.frame = _target.currentFrame;
+ addTween(this, "frame", this.frame, $value, "frame");
+ return true;
+ }
+
+ override public function set changeFactor($n:Number):void {
+ updateTweens($n);
+ _target.gotoAndStop(this.frame);
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/GlowFilterPlugin.as b/gs/plugins/GlowFilterPlugin.as
new file mode 100644
index 0000000..bb38a89
--- /dev/null
+++ b/gs/plugins/GlowFilterPlugin.as
@@ -0,0 +1,59 @@
+/*
+VERSION: 1.0
+DATE: 1/8/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Tweens a GlowFilter. The following properties are available (you only need to define the ones you want to tween):
+ - color : uint [0x000000]
+ - alpha :Number [0]
+ - blurX : Number [0]
+ - blurY : Number [0]
+ - strength : Number [1]
+ - quality : uint [2]
+ - inner : Boolean [false]
+ - knockout : Boolean [false]
+ - index : uint
+ - addFilter : Boolean [false]
+ - remove : Boolean [false]
+
+ Set remove to true if you want the filter to be removed when the tween completes.
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([GlowFilterPlugin]); //only do this once in your SWF to activate the plugin in TweenLite (it is already activated in TweenMax by default)
+
+ TweenLite.to(mc, 1, {glowFilter:{color:0x00FF00, blurX:10, blurY:10, strength:1, strength:1}});
+
+
+BYTES ADDED TO SWF: 187 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.filters.*;
+ import flash.display.*;
+ import gs.*;
+
+ public class GlowFilterPlugin extends FilterPlugin {
+ public static const VERSION:Number = 1.0;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ public function GlowFilterPlugin() {
+ super();
+ this.propName = "glowFilter";
+ this.overwriteProps = ["glowFilter"];
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ _target = $target;
+ _type = GlowFilter;
+ initFilter($value, new GlowFilter(0xFFFFFF, 0, 0, 0, $value.strength || 1, $value.quality || 2, $value.inner, $value.knockout));
+ return true;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/HexColorsPlugin.as b/gs/plugins/HexColorsPlugin.as
new file mode 100644
index 0000000..8f4951f
--- /dev/null
+++ b/gs/plugins/HexColorsPlugin.as
@@ -0,0 +1,104 @@
+/*
+VERSION: 1.01
+DATE: 2/5/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Although hex colors are technically numbers, if you try to tween them conventionally,
+ you'll notice that they don't tween smoothly. To tween them properly, the red, green, and
+ blue components must be extracted and tweened independently. The HexColorsPlugin makes it easy.
+ To tween a property of your object that's a hex color to another hex color, just pass a hexColors
+ Object with properties named the same as your object's hex color properties. For example,
+ if myObject has a "myHexColor" property that you'd like to tween to red (0xFF0000) over the
+ course of 2 seconds, you'd do:
+
+ TweenMax.to(myObject, 2, {hexColors:{myHexColor:0xFF0000}});
+
+ You can pass in any number of hexColor properties.
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([HexColorsPlugin]); //only do this once in your SWF to activate the plugin in TweenLite (it is already activated in TweenMax by default)
+
+ TweenLite.to(myObject, 2, {hexColors:{myHexColor:0xFF0000}});
+
+ or if you just want to tween a color and apply it somewhere on every frame, you could do:
+
+ var myColor:Object = {hex:0xFF0000};
+ TweenLite.to(myColor, 2, {hexColors:{hex:0x0000FF}, onUpdate:applyColor});
+ function applyColor():void {
+ mc.graphics.clear();
+ mc.graphics.beginFill(myColor.hex, 1);
+ mc.graphics.drawRect(0, 0, 100, 100);
+ mc.graphics.endFill();
+ }
+
+
+BYTES ADDED TO SWF: 389 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+ import gs.*;
+
+ public class HexColorsPlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.01;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ protected var _colors:Array;
+
+ public function HexColorsPlugin() {
+ super();
+ this.propName = "hexColors";
+ this.overwriteProps = [];
+ _colors = [];
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ for (var p:String in $value) {
+ initColor($target, p, uint($target[p]), uint($value[p]));
+ }
+ return true;
+ }
+
+ public function initColor($target:Object, $propName:String, $start:uint, $end:uint):void {
+ if ($start != $end) {
+ var r:Number = $start >> 16;
+ var g:Number = ($start >> 8) & 0xff;
+ var b:Number = $start & 0xff;
+ _colors[_colors.length] = [$target,
+ $propName,
+ r,
+ ($end >> 16) - r,
+ g,
+ (($end >> 8) & 0xff) - g,
+ b,
+ ($end & 0xff) - b];
+ this.overwriteProps[this.overwriteProps.length] = $propName;
+ }
+ }
+
+ override public function killProps($lookup:Object):void {
+ for (var i:int = _colors.length - 1; i > -1; i--) {
+ if ($lookup[_colors[i][1]] != undefined) {
+ _colors.splice(i, 1);
+ }
+ }
+ super.killProps($lookup);
+ }
+
+ override public function set changeFactor($n:Number):void {
+ var i:int, a:Array;
+ for (i = _colors.length - 1; i > -1; i--) {
+ a = _colors[i];
+ a[0][a[1]] = ((a[2] + ($n * a[3])) << 16 | (a[4] + ($n * a[5])) << 8 | (a[6] + ($n * a[7])));
+ }
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/QuaternionsPlugin.as b/gs/plugins/QuaternionsPlugin.as
new file mode 100644
index 0000000..f51978a
--- /dev/null
+++ b/gs/plugins/QuaternionsPlugin.as
@@ -0,0 +1,135 @@
+/*
+VERSION: 1.0
+DATE: 1/8/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Performs SLERP interpolation between 2 Quaternions. Each Quaternion should have x, y, z, and w properties.
+ Simply pass in an Object containing properties that correspond to your object's quaternion properties.
+ For example, if your myCamera3D has an "orientation" property that's a Quaternion and you want to
+ tween its values to x:1, y:0.5, z:0.25, w:0.5, you could do:
+
+ TweenLite.to(myCamera3D, 2, {quaternions:{orientation:new Quaternion(1, 0.5, 0.25, 0.5)}});
+
+ You can define as many quaternion properties as you want.
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([QuaternionsPlugin]); //only do this once in your SWF to activate the plugin
+
+ TweenLite.to(myCamera3D, 2, {quaternions:{orientation:new Quaternion(1, 0.5, 0.25, 0.5)}});
+
+
+BYTES ADDED TO SWF: 700 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import gs.*;
+
+ public class QuaternionsPlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.0;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ protected static const _RAD2DEG:Number = 180 / Math.PI; //precalculate for speed
+
+ protected var _target:Object;
+ protected var _quaternions:Array = [];
+
+ public function QuaternionsPlugin() {
+ super();
+ this.propName = "quaternions"; //name of the special property that the plugin should intercept/manage
+ this.overwriteProps = [];
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ if ($value == null) {
+ return false;
+ }
+ for (var p:String in $value) {
+ initQuaternion($target[p], $value[p], p);
+ }
+ return true;
+ }
+
+ public function initQuaternion($start:Object, $end:Object, $propName:String):void {
+ var angle:Number, q1:Object, q2:Object, x1:Number, x2:Number, y1:Number, y2:Number, z1:Number, z2:Number, w1:Number, w2:Number, theta:Number;
+ q1 = $start;
+ q2 = $end;
+ x1 = q1.x; x2 = q2.x;
+ y1 = q1.y; y2 = q2.y;
+ z1 = q1.z; z2 = q2.z;
+ w1 = q1.w; w2 = q2.w;
+ angle = x1 * x2 + y1 * y2 + z1 * z2 + w1 * w2;
+ if (angle < 0) {
+ x1 *= -1;
+ y1 *= -1;
+ z1 *= -1;
+ w1 *= -1;
+ angle *= -1;
+ }
+ if ((angle + 1) < 0.000001) {
+ y2 = -y1;
+ x2 = x1;
+ w2 = -w1;
+ z2 = z1;
+ }
+ theta = Math.acos(angle);
+ _quaternions[_quaternions.length] = [q1, $propName, x1, x2, y1, y2, z1, z2, w1, w2, angle, theta, 1 / Math.sin(theta)];
+ this.overwriteProps[this.overwriteProps.length] = $propName;
+ }
+
+ override public function killProps($lookup:Object):void {
+ for (var i:int = _quaternions.length - 1; i > -1; i--) {
+ if ($lookup[_quaternions[i][1]] != undefined) {
+ _quaternions.splice(i, 1);
+ }
+ }
+ super.killProps($lookup);
+ }
+
+ override public function set changeFactor($n:Number):void {
+ var i:int, q:Array, scale:Number, invScale:Number;
+ for (i = _quaternions.length - 1; i > -1; i--) {
+ q = _quaternions[i];
+ if ((q[10] + 1) > 0.000001) {
+ if ((1 - q[10]) >= 0.000001) {
+ scale = Math.sin(q[11] * (1 - $n)) * q[12];
+ invScale = Math.sin(q[11] * $n) * q[12];
+ } else {
+ scale = 1 - $n;
+ invScale = $n;
+ }
+ } else {
+ scale = Math.sin(Math.PI * (0.5 - $n));
+ invScale = Math.sin(Math.PI * $n);
+ }
+ q[0].x = scale * q[2] + invScale * q[3];
+ q[0].y = scale * q[4] + invScale * q[5];
+ q[0].z = scale * q[6] + invScale * q[7];
+ q[0].w = scale * q[8] + invScale * q[9];
+ }
+ /*
+ Array access is faster (though less readable). Here is the key:
+ 0 - target
+ 1 = propName
+ 2 = x1
+ 3 = x2
+ 4 = y1
+ 5 = y2
+ 6 = z1
+ 7 = z2
+ 8 = w1
+ 9 = w2
+ 10 = angle
+ 11 = theta
+ 12 = invTheta
+ */
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/RemoveTintPlugin.as b/gs/plugins/RemoveTintPlugin.as
new file mode 100644
index 0000000..8112c7e
--- /dev/null
+++ b/gs/plugins/RemoveTintPlugin.as
@@ -0,0 +1,39 @@
+/*
+VERSION: 1.01
+DATE: 1/23/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Removes the tint of a DisplayObject over time.
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([RemoveTintPlugin]); //only do this once in your SWF to activate the plugin (it is already activated in TweenLite and TweenMax by default)
+
+ TweenLite.to(mc, 1, {removeTint:true});
+
+
+BYTES ADDED TO SWF: 61 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+ import flash.geom.ColorTransform;
+ import gs.*;
+ import gs.plugins.*;
+
+ public class RemoveTintPlugin extends TintPlugin {
+ public static const VERSION:Number = 1.01;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ public function RemoveTintPlugin() {
+ super();
+ this.propName = "removeTint";
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/RoundPropsPlugin.as b/gs/plugins/RoundPropsPlugin.as
new file mode 100644
index 0000000..e3d0e29
--- /dev/null
+++ b/gs/plugins/RoundPropsPlugin.as
@@ -0,0 +1,52 @@
+/*
+VERSION: 1.0
+DATE: 12/30/2008
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ If you'd like the inbetween values in a tween to always get rounded to the nearest integer, use the roundProps
+ special property. Just pass in an Array containing the property names that you'd like rounded. For example,
+ if you're tweening the x, y, and alpha properties of mc and you want to round the x and y values (not alpha)
+ every time the tween is rendered, you'd do:
+
+ TweenMax.to(mc, 2, {x:300, y:200, alpha:0.5, roundProps:["x","y"]});
+
+ roundProps requires TweenMax! TweenLite tweens will not round properties.
+
+
+USAGE:
+ (this plugin is activated by default in TweenMax and cannot be activated in TweenLite)
+
+ import gs.*;
+
+ TweenMax.to(mc, 2, {x:300, y:200, alpha:0.5, roundProps:["x","y"]});
+
+
+BYTES ADDED TO SWF: 158 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+ import gs.*;
+
+ public class RoundPropsPlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.0;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ public function RoundPropsPlugin() {
+ super();
+ this.propName = "roundProps";
+ this.overwriteProps = [];
+ this.round = true;
+ }
+
+ public function add($object:Object, $propName:String, $start:Number, $change:Number):void {
+ addTween($object, $propName, $start, $start + $change, $propName);
+ this.overwriteProps[this.overwriteProps.length] = $propName;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/ScalePlugin.as b/gs/plugins/ScalePlugin.as
new file mode 100644
index 0000000..7c04adb
--- /dev/null
+++ b/gs/plugins/ScalePlugin.as
@@ -0,0 +1,72 @@
+/*
+VERSION: 1.11
+DATE: 3/20/2009
+ACTIONSCRIPT VERSION: 3.0
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ ScalePlugin combines scaleX and scaleY into one "scale" property.
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([ScalePlugin]); //only do this once in your SWF to activate the plugin
+
+ TweenLite.to(mc, 1, {scale:2}); //tweens horizontal and vertical scale simultaneously
+
+
+Greensock Tweening Platform
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+package gs.plugins {
+ import flash.display.*;
+
+ import gs.*;
+
+ public class ScalePlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.11;
+ public static const API:Number = 1.0;
+
+ protected var _target:Object;
+ protected var _startX:Number;
+ protected var _changeX:Number;
+ protected var _startY:Number;
+ protected var _changeY:Number;
+
+ public function ScalePlugin() {
+ super();
+ this.propName = "scale";
+ this.overwriteProps = ["scaleX", "scaleY", "width", "height"];
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ if (!$target.hasOwnProperty("scaleX")) {
+ return false;
+ }
+ _target = $target;
+ _startX = _target.scaleX;
+ _startY = _target.scaleY;
+ if (typeof($value) == "number") {
+ _changeX = $value - _startX;
+ _changeY = $value - _startY;
+ } else {
+ _changeX = _changeY = Number($value);
+ }
+ return true;
+ }
+
+ override public function killProps($lookup:Object):void {
+ for (var i:int = this.overwriteProps.length - 1; i > -1; i--) {
+ if (this.overwriteProps[i] in $lookup) { //if any of the properties are found in the lookup, this whole plugin instance should be essentially deactivated. To do that, we must empty the overwriteProps Array.
+ this.overwriteProps = [];
+ return;
+ }
+ }
+ }
+
+ override public function set changeFactor($n:Number):void {
+ _target.scaleX = _startX + ($n * _changeX);
+ _target.scaleY = _startY + ($n * _changeY);
+ }
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/SetSizePlugin.as b/gs/plugins/SetSizePlugin.as
new file mode 100644
index 0000000..cf1d0ca
--- /dev/null
+++ b/gs/plugins/SetSizePlugin.as
@@ -0,0 +1,79 @@
+/*
+VERSION: 1.01
+DATE: 2/6/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Some components require resizing with setSize() instead of standard tweens of width/height in
+ order to scale properly. The SetSizePlugin accommodates this easily. You can define the width,
+ height, or both.
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([SetSizePlugin]); //only do this once in your SWF to activate the plugin
+
+ TweenLite.to(myComponent, 1, {setSize:{width:200, height:30}});
+
+
+BYTES ADDED TO SWF: 365 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+
+ import gs.*;
+
+ public class SetSizePlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.01;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ public var width:Number;
+ public var height:Number;
+
+ protected var _target:Object;
+ protected var _setWidth:Boolean;
+ protected var _setHeight:Boolean;
+ protected var _hasSetSize:Boolean;
+
+ public function SetSizePlugin() {
+ super();
+ this.propName = "setSize";
+ this.overwriteProps = ["setSize","width","height","scaleX","scaleY"];
+ this.round = true;
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ _target = $target;
+ _hasSetSize = Boolean("setSize" in _target);
+ if ("width" in $value && _target.width != $value.width) {
+ addTween((_hasSetSize) ? this : _target, "width", _target.width, $value.width, "width");
+ _setWidth = _hasSetSize;
+ }
+ if ("height" in $value && _target.height != $value.height) {
+ addTween((_hasSetSize) ? this : _target, "height", _target.height, $value.height, "height");
+ _setHeight = _hasSetSize;
+ }
+ return true;
+ }
+
+ override public function killProps($lookup:Object):void {
+ super.killProps($lookup);
+ if (_tweens.length == 0 || "setSize" in $lookup) {
+ this.overwriteProps = [];
+ }
+ }
+
+ override public function set changeFactor($n:Number):void {
+ updateTweens($n);
+ if (_hasSetSize) {
+ _target.setSize((_setWidth) ? this.width : _target.width, (_setHeight) ? this.height : _target.height);
+ }
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/ShortRotationPlugin.as b/gs/plugins/ShortRotationPlugin.as
new file mode 100644
index 0000000..f64e6f8
--- /dev/null
+++ b/gs/plugins/ShortRotationPlugin.as
@@ -0,0 +1,66 @@
+/*
+VERSION: 1.0
+DATE: 1/8/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ To tween any rotation property of the target object in the shortest direction, use "shortRotation"
+ For example, if myObject.rotation is currently 170 degrees and you want to tween it to -170 degrees,
+ a normal rotation tween would travel a total of 340 degrees in the counter-clockwise direction,
+ but if you use shortRotation, it would travel 20 degrees in the clockwise direction instead. You
+ can define any number of rotation properties in the shortRotation object which makes 3D tweening
+ easier, like TweenMax.to(mc, 2, {shortRotation:{rotationX:-170, rotationY:35, rotationZ:200}});
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([ShortRotationPlugin]); //only do this once in your SWF to activate the plugin in TweenLite (it is already activated in TweenMax by default)
+
+ TweenLite.to(mc, 1, {shortRotation:{rotation:-170}});
+
+ //or for a 3D tween with multiple rotation values...
+ TweenLite.to(mc, 1, {shortRotation:{rotationX:-170, rotationY:35, rotationZ:10}});
+
+
+BYTES ADDED TO SWF: 361 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+ import gs.*;
+
+ public class ShortRotationPlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.0;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ public function ShortRotationPlugin() {
+ super();
+ this.propName = "shortRotation";
+ this.overwriteProps = [];
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ if (typeof($value) == "number") {
+ trace("WARNING: You appear to be using the old shortRotation syntax. Instead of passing a number, please pass an object with properties that correspond to the rotations values For example, TweenMax.to(mc, 2, {shortRotation:{rotationX:-170, rotationY:25}})");
+ return false;
+ }
+ for (var p:String in $value) {
+ initRotation($target, p, $target[p], $value[p]);
+ }
+ return true;
+ }
+
+ public function initRotation($target:Object, $propName:String, $start:Number, $end:Number):void {
+ var dif:Number = ($end - $start) % 360;
+ if (dif != dif % 180) {
+ dif = (dif < 0) ? dif + 360 : dif - 360;
+ }
+ addTween($target, $propName, $start, $start + dif, $propName);
+ this.overwriteProps[this.overwriteProps.length] = $propName;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/TintPlugin.as b/gs/plugins/TintPlugin.as
new file mode 100644
index 0000000..3a5283a
--- /dev/null
+++ b/gs/plugins/TintPlugin.as
@@ -0,0 +1,84 @@
+/*
+VERSION: 1.1
+DATE: 2/27/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ To change a DisplayObject's tint/color, set this to the hex value of the tint you'd like
+ to end up at (or begin at if you're using TweenMax.from()). An example hex value would be 0xFF0000.
+
+ To remove a tint completely, use the RemoveTintPlugin (after activating it, you can just set removeTint:true)
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([TintPlugin]); //only do this once in your SWF to activate the plugin (it is already activated in TweenLite and TweenMax by default)
+
+ TweenLite.to(mc, 1, {tint:0xFF0000});
+
+
+BYTES ADDED TO SWF: 436 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+ import flash.geom.ColorTransform;
+
+ import gs.*;
+ import gs.utils.tween.TweenInfo;
+
+ public class TintPlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.1;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+ protected static var _props:Array = ["redMultiplier", "greenMultiplier", "blueMultiplier", "alphaMultiplier", "redOffset", "greenOffset", "blueOffset", "alphaOffset"];
+
+ protected var _target:DisplayObject;
+ protected var _ct:ColorTransform;
+ protected var _ignoreAlpha:Boolean;
+
+ public function TintPlugin() {
+ super();
+ this.propName = "tint";
+ this.overwriteProps = ["tint"];
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ if (!($target is DisplayObject)) {
+ return false;
+ }
+ var end:ColorTransform = new ColorTransform();
+ if ($value != null && $tween.exposedVars.removeTint != true) {
+ end.color = uint($value);
+ }
+ _ignoreAlpha = true;
+ init($target as DisplayObject, end);
+ return true;
+ }
+
+ public function init($target:DisplayObject, $end:ColorTransform):void {
+ _target = $target;
+ _ct = _target.transform.colorTransform;
+ var i:int, p:String;
+ for (i = _props.length - 1; i > -1; i--) {
+ p = _props[i];
+ if (_ct[p] != $end[p]) {
+ _tweens[_tweens.length] = new TweenInfo(_ct, p, _ct[p], $end[p] - _ct[p], "tint", false);
+ }
+ }
+ }
+
+ override public function set changeFactor($n:Number):void {
+ updateTweens($n);
+ if (_ignoreAlpha) {
+ var ct:ColorTransform = _target.transform.colorTransform;
+ _ct.alphaMultiplier = ct.alphaMultiplier;
+ _ct.alphaOffset = ct.alphaOffset;
+ }
+ _target.transform.colorTransform = _ct;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/TweenPlugin.as b/gs/plugins/TweenPlugin.as
new file mode 100644
index 0000000..5e5de0f
--- /dev/null
+++ b/gs/plugins/TweenPlugin.as
@@ -0,0 +1,213 @@
+/*
+VERSION: 1.03
+DATE: 1/13/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ TweenPlugin is the base class for all TweenLite/TweenMax plugins.
+
+USAGE:
+ To create your own plugin, extend TweenPlugin and override whichever methods you need. Typically,
+ you only need to override onInitTween() and the changeFactor setter. There are a few key concepts
+ to keep in mind:
+
+ - In the constructor, set this.propName to whatever special property you want your plugin to handle.
+
+ - When a tween that uses your plugin initializes its tween values (normally when it starts), a new instance
+ of your plugin will be created and the onInitTween() method will be called. That's where you'll want to
+ store any initial values and prepare for the tween. onInitTween() should return a Boolean value that
+ essentially indicates whether or not the plugin initted successfully. If you return false, TweenLite/Max
+ will just use a normal tween for the value, ignoring the plugin for that particular tween.
+
+ - The changeFactor setter will be updated on every frame during the course of the tween with a multiplier
+ that describes the amount of change based on how far along the tween is and the ease applied. It will be
+ zero at the beginning of the tween and 1 at the end, but inbetween it could be any value based on the
+ ease applied (for example, an Elastic.easeOut tween would cause the value to shoot past 1 and back again before
+ the end of the tween). So if the tween uses the Linear.easeNone easing equation, when it's halfway finished,
+ the changeFactor will be 0.5.
+
+ - The overwriteProps is an Array that should contain the properties that your plugin should overwrite
+ when OverwriteManager's mode is AUTO and a tween of the same object is created. For example, the
+ autoAlpha plugin controls the "visible" and "alpha" properties of an object, so if another tween
+ is created that controls the alpha of the target object, your plugin's killProps() will be called
+ which should handle killing the "alpha" part of the tween. It is your responsibility to populate
+ (and depopulate) the overwriteProps Array. Failure to do so properly can cause odd overwriting behavior.
+
+ - Note that there's a "round" property that indicates whether or not values in your plugin should be
+ rounded to the nearest integer (compatible with TweenMax only). If you use the _tweens Array, populating
+ it through the addTween() method, rounding will happen automatically (if necessary) in the
+ updateTweens() method, but if you don't use addTween() and prefer to manually calculate tween values
+ in your changeFactor setter, just remember to accommodate the "round" flag if it makes sense in your plugin.
+
+ - If you need to run a block of code when the tween has finished, point the onComplete property to a
+ method you created inside your plugin.
+
+ - Please use the same naming convention as the rest of the plugins, like MySpecialPropertyNamePlugin.
+
+ - IMPORTANT: The plugin framework is brand new, so there is a chance that it will change slightly over time and
+ you may need to adjust your custom plugins if the framework changes. I'll try to minimize the changes,
+ but I'd highly recommend getting a membership to Club GreenSock to make sure you get update notifications.
+ See http://blog.greensock.com/club/ for details.
+
+
+BYTES ADDED TO SWF: 560 (0.5kb)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import gs.*;
+ import gs.utils.tween.*;
+
+ public class TweenPlugin {
+ public static const VERSION:Number = 1.03;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ /**
+ * Name of the special property that the plugin should intercept/handle
+ */
+ public var propName:String;
+
+ /**
+ * Array containing the names of the properties that should be overwritten in OverwriteManager's
+ * AUTO mode. Typically the only value in this Array is the propName, but there are cases when it may
+ * be different. For example, a bezier tween's propName is "bezier" but it can manage many different properties
+ * like x, y, etc. depending on what's passed in to the tween.
+ */
+ public var overwriteProps:Array;
+
+ /**
+ * If the values should be rounded to the nearest integer, set this to true.
+ */
+ public var round:Boolean;
+
+ /**
+ * Called when the tween is complete.
+ */
+ public var onComplete:Function;
+
+ protected var _tweens:Array = [];
+ protected var _changeFactor:Number = 0;
+
+
+ public function TweenPlugin() {
+ //constructor
+ }
+
+ /**
+ * Gets called when any tween of the special property begins. Store any initial values
+ * and/or variables that will be used in the "changeFactor" setter when this method runs.
+ *
+ * @param $target target object of the TweenLite instance using this plugin
+ * @param $value The value that is passed in through the special property in the tween.
+ * @param $tween The TweenLite or TweenMax instance using this plugin.
+ * @return If the initialization failed, it returns false. Otherwise true. It may fail if, for example, the plugin requires that the target be a DisplayObject or has some other unmet criteria in which case the plugin is skipped and a normal property tween is used inside TweenLite
+ */
+ public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ addTween($target, this.propName, $target[this.propName], $value, this.propName);
+ return true;
+ }
+
+ /**
+ * Offers a simple way to add tweening values to the plugin. You don't need to use this,
+ * but it is convenient because the tweens get updated in the updateTweens() method which also
+ * handles rounding. killProps() nicely integrates with most tweens added via addTween() as well,
+ * but if you prefer to handle this manually in your plugin, you're welcome to.
+ *
+ * @param $object target object whose property you'd like to tween. (i.e. myClip)
+ * @param $propName the property name that should be tweened. (i.e. "x")
+ * @param $start starting value
+ * @param $end end value (can be either numeric or a string value. If it's a string, it will be interpreted as relative to the starting value)
+ * @param $overwriteProp name of the property that should be associated with the tween for overwriting purposes. Normally, it's the same as $propName, but not always. For example, you may tween the "changeFactor" property of a VisiblePlugin, but the property that it's actually controling in the end is "visible", so if a new overlapping tween of the target object is created that affects its "visible" property, this allows the plugin to kill the appropriate tween(s) when killProps() is called.
+ */
+ protected function addTween($object:Object, $propName:String, $start:Number, $end:*, $overwriteProp:String=null):void {
+ if ($end != null) {
+ var change:Number = (typeof($end) == "number") ? $end - $start : Number($end);
+ if (change != 0) { //don't tween values that aren't changing! It's a waste of CPU cycles
+ _tweens[_tweens.length] = new TweenInfo($object, $propName, $start, change, $overwriteProp || $propName, false);
+ }
+ }
+ }
+
+ /**
+ * Updates all the tweens in the _tweens Array.
+ *
+ * @param $changeFactor Multiplier describing the amount of change that should be applied. It will be zero at the beginning of the tween and 1 at the end, but inbetween it could be any value based on the ease applied (for example, an Elastic tween would cause the value to shoot past 1 and back again before the end of the tween)
+ */
+ protected function updateTweens($changeFactor:Number):void {
+ var i:int, ti:TweenInfo;
+ if (this.round) {
+ var val:Number, neg:int;
+ for (i = _tweens.length - 1; i > -1; i--) {
+ ti = _tweens[i];
+ val = ti.start + (ti.change * $changeFactor);
+ neg = (val < 0) ? -1 : 1;
+ ti.target[ti.property] = ((val % 1) * neg > 0.5) ? int(val) + neg : int(val); //twice as fast as Math.round()
+ }
+
+ } else {
+ for (i = _tweens.length - 1; i > -1; i--) {
+ ti = _tweens[i];
+ ti.target[ti.property] = ti.start + (ti.change * $changeFactor);
+ }
+ }
+ }
+
+ /**
+ * In most cases, your custom updating code should go here. The changeFactor value describes the amount
+ * of change based on how far along the tween is and the ease applied. It will be zero at the beginning
+ * of the tween and 1 at the end, but inbetween it could be any value based on the ease applied (for example,
+ * an Elastic tween would cause the value to shoot past 1 and back again before the end of the tween)
+ * This value gets updated on every frame during the course of the tween.
+ *
+ * @param $n Multiplier describing the amount of change that should be applied. It will be zero at the beginning of the tween and 1 at the end, but inbetween it could be any value based on the ease applied (for example, an Elastic tween would cause the value to shoot past 1 and back again before the end of the tween)
+ */
+ public function set changeFactor($n:Number):void {
+ updateTweens($n);
+ _changeFactor = $n;
+ }
+
+ public function get changeFactor():Number {
+ return _changeFactor;
+ }
+
+ /**
+ * Gets called on plugins that have multiple overwritable properties by OverwriteManager when
+ * in AUTO mode. Basically, it instructs the plugin to overwrite certain properties. For example,
+ * if a bezier tween is affecting x, y, and width, and then a new tween is created while the
+ * bezier tween is in progress, and the new tween affects the "x" property, we need a way
+ * to kill just the "x" part of the bezier tween.
+ *
+ * @param $lookup An object containing properties that should be overwritten. We don't pass in an Array because looking up properties on the object is usually faster because it gives us random access. So to overwrite the "x" and "y" properties, a {x:true, y:true} object would be passed in.
+ */
+ public function killProps($lookup:Object):void {
+ var i:int;
+ for (i = this.overwriteProps.length - 1; i > -1; i--) {
+ if (this.overwriteProps[i] in $lookup) {
+ this.overwriteProps.splice(i, 1);
+ }
+ }
+ for (i = _tweens.length - 1; i > -1; i--) {
+ if (_tweens[i].name in $lookup) {
+ _tweens.splice(i, 1);
+ }
+ }
+ }
+
+ /**
+ * Handles integrating the plugin into the GreenSock tweening platform.
+ *
+ * @param $plugin An Array of Plugin classes (that all extend TweenPlugin) to be activated. For example, TweenPlugin.activate([FrameLabelPlugin, ShortRotationPlugin, TintPlugin]);
+ */
+ public static function activate($plugins:Array):Boolean {
+ var i:int, instance:Object;
+ for (i = $plugins.length - 1; i > -1; i--) {
+ instance = new $plugins[i]();
+ TweenLite.plugins[instance.propName] = $plugins[i];
+ }
+ return true;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/VisiblePlugin.as b/gs/plugins/VisiblePlugin.as
new file mode 100644
index 0000000..3e4bf99
--- /dev/null
+++ b/gs/plugins/VisiblePlugin.as
@@ -0,0 +1,65 @@
+/*
+VERSION: 1.0
+DATE: 1/8/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Toggles the visibility at the end of a tween. For example, if you want to set visible to false
+ at the end of the tween, do TweenLite.to(mc, 1, {x:100, visible:false});
+
+ The visible property is forced to true during the course of the tween.
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([VisiblePlugin]); //only do this once in your SWF to activate the plugin (it is already activated in TweenLite and TweenMax by default)
+
+ TweenLite.to(mc, 1, {x:100, visible:false});
+
+
+BYTES ADDED TO SWF: 244 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+ import gs.*;
+
+ public class VisiblePlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.0;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ protected var _target:Object;
+ protected var _tween:TweenLite;
+ protected var _visible:Boolean;
+
+ public function VisiblePlugin() {
+ super();
+ this.propName = "visible";
+ this.overwriteProps = ["visible"];
+ this.onComplete = onCompleteTween;
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ _target = $target;
+ _tween = $tween;
+ _visible = Boolean($value);
+ return true;
+ }
+
+ public function onCompleteTween():void {
+ if (_tween.vars.runBackwards != true && _tween.ease == _tween.vars.ease) { //_tween.ease == _tween.vars.ease checks to make sure the tween wasn't reversed with a TweenGroup
+ _target.visible = _visible;
+ }
+ }
+
+ override public function set changeFactor($n:Number):void {
+ if (_target.visible != true) {
+ _target.visible = true;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/plugins/VolumePlugin.as b/gs/plugins/VolumePlugin.as
new file mode 100644
index 0000000..fda566b
--- /dev/null
+++ b/gs/plugins/VolumePlugin.as
@@ -0,0 +1,59 @@
+/*
+VERSION: 1.01
+DATE: 2/17/2009
+ACTIONSCRIPT VERSION: 3.0 (AS2 version is also available)
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenMax.com
+DESCRIPTION:
+ Tweens the volume of an object with a soundTransform property (MovieClip/SoundChannel/NetStream, etc.)
+
+USAGE:
+ import gs.*;
+ import gs.plugins.*;
+ TweenPlugin.activate([VolumePlugin]); //only do this once in your SWF to activate the plugin (it is already activated in TweenLite and TweenMax by default)
+
+ TweenLite.to(mc, 1, {volume:0});
+
+
+BYTES ADDED TO SWF: 275 (not including dependencies)
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.plugins {
+ import flash.display.*;
+ import flash.media.SoundTransform;
+ import gs.*;
+ import gs.plugins.*;
+
+ public class VolumePlugin extends TweenPlugin {
+ public static const VERSION:Number = 1.01;
+ public static const API:Number = 1.0; //If the API/Framework for plugins changes in the future, this number helps determine compatibility
+
+ protected var _target:Object;
+ protected var _st:SoundTransform;
+
+ public function VolumePlugin() {
+ super();
+ this.propName = "volume";
+ this.overwriteProps = ["volume"];
+ }
+
+ override public function onInitTween($target:Object, $value:*, $tween:TweenLite):Boolean {
+ if (isNaN($value) || !$target.hasOwnProperty("soundTransform")) {
+ return false;
+ }
+ _target = $target;
+ _st = _target.soundTransform;
+ addTween(_st, "volume", _st.volume, $value, "volume");
+ return true;
+ }
+
+ override public function set changeFactor($n:Number):void {
+ updateTweens($n);
+ _target.soundTransform = _st;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/gs/utils/tween/ArrayTweenInfo.as b/gs/utils/tween/ArrayTweenInfo.as
new file mode 100644
index 0000000..04acdca
--- /dev/null
+++ b/gs/utils/tween/ArrayTweenInfo.as
@@ -0,0 +1,26 @@
+/*
+VERSION: 1.0
+DATE: 1/23/2009
+ACTIONSCRIPT VERSION: 3.0
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenLite.com
+DESCRIPTION:
+ Stores basic info about Array tweens in TweenLite/Max.
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.utils.tween {
+
+ public class ArrayTweenInfo {
+ public var index:uint;
+ public var start:Number;
+ public var change:Number;
+
+ public function ArrayTweenInfo($index:uint, $start:Number, $change:Number) {
+ this.index = $index;
+ this.start = $start;
+ this.change = $change;
+ }
+ }
+}
\ No newline at end of file
diff --git a/gs/utils/tween/BevelFilterVars.as b/gs/utils/tween/BevelFilterVars.as
new file mode 100644
index 0000000..5a08ee7
--- /dev/null
+++ b/gs/utils/tween/BevelFilterVars.as
@@ -0,0 +1,144 @@
+/*
+VERSION: 1.01
+DATE: 1/29/2009
+ACTIONSCRIPT VERSION: 3.0
+DESCRIPTION:
+ This class works in conjunction with the TweenLiteVars or TweenMaxVars class to grant
+ strict data typing and code hinting (in most code editors) for filter tweens. See the documentation
+ in TweenMaxVars for more information.
+
+USAGE:
+
+ Instead of TweenMax.to(my_mc, 1, {bevelFilter:{distance:5, blurX:10, blurY:10, strength:2}, onComplete:myFunction}), you could use this utility like:
+
+ var myVars:TweenMaxVars = new TweenMaxVars();
+ myVars.bevelFilter = new BevelFilterVars(5, 10, 10, 2);
+ myVars.onComplete = myFunction;
+ TweenMax.to(my_mc, 1, myVars);
+
+
+NOTES:
+ - This utility is completely optional. If you prefer the shorter synatax in the regular TweenMax class, feel
+ free to use it. The purpose of this utility is simply to enable code hinting and to allow for strict data typing.
+ - You cannot define relative tween values with this utility. If you need relative values, just use the shorter (non strictly
+ data typed) syntax, like TweenMax.to(my_mc, 1, {bevelFilter:{blurX:"-5", blurY:"3"}});
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+
+package gs.utils.tween {
+
+ public class BevelFilterVars extends FilterVars {
+
+ protected var _distance:Number;
+ protected var _blurX:Number;
+ protected var _blurY:Number;
+ protected var _strength:Number;
+ protected var _angle:Number;
+ protected var _highlightAlpha:Number;
+ protected var _highlightColor:uint;
+ protected var _shadowAlpha:Number;
+ protected var _shadowColor:uint;
+ protected var _quality:uint;
+
+ public function BevelFilterVars($distance:Number=4, $blurX:Number=4, $blurY:Number=4, $strength:Number=1, $angle:Number=45, $highlightAlpha:Number=1, $highlightColor:uint=0xFFFFFF, $shadowAlpha:Number=1, $shadowColor:uint=0x000000, $quality:uint=2, $remove:Boolean=false, $index:int=-1, $addFilter:Boolean=false) {
+ super($remove, $index, $addFilter);
+ this.distance = $distance;
+ this.blurX = $blurX;
+ this.blurY = $blurY;
+ this.strength = $strength;
+ this.angle = $angle;
+ this.highlightAlpha = $highlightAlpha;
+ this.highlightColor = $highlightColor;
+ this.shadowAlpha = $shadowAlpha;
+ this.shadowColor = $shadowColor;
+ this.quality = $quality;
+ }
+
+ public static function createFromGeneric($vars:Object):BevelFilterVars { //for parsing values that are passed in as generic Objects, like blurFilter:{blurX:5, blurY:3} (typically via the constructor)
+ if ($vars is BevelFilterVars) {
+ return $vars as BevelFilterVars;
+ }
+ return new BevelFilterVars($vars.distance || 0,
+ $vars.blurX || 0,
+ $vars.blurY || 0,
+ ($vars.strength == null) ? 1 : $vars.strength,
+ ($vars.angle == null) ? 45 : $vars.angle,
+ ($vars.highlightAlpha == null) ? 1 : $vars.highlightAlpha,
+ ($vars.highlightColor == null) ? 0xFFFFFF : $vars.highlightColor,
+ ($vars.shadowAlpha == null) ? 1 : $vars.shadowAlpha,
+ ($vars.shadowColor == null) ? 0xFFFFFF : $vars.shadowColor,
+ $vars.quality || 2,
+ $vars.remove || false,
+ ($vars.index == null) ? -1 : $vars.index,
+ $vars.addFilter || false);
+ }
+
+//---- GETTERS / SETTERS --------------------------------------------------------------------------------------------
+
+ public function set distance($n:Number):void {
+ _distance = this.exposedVars.distance = $n;
+ }
+ public function get distance():Number {
+ return _distance;
+ }
+ public function set blurX($n:Number):void {
+ _blurX = this.exposedVars.blurX = $n;
+ }
+ public function get blurX():Number {
+ return _blurX;
+ }
+ public function set blurY($n:Number):void {
+ _blurY = this.exposedVars.blurY = $n;
+ }
+ public function get blurY():Number {
+ return _blurY;
+ }
+ public function set strength($n:Number):void {
+ _strength = this.exposedVars.strength = $n;
+ }
+ public function get strength():Number {
+ return _strength;
+ }
+ public function set angle($n:Number):void {
+ _angle = this.exposedVars.angle = $n;
+ }
+ public function get angle():Number {
+ return _angle;
+ }
+ public function set highlightAlpha($n:Number):void {
+ _highlightAlpha = this.exposedVars.highlightAlpha = $n;
+ }
+ public function get highlightAlpha():Number {
+ return _highlightAlpha;
+ }
+ public function set highlightColor($n:uint):void {
+ _highlightColor = this.exposedVars.highlightColor = $n;
+ }
+ public function get highlightColor():uint {
+ return _highlightColor;
+ }
+ public function set shadowAlpha($n:Number):void {
+ _shadowAlpha = this.exposedVars.shadowAlpha = $n;
+ }
+ public function get shadowAlpha():Number {
+ return _shadowAlpha;
+ }
+ public function set shadowColor($n:uint):void {
+ _shadowColor = this.exposedVars.shadowColor = $n;
+ }
+ public function get shadowColor():uint {
+ return _shadowColor;
+ }
+ public function set quality($n:uint):void {
+ _quality = this.exposedVars.quality = $n;
+ }
+ public function get quality():uint {
+ return _quality;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/gs/utils/tween/BlurFilterVars.as b/gs/utils/tween/BlurFilterVars.as
new file mode 100644
index 0000000..6221fc3
--- /dev/null
+++ b/gs/utils/tween/BlurFilterVars.as
@@ -0,0 +1,78 @@
+/*
+VERSION: 1.01
+DATE: 1/29/2009
+ACTIONSCRIPT VERSION: 3.0
+DESCRIPTION:
+ This class works in conjunction with the TweenLiteVars or TweenMaxVars class to grant
+ strict data typing and code hinting (in most code editors) for filter tweens. See the documentation in
+ the TweenLiteVars or TweenMaxVars for more information.
+
+USAGE:
+
+ Instead of TweenMax.to(my_mc, 1, {blurFilter:{blurX:10, blurY:10}, onComplete:myFunction}), you could use this utility like:
+
+ var myVars:TweenMaxVars = new TweenMaxVars();
+ myVars.blurFilter = new BlurFilterVars(10, 10);
+ myVars.onComplete = myFunction;
+ TweenMax.to(my_mc, 1, myVars);
+
+
+NOTES:
+ - This utility is completely optional. If you prefer the shorter synatax in the regular TweenLite/TweenMax class, feel
+ free to use it. The purpose of this utility is simply to enable code hinting and to allow for strict data typing.
+ - You cannot define relative tween values with this utility. If you need relative values, just use the shorter (non strictly
+ data typed) syntax, like TweenMax.to(my_mc, 1, {blurFilter:{blurX:"-5", blurY:"3"}});
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+
+package gs.utils.tween {
+ public class BlurFilterVars extends FilterVars {
+ protected var _blurX:Number;
+ protected var _blurY:Number;
+ protected var _quality:uint;
+
+ public function BlurFilterVars($blurX:Number=10, $blurY:Number=10, $quality:uint=2, $remove:Boolean=false, $index:int=-1, $addFilter:Boolean=false) {
+ super($remove, $index, $addFilter);
+ this.blurX = $blurX;
+ this.blurY = $blurY;
+ this.quality = $quality;
+ }
+
+ public static function createFromGeneric($vars:Object):BlurFilterVars { //for parsing values that are passed in as generic Objects, like blurFilter:{blurX:5, blurY:3} (typically via the constructor)
+ if ($vars is BlurFilterVars) {
+ return $vars as BlurFilterVars;
+ }
+ return new BlurFilterVars($vars.blurX || 0,
+ $vars.blurY || 0,
+ $vars.quality || 2,
+ $vars.remove || false,
+ ($vars.index == null) ? -1 : $vars.index,
+ $vars.addFilter || false);
+ }
+
+//---- GETTERS / SETTERS ------------------------------------------------------------------------------
+
+ public function set blurX($n:Number):void {
+ _blurX = this.exposedVars.blurX = $n;
+ }
+ public function get blurX():Number {
+ return _blurX;
+ }
+ public function set blurY($n:Number):void {
+ _blurY = this.exposedVars.blurY = $n;
+ }
+ public function get blurY():Number {
+ return _blurY;
+ }
+ public function set quality($n:uint):void {
+ _quality = this.exposedVars.quality = $n;
+ }
+ public function get quality():uint {
+ return _quality;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/utils/tween/ColorMatrixFilterVars.as b/gs/utils/tween/ColorMatrixFilterVars.as
new file mode 100644
index 0000000..d1de01c
--- /dev/null
+++ b/gs/utils/tween/ColorMatrixFilterVars.as
@@ -0,0 +1,109 @@
+/*
+VERSION: 1.01
+DATE: 1/29/2009
+ACTIONSCRIPT VERSION: 3.0
+DESCRIPTION:
+ This class works in conjunction with the TweenLiteVars or TweenMaxVars class to grant
+ strict data typing and code hinting (in most code editors) for filter tweens. See the documentation in
+ the TweenLiteVars or TweenMaxVars for more information.
+
+USAGE:
+
+ Instead of TweenMax.to(my_mc, 1, {colorMatrixFilter:{colorize:0xFF0000, amount:0.5}, onComplete:myFunction}), you could use this utility like:
+
+ var myVars:TweenMaxVars = new TweenMaxVars();
+ myVars.colorMatrixFilter = new ColorMatrixFilterVars(0xFF0000, 0.5);
+ myVars.onComplete = myFunction;
+ TweenMax.to(my_mc, 1, myVars);
+
+
+NOTES:
+ - This utility is completely optional. If you prefer the shorter synatax in the regular TweenLite/TweenMax class, feel
+ free to use it. The purpose of this utility is simply to enable code hinting and to allow for strict data typing.
+ - You cannot define relative tween values with this utility. If you need relative values, just use the shorter (non strictly
+ data typed) syntax, like TweenMax.to(my_mc, 1, {colorMatrixFilter:{contrast:0.5, relative:true}});
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+
+package gs.utils.tween {
+ import gs.plugins.*;
+
+ public class ColorMatrixFilterVars extends FilterVars {
+ public var matrix:Array;
+
+ protected static var _ID_MATRIX:Array = [1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];
+ protected static var _lumR:Number = 0.212671; //Red constant - used for a few color matrix filter functions
+ protected static var _lumG:Number = 0.715160; //Green constant - used for a few color matrix filter functions
+ protected static var _lumB:Number = 0.072169; //Blue constant - used for a few color matrix filter functions
+
+ public function ColorMatrixFilterVars($colorize:uint=0xFFFFFF, $amount:Number=1, $saturation:Number=1, $contrast:Number=1, $brightness:Number=1, $hue:Number=0, $threshold:Number=-1, $remove:Boolean=false, $index:int=-1, $addFilter:Boolean=false) {
+ super($remove, $index, $addFilter);
+ this.matrix = _ID_MATRIX.slice();
+ if ($brightness != 1) {
+ setBrightness($brightness);
+ }
+ if ($contrast != 1) {
+ setContrast($contrast);
+ }
+ if ($hue != 0) {
+ setHue($hue);
+ }
+ if ($saturation != 1) {
+ setSaturation($saturation);
+ }
+ if ($threshold != -1) {
+ setThreshold($threshold);
+ }
+ if ($colorize != 0xFFFFFF) {
+ setColorize($colorize, $amount);
+ }
+ }
+
+ public function setBrightness($n:Number):void {
+ this.matrix = this.exposedVars.matrix = ColorMatrixFilterPlugin.setBrightness(this.matrix, $n);
+ }
+ public function setContrast($n:Number):void {
+ this.matrix = this.exposedVars.matrix = ColorMatrixFilterPlugin.setContrast(this.matrix, $n);
+ }
+ public function setHue($n:Number):void {
+ this.matrix = this.exposedVars.matrix = ColorMatrixFilterPlugin.setHue(this.matrix, $n);
+ }
+ public function setSaturation($n:Number):void {
+ this.matrix = this.exposedVars.matrix = ColorMatrixFilterPlugin.setSaturation(this.matrix, $n);
+ }
+ public function setThreshold($n:Number):void {
+ this.matrix = this.exposedVars.matrix = ColorMatrixFilterPlugin.setThreshold(this.matrix, $n);
+ }
+ public function setColorize($color:uint, $amount:Number=1):void {
+ this.matrix = this.exposedVars.matrix = ColorMatrixFilterPlugin.colorize(this.matrix, $color, $amount);
+ }
+
+ public static function createFromGeneric($vars:Object):ColorMatrixFilterVars { //for parsing values that are passed in as generic Objects, like blurFilter:{blurX:5, blurY:3} (typically via the constructor)
+ var v:ColorMatrixFilterVars;
+ if ($vars is ColorMatrixFilterVars) {
+ v = $vars as ColorMatrixFilterVars;
+ } else if ($vars.matrix != null) {
+ v = new ColorMatrixFilterVars();
+ v.matrix = $vars.matrix;
+ } else {
+ v = new ColorMatrixFilterVars($vars.colorize || 0xFFFFFF,
+ ($vars.amount == null) ? 1 : $vars.amount,
+ ($vars.saturation == null) ? 1 : $vars.saturation,
+ ($vars.contrast == null) ? 1 : $vars.contrast,
+ ($vars.brightness == null) ? 1 : $vars.brightness,
+ $vars.hue || 0,
+ ($vars.threshold == null) ? -1 : $vars.threshold,
+ $vars.remove || false,
+ ($vars.index == null) ? -1 : $vars.index,
+ $vars.addFilter || false);
+ }
+ return v;
+ }
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/gs/utils/tween/ColorTransformVars.as b/gs/utils/tween/ColorTransformVars.as
new file mode 100644
index 0000000..7aecbac
--- /dev/null
+++ b/gs/utils/tween/ColorTransformVars.as
@@ -0,0 +1,170 @@
+/*
+VERSION: 1.0
+DATE: 1/29/2009
+ACTIONSCRIPT VERSION: 3.0
+DESCRIPTION:
+ This class works in conjunction with the TweenLiteVars or TweenMaxVars class to grant
+ strict data typing and code hinting (in most code editors) for colorTransform tweens. See the documentation in
+ the TweenLiteVars or TweenMaxVars for more information.
+
+USAGE:
+
+ Instead of TweenMax.to(my_mc, 1, {colorTransform:{exposure:2}}, onComplete:myFunction}), you could use this utility like:
+
+ var myVars:TweenMaxVars = new TweenMaxVars();
+ var ct:ColorTransformVars = new ColorTransformVars();
+ ct.exposure = 2;
+ myVars.colorTransform = ct;
+ myVars.onComplete = myFunction;
+ TweenMax.to(my_mc, 1, myVars);
+
+
+NOTES:
+ - This utility is completely optional. If you prefer the shorter synatax in the regular TweenLite/TweenMax class, feel
+ free to use it. The purpose of this utility is simply to enable code hinting and to allow for strict data typing.
+ - You cannot define relative tween values with this utility.
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+
+package gs.utils.tween {
+
+ public class ColorTransformVars extends SubVars {
+
+ public function ColorTransformVars($tint:Number=NaN, $tintAmount:Number=NaN, $exposure:Number=NaN, $brightness:Number=NaN, $redMultiplier:Number=NaN, $greenMultiplier:Number=NaN, $blueMultiplier:Number=NaN, $alphaMultiplier:Number=NaN, $redOffset:Number=NaN, $greenOffset:Number=NaN, $blueOffset:Number=NaN, $alphaOffset:Number=NaN) {
+ super();
+ if (!isNaN($tint)) {
+ this.tint = uint($tint);
+ }
+ if (!isNaN($tintAmount)) {
+ this.tintAmount = $tintAmount;
+ }
+ if (!isNaN($exposure)) {
+ this.exposure = $exposure;
+ }
+ if (!isNaN($brightness)) {
+ this.brightness = $brightness;
+ }
+ if (!isNaN($redMultiplier)) {
+ this.redMultiplier = $redMultiplier;
+ }
+ if (!isNaN($greenMultiplier)) {
+ this.greenMultiplier = $greenMultiplier;
+ }
+ if (!isNaN($blueMultiplier)) {
+ this.blueMultiplier = $blueMultiplier;
+ }
+ if (!isNaN($alphaMultiplier)) {
+ this.alphaMultiplier = $alphaMultiplier;
+ }
+ if (!isNaN($redOffset)) {
+ this.redOffset = $redOffset;
+ }
+ if (!isNaN($greenOffset)) {
+ this.greenOffset = $greenOffset;
+ }
+ if (!isNaN($blueOffset)) {
+ this.blueOffset = $blueOffset;
+ }
+ if (!isNaN($alphaOffset)) {
+ this.alphaOffset = $alphaOffset;
+ }
+ }
+
+ public static function createFromGeneric($vars:Object):ColorTransformVars { //for parsing values that are passed in as generic Objects, like blurFilter:{blurX:5, blurY:3} (typically via the constructor)
+ if ($vars is ColorTransformVars) {
+ return $vars as ColorTransformVars;
+ }
+ return new ColorTransformVars($vars.tint,
+ $vars.tintAmount,
+ $vars.exposure,
+ $vars.brightness,
+ $vars.redMultiplier,
+ $vars.greenMultiplier,
+ $vars.blueMultiplier,
+ $vars.alphaMultiplier,
+ $vars.redOffset,
+ $vars.greenOffset,
+ $vars.blueOffset,
+ $vars.alphaOffset);
+ }
+
+//---- GETTERS / SETTERS ------------------------------------------------------------------------------
+
+ public function set tint($n:Number):void {
+ this.exposedVars.tint = $n;
+ }
+ public function get tint():Number {
+ return Number(this.exposedVars.tint);
+ }
+ public function set tintAmount($n:Number):void {
+ this.exposedVars.tintAmount = $n;
+ }
+ public function get tintAmount():Number {
+ return Number(this.exposedVars.tintAmount);
+ }
+ public function set exposure($n:Number):void {
+ this.exposedVars.exposure = $n;
+ }
+ public function get exposure():Number {
+ return Number(this.exposedVars.exposure);
+ }
+ public function set brightness($n:Number):void {
+ this.exposedVars.brightness = $n;
+ }
+ public function get brightness():Number {
+ return Number(this.exposedVars.brightness);
+ }
+ public function set redMultiplier($n:Number):void {
+ this.exposedVars.redMultiplier = $n;
+ }
+ public function get redMultiplier():Number {
+ return Number(this.exposedVars.redMultiplier);
+ }
+ public function set greenMultiplier($n:Number):void {
+ this.exposedVars.greenMultiplier = $n;
+ }
+ public function get greenMultiplier():Number {
+ return Number(this.exposedVars.greenMultiplier);
+ }
+ public function set blueMultiplier($n:Number):void {
+ this.exposedVars.blueMultiplier = $n;
+ }
+ public function get blueMultiplier():Number {
+ return Number(this.exposedVars.blueMultiplier);
+ }
+ public function set alphaMultiplier($n:Number):void {
+ this.exposedVars.alphaMultiplier = $n;
+ }
+ public function get alphaMultiplier():Number {
+ return Number(this.exposedVars.alphaMultiplier);
+ }
+ public function set redOffset($n:Number):void {
+ this.exposedVars.redOffset = $n;
+ }
+ public function get redOffset():Number {
+ return Number(this.exposedVars.redOffset);
+ }
+ public function set greenOffset($n:Number):void {
+ this.exposedVars.greenOffset = $n;
+ }
+ public function get greenOffset():Number {
+ return Number(this.exposedVars.greenOffset);
+ }
+ public function set blueOffset($n:Number):void {
+ this.exposedVars.blueOffset = $n;
+ }
+ public function get blueOffset():Number {
+ return Number(this.exposedVars.blueOffset);
+ }
+ public function set alphaOffset($n:Number):void {
+ this.exposedVars.alphaOffset = $n;
+ }
+ public function get alphaOffset():Number {
+ return Number(this.exposedVars.alphaOffset);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/utils/tween/DropShadowFilterVars.as b/gs/utils/tween/DropShadowFilterVars.as
new file mode 100644
index 0000000..6c97b5b
--- /dev/null
+++ b/gs/utils/tween/DropShadowFilterVars.as
@@ -0,0 +1,153 @@
+/*
+VERSION: 1.01
+DATE: 1/29/2009
+ACTIONSCRIPT VERSION: 3.0
+DESCRIPTION:
+ This class works in conjunction with the TweenLiteVars or TweenMaxVars class to grant
+ strict data typing and code hinting (in most code editors) for filter tweens. See the documentation in
+ the TweenLiteVars or TweenMaxVars for more information.
+
+USAGE:
+
+ Instead of TweenMax.to(my_mc, 1, {dropShadowFilter:{distance:5, blurX:10, blurY:10, color:0xFF0000}, onComplete:myFunction}), you could use this utility like:
+
+ var myVars:TweenMaxVars = new TweenMaxVars();
+ myVars.dropShadowFilter = new DropShadowFilterVars(5, 10, 10, 1, 45, 0xFF0000);
+ myVars.onComplete = myFunction;
+ TweenMax.to(my_mc, 1, myVars);
+
+
+NOTES:
+ - This utility is completely optional. If you prefer the shorter synatax in the regular TweenLite/TweenMax class, feel
+ free to use it. The purpose of this utility is simply to enable code hinting and to allow for strict data typing.
+ - You cannot define relative tween values with this utility. If you need relative values, just use the shorter (non strictly
+ data typed) syntax, like TweenMax.to(my_mc, 1, {dropShadowFilter:{blurX:"-5", blurY:"3"}});
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+
+package gs.utils.tween {
+
+ public class DropShadowFilterVars extends FilterVars {
+ protected var _distance:Number;
+ protected var _blurX:Number;
+ protected var _blurY:Number;
+ protected var _alpha:Number;
+ protected var _angle:Number;
+ protected var _color:uint;
+ protected var _strength:Number;
+ protected var _inner:Boolean;
+ protected var _knockout:Boolean;
+ protected var _hideObject:Boolean;
+ protected var _quality:uint;
+
+ public function DropShadowFilterVars($distance:Number=4, $blurX:Number=4, $blurY:Number=4, $alpha:Number=1, $angle:Number=45, $color:uint=0x000000, $strength:Number=2, $inner:Boolean=false, $knockout:Boolean=false, $hideObject:Boolean=false, $quality:uint=2, $remove:Boolean=false, $index:int=-1, $addFilter:Boolean=false) {
+ super($remove, $index, $addFilter);
+ this.distance = $distance;
+ this.blurX = $blurX;
+ this.blurY = $blurY;
+ this.alpha = $alpha;
+ this.angle = $angle;
+ this.color = $color;
+ this.strength = $strength;
+ this.inner = $inner;
+ this.knockout = $knockout;
+ this.hideObject = $hideObject;
+ this.quality = $quality;
+ }
+
+ public static function createFromGeneric($vars:Object):DropShadowFilterVars { //for parsing values that are passed in as generic Objects, like blurFilter:{blurX:5, blurY:3} (typically via the constructor)
+ if ($vars is DropShadowFilterVars) {
+ return $vars as DropShadowFilterVars;
+ }
+ return new DropShadowFilterVars($vars.distance || 0,
+ $vars.blurX || 0,
+ $vars.blurY || 0,
+ $vars.alpha || 0,
+ ($vars.angle == null) ? 45 : $vars.angle,
+ ($vars.color == null) ? 0x000000 : $vars.color,
+ ($vars.strength == null) ? 2 : $vars.strength,
+ Boolean($vars.inner),
+ Boolean($vars.knockout),
+ Boolean($vars.hideObject),
+ $vars.quality || 2,
+ $vars.remove || false,
+ ($vars.index == null) ? -1 : $vars.index,
+ $vars.addFilter);
+ }
+
+//---- GETTERS / SETTERS --------------------------------------------------------------------------------------------
+
+ public function set distance($n:Number):void {
+ _distance = this.exposedVars.distance = $n;
+ }
+ public function get distance():Number {
+ return _distance;
+ }
+ public function set blurX($n:Number):void {
+ _blurX = this.exposedVars.blurX = $n;
+ }
+ public function get blurX():Number {
+ return _blurX;
+ }
+ public function set blurY($n:Number):void {
+ _blurY = this.exposedVars.blurY = $n;
+ }
+ public function get blurY():Number {
+ return _blurY;
+ }
+ public function set alpha($n:Number):void {
+ _alpha = this.exposedVars.alpha = $n;
+ }
+ public function get alpha():Number {
+ return _alpha;
+ }
+ public function set angle($n:Number):void {
+ _angle = this.exposedVars.angle = $n;
+ }
+ public function get angle():Number {
+ return _angle;
+ }
+ public function set color($n:uint):void {
+ _color = this.exposedVars.color = $n;
+ }
+ public function get color():uint {
+ return _color;
+ }
+ public function set strength($n:Number):void {
+ _strength = this.exposedVars.strength = $n;
+ }
+ public function get strength():Number {
+ return _strength;
+ }
+ public function set inner($b:Boolean):void {
+ _inner = this.exposedVars.inner = $b;
+ }
+ public function get inner():Boolean {
+ return _inner;
+ }
+ public function set knockout($b:Boolean):void {
+ _knockout = this.exposedVars.knockout = $b;
+ }
+ public function get knockout():Boolean {
+ return _knockout;
+ }
+ public function set hideObject($b:Boolean):void {
+ _hideObject = this.exposedVars.hideObject = $b;
+ }
+ public function get hideObject():Boolean {
+ return _hideObject;
+ }
+ public function set quality($n:uint):void {
+ _quality = this.exposedVars.quality = $n;
+ }
+ public function get quality():uint {
+ return _quality;
+ }
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/gs/utils/tween/FilterVars.as b/gs/utils/tween/FilterVars.as
new file mode 100644
index 0000000..245c363
--- /dev/null
+++ b/gs/utils/tween/FilterVars.as
@@ -0,0 +1,32 @@
+/*
+VERSION: 1.0
+DATE: 1/29/2009
+ACTIONSCRIPT VERSION: 3.0
+DESCRIPTION:
+ This class works in conjunction with the TweenLiteVars or TweenMaxVars class to grant
+ strict data typing and code hinting (in most code editors) for filter tweens. See the documentation in
+ the TweenLiteVars or TweenMaxVars for more information.
+
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+
+package gs.utils.tween {
+ public class FilterVars extends SubVars {
+ public var remove:Boolean;
+ public var index:int;
+ public var addFilter:Boolean;
+
+ public function FilterVars($remove:Boolean=false, $index:int=-1, $addFilter:Boolean=false) {
+ super();
+ this.remove = $remove;
+ if ($index > -1) {
+ this.index = $index;
+ }
+ this.addFilter = $addFilter;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/utils/tween/GlowFilterVars.as b/gs/utils/tween/GlowFilterVars.as
new file mode 100644
index 0000000..ab9e21a
--- /dev/null
+++ b/gs/utils/tween/GlowFilterVars.as
@@ -0,0 +1,126 @@
+/*
+VERSION: 1.01
+DATE: 1/29/2009
+ACTIONSCRIPT VERSION: 3.0
+DESCRIPTION:
+ This class works in conjunction with the TweenLiteVars or TweenMaxVars class to grant
+ strict data typing and code hinting (in most code editors) for filter tweens. See the documentation in
+ the TweenLiteVars, or TweenMaxVars for more information.
+
+USAGE:
+
+ Instead of TweenMax.to(my_mc, 1, {glowFilter:{blurX:10, blurY:10, color:0xFF0000}, onComplete:myFunction}), you could use this utility like:
+
+ var myVars:TweenMaxVars = new TweenMaxVars();
+ myVars.glowFilter = new GlowFilterVars(10, 10);
+ myVars.onComplete = myFunction;
+ TweenMax.to(my_mc, 1, myVars);
+
+
+NOTES:
+ - This utility is completely optional. If you prefer the shorter synatax in the regular TweenLite/TweenMax class, feel
+ free to use it. The purpose of this utility is simply to enable code hinting and to allow for strict data typing.
+ - You cannot define relative tween values with this utility. If you need relative values, just use the shorter (non strictly
+ data typed) syntax, like TweenMax.to(my_mc, 1, {glowFilter:{blurX:"-5", blurY:"3"}});
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+
+package gs.utils.tween {
+
+ public class GlowFilterVars extends FilterVars {
+ protected var _blurX:Number;
+ protected var _blurY:Number;
+ protected var _color:uint;
+ protected var _alpha:Number;
+ protected var _strength:Number;
+ protected var _inner:Boolean;
+ protected var _knockout:Boolean;
+ protected var _quality:uint;
+
+ public function GlowFilterVars($blurX:Number=10, $blurY:Number=10, $color:uint=0xFFFFFF, $alpha:Number=1, $strength:Number=2, $inner:Boolean=false, $knockout:Boolean=false, $quality:uint=2, $remove:Boolean=false, $index:int=-1, $addFilter:Boolean=false) {
+ super($remove, $index, $addFilter);
+ this.blurX = $blurX;
+ this.blurY = $blurY;
+ this.color = $color;
+ this.alpha = $alpha;
+ this.strength = $strength;
+ this.inner = $inner;
+ this.knockout = $knockout;
+ this.quality = $quality;
+ }
+
+ public static function createFromGeneric($vars:Object):GlowFilterVars { //for parsing values that are passed in as generic Objects, like blurFilter:{blurX:5, blurY:3} (typically via the constructor)
+ if ($vars is GlowFilterVars) {
+ return $vars as GlowFilterVars;
+ }
+ return new GlowFilterVars($vars.blurX || 0,
+ $vars.blurY || 0,
+ ($vars.color == null) ? 0x000000 : $vars.color,
+ $vars.alpha || 0,
+ ($vars.strength == null) ? 2 : $vars.strength,
+ Boolean($vars.inner),
+ Boolean($vars.knockout),
+ $vars.quality || 2,
+ $vars.remove || false,
+ ($vars.index == null) ? -1 : $vars.index,
+ $vars.addFilter || false);
+ }
+
+//---- GETTERS / SETTERS -------------------------------------------------------------------------------------
+
+ public function set blurX($n:Number):void {
+ _blurX = this.exposedVars.blurX = $n;
+ }
+ public function get blurX():Number {
+ return _blurX;
+ }
+ public function set blurY($n:Number):void {
+ _blurY = this.exposedVars.blurY = $n;
+ }
+ public function get blurY():Number {
+ return _blurY;
+ }
+ public function set color($n:uint):void {
+ _color = this.exposedVars.color = $n;
+ }
+ public function get color():uint {
+ return _color;
+ }
+ public function set alpha($n:Number):void {
+ _alpha = this.exposedVars.alpha = $n;
+ }
+ public function get alpha():Number {
+ return _alpha;
+ }
+ public function set strength($n:Number):void {
+ _strength = this.exposedVars.strength = $n;
+ }
+ public function get strength():Number {
+ return _strength;
+ }
+ public function set inner($b:Boolean):void {
+ _inner = this.exposedVars.inner = $b;
+ }
+ public function get inner():Boolean {
+ return _inner;
+ }
+ public function set knockout($b:Boolean):void {
+ _knockout = this.exposedVars.knockout = $b;
+ }
+ public function get knockout():Boolean {
+ return _knockout;
+ }
+ public function set quality($n:uint):void {
+ _quality = this.exposedVars.quality = $n;
+ }
+ public function get quality():uint {
+ return _quality;
+ }
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/gs/utils/tween/SubVars.as b/gs/utils/tween/SubVars.as
new file mode 100644
index 0000000..4c3004c
--- /dev/null
+++ b/gs/utils/tween/SubVars.as
@@ -0,0 +1,26 @@
+/*
+VERSION: 1.0
+DATE: 1/29/2009
+ACTIONSCRIPT VERSION: 3.0
+DESCRIPTION:
+ This class works in conjunction with the TweenLiteVars or TweenMaxVars class to grant
+ strict data typing and code hinting (in most code editors) for filter tweens. See the documentation in
+ the TweenLiteVars or TweenMaxVars for more information.
+
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+
+package gs.utils.tween {
+ public class SubVars {
+ public var isTV:Boolean = true;
+ public var exposedVars:Object;
+
+ public function SubVars() {
+ this.exposedVars = {};
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/utils/tween/TransformAroundCenterVars.as b/gs/utils/tween/TransformAroundCenterVars.as
new file mode 100644
index 0000000..0ff47b5
--- /dev/null
+++ b/gs/utils/tween/TransformAroundCenterVars.as
@@ -0,0 +1,54 @@
+/*
+VERSION: 1.0
+DATE: 1/29/2009
+ACTIONSCRIPT VERSION: 3.0
+DESCRIPTION:
+ This class works in conjunction with the TweenLiteVars or TweenMaxVars class to grant
+ strict data typing and code hinting (in most code editors) for transformAroundPoint tweens. See the documentation in
+ the TweenLiteVars or TweenMaxVars for more information.
+
+USAGE:
+
+ Instead of TweenMax.to(my_mc, 1, {transformAroundCenter:{scaleX:2, scaleY:1.5, rotation:30}}, onComplete:myFunction}), you could use this utility like:
+
+ var myVars:TweenMaxVars = new TweenMaxVars();
+ myVars.transformAroundPoint = new TransformAroundCenterVars(2, 1.5, 30);
+ myVars.onComplete = myFunction;
+ TweenMax.to(my_mc, 1, myVars);
+
+
+NOTES:
+ - This utility is completely optional. If you prefer the shorter synatax in the regular TweenLite/TweenMax class, feel
+ free to use it. The purpose of this utility is simply to enable code hinting and to allow for strict data typing.
+ - You cannot define relative tween values with this utility.
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+
+package gs.utils.tween {
+ import flash.geom.Point;
+
+ public class TransformAroundCenterVars extends TransformAroundPointVars {
+
+ public function TransformAroundCenterVars($scaleX:Number=NaN, $scaleY:Number=NaN, $rotation:Number=NaN, $width:Number=NaN, $height:Number=NaN, $shortRotation:Object=null, $x:Number=NaN, $y:Number=NaN) {
+ super(null, $scaleX, $scaleY, $rotation, $width, $height, $shortRotation, $x, $y);
+ }
+
+ public static function createFromGeneric($vars:Object):TransformAroundCenterVars { //for parsing values that are passed in as generic Objects, like blurFilter:{blurX:5, blurY:3} (typically via the constructor)
+ if ($vars is TransformAroundCenterVars) {
+ return $vars as TransformAroundCenterVars;
+ }
+ return new TransformAroundCenterVars($vars.scaleX,
+ $vars.scaleY,
+ $vars.rotation,
+ $vars.width,
+ $vars.height,
+ $vars.shortRotation,
+ $vars.x,
+ $vars.y);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/utils/tween/TransformAroundPointVars.as b/gs/utils/tween/TransformAroundPointVars.as
new file mode 100644
index 0000000..f512381
--- /dev/null
+++ b/gs/utils/tween/TransformAroundPointVars.as
@@ -0,0 +1,145 @@
+/*
+VERSION: 1.0
+DATE: 1/29/2009
+ACTIONSCRIPT VERSION: 3.0
+DESCRIPTION:
+ This class works in conjunction with the TweenLiteVars or TweenMaxVars class to grant
+ strict data typing and code hinting (in most code editors) for transformAroundPoint tweens. See the documentation in
+ the TweenLiteVars or TweenMaxVars for more information.
+
+USAGE:
+
+ Instead of TweenMax.to(my_mc, 1, {transformAroundPoint:{point:new Point(100, 50), scaleX:2, scaleY:1.5, rotation:30}}, onComplete:myFunction}), you could use this utility like:
+
+ var myVars:TweenMaxVars = new TweenMaxVars();
+ myVars.transformAroundPoint = new TransformAroundPointVars(new Point(100, 50), 2, 1.5, 30);
+ myVars.onComplete = myFunction;
+ TweenMax.to(my_mc, 1, myVars);
+
+
+NOTES:
+ - This utility is completely optional. If you prefer the shorter synatax in the regular TweenLite/TweenMax class, feel
+ free to use it. The purpose of this utility is simply to enable code hinting and to allow for strict data typing.
+ - You cannot define relative tween values with this utility.
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+
+package gs.utils.tween {
+ import flash.geom.Point;
+
+ public class TransformAroundPointVars extends SubVars {
+
+ public function TransformAroundPointVars($point:Point=null, $scaleX:Number=NaN, $scaleY:Number=NaN, $rotation:Number=NaN, $width:Number=NaN, $height:Number=NaN, $shortRotation:Object=null, $x:Number=NaN, $y:Number=NaN) {
+ super();
+ if ($point != null) {
+ this.point = $point;
+ }
+ if (!isNaN($scaleX)) {
+ this.scaleX = $scaleX;
+ }
+ if (!isNaN($scaleY)) {
+ this.scaleY = $scaleY;
+ }
+ if (!isNaN($rotation)) {
+ this.rotation = $rotation;
+ }
+ if (!isNaN($width)) {
+ this.width = $width;
+ }
+ if (!isNaN($height)) {
+ this.height = $height;
+ }
+ if ($shortRotation != null) {
+ this.shortRotation = $shortRotation;
+ }
+ if (!isNaN($x)) {
+ this.x = $x;
+ }
+ if (!isNaN($y)) {
+ this.y = $y;
+ }
+ }
+
+ public static function createFromGeneric($vars:Object):TransformAroundPointVars { //for parsing values that are passed in as generic Objects, like blurFilter:{blurX:5, blurY:3} (typically via the constructor)
+ if ($vars is TransformAroundPointVars) {
+ return $vars as TransformAroundPointVars;
+ }
+ return new TransformAroundPointVars($vars.point,
+ $vars.scaleX,
+ $vars.scaleY,
+ $vars.rotation,
+ $vars.width,
+ $vars.height,
+ $vars.shortRotation,
+ $vars.x,
+ $vars.y);
+ }
+
+//---- GETTERS / SETTERS ------------------------------------------------------------------------------
+
+ public function set point($p:Point):void {
+ this.exposedVars.point = $p;
+ }
+ public function get point():Point {
+ return this.exposedVars.point;
+ }
+ public function set scaleX($n:Number):void {
+ this.exposedVars.scaleX = $n;
+ }
+ public function get scaleX():Number {
+ return Number(this.exposedVars.scaleX);
+ }
+ public function set scaleY($n:Number):void {
+ this.exposedVars.scaleY = $n;
+ }
+ public function get scaleY():Number {
+ return Number(this.exposedVars.scaleY);
+ }
+ public function set scale($n:Number):void {
+ this.exposedVars.scale = $n;
+ }
+ public function get scale():Number {
+ return Number(this.exposedVars.scale);
+ }
+ public function set rotation($n:Number):void {
+ this.exposedVars.rotation = $n;
+ }
+ public function get rotation():Number {
+ return Number(this.exposedVars.rotation);
+ }
+ public function set width($n:Number):void {
+ this.exposedVars.width = $n;
+ }
+ public function get width():Number {
+ return Number(this.exposedVars.width);
+ }
+ public function set height($n:Number):void {
+ this.exposedVars.height = $n;
+ }
+ public function get height():Number {
+ return Number(this.exposedVars.height);
+ }
+ public function set shortRotation($o:Object):void {
+ this.exposedVars.shortRotation = $o;
+ }
+ public function get shortRotation():Object {
+ return this.exposedVars.shortRotation;
+ }
+ public function set x($n:Number):void {
+ this.exposedVars.x = $n;
+ }
+ public function get x():Number {
+ return Number(this.exposedVars.x);
+ }
+ public function set y($n:Number):void {
+ this.exposedVars.y = $n;
+ }
+ public function get y():Number {
+ return Number(this.exposedVars.y);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/gs/utils/tween/TweenInfo.as b/gs/utils/tween/TweenInfo.as
new file mode 100644
index 0000000..db0e594
--- /dev/null
+++ b/gs/utils/tween/TweenInfo.as
@@ -0,0 +1,32 @@
+/*
+VERSION: 1.0
+DATE: 1/21/2009
+ACTIONSCRIPT VERSION: 3.0
+UPDATES & MORE DETAILED DOCUMENTATION AT: http://www.TweenLite.com
+DESCRIPTION:
+ Stores basic info about individual property tweens in TweenLite/Max.
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.utils.tween {
+
+ public class TweenInfo {
+ public var target:Object;
+ public var property:String;
+ public var start:Number;
+ public var change:Number;
+ public var name:String;
+ public var isPlugin:Boolean;
+
+ public function TweenInfo($target:Object, $property:String, $start:Number, $change:Number, $name:String, $isPlugin:Boolean) {
+ this.target = $target;
+ this.property = $property;
+ this.start = $start;
+ this.change = $change;
+ this.name = $name;
+ this.isPlugin = $isPlugin;
+ }
+ }
+}
\ No newline at end of file
diff --git a/gs/utils/tween/TweenLiteVars.as b/gs/utils/tween/TweenLiteVars.as
new file mode 100644
index 0000000..0449866
--- /dev/null
+++ b/gs/utils/tween/TweenLiteVars.as
@@ -0,0 +1,574 @@
+/*
+VERSION: 2.03
+DATE: 1/30/2009
+ACTIONSCRIPT VERSION: 3.0
+DESCRIPTION:
+ There are 2 primary benefits of using this utility to define your TweenLite variables:
+ 1) In most code editors, code hinting will be activated which helps remind you which special properties are available in TweenLite
+ 2) It allows you to code using strict datatyping (although it doesn't force you to).
+
+USAGE:
+
+ Instead of TweenLite.to(my_mc, 1, {x:300, tint:0xFF0000, onComplete:myFunction}), you could use this utility like:
+
+ var myVars:TweenLiteVars = new TweenLiteVars();
+ myVars.addProp("x", 300); // use addProp() to add any property that doesn't already exist in the TweenLiteVars instance.
+ myVars.tint = 0xFF0000;
+ myVars.onComplete = myFunction;
+ TweenLite.to(my_mc, 1, myVars);
+
+ Or if you just want to add multiple properties with one function, you can add up to 15 with the addProps() function, like:
+
+ var myVars:TweenLiteVars = new TweenLiteVars();
+ myVars.addProps("x", 300, false, "y", 100, false, "scaleX", 1.5, false, "scaleY", 1.5, false);
+ myVars.onComplete = myFunction;
+ TweenLite.to(my_mc, 1, myVars);
+
+NOTES:
+ - This class adds about 13 Kb to your published SWF (including all dependencies).
+ - This utility is completely optional. If you prefer the shorter synatax in the regular TweenLite class, feel
+ free to use it. The purpose of this utility is simply to enable code hinting and to allow for strict datatyping.
+ - You may add custom properties to this class if you want, but in order to expose them to TweenLite, make sure
+ you also add a getter and a setter that adds the property to the _exposedVars Object.
+ - You can reuse a single TweenLiteVars Object for multiple tweens if you want, but be aware that there are a few
+ properties that must be handled in a special way, and once you set them, you cannot remove them. Those properties
+ are: frame, visible, tint, and volume. If you are altering these values, it might be better to avoid reusing a TweenLiteVars
+ Object.
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.utils.tween {
+ import gs.TweenLite;
+
+ dynamic public class TweenLiteVars {
+ public static const version:Number = 2.03;
+ public const isTV:Boolean = true; // (stands for "isTweenVars") - Just gives us a way to check inside TweenLite to see if the Object is a TweenLiteVars without having to embed the class. This is helpful when handling tint, visible, and other properties that the user didn't necessarily define, but this utility class forces to be present.
+ /**
+ * The number of seconds to delay before the tween begins.
+ */
+ public var delay:Number = 0;
+ /**
+ * An easing function (i.e. fl.motion.easing.Elastic.easeOut) The default is Regular.easeOut.
+ */
+ public var ease:Function;
+ /**
+ * An Array of extra parameter values to feed the easing equation (beyond the standard 4). This can be useful with easing equations like Elastic that accept extra parameters like the amplitude and period. Most easing equations, however, don't require extra parameters so you won't need to pass in any easeParams.
+ */
+ public var easeParams:Array;
+ /**
+ * A function to call when the tween begins. This can be useful when there's a delay and you want something to happen just as the tween begins.
+ */
+ public var onStart:Function;
+ /**
+ * An Array of parameters to pass the onStart function.
+ */
+ public var onStartParams:Array;
+ /**
+ * A function to call whenever the tweening values are updated (on every frame during the time the tween is active).
+ */
+ public var onUpdate:Function;
+ /**
+ * An Array of parameters to pass the onUpdate function
+ */
+ public var onUpdateParams:Array;
+ /**
+ * A function to call when the tween has completed.
+ */
+ public var onComplete:Function;
+ /**
+ * An Array of parameters to pass the onComplete function
+ */
+ public var onCompleteParams:Array;
+ /**
+ * NONE = 0, ALL = 1, AUTO* = 2, CONCURRENT* = 3 *Only available with the optional OverwriteManager add-on class which must be initted once for TweenLite or TweenFilterLite, like OverwriteManager.init(). TweenMax automatically inits OverwriteManager.
+ */
+ public var overwrite:int = 2;
+ /**
+ * To prevent a tween from getting garbage collected after it completes, set persist to true. This does NOT, however, prevent teh tween from getting overwritten by other tweens of the same target.
+ */
+ public var persist:Boolean = false;
+ /**
+ * If you're using TweenLite.from() with a delay and you want to prevent the tween from rendering until it actually begins, set this special property to true. By default, it's false which causes TweenLite.from() to render its values immediately, even before the delay has expired.
+ */
+ public var renderOnStart:Boolean = false;
+ /**
+ * Primarily used in from() calls - forces the values to get flipped.
+ */
+ public var runBackwards:Boolean = false;
+ /**
+ * Defines starting values for the tween (by default, the target's current values at the time the tween begins are used)
+ */
+ public var startAt:TweenLiteVars;
+
+ protected var _exposedVars:Object; // Gives us a way to make certain non-dynamic properties enumerable.
+ protected var _autoAlpha:Number;
+ protected var _endArray:Array;
+ protected var _frame:int;
+ protected var _frameLabel:String;
+ protected var _removeTint:Boolean;
+ protected var _tint:uint;
+ protected var _visible:Boolean = true;
+ protected var _volume:Number;
+ protected var _bevelFilter:BevelFilterVars;
+ protected var _bezier:Array;
+ protected var _bezierThrough:Array;
+ protected var _blurFilter:BlurFilterVars;
+ protected var _colorMatrixFilter:ColorMatrixFilterVars;
+ protected var _dropShadowFilter:DropShadowFilterVars;
+ protected var _glowFilter:GlowFilterVars;
+ protected var _hexColors:Object;
+ protected var _orientToBezier:Array;
+ protected var _quaternions:Object;
+ protected var _setSize:Object;
+ protected var _shortRotation:Object;
+ protected var _transformAroundPoint:TransformAroundPointVars;
+ protected var _transformAroundCenter:TransformAroundCenterVars;
+ protected var _colorTransform:ColorTransformVars;
+
+
+ /**
+ * @param $vars An Object containing properties that correspond to the properties you'd like to add to this TweenLiteVars Object. For example, TweenLiteVars({x:300, onComplete:myFunction})
+ */
+ public function TweenLiteVars($vars:Object = null) {
+ _exposedVars = {};
+ if ($vars != null) {
+ for (var p:String in $vars) {
+ if (p == "blurFilter" || p == "glowFilter" || p == "colorMatrixFilter" || p == "bevelFilter" || p == "dropShadowFilter" || p == "transformAroundPoint" || p == "transformAroundCenter" || p == "colorTransform") {
+ //ignore SubVars - they must be handled differently later...
+ } else if (p != "protectedVars") {
+ this[p] = $vars[p];
+ }
+ }
+
+ if ($vars.blurFilter != null) {
+ this.blurFilter = BlurFilterVars.createFromGeneric($vars.blurFilter);
+ }
+ if ($vars.bevelFilter != null) {
+ this.bevelFilter = BevelFilterVars.createFromGeneric($vars.bevelFilter);
+ }
+ if ($vars.colorMatrixFilter != null) {
+ this.colorMatrixFilter = ColorMatrixFilterVars.createFromGeneric($vars.colorMatrixFilter);
+ }
+ if ($vars.dropShadowFilter != null) {
+ this.dropShadowFilter = DropShadowFilterVars.createFromGeneric($vars.dropShadowFilter);
+ }
+ if ($vars.glowFilter != null) {
+ this.glowFilter = GlowFilterVars.createFromGeneric($vars.glowFilter);
+ }
+ if ($vars.transformAroundPoint != null) {
+ this.transformAroundPoint = TransformAroundPointVars.createFromGeneric($vars.transformAroundPoint);
+ }
+ if ($vars.transformAroundCenter != null) {
+ this.transformAroundCenter = TransformAroundCenterVars.createFromGeneric($vars.transformAroundCenter);
+ }
+ if ($vars.colorTransform != null) {
+ this.colorTransform = ColorTransformVars.createFromGeneric($vars.colorTransform);
+ }
+
+ if ($vars.protectedVars != null) { //used for clone()-ing protected vars
+ var pv:Object = $vars.protectedVars;
+ for (p in pv) {
+ this[p] = pv[p];
+ }
+ }
+ }
+ if (TweenLite.version < 10.05) {
+ trace("TweenLiteVars error! Please update your TweenLite class or try deleting your ASO files. TweenLiteVars requires a more recent version. Download updates at http://www.TweenLite.com.");
+ }
+ }
+
+ /**
+ * Adds a dynamic property for tweening and allows you to set whether the end value is relative or not
+ *
+ * @param $name Property name
+ * @param $value Numeric end value (or beginning value for from() calls)
+ * @param $relative If true, the value will be relative to the target's current value. For example, if my_mc.x is currently 300 and you do addProp("x", 200, true), the end value will be 500.
+ */
+ public function addProp($name:String, $value:Number, $relative:Boolean = false):void {
+ if ($relative) {
+ this[$name] = String($value);
+ } else {
+ this[$name] = $value;
+ }
+ }
+
+ /**
+ * Adds up to 15 dynamic properties at once (just like doing addProp() multiple times). Saves time and reduces code.
+ */
+ public function addProps($name1:String, $value1:Number, $relative1:Boolean = false,
+ $name2:String = null, $value2:Number = 0, $relative2:Boolean = false,
+ $name3:String = null, $value3:Number = 0, $relative3:Boolean = false,
+ $name4:String = null, $value4:Number = 0, $relative4:Boolean = false,
+ $name5:String = null, $value5:Number = 0, $relative5:Boolean = false,
+ $name6:String = null, $value6:Number = 0, $relative6:Boolean = false,
+ $name7:String = null, $value7:Number = 0, $relative7:Boolean = false,
+ $name8:String = null, $value8:Number = 0, $relative8:Boolean = false,
+ $name9:String = null, $value9:Number = 0, $relative9:Boolean = false,
+ $name10:String = null, $value10:Number = 0, $relative10:Boolean = false,
+ $name11:String = null, $value11:Number = 0, $relative11:Boolean = false,
+ $name12:String = null, $value12:Number = 0, $relative12:Boolean = false,
+ $name13:String = null, $value13:Number = 0, $relative13:Boolean = false,
+ $name14:String = null, $value14:Number = 0, $relative14:Boolean = false,
+ $name15:String = null, $value15:Number = 0, $relative15:Boolean = false):void {
+ addProp($name1, $value1, $relative1);
+ if ($name2 != null) {
+ addProp($name2, $value2, $relative2);
+ }
+ if ($name3 != null) {
+ addProp($name3, $value3, $relative3);
+ }
+ if ($name4 != null) {
+ addProp($name4, $value4, $relative4);
+ }
+ if ($name5 != null) {
+ addProp($name5, $value5, $relative5);
+ }
+ if ($name6 != null) {
+ addProp($name6, $value6, $relative6);
+ }
+ if ($name7 != null) {
+ addProp($name7, $value7, $relative7);
+ }
+ if ($name8 != null) {
+ addProp($name8, $value8, $relative8);
+ }
+ if ($name9 != null) {
+ addProp($name9, $value9, $relative9);
+ }
+ if ($name10 != null) {
+ addProp($name10, $value10, $relative10);
+ }
+ if ($name11 != null) {
+ addProp($name11, $value11, $relative11);
+ }
+ if ($name12 != null) {
+ addProp($name12, $value12, $relative12);
+ }
+ if ($name13 != null) {
+ addProp($name13, $value13, $relative13);
+ }
+ if ($name14 != null) {
+ addProp($name14, $value14, $relative14);
+ }
+ if ($name15 != null) {
+ addProp($name15, $value15, $relative15);
+ }
+ }
+
+ /**
+ * Clones the TweenLiteVars object.
+ */
+ public function clone():TweenLiteVars {
+ var vars:Object = {protectedVars:{}};
+ appendCloneVars(vars, vars.protectedVars);
+ return new TweenLiteVars(vars);
+ }
+
+ /**
+ * Works with clone() to copy all the necessary properties. Split apart from clone() to take advantage of inheritence for TweenMaxVars
+ */
+ protected function appendCloneVars($vars:Object, $protectedVars:Object):void {
+ var props:Array, special:Array, i:int, p:String;
+ props = ["delay","ease","easeParams","onStart","onStartParams","onUpdate","onUpdateParams","onComplete","onCompleteParams","overwrite","persist","renderOnStart","runBackwards","startAt"];
+ for (i = props.length - 1; i > -1; i--) {
+ $vars[props[i]] = this[props[i]];
+ }
+ special = ["_autoAlpha",
+ "_bevelFilter",
+ "_bezier",
+ "_bezierThrough",
+ "_blurFilter",
+ "_colorMatrixFilter",
+ "_colorTransform",
+ "_dropShadowFilter",
+ "_endArray",
+ "_frame",
+ "_frameLabel",
+ "_glowFilter",
+ "_hexColors",
+ "_orientToBezier",
+ "_quaternions",
+ "_removeTint",
+ "_setSize",
+ "_shortRotation",
+ "_tint",
+ "_transformAroundCenter",
+ "_transformAroundPoint",
+ "_visible",
+ "_volume",
+ "_exposedVars"];
+
+ for (i = special.length - 1; i > -1; i--) {
+ $protectedVars[special[i]] = this[special[i]];
+ }
+ for (p in this) {
+ $vars[p] = this[p]; //add all the dynamic properties.
+ }
+ }
+
+
+//---- GETTERS / SETTERS -------------------------------------------------------------------------------------------------------------
+
+ /**
+ * @return Exposes enumerable properties.
+ */
+ public function get exposedVars():Object {
+ var o:Object = {}, p:String;
+ for (p in _exposedVars) {
+ o[p] = _exposedVars[p];
+ }
+ for (p in this) {
+ o[p] = this[p]; //add all the dynamic properties.
+ }
+ return o;
+ }
+
+ /**
+ * @param $n Same as changing the "alpha" property but with the additional feature of toggling the "visible" property to false when alpha is 0.
+ */
+ public function set autoAlpha($n:Number):void {
+ _autoAlpha = _exposedVars.autoAlpha = $n;
+ }
+ public function get autoAlpha():Number {
+ return _autoAlpha;
+ }
+
+ /**
+ * @param $a An Array containing numeric end values of the target Array. Keep in mind that the target of the tween must be an Array with at least the same length as the endArray.
+ */
+ public function set endArray($a:Array):void {
+ _endArray = _exposedVars.endArray = $a;
+ }
+ public function get endArray():Array {
+ return _endArray;
+ }
+
+ /**
+ * @param $b To remove the tint from a DisplayObject, set removeTint to true.
+ */
+ public function set removeTint($b:Boolean):void {
+ _removeTint = _exposedVars.removeTint = $b;
+ }
+ public function get removeTint():Boolean {
+ return _removeTint;
+ }
+
+ /**
+ * @param $b To set a DisplayObject's "visible" property at the end of the tween, use this special property.
+ */
+ public function set visible($b:Boolean):void {
+ _visible = _exposedVars.visible = $b;
+ }
+ public function get visible():Boolean {
+ return _visible;
+ }
+
+ /**
+ * @param $n Tweens a MovieClip to a particular frame.
+ */
+ public function set frame($n:int):void {
+ _frame = _exposedVars.frame = $n;
+ }
+ public function get frame():int {
+ return _frame;
+ }
+
+ /**
+ * @param $n Tweens a MovieClip to a particular frame.
+ */
+ public function set frameLabel($s:String):void {
+ _frameLabel = _exposedVars.frameLabel = $s;
+ }
+ public function get frameLabel():String {
+ return _frameLabel;
+ }
+
+ /**
+ * @param $n To change a DisplayObject's tint, set this to the hex value of the color you'd like the DisplayObject to end up at(or begin at if you're using TweenLite.from()). An example hex value would be 0xFF0000. If you'd like to remove the tint from a DisplayObject, use the removeTint special property.
+ */
+ public function set tint($n:uint):void {
+ _tint = _exposedVars.tint = $n;
+ }
+ public function get tint():uint {
+ return _tint;
+ }
+
+ /**
+ * @param $n To change a MovieClip's (or SoundChannel's) volume, just set this to the value you'd like the MovieClip to end up at (or begin at if you're using TweenLite.from()).
+ */
+ public function set volume($n:Number):void {
+ _volume = _exposedVars.volume = $n;
+ }
+ public function get volume():Number {
+ return _volume;
+ }
+
+ /**
+ * @param $f Applies a BevelFilter tween (use the BevelFilterVars utility class to define the values).
+ */
+ public function set bevelFilter($f:BevelFilterVars):void {
+ _bevelFilter = _exposedVars.bevelFilter = $f;
+ }
+ public function get bevelFilter():BevelFilterVars {
+ return _bevelFilter;
+ }
+
+ /**
+ * @param $a Array of Objects, one for each "control point" (see documentation on Flash's curveTo() drawing method for more about how control points work). In this example, let's say the control point would be at x/y coordinates 250,50. Just make sure your my_mc is at coordinates 0,0 and then do: TweenMax.to(my_mc, 3, {_x:500, _y:0, bezier:[{_x:250, _y:50}]});
+ */
+ public function set bezier($a:Array):void {
+ _bezier = _exposedVars.bezier = $a;
+ }
+ public function get bezier():Array {
+ return _bezier;
+ }
+
+ /**
+ * @param $a Identical to bezier except that instead of passing Bezier control point values, you pass values through which the Bezier values should move. This can be more intuitive than using control points.
+ */
+ public function set bezierThrough($a:Array):void {
+ _bezierThrough = _exposedVars.bezierThrough = $a;
+ }
+ public function get bezierThrough():Array {
+ return _bezierThrough;
+ }
+
+ /**
+ * @param $f Applies a BlurFilter tween (use the BlurFilterVars utility class to define the values).
+ */
+ public function set blurFilter($f:BlurFilterVars):void {
+ _blurFilter = _exposedVars.blurFilter = $f;
+ }
+ public function get blurFilter():BlurFilterVars {
+ return _blurFilter;
+ }
+
+ /**
+ * @param $f Applies a ColorMatrixFilter tween (use the ColorMatrixFilterVars utility class to define the values).
+ */
+ public function set colorMatrixFilter($f:ColorMatrixFilterVars):void {
+ _colorMatrixFilter = _exposedVars.colorMatrixFilter = $f;
+ }
+ public function get colorMatrixFilter():ColorMatrixFilterVars {
+ return _colorMatrixFilter;
+ }
+
+ /**
+ * @param $ct Applies a ColorTransform tween (use the ColorTransformVars utility class to define the values).
+ */
+ public function set colorTransform($ct:ColorTransformVars):void {
+ _colorTransform = _exposedVars.colorTransform = $ct;
+ }
+ public function get colorTransform():ColorTransformVars {
+ return _colorTransform;
+ }
+
+ /**
+ * @param $f Applies a DropShadowFilter tween (use the DropShadowFilterVars utility class to define the values).
+ */
+ public function set dropShadowFilter($f:DropShadowFilterVars):void {
+ _dropShadowFilter = _exposedVars.dropShadowFilter = $f;
+ }
+ public function get dropShadowFilter():DropShadowFilterVars {
+ return _dropShadowFilter;
+ }
+
+ /**
+ * @param $f Applies a GlowFilter tween (use the GlowFilterVars utility class to define the values).
+ */
+ public function set glowFilter($f:GlowFilterVars):void {
+ _glowFilter = _exposedVars.glowFilter = $f;
+ }
+ public function get glowFilter():GlowFilterVars {
+ return _glowFilter;
+ }
+
+ /**
+ * @param $o Although hex colors are technically numbers, if you try to tween them conventionally, you'll notice that they don't tween smoothly. To tween them properly, the red, green, and blue components must be extracted and tweened independently. TweenMax makes it easy. To tween a property of your object that's a hex color to another hex color, use this special hexColors property of TweenMax. It must be an OBJECT with properties named the same as your object's hex color properties. For example, if your my_obj object has a "myHexColor" property that you'd like to tween to red (0xFF0000) over the course of 2 seconds, do: TweenMax.to(my_obj, 2, {hexColors:{myHexColor:0xFF0000}}); You can pass in any number of hexColor properties.
+ */
+ public function set hexColors($o:Object):void {
+ _hexColors = _exposedVars.hexColors = $o;
+ }
+ public function get hexColors():Object {
+ return _hexColors;
+ }
+
+ /**
+ * @param $a A common effect that designers/developers want is for a MovieClip/Sprite to orient itself in the direction of a Bezier path (alter its rotation). orientToBezier makes it easy. In order to alter a rotation property accurately, TweenMax needs 4 pieces of information:
+ *
+ * 1. Position property 1 (typically "x")
+ * 2. Position property 2 (typically "y")
+ * 3. Rotational property (typically "rotation")
+ * 4. Number of degrees to add (optional - makes it easy to orient your MovieClip/Sprite properly)
+ *
+ * The orientToBezier property should be an Array containing one Array for each set of these values. For maximum flexibility, you can pass in any number of Arrays inside the container Array, one for each rotational property. This can be convenient when working in 3D because you can rotate on multiple axis. If you're doing a standard 2D x/y tween on a bezier, you can simply pass in a boolean value of true and TweenMax will use a typical setup, [["x", "y", "rotation", 0]]. Hint: Don't forget the container Array (notice the double outer brackets)
+ */
+ public function set orientToBezier($a:*):void {
+ if ($a is Array) {
+ _orientToBezier = _exposedVars.orientToBezier = $a;
+ } else if ($a == true) {
+ _orientToBezier = _exposedVars.orientToBezier = [["x", "y", "rotation", 0]];
+ } else {
+ _orientToBezier = null;
+ delete _exposedVars.orientToBezier;
+ }
+ }
+ public function get orientToBezier():* {
+ return _orientToBezier;
+ }
+
+ /**
+ * @param $q An object with properties that correspond to the quaternion properties of the target object. For example, if your my3DObject has "orientation" and "childOrientation" properties that contain quaternions, and you'd like to tween them both, you'd do: {orientation:myTargetQuaternion1, childOrientation:myTargetQuaternion2}. Quaternions must have the following properties: x, y, z, and w.
+ */
+ public function set quaternions($q:Object):void {
+ _quaternions = _exposedVars.quaternions = $q;
+ }
+ public function get quaternions():Object {
+ return _quaternions;
+ }
+
+ /**
+ * @param $o An object containing a "width" and/or "height" property which will be tweened over time and applied using setSize() on every frame during the course of the tween.
+ */
+ public function set setSize($o:Object):void {
+ _setSize = _exposedVars.setSize = $o;
+ }
+ public function get setSize():Object {
+ return _setSize;
+ }
+
+ /**
+ * @param $o To tween any rotation property (even multiple properties) of the target object in the shortest direction, use shortRotation. For example, if myObject.rotation is currently 170 degrees and you want to tween it to -170 degrees, a normal rotation tween would travel a total of 340 degrees in the counter-clockwise direction, but if you use shortRotation, it would travel 20 degrees in the clockwise direction instead. Pass in an object in with properties that correspond to the rotation values of the target, like {rotation:-170} or {rotationX:-170, rotationY:50}
+ */
+ public function set shortRotation($o:Object):void {
+ _shortRotation = _exposedVars.shortRotation = $o;
+ }
+ public function get shortRotation():Object {
+ return _shortRotation;
+ }
+
+ /**
+ * @param $tp Applies a transformAroundCenter tween (use the TransformAroundCenterVars utility class to define the values).
+ */
+ public function set transformAroundCenter($tp:TransformAroundCenterVars):void {
+ _transformAroundCenter = _exposedVars.transformAroundCenter = $tp;
+ }
+ public function get transformAroundCenter():TransformAroundCenterVars {
+ return _transformAroundCenter;
+ }
+
+ /**
+ * @param $tp Applies a transformAroundPoint tween (use the TransformAroundPointVars utility class to define the values).
+ */
+ public function set transformAroundPoint($tp:TransformAroundPointVars):void {
+ _transformAroundPoint = _exposedVars.transformAroundPoint = $tp;
+ }
+ public function get transformAroundPoint():TransformAroundPointVars {
+ return _transformAroundPoint;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/gs/utils/tween/TweenMaxVars.as b/gs/utils/tween/TweenMaxVars.as
new file mode 100644
index 0000000..831479c
--- /dev/null
+++ b/gs/utils/tween/TweenMaxVars.as
@@ -0,0 +1,113 @@
+/*
+VERSION: 2.01
+DATE: 1/19/2009
+ACTIONSCRIPT VERSION: 3.0
+DESCRIPTION:
+ There are 2 primary benefits of using this utility to define your TweenMax variables:
+ 1) In most code editors, code hinting will be activated which helps remind you which special properties are available in TweenMax
+ 2) It allows you to code using strict datatyping (although it doesn't force you to).
+
+USAGE:
+
+ Instead of TweenMax.to(my_mc, 1, {x:300, tint:0xFF0000, onComplete:myFunction}), you could use this utility like:
+
+ var myVars:TweenMaxVars = new TweenMaxVars();
+ myVars.addProp("x", 300); // use addProp() to add any property that doesn't already exist in the TweenMaxVars instance.
+ myVars.tint = 0xFF0000;
+ myVars.onComplete = myFunction;
+ TweenMax.to(my_mc, 1, myVars);
+
+ Or if you just want to add multiple properties with one function, you can add up to 15 with the addProps() function, like:
+
+ var myVars:TweenMaxVars = new TweenMaxVars();
+ myVars.addProps("x", 300, false, "y", 100, false, "scaleX", 1.5, false, "scaleY", 1.5, false);
+ myVars.onComplete = myFunction;
+ TweenMax.to(my_mc, 1, myVars);
+
+NOTES:
+ - This class adds about 14 Kb to your published SWF.
+ - This utility is completely optional. If you prefer the shorter synatax in the regular TweenMax class, feel
+ free to use it. The purpose of this utility is simply to enable code hinting and to allow for strict datatyping.
+ - You may add custom properties to this class if you want, but in order to expose them to TweenMax, make sure
+ you also add a getter and a setter that adds the property to the _exposedVars Object.
+ - You can reuse a single TweenMaxVars Object for multiple tweens if you want, but be aware that there are a few
+ properties that must be handled in a special way, and once you set them, you cannot remove them. Those properties
+ are: frame, visible, tint, and volume. If you are altering these values, it might be better to avoid reusing a TweenMaxVars
+ Object.
+
+AUTHOR: Jack Doyle, jack@greensock.com
+Copyright 2009, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.
+*/
+
+package gs.utils.tween {
+ import gs.utils.tween.TweenLiteVars;
+
+ dynamic public class TweenMaxVars extends TweenLiteVars {
+ public static const version:Number = 2.01;
+ /**
+ * A function to which the TweenMax instance should dispatch a TweenEvent when it begins. This is the same as doing myTweenMaxInstance.addEventListener(TweenEvent.START, myFunction);
+ */
+ public var onStartListener:Function;
+ /**
+ * A function to which the TweenMax instance should dispatch a TweenEvent every time it updates values. This is the same as doing myTweenMaxInstance.addEventListener(TweenEvent.UPDATE, myFunction);
+ */
+ public var onUpdateListener:Function;
+ /**
+ * A function to which the TweenMax instance should dispatch a TweenEvent when it completes. This is the same as doing myTweenMaxInstance.addEventListener(TweenEvent.COMPLETE, myFunction);
+ */
+ public var onCompleteListener:Function;
+ /**
+ * To make the tween reverse when it completes (like a yoyo) any number of times, set this to the number of cycles you'd like the tween to yoyo. A value of zero causes the tween to yoyo endlessly.
+ */
+ public var yoyo:Number;
+ /**
+ * To make the tween repeat when it completes any number of times, set this to the number of cycles you'd like the tween to loop. A value of zero causes the tween to loop endlessly.
+ */
+ public var loop:Number;
+
+ protected var _roundProps:Array;
+
+ /**
+ * @param $vars An Object containing properties that correspond to the properties you'd like to add to this TweenMaxVars Object. For example, TweenMaxVars({blurFilter:{blurX:10, blurY:20}, onComplete:myFunction})
+ */
+ public function TweenMaxVars($vars:Object = null) {
+ super($vars);
+ }
+
+ /**
+ * Clones the TweenMaxVars object.
+ */
+ override public function clone():TweenLiteVars {
+ var vars:Object = {protectedVars:{}};
+ appendCloneVars(vars, vars.protectedVars);
+ return new TweenMaxVars(vars);
+ }
+
+ /**
+ * Works with clone() to copy all the necessary properties. Split apart from clone() to take advantage of inheritence
+ */
+ override protected function appendCloneVars($vars:Object, $protectedVars:Object):void {
+ super.appendCloneVars($vars, $protectedVars);
+ var props:Array = ["onStartListener","onUpdateListener","onCompleteListener","onCompleteAllListener","yoyo","loop"];
+ for (var i:int = props.length - 1; i > -1; i--) {
+ $vars[props[i]] = this[props[i]];
+ }
+ $protectedVars._roundProps = _roundProps;
+ }
+
+
+//---- GETTERS / SETTERS ---------------------------------------------------------------------------------------------
+
+ /**
+ * @param $a An Array of the names of properties that should be rounded to the nearest integer when tweening
+ */
+ public function set roundProps($a:Array):void {
+ _roundProps = _exposedVars.roundProps = $a;
+ }
+ public function get roundProps():Array {
+ return _roundProps;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/icons/128.png b/icons/128.png
new file mode 100644
index 0000000..adabb8f
--- /dev/null
+++ b/icons/128.png
Binary files differ
diff --git a/icons/16.png b/icons/16.png
new file mode 100644
index 0000000..ca5fc6e
--- /dev/null
+++ b/icons/16.png
Binary files differ
diff --git a/icons/32.png b/icons/32.png
new file mode 100644
index 0000000..06d0b6e
--- /dev/null
+++ b/icons/32.png
Binary files differ
diff --git a/icons/48.png b/icons/48.png
new file mode 100644
index 0000000..e399f1f
--- /dev/null
+++ b/icons/48.png
Binary files differ
diff --git a/icons/64.png b/icons/64.png
new file mode 100644
index 0000000..776d65c
--- /dev/null
+++ b/icons/64.png
Binary files differ
diff --git a/quiz.fla b/quiz.fla
new file mode 100644
index 0000000..5145b9e
--- /dev/null
+++ b/quiz.fla
Binary files differ
diff --git a/quiz.html b/quiz.html
new file mode 100644
index 0000000..99d7e87
--- /dev/null
+++ b/quiz.html
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+