_global variable in actionscript 3.0

here is a simple class that help global vars in actionscript 3.0

package {
public class globals {
public static var vals:Object = new Object();
}
}

now you can access the globals.vals any where from your movie.

globals.vals.red = 0xFF0000;
trace(glo.bal.red);

cs4 FileReference.save example

this is a simple example of new feature in flash cs4 FileReference.save(). in this example i just create an html file using the rich text editor from http://mobilewish.com/applications/as3texteditor/. and save it using FileReference.save() to local file system . download rich text editor

Source File:http://anilmathew.info/flash/filerefer_example.fla
code sample


import flash.net.FileReference;


tt.input_txt=abc;
tt.scroller=scroller;
abc.addEventListener(MouseEvent.MOUSE_UP, tt.handleClick);
generate_btn.addEventListener( MouseEvent.CLICK, generateTEXT );

function generateTEXT( e:MouseEvent ) {

var texT:String=abc.htmlText;
var file:FileReference = new FileReference();
file.save(texT,"myfile.html");


}





Create PDF using flash 10 save to local file

here is an example for saving PDF file from flash 10 player(cs4) usning alivepdf And FileReference.Save();
Code


import org.alivepdf.pdf.PDF;
import org.alivepdf.layout.Orientation;
import org.alivepdf.layout.Size;
import org.alivepdf.layout.Unit;
import org.alivepdf.display.Display;
import org.alivepdf.saving.Method;
import org.alivepdf.fonts.FontFamily;
import org.alivepdf.fonts.Style;
import org.alivepdf.colors.RGBColor;
import flash.net.FileReference;


// we create the PDF
var myPDF:PDF = new PDF( Orientation.LANDSCAPE, Unit.MM, Size.A4 );

// we set the zoom to 100%
myPDF.setDisplayMode ( Display.REAL );

// we add a page
myPDF.addPage();

// set the line style color
myPDF.lineStyle ( new RGBColor ( 0x990000 ) );

// we draw a circle
//myPDF.drawCircle ( 20, 20, 20 );
myPDF.addImage(clip,0,0);
// we add our second page
myPDF.addPage();

// we set font and size
myPDF.setFont ( FontFamily.HELVETICA, Style.NORMAL );
myPDF.setFontSize ( 16 );

// we add some text
myPDF.addMultiCell ( 80, 8, "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut posuere, felis volutpat hendrerit ullamcorper, purus sem vehicula augue, ac volutpat sapien dui non metus." );

// we generate the PDF when the button is clicked
generate_btn.addEventListener( MouseEvent.CLICK, generatePDF );

function generatePDF ( e:MouseEvent )

{

// to save the PDF your specificy the path to the create.php script
// alivepdf takes care of the rest, if you are using AIR and want to save the PDF locally just use Method.LOCAL
// and save the returned bytes on the disk through the FileStream class

var bytes:ByteArray = myPDF.save(Method.LOCAL);
var file:FileReference = new FileReference();
file.save(bytes,"myfile.pdf");


}






flash cs4 3d flower

this is just a test i created in flash cs4 3d. I'm not sing that this flower is a beautiful one. you can download the source here.any way flash cs4 3d feature is a great one. on coming days i'm tring to do more thing in cs4 3d

Note: flash 10 player required to view this sample

flash cs4 3d example

see a simple flash 3d tutorial at http://www.gotoandlearn.com/play?id=88


PHP developer Cochin |PHP developer Kerala | PHP developer India | Flash developer/programmer Cochin | Flash developer/programmer Kerala | Flash developer/programmer India | web programmer kerala |web programmer Cochin |web programmer India |web developer kerala |Web developer Cochin | Kerala PHP | PHP freelancer| flash actionscript freelancer