/** *******************************************************************
* MySnippets
* Free for use
*
* @author Jonnie Spratley
* @contact jonniespratley@gmail.com
******************************************************************* */
package
{
import com.adobe.cairngorm.business.ServiceLocator;
import flash.utils.ByteArray;
import mx.rpc.AsyncToken;
import mx.rpc.IResponder;
/**
* The Business Delegate delegates all the responsibility for the
* business logic that must locate a service, and then invokes
* a method on the service.
*
*/
public class Delegate
{
private var responder:IResponder;
private var service:Object;
public function SnipprDelegate( responder:IResponder )
{
this.service = ServiceLocator.getInstance().getRemoteObject( "MyService" );
this.responder = responder;
}
/************** ServiceCalls ********************/
public function getData():void
{
var token:AsyncToken = service.getData();
token.addResponder( responder );
}
}
}
=begin
r - Open a file for reading. The file must exist.
w - Create an empty file for writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file.
a - Append to a file. Writing operations append data at the end of the file. The file is created if it does not exist.
r+ - Open a file for update both reading and writing. The file must exist.
w+ - Create an empty file for both reading and writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file.
a+ - Open a file for reading and appending. All writing operations are performed at the end of the file, protecting the previous content to be overwritten. You can reposition (fseek, rewind) the internal pointer to anywhere in the file for reading, but writing operations will move it back to the end of file. The file is created if it does not exist.
=end
File.open(local_filename, 'w') {|f| f.write(doc) }
<script src="graphics/js/jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="graphics/js/jquery.cookie.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// See which font size the user wants
$(".text a").click(function() {
switch ($(this).attr("class")) {
case 'small' : setFontSize(.8); break;
case 'large' : setFontSize(1.6); break;
case 'default' : setFontSize(1.2); break;
}
return false;
});
// Set the font size and set a cookie
function setFontSize(size) {
$("#wrap, input, textarea").animate({fontSize: size+"em"}, 500).fadeIn("slow");
createCookie(size);
}
// Create and read coookies
// Code functions by: Peter-Paul Koch
// http://www.quirksmode.org/js/cookies.html
function createCookie(value) {
var date = new Date();
date.setTime(date.getTime()+(30*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
document.cookie = "font_size="+value+expires+"; path=/";
}
var font_size = $.cookie('font_size');
if (font_size == '0.8') {
$('#wrap').css("font-size",".8em");
}
if (font_size == '1.6') {
$('#wrap').css("font-size","1.6em");
}
if (font_size == '1.2') {
$('#wrap').css("font-size","1.2em");
}
});
</script>