AS3 how to save quiz score with SharedObject

I'm working on a quiz using AS3 on timeline. I can't figure out how to save the score at the end of the quiz.  The result of quiz is displayed by its dynamic text box (out_score.text), but it isn't saved along with the rest of information. Please help!
When I go back to section I, all information is displayed, but quiz score goes back to zero (0).
I have section I, which collects user information. Section II, 25 question quiz, and section III, which displays information and score.
SECTION ONE (labeled "inf"):
// score variable
var i:Number=0;
stage.showDefaultContextMenu=false;
// declaring sharedObject
var userInf:SharedObject = SharedObject.getLocal("userInformation", "/");
if(userInf.data.userName != undefined) {
gotoAndStop("closing");
// inf button
inf_bt.addEventListener(MouseEvent.CLICK, saveData);
function saveData(evt:MouseEvent): void
gotoAndStop("pg1"); // here starts the quiz
// SECTION II, for each correct answer
i++;
SECTION III (labeled "closing").
out_score.text = i.toString(); // dynamic box
userInf.data.userScore = out_score.text;
out_score.text = userInf.data.userScore;
// button saves score and user's information
save_bt.addEventListener(MouseEvent.CLICK, gotoResults);
function gotoResults(evt:MouseEvent): void
userInf.flush();
gotoAndStop("intro");
Thanks for any help!
German

Kglad:
userInf.data.userScore exists only on section III ("closing"). Here is a short version of my file.
//INTRODUCTION
stop();
var i:Number=0;
intro_bt.addEventListener(MouseEvent.CLICK, gotoInf);
function gotoInf(evt:MouseEvent): void
gotoAndStop("inf");
//INFORMATION
stop();
stage.showDefaultContextMenu=false;
// declaring sharedObject
var userInf:SharedObject = SharedObject.getLocal("userInformation", "/");
if(userInf.data.userName != undefined) {
gotoAndStop("closing");
// saving data
inf_bt.addEventListener(MouseEvent.CLICK, saveData);
function saveData(evt:MouseEvent): void
userInf.data.userName = input_name.text;
userInf.data.userDate = input_date.text;
userInf.data.userAge = input_age.text;
gotoAndStop("pg1");
// QUESTIONS  -- 25
// CLOSING
out_score.text = i.toString();
userInf.data.userScore = out_score.text;
trace("out_score.text is " +out_score.text);
input_name.text =userInf.data.userName;
input_date.text = userInf.data.userDate;
input_age.text = userInf.data.userAge;
save_bt.addEventListener(MouseEvent.CLICK, gotoResults);
function gotoResults(evt:MouseEvent): void
userInf.flush();
gotoAndStop("intro");
// clearing data
reset_bt.addEventListener(MouseEvent.CLICK, deleteInf);
function deleteInf(evt:MouseEvent): void
userInf.clear();
gotoAndStop("intro");
For your help!
German

Similar Messages

  • How to save a png with a straight or fat alpha?

    Long story short, work in broadcast and a new piece of gear prefers png files.  I know how to save png's with a transparency, that's not the problem.  What I don't know how to do or if it's possible is to save them with a straight or fat alpha.  Right now we feather or extend the edges out past the alpha of say a logo and save it as a tif, psd or .tga.  That way once it's keyed over video or whatever, the edges look good, no black bad edging.... this makes sense, probably not explaining it very well.   But switching to png files I have no idea how to make a straight or fat alpha since it sees transparency.  I mean if I feathered out the edges, a png will see that correct, since there's no alpha??
    I hope this makes sense ?

    Chris, this is probably the answer I seek "PNG always saves with straight color - that's how the PNG spec defines it." 
    I admit my explanation was a bit weak and I understand PNG only supports transparency, which is not an alpha,  and the apps aren't treating them wrong....I just couldn't formulate an intelligent question and explain it, my bad.
    After thinking about it I don't think using a PNG will work. RIght now for broadcast gear/applications if we don't fill the transparent and semi-transparent areas of an image with the colored part of the image, we usually end up getting a dirty key/matte or a lot of fringing.  So when using a .tif or .tga that reads an actuall alpha, we can fix the issue by doing what I described.  In fact we use a quick little plugin from flaming Pear called "Solidifty" to speed up the process http://www.flamingpear.com/download.html .  With that said, I know we can't do the same steps with a png because it only sees transparency, but I guess I was wondering if there was a work-around or a trick to fix that issue.  I could be wong, but doesn't a png save with white ?
    But again, as I thought about it, I think i'm asking for something it's not meant to do, but I thought I'd ask anyway.
    Thanks Chris, does this make more sense or more confusing?  The bottom-line is I don't think it will work.

  • How to save a flash with .SWF

    Hi, I have the 'Adobe Flash CS3 Professional', and I want to
    know if you could tell me how to save a flash with .SWF.
    When I want to create a new project, I can chose between nine
    types of documents, and I want to make a flash for a website. What
    type of document would you chose if you were me ?
    I can't write the name of the diferent types of documents,
    because I have this programme in Spanish.
    Can you help me ?
    Thank you

    FLA is the native source format - make your movie and then
    publish to SWF -
    you can not create an SWF initially - SWF is the
    exported/published format
    of your FLA>
    "Marti_17" <[email protected]> wrote in
    message
    news:gioa0k$otm$[email protected]..
    > Hi, I have the 'Adobe Flash CS3 Professional', and I
    want to know if you
    > could
    > tell me how to save a flash with .SWF.
    > When I want to create a new project, I can chose between
    nine types of
    > documents, and I want to make a flash for a website.
    What type of document
    > would you chose if you were me ?
    >
    > I can't write the name of the diferent types of
    documents, because I have
    > this
    > programme in Spanish.
    >
    > Can you help me ?
    > Thank you
    >
    >

  • How to save a photo with a password on a mac

    how to save a photo with a password on a mac

    http://osxdaily.com/2012/08/12/encrypt-folders-mac-os-x/
    Note: I have never tried this.
    Best.

  • How to save a graph with some parameters on it?

    hi
    my application involves analysis of data and plot a graph of analysed data, how to save graph along with analysed data in a file otherthan labview?

    Well, it sounds like you are wanting a picture of the graph, yes? If so there are two ways of getting it. First there is a VI method (Get Panel Image) that lets you get an image of the entire screen, and then there is a control method (Get Image) that lets you get an image of just the front panel object that you are interested in.
    The help file entries for either method provides added detail on how to uses these methods to save a picture of your data.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How to save a variant with dynamic selections parameters

    Anybody knows how to save a variant for an ABAP that uses a Logical database with Dynamic Selections?
    Have a look for example to the following:
    SE38 - DEMO_PROGRAM_GET - Execute - Shift F4 - Connection Number.
    How to save 0820 as Connection Number?
    Function Group SVAR seems good but FREE SELECTIONs are not easy to manage...

    Hello,
      I tried to save the variant of DEMO_PROGRAM_GET with dynamic selection field (Connection Number) filled. It gets saved without any problem. Just click 'SAVE' and enter the variant name and description.
    Thanks,
    Venu

  • How to save a BufferredImage with RGB color encoded JPEG file.

    Hi, I am new to Java Imaging API programming.
    When I try to write a BufferredImage using following code -
    BufferedImage output = new BufferedImage (width, height, BufferedImage.TYPE_INT_ARGB);
    // Save
    File outputFile = new File("image.jpeg");
    ImageIO.write(output, "jpeg", outputFile);
    It seems that myfile.jpg have CMYK color encoding, Can someone tell me how can I save the BufferredImage with RGB color encoding.
    Thanks,
    Sanjay Ujjainkar

    how to format the text ?
    i have format ted the text but it seems not work!
    Message was edited by:
    Enjoyfans

  • How to save a clip with a transparent background?

    How do i save a clip with a transparent background to export to quicktime and then be able to import it back into my timeline and have it be able to overlay ontop of another clip? Transparent clip is for lower third

    For transparency to work, you need to save it in a format that has an alpha channel. Not sure if FCE supports the Animation codec but if it does you'll want your material as "millions of colors +". The "+" means Alpha.
    x

  • How to save files received with iChat?

    I was in a text chat with a friend. He sent me an mp3 file, and it showed up in the chat window with the familiar play controls of Quicktime.. I was able to listen to it and everything. However, I couldn't figure out how to save the files??? All I could do was play, rewind etc...no way that I could see to save it.
    Any help you can provide?
    Thanks,
    John
    PowerMac G5 Dual 2.3   Mac OS X (10.4.2)  

    Hi John,
    You should be able to drag it from the window to the Desktop and subsequently, any folder.
    Alternatively you can set iChat to save all Chats and replay it from there.
    Or use Save As when the App that uses the files is open with the file in question.
    Ralph

  • How to save an object with JSTL

    I have an object, how to save it with JSTL?
    I have this
    public class Auto{
    private AutoBomba a;
    public AutoBomba getA()
    return this.a;
    public AutoBomba setA(AutoBomba a)
    this.a = a;
    How can I set the from a JSP page a AutoBomba? The objects name is only for example

    There is of course the JSTL c:set tag
    This relies on the appropriate variables being in JSTL scope.
    <jsp:useBean id="auto" class="com.mypackage.Auto" scope="request"/>
    <jsp:useBean id="bomba" class = "com.mypackage.AutoBomba"/>
    <c:set target="auto" property="a" value="${bomba}"/>Cheers,
    evnafets

  • How to save the template with cell locking?

    Hi Gurus,
         I have successfully locked the cell by using Data validation of Excel function in BPC input schedule. But when I save and reopen it once again the data validation does not work. My target is to distribute the cell locked template to different users thru offline wizard. Can anybody let me know how to save the data validation in the template ?
    Regards,
    KumarMG

    Resolved myself

  • How to save an entity with description and a file?

    Hi everybody!
    I have an entity Video:
    @Entity
    public class Video {
    @PrimaryKey
    private String title;
    @SecondaryKey(relate = MANY_TO_ONE, relatedEntity=Journalist.class)
    private String jorName;
    @SecondaryKey(relate = MANY_TO_ONE, relatedEntity=Operator.class)
    private String oName;
    @SecondaryKey(relate = MANY_TO_ONE)
    private Date date;
    @SecondaryKey(relate = MANY_TO_ONE)
    private String place;
    private File file;
    the video accesor for PK is:
    PrimaryIndex<String,Video> pIdx=store.getPrimaryIndex(String.class, Video.class);
    A user opens a form(it is written in swing) and fills in the title, name of the author, date, place of the video and browsers a file from some source. Now the user presses button "upload" and the whole object must be put to database. I dont understand how the whole object(file with filled description) can be put to db?
    Below is actionPerformed function:
    public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();
    if (e.getSource() == btnBrowse) {
    int returnVal = fc.showOpenDialog(VideoPanel.this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
    File file = fc.getSelectedFile();
    textField.setText(file.toString());
    if(source == btnUpload){
    if(text1.getText().equals("")&&text2.getText().equals("")&&text3.getText().equals("")){
    //how to put the whole object?
    Thanks in advance!

    Hello,
    I dont understand how the whole object(file with filled description) can be put to db?Have you read the documentation and examples about how to use the com.sleepycat.persist API to write and read persistent objects? If so, what specifically is confusing? Be sure to look at the example programs.
    We can help with questions about our APIs, once you've read the doc, but please understand that we won't be able to supply you with the code to integrate with your Swing app -- that's your job.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How To Save A Document With Lion X

    What exactly do I do to save a document with iWork 09, Pages, and Lion on an up to date 10.7.1?

    Unfortunately, there isn't much in the way of support or troubleshooting documents yet on these new features, so we're all learning as we go....
    I've another idea: Have you checked the various versions? Open one of yours - try it with the original or a duplicate - and click on its name - see here:
    I opened a Pages doc, typed one word, saved it. Opened it again, added one more word and just closed it.
    Then I opened it again - see the dialog popup.
    Choose browse all versions and see what your various pages look like.

  • How to save a PNG with layers in Photoshop.

    i am tryin to save a PNG with layers. Is it poosible ?
    What i found on the net is ....PNG is not meant for multiple layers. But still want to know if photoshop have its own proprietory standard for PNG.
    Thanks in advance.

    No, it is not possible.
    PNG doesn't support layers.
    A few apps stuff their own private data into PNG to hide layer data, but well, it's private undocumented data.

  • How to save HTML file with images present in the server to local machine

    Hi all
    In my application i have a option for the user to save HTML files with images present in the server. The HTML file is getting saved but the images are not being saved.
    The code i am using is below :-
    l
                        File fname = new File(filePath);
                        if(!fname.exists())                return;
                        FileInputStream istr = null;
                        OutputStream ostr = null;
                        response.setContentType("application/"+format);
                        response.setHeader("Content-Disposition", "attachment; filename=\"" + fname.getName() + "\";");
                        try { 
                             istr = new FileInputStream(fname);
                             ostr = response.getOutputStream();
                             int curByte=-1;
                             while( (curByte=istr.read()) !=-1)
                                  ostr.write(curByte);
                             ostr.flush();
    Can anyone suggest what i need to do
    regards

    The client should probably parse the html that comes down, and look for <img> links, and request those of the server as well.

Maybe you are looking for