Sample Code (Not Final Version) for 'Myhts from Amazon' Project
In the previous blogs, details about the Software installation, marker creation, 3D Model and links to resources were posted.
The following is the Code (Not final version - Needs tuning for performance and some changes to include the overall scope of the project ) for the Interactive Story Telling Project - Myths from Amazon.
(Thanks to the developers that support open source and posted sample code at various sites.
The sample code from: http://gotoandlearn.com/ was used as the basis for this project)
------------
-Suresh
The following is the Code (Not final version - Needs tuning for performance and some changes to include the overall scope of the project ) for the Interactive Story Telling Project - Myths from Amazon.
(Thanks to the developers that support open source and posted sample code at various sites.
The sample code from: http://gotoandlearn.com/ was used as the basis for this project)
------------
-Suresh
Comments
(1) Arrays - For lists of markers, containers and models, use arrays instead of individual variables. Documentation at http://flash-creations.com/notes/actionscript_complexdata.php.
(2) Loops - There are repetitive if-tests that are unnecessary. Either loop through the set of possibilities or directly reference the id via the array-index. An example of a loop for the onAdded function is like:
var i:Number = 0;
for(i=0;i<13;i++){
if (e.marker.patternId == i){
aryMarker(i) = e.marker;
aryContainer(i).visible = true;
}
else{
//nomarker
}
}