Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Actionscript 3.0 help
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
stevo_1515




PostPosted: Mon Aug 09, 2010 10:44 am   Post subject: Actionscript 3.0 help

Im creating a program that is designed to allow the used to select 3 pictures (movie clips) and print them off on a single peace of paper.



The program works by allowing the user to select 3 graphics (the graphics are actually instructions for various exercises) and then moving the desired movieclips onto the stage. This all happens on a layer named "Content"

So far the program will allow the user to select the movieclips and will move them into place on the Content layer as well as move smaller versions of the pictures into a preview box the only thing it does not do is print. (the most important bit)


My problem is that I don't know how to print the stage on the Content layer.


Also I was wondering if there was a command to "reset" a program. This would be nice as if I convert the Content layer to a movie clip the program must be restarted every time you want to print out a new page.


here is the code so far


code:

//----------------Setting up page********************


//---------------define var********
var slot1 : String
var slot2 : String
var slot3 : String
var content_mc : MovieClip

//---------------SET MovieClips*********



//-----------------SET Drop Boxes********
//--------slot 1***********
slot1_cb.addItem ({label:"exersise 1"});
slot1_cb.addItem ({label:"exersise 2"});
slot1_cb.addItem ({label:"exersise 3"});

//--------slot 2*************
slot2_cb.addItem ({label:"exersise 1"});
slot2_cb.addItem ({label:"exersise 2"});
slot2_cb.addItem ({label:"exersise 3"});

 
//--------slot 3**************
slot3_cb.addItem ({label:"exersise 1"});
slot3_cb.addItem ({label:"exersise 2"});
slot3_cb.addItem ({label:"exersise 3"});











//--------------CreatPage*********************
creatpg_btn.addEventListener(MouseEvent.CLICK,creatpg);

function creatpg(evt:MouseEvent)
{
 
 
 
 
 
 
 
 
 
 
 
 
//--------------Slot1**********
slot1 = slot1_cb.selectedItem.label
if (slot1 == "exersise 1")
{
//move perview box
exerize1prv_mc.x = 294
exerize1prv_mc.y = 268
//set main item for print
exerize1_mc.x = 0
exerize1_mc.y = 0
}
 
else if (slot1 == "exersise 2")
{
//move perview box
exerize2prv_mc.x = 294
exerize2prv_mc.y = 268
//set main item for print
exerize2_mc.x = 0
exerize2_mc.y = 0
}
 
else if (slot1 == "exersise 3")
{
//move perview box
exerize3prv_mc.x = 294
exerize3prv_mc.y = 268
//set main item for print
exerize3_mc.x = 0
exerize3_mc.y = 0
}
 
 
 
 
 
 
 
 
 
 
 
 

//--------------Slot2************
slot2 = slot2_cb.selectedItem.label
if (slot2 == "exersise 1")
{
//move perview box
exerize1prv_mc.x = 294
exerize1prv_mc.y = 378
//set main item for print
exerize1_mc.x = 274
exerize1_mc.y = 0
}
 
else if (slot2 == "exersise 2")
{
//move perview box
exerize2prv_mc.x = 294
exerize2prv_mc.y = 378
//set main item for print
exerize2_mc.x = 274
exerize2_mc.y = 0
}
 
else if (slot2 == "exersise 3")
{
//move perview box
exerize3prv_mc.x = 294
exerize3prv_mc.y = 378
//set main item for print
exerize3_mc.x = 274
exerize3_mc.y = 0
}
 
 
 
 
 
 
 
 
 
 

//---------------Slot3**************
slot3 = slot3_cb.selectedItem.label
if (slot3 == "exersise 1")
{
//move perview box
exerize1prv_mc.x = 294
exerize1prv_mc.y = 488
//set main item for print
exerize1_mc.x = 0
exerize1_mc.y = 548
}
 
else if (slot3 == "exersise 2")
{
//move perview box
exerize2prv_mc.x = 294
exerize2prv_mc.y = 488
//set main item for print
exerize2_mc.x = 0
exerize2_mc.y = 548
}
 
else if (slot3 == "exersise 3")
{
//move perview box
exerize3prv_mc.x = 294
exerize3prv_mc.y = 488
//set main item for print
exerize3_mc.x = 0
exerize3_mc.y = 548
}
}




/*
NOTE:

For PREv

each inc mc has y val 110 pix

Cord for slots
slot 1 x294   y 268
slot 2 x294   y 378
slot 3 x294   y 488





For print

each inc mc has y val 274 pix

Cord for slots
slot 1 x0   y 0
slot 2 x0   y 274
slot 3 x0   y 548

For print


*/






//----------------Printing************************

print_btn.addEventListener(MouseEvent.CLICK,printContent);

function printContent(evt:MouseEvent)
{
var printJob:PrintJob = new PrintJob();
{

if (printJob.start())
printJob.addPage(content_mc);
printJob.send();
}
}
 
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: