Solved

Create button with AC3 that triggers snapshot function

Posted on 2011-03-01
7
436 Views
Last Modified: 2013-11-11
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
0
Comment
Question by:James_Avery
  • 4
  • 2
7 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 35016226
Hi James, i didn't look through all your code, as it probably won't make sense out of context.
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(MouseEvent.CLICK, yourfunctioname);

function yourfunctionname(e:MouseEvent):void
{
//your code here
}

0
 

Author Comment

by:James_Avery
ID: 35017980
I have added your code to my script but am now receiving the follow error:

/Users/jamesavery/Desktop/Eos Interactive 2.0/EosInteractive_src/classes/com/orcamedia/eos/EOSInteractiveService.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
0
 

Author Comment

by:James_Avery
ID: 35018028
My mistake. Below is the actual error I am recieving:

/Users/jamesavery/Desktop/Eos Interactive 2.0/EosInteractive_src/classes/com/orcamedia/eos/EOSInteractiveService.as, Line 206      1046: Type was not found or was not a compile-time constant: MouseEvent.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:James_Avery
ID: 35018357
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/classes/com/orcamedia/eos/EOSInteractiveService.as, Line 213      1120: Access of undefined property snapshot_errorHandler.
/Users/jamesavery/Desktop/Eos Interactive 2.0/EosInteractive_src/classes/com/orcamedia/eos/EOSInteractiveService.as, Line 198      1180: Call to a possibly undefined method addChild.
/Users/jamesavery/Desktop/Eos Interactive 2.0/EosInteractive_src/classes/com/orcamedia/eos/EOSInteractiveService.as, Line 197      1180: Call to a possibly undefined method PrintBtn.
/Users/jamesavery/Desktop/Eos Interactive 2.0/EosInteractive_src/classes/com/orcamedia/eos/EOSInteractiveService.as, Line 197      1046: Type was not found or was not a compile-time constant: PrintBtn.
0
 

Author Comment

by:James_Avery
ID: 35018385
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
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 35020379
can you upload your project, i.e all the files, will make it much easier to trouble shoot.
0
 
LVL 2

Accepted Solution

by:
nycynik earned 500 total points
ID: 35142694
You have not yet created the movie clip for PrintBtn

You have two choices:

1) create the movieclip PrintBtn
2) use a standard button in flash

1) Using movie clip
- Create a graphic in flash, on the stage (fla file) of the button you want the user to click on.  
- click the graphic, and convert it to a symbol (Menu, Modify->Convert to Symbol, or F8).
- right click on the symbol you just created, and select properties (assuming cs5), turn down the advanced triangle
- click export for actionscript, and name the instance "PrintBtn"
-Click save
- save the project, and try it.

2) using standard button
- add the button to the flash by dragging it from the components to the fla  (its under user interface->button)
type "PrintBtn" in to the insttance name for the button in the properties dialog
- save the project, and try it.



-
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now