Solved

Create button with AC3 that triggers snapshot function

Posted on 2011-03-01
7
445 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

636 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