I’m getting a 1007 error: Instantiation attempted on a non-constructor.
Thanks for any help!
The error seems to be on the first line or on line 60:
[Embed( source="card.jpg", mimeType="application/octet-stream" )]
var CardBytes:Class;
var pdf:PDF;
var page:Page;
var body:TextField;
var title:TextField;
var ba:ByteArray;
function Main(event:Event):void
{
ba = new ByteArray();
title = new TextField();
title.type = TextFieldType.INPUT;
title.border = true;
title.borderColor = 0xefefef;
title.width = 400;
title.height = 50;
title.defaultTextFormat = new TextFormat( "Times", 40, 0x666666 );
title.x = 20;
title.y = 340;
title.text = "Happy Holidays";
addChild( title );
body = new TextField();
body.type = TextFieldType.INPUT;
body.border = true;
body.borderColor = 0xefefef;
body.width = 400;
body.height = 100;
body.wordWrap = true;
body.multiline = true;
body.x = 20;
body.y = 400;
body.text = "Here's 1/1000,000,000,000,000 of a white Christmas. ";
body.defaultTextFormat = new TextFormat( "Arial", 12, 0x666666 );
body.setTextFormat(new TextFormat( "Arial", 12, 0x666666 ));
addChild( body );
trace("write")
button.addEventListener(MouseEvent.CLICK, generatePDF );
}
function generatePDF(e:MouseEvent):void
{
page = new Page( Orientation.LANDSCAPE, Unit.MM, Size.LETTER );
pdf = new PDF();
pdf.addPage( page );
pdf.textStyle(new RGBColor(0x666666));
pdf.setFont( FontFamily.TIMES, "", 40 );
pdf.addText( title.text, title.x, title.y );
pdf.setFont( FontFamily.ARIAL, "", 12 );
pdf.setXY( body.x, 30 );
pdf.addMultiCell( 150, 5, body.text );
pdf.setTitle( title.text );
pdf.addImageStream( new CardBytes() as ByteArray );
pdf.save(Method.REMOTE, "http://alivepdf.bytearray.org/wp-content/create.php", Download.INLINE);
}