James_Avery
asked on
Create button with AC3 that triggers snapshot function
I have an AC3 project. I have a print function 'printCertificate()' that sends a specific movieclip instance to the printer (a certificate of completion for a quiz after the user has passed),
I also have code in place that saves a screenshot in jpeg format, and attempts to save it to the harddrive after the user selects the desired download location.
MY PROBLEM:
My problem is that I am not requesting the user to trigger the save function, and because of security limitations, the save window won't appear unless a button is displayed and clicked on.
I need to modify my script (starts on line 191 of the attached code) so that a button will appear that when clicked, will open a save dialogue, followed by a print dialogue. I have all of the other code in place, I just need to add a button within actionscript in the center of the screen for the user to trigger the save and print.
Any ideas? Attached is my script that I need modified. Your help is greatly appreciated!
EOSInteractiveService.as
I also have code in place that saves a screenshot in jpeg format, and attempts to save it to the harddrive after the user selects the desired download location.
MY PROBLEM:
My problem is that I am not requesting the user to trigger the save function, and because of security limitations, the save window won't appear unless a button is displayed and clicked on.
I need to modify my script (starts on line 191 of the attached code) so that a button will appear that when clicked, will open a save dialogue, followed by a print dialogue. I have all of the other code in place, I just need to add a button within actionscript in the center of the screen for the user to trigger the save and print.
Any ideas? Attached is my script that I need modified. Your help is greatly appreciated!
EOSInteractiveService.as
ASKER
I have added your code to my script but am now receiving the follow error:
/Users/jamesavery/Desktop/ Eos Interactive 2.0/EosInteractive_src/cla sses/com/o rcamedia/e os/EOSInte ractiveSer vice.as, Line 206 1046: Type was not found or was not a compile-time constant: CLICK.
I have attached my code. Any ideas as to why this is happening? Thanks again for your help!
EOSInteractiveService.as
/Users/jamesavery/Desktop/
I have attached my code. Any ideas as to why this is happening? Thanks again for your help!
EOSInteractiveService.as
ASKER
My mistake. Below is the actual error I am recieving:
/Users/jamesavery/Desktop/ Eos Interactive 2.0/EosInteractive_src/cla sses/com/o rcamedia/e os/EOSInte ractiveSer vice.as, Line 206 1046: Type was not found or was not a compile-time constant: MouseEvent.
/Users/jamesavery/Desktop/
ASKER
I added the lines:
import flash.display.SimpleButton ;
import flash.events.MouseEvent;
Which solved that error, but now I am receiving these:
/Users/jamesavery/Desktop/ Eos Interactive 2.0/EosInteractive_src/cla sses/com/o rcamedia/e os/EOSInte ractiveSer vice.as, Line 213 1120: Access of undefined property snapshot_errorHandler.
/Users/jamesavery/Desktop/ Eos Interactive 2.0/EosInteractive_src/cla sses/com/o rcamedia/e os/EOSInte ractiveSer vice.as, Line 198 1180: Call to a possibly undefined method addChild.
/Users/jamesavery/Desktop/ Eos Interactive 2.0/EosInteractive_src/cla sses/com/o rcamedia/e os/EOSInte ractiveSer vice.as, Line 197 1180: Call to a possibly undefined method PrintBtn.
/Users/jamesavery/Desktop/ Eos Interactive 2.0/EosInteractive_src/cla sses/com/o rcamedia/e os/EOSInte ractiveSer vice.as, Line 197 1046: Type was not found or was not a compile-time constant: PrintBtn.
import flash.display.SimpleButton
import flash.events.MouseEvent;
Which solved that error, but now I am receiving these:
/Users/jamesavery/Desktop/
/Users/jamesavery/Desktop/
/Users/jamesavery/Desktop/
/Users/jamesavery/Desktop/
ASKER
Here is my new script. Any ideas why I am getting these errors? I am a major AC rookie working on someone elses code.
EOSInteractiveService.as
EOSInteractiveService.as
can you upload your project, i.e all the files, will make it much easier to trouble shoot.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if i understand you correctly, create the movieclip to serve as your button give it a linkage name
ie. PrintBtn
so now when you need the button there
var printBtn:PrintBtn = new PrintBtn();
addChild(printBtn)
printBtn.x = //etc set x and y locations.
printBtn.addEventListener(
function yourfunctionname(e:MouseEv
{
//your code here
}