Converting+to+a+New+Activity+Template

There have been a couple of major changes to the Activity Template:
 * 1) 2008-04-07 when we went from v1 wrapper to v2 wrapper (cf. old instructions)
 * 2) 2009-07-04 when we completely revamped the Template and .as files, introducing wrapperCommon.as
 * 3) 2011-07-11 when we moved to a template that gets the bulk of its standard code from #included .as files - this means that in future, moving to a new activity template will be as easy as recompiling the .fla

If your activity predates one of these, then the following is the best approach to safely update it. If a tweak is all that is required, the following may be helpful: The old instructions for updating the template, the old instructions for updating the calculator.

A. Make new fla's for the process

 * 1) Open up the activity's .fla, which is currently based on an earlier template, this will be referred to as the **old .fla**.
 * 2) Ensure that this version is archived in the correct Source folder on the FTP site and/or copied to a safe location.
 * 3) Open up a fresh copy of the most recent activity template .fla - this should be in classes/edu/clips/activityTemplate folder of the SVN.
 * 4) Rename this fresh copy to something like CL00X_C0Y_A0Z_ExpectedActivityName2012-07-25RI.fla and save it in the root of your testbed. This will be referred to as the **new .fla**.
 * 5) You may want to save versions of the new .fla as you proceed through the steps so that they can be reversed. Do **not** ever overwrite the old .fla.
 * 6) (optional) Go to File | Publish Settings in the **new .fla** to publish the .swf to the desired directory in your testbed.

B. Get the correct Number of Scenes

 * 1) Make the **new .fla**have the correct number of scenes. Don't touch the first or last scenes since they load the activity_start and activity_end pages.
 * 2) If there are **too //many// scenes**in the new .fla
 * 3) Click on the global layer of the first unnecessary frame and shift-click on the scenes layer of the last unnecessary frame. This should select all the unnecessary frames on all the unnecessary layers (currently 7).
 * 4) Press Shift-F5 to remove them.
 * 5) If there are **too //few// scenes**in the new .fla.
 * 6) Select all the layers in the second to last frame (that is the one before the end frame).
 * 7) Press F5 repeatedly to get enough room for all of the scenes.
 * 8) Select the frame in the global's layer that you just extended (the last one with code in it, other that the activity_end frame).
 * 9) Press CTRL-ALT-C to copy the frame.
 * 10) In each of the frames added to the timeline in the globals layer, press CTRL-ALT-V, to paste a copy. Each frame of the globals layer should look like a keyframe with actions code in it.
 * 11) Repeat step 5 with the frames added to the timeline in the scenes layer. Each frame of the scenes layer should look like a keyframe coloured grey to indicate that they contain objects.
 * 12) Save the new .fla

C. Get the global and actions layer right
>> var showFrameNumbers:Boolean = false; >> var usingNarration:Boolean = true; >> are the usual settings for published activities. >> code format="actionscript" ReleaseDate = "Revised July 2012"; code
 * 1) Copy the variable definitions from the **old .fla**'s main timeline, global layer, frame 1 into a text editor, like Sublime Text 2.
 * 2) Ensure the corresponding variable definitions in the **new .fla**are correct. Note:
 * 3) this can be accomplished by copying and pasting from the old values contained in the text editor to the actions panel of the new .fla
 * 4) var inDebugMode:Boolean = false;
 * 1) scan the code for any activity specific code - there shouldn't be any since it is supposed to be on the layer below
 * 2) The cluster names were changed in July 2011, make sure the new name is being used from the table below.
 * 3) Change the release date to something like:
 * 1) Walk through the code in the **old .fla**'s main timeline, global layer from 1 to the end to make sure that there isn't any special code that looks like it is required for something other than the operation of the wrappers. If there is any, consider moving it to the actions layer. Since the old .fla has been archived, you can save and test any changes made to ensure the code is still operational.
 * 2) If there is any code in the main timeline of the old .fla's actions layer, copy all the frames from the old .fla to the new .fla. (See instructions above for the shortcuts for copy frames and paste frames). Technically, there might be code that someone cares about on the debug layer, but we assume that was only used for code that is not required for the published version.
 * 3) Save the new .fla

D. Populate the library with the Scenes and Objects required
> Generally, we want to copy all the objects with a **non-zero Use Count** or that have an **export linkage**. > We don't want to copy anything that has to do with the Template (e.g. TemplatePages, TemplateStuff), miniWrapper, miniCalc, Fonts, FLVPlayback, right.mp3 etc. > This is especially a problem with Fireworks Objects. Search the library for "Fireworks" or "Page 1" to make sure that you will not lose Mathcot images etc. when copying. > **#include "../classes/edu/clips/ActivityTemplate/scene01.as"**(note that there is no semicolon) (i.e., include activities_0X, onUnload, continuebutton, pingCorrect, pingIncorrect, delete onEnterFrame) >
 * 1) Press F11 to open the library. Use the drop-down list at the top of the library to ensure you are looking at the **old .fla**'s library.
 * 2) Right click on Use Count and ensure that Keep Use Counts updated is checked.
 * 1) Look for objects in the old .fla that use the same name. One of these will have to be renamed before the copying is done.
 * 1) Select the object to copy, right-click and choose Copy, change to the new .fla's library using the drop-down list at the top of the library panel.
 * 2) In the new library, make sure that an object at the level you wish to paste at is selected (e.g. Scene_2) and right-click and choose Paste.
 * 3) You should be told that you have to resolve library conflicts. Select **replace** existing items.
 * 4)  There is a possibility that importing stuff from the old .fla could have overridden some of the TemplateStuff, like the continue button. It might be a good idea at this stage to open a clean copy of the Activity Template and copy the TemplateStuff folder into your new .fla.
 * 5) Press F9 to open the Actions window. Navigate to each scene's globals and sound Frame 1, replace all the "standard" stuff with
 * 1) Save the new .fla

