next up previous contents
Next: Using autoupdate Up: Tutorials Previous: Calling Active scripting languages   Contents

Using shared objects in packed movies

Generally, shared objects are relative to the full path name of the movie that creates them. However, the path name of a packed movie changes each time the application launches. The reason is that the SWFKit applications will extract the packed movies to a temporary folder, and will remove the temporary folder when they are about to exit. Each time the temporary folder changes, so the path names of the unpacked movies change. In this case, shared objects do not work in packed movies. However, there is still a way to make the shared objects work in packed movies.
var aso = SharedObject.getLocal("testso.testso.swfkitproject.topcmm", "/");
trace(aso);
if (aso.data.score == undefined)
{
    aso.data.score = new Object;
    aso.data.score.minValue = 0;
    aso.data.score.maxValue = 100;
}
else
{
    _root.minValue = aso.data.score.minValue;
    _root.maxValue = aso.data.score.maxValue;
}
In the above example, the second parameter "/" of the getLocal method means that the shared objects will be saved in a root folder that any local flash movies can access it. In this case, however, it may cause conflicts between two different flash movies because they might use the same shared object name. Hence, we should specify a longer shared object name like that in the above example.


next up previous contents
Next: Using autoupdate Up: Tutorials Previous: Calling Active scripting languages   Contents
Copyright ©2000-2007 Shanghai TopCMM Software Technologies. All Rights Reserved.