Photoshop Tutorials, Flash Tutorials, 3Ds Studio Max Tutorials, Web Design Tutorials

Home  |  Submit Tutorial  |  Top Sites  |  Free Templates (NEW)  |  Website templates  |  Privacy Policy  |  Link Exchange  |  Contact Us

Recommended Hosting:
Host Unlimited Domains on 1 Account
1500GB storage and 15000GB bandwidth for $6.95/mo!
Recommended Hosting:
Host Unlimited Domains on 1 Account
1500GB storage and 15000GB bandwidth for $6.95/mo!

Welcome To ProDesignHost.com Flash Tutorials Area - Mmsave

This function is used internally by the Macromedia Answers Panel as part of the update process. This function is used to save a local copy of a .swf file or a local textfile. This function is exactly the same as the undocumented Flash 5 function, dashboardSave. It can only be used within the Macromedia Authoring Environment, therefore it can only be used in .swf files that are going to be displayed inside of a panel in the authoring environment. With this function exposed, we can now create things such as self updating custom component user interfaces...

MMSave(target,filename); This function accepts two arguments, both of which are required for the function to execute. The first argument 'target' is a target path to a movieclip or a string variable. If you pass a target path to a movieclip and if this movieclip contains a 'fully loaded' movie, loaded using either of these methods/functions:

loadMovieNum(url,level,method);
loadMovie(url,movieclip,method)
movieclip.loadMovie(url,method);


Then the loaded movie will be outputted to a local file on the users hardrive, otherwise the movie that the target path resides in, is outputted to a local file. If you pass a string variable as the argument, then a textfile will be created on the users local computer containing the the valur of the string variable. This argument can be an absolute path or a relative path. Remember, that levels are also classed as movieclips, so passing _level1 as the value for the 'target' argument will save the movie which has been loaded into _level1 as a local file. The second argument 'filename' is the filename of the outputted .swf file. This argument can only be a relative path. If you do specify a directory path, bear in mind, that the document root ( / ) as far as this function is concerned is located in the Configuration directory for your Macromedia Flash MX installation. On Windows ME, the Configuration directory is located in:

C:WindowsApplication DataMacromediaFlash MXConfiguration

To find out the root directory where all relative file paths that the MMSave function recieves, will resolve to, use this function:

getConfigPath = function(){
var d = ASnative(302, 0)();
var i = d.lastIndexOf("/");
d = d.substr(0,i);
i = d.lastIndexOf("/")+1;
return d.substr(0,i);
}

Therefore if i wanted to create a .swf file named "guy.swf" in the root of the hardrive i could use:

MMSave(this,"../../../../../guy.swf");

The above code would save the entire movie in which the above line of code resides. Or if i wanted to save a .swf file in the root of the Configuration directory i could use either of these lines of code:

MMSave(this,"/guy.swf");
MMSave(this,"guy.swf");

If a file with the same filename as the value you pass for the 'filename' argument already exists, then it will be automatically over-written. This can cause serious security problems, because it could be used maliciously to over-write windows system files. Create .swf Code Example:

//create a new movieclip
this.createEmptyMovieClip("holder",1);
//load Macromedia's site navigation into that movieclip
holder.loadMovie("http://www.macromedia.com/uber/nav/global_home.swf");
//check to see if the movie has fully loaded
//before outputting the local file
this.onEnterFrame=function(){
if(holder.getBytesLoaded() == holder.getBytesTotal()){
//save the movie loaded into the holder movieclip
//as macromedia_navigation.swf in the Configuration
//directory on the local computer
MMSave(holder,"macromedia_navigation.swf");
//stop checking to see if the movie has fully loaded
delete this.onEnterFrame;
}
}

Create textfile Code Example:

mystring="This is some text that i want to save locally";
MMSave(mystring,"mystring.txt");

This function returns 'true' if the file was succesfully created on the users local computer, and 'false' otherwise. I assume, that this function works on all OS's because otherwise Macromedia wouldnt use it in their Answers Panel. If you are using an operating system that it doesnt work on, please let us know by posting a comment. Remember to have a good dig around for the file first, use the search tool.
Author: Guy Watson
Advertisements

Premium Partners

  Free Website Templates - Flash templates, Affordable Website Design, Website Templates, Website Redesign, Custom Website Design, Web Design Tutorials, Flash Tutorials, Promotion Tutorials - that is what we do. Metamorphosis Design Studio offers quality, free and low cost web site templates for your business and personal life, we also offer affordable web design and site re-design.
  Vertex Website Tempales - It saves tones of time and money to use pre-made web designs to build your web site. You need a web site but you don't want to pay thousands dollars to professional web design companies? Our web templates is just for you! They are designed to be easilly edited by your favorite html editor, like MS FrontPage
  Website Design Tutorials - Web site design is an area that simply takes experience to perfect. Get started with these tutorials covering everything from page layout to content tips. At Webdesigntutorials.net you will find all the Web-building tutorials you need, from basic HTML and XHTML to advanced Adobe Photoshop, Macromedia Flash MX and 3D Studio Max software.
Free website templates and paid web templates are great tools to make your websites look perfect! You will save time and money with our flash templates and free website templates Our visitors are satisfied with the quality of our free and paid website templates! Please visit our free website templates and paid website templates sections. We offer free web templates, free web layouts, free web page templates and other stuff for free download. All templates come with the html and external css file so you may easily edit HTML with your favorite HTML editor. Feel free to download our free web templates for your personal websites.

Terms of use depend upon the website template vendor.

Home  |  Submit Tutorial  |  Top Sites  |  Free Templates  |  Website templates  |  Privacy Policy  |  Contact Us

All Right Reserved by ProDesignHost.com