E. Get the scenes into the right places
> In the main timeline look for named frames (denoted by a red flag) in the old .fla, the corresponding frame in the new .fla will need to be named as well. Use the properties window to make the names match. > code bt_large_continue._x = 615; bt_large_continue._y = 35; code
 * 1) For each frame of the new fla.'s main timeline scenes layer, click on the scene object (like a title, or if empty, the hollow circle at the top left of the stage) and make sure that the property panel indicates the correct name (always "scene") and that it is an Instance of the correct library object. If it is not an instance of the correct library object, click Swap, and point to the correct object. This will be absolutely necessary if any frames were added to the template.
 * 2) Some activities do not use a linear Scene 2 to Scene N type numbering - this should be fixed now if it is the case.
 * 3) Delete any extra scenes from the library.
 * 4) Use the Edit Symbols button to navigate to each scene.
 * 1) If an activity uses the old continue button, scan each scene for the various placements of it. Note any x, y properties for continue buttons not in the lower right. In the globals and sound layer of such frames insert code like:
 * 1) With the new standard wait code, make sure that any movement of the continue button is done prior to the call to showcontinue or else you will get the yellow halo at the incorrect locations.
 * 2) Occasionally, a scene will have been scaled to make it work. In that case, you will need to open the old .fla and look at the x, y, width, height properties of the scene and reproduce them in the new .fla.
 * 3) Save the new .fla

F. Tidying up
>> For example, activities that use the GraphingBoard class will have import edu.clips.graph.* replaced with >> code format="actionscript" import edu.clips.graph.GraphingBoard; import edu.clips.graph.MathParser; import edu.clips.graph.RangeParser; code
 * 1) Find all occurrences of "import". Remove any references to *.
 * 2) In the frame that uses a * reference, find any occurrences of ".create(" and "new " (the space is intentional) and, if desperate, " ub" to find any classes, other than primitive ones like Object, TextFormat, and Array
 * 3) If you find any really old classes, like CLIPSubShape, http://mathfest.wikispaces.com/Fixing+Older+Activities+with+Audio+and+Timeline+Issues may help modernize the activity.
 * 4) Write an import statement for each class that you found. It may help to do a global find and replace for this class name and make sure the code has an import for it.
 * 5) Classes to look for if doing a global find: **ubObject**, **ubColour**, **ubMovieClipTransform**, **ubError**, **ubDebug**, **ubIcon**, **ubMath**
 * 6) If you miss an import, an object will not appear on the screen that should have. This is sometimes very hard to notice.
 * 1) Find all occurrences of "trace" and replace them with "//trace" (unless they are clearly warnings)
 * 2) Find all occurrences of "swapDepth" and see that no funny business is going on.

G. Finishing up
> Have the existing copy open in a browser window to do a direct compare to make sure all buttons, objects, feedback etc. match.If a graphing board shows, but not some other things, check the 6th parameter in the new GraphingBoard call and try changing it (it represents the depth)
 * 1) Test that the new .fla works properly. This is a time-consuming task - see CLIPS Reviewing an Activity
 * 1) **Save and Compact** the final version of the new .fla and upload it.
 * 2) Test in the main wrapper and in standalone mode. Make sure that the breadcrumbs with the activity name don't overlap.


 * Cluster Names:**


 * 1 || Fractions – Exploring Part/Whole Relationships ||
 * 2 || Trigonometric Functions – Graphing Sine (degrees) ||
 * 3 || Fractions – Adding and Subtracting ||
 * 4 || Linear Growing Patterns – Representing ||
 * 5 || Integers – Representing, Comparing & Ordering ||
 * 6 || Trigonometric Functions – Understanding Radians ||
 * 7 || Integers – Adding and Subtracting ||
 * 8 || Fractions – Multiplying and Dividing ||

Updating to October 2011 Activity Template

 * 1) copy the //copyright pod// library object to the .fla from the latest activity template.
 * 2) check globals frame 1 for _global.myMute == "nosound" (or anything other that "on") and set this.myMute instead.

Updating to November 2011 Activity Template

 * 1) check that the needsActivityTools Boolean is present (see above)
 * 2) make sure that there is a CLIPS_Empty empty movieclip in the library. If not, go to the Library (F11), right click and select **New Symbol**, use "CLIPS_Empty" for the name and Export for Actionscript which will select Export in frame 1 and fill in the indentifier. Alternatively, it can be copied from another library. Ensure that "Export:CLIPS_Empty" shows in the Linkage column of the Library. It should be placed at the root of TemplateStuff.