Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Create button with AC3 that triggers snapshot function

Posted on 2011-03-01
7
Medium Priority
?
446 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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 2000 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
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…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

715 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