A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Dynamic Text wont display input inside movie clip

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    25

    Dynamic Text wont display input inside movie clip

    I'm updating a game in a Flash, using Actionscript 2 (what it was originally built in) It's a quiz game with different categories. At the end of each test is a results page showing their score for each of all the categories; each score being saved and displayed each time it's brought up. I need to have a print button added to this page, which I was able to do with
    Code:
    printButton.onPress = function() {
    print(drawingArea, "bframe")
    }
    And labeling the frame of what I want to print #p. This works, but the drawback is, I can do that on each results page frame for each category; the error that results from multiple frames labeled the same thing, 'causes the dynamic text fields displaying the score to go blank when the print button is clicked. Even if it didn't, it would still print all of the frames with that label, printing multiple copies of the same results screen.
    Initially I planned to tie all the quizzes to a single results page; one results page, one results frame, only one frame with the #p label, and is the only thing printed. The problem there is, I need to be able to have a back button that goes back to a point in the category the user just finished; so they can take the test again if they want, or take another part of the test in that category.

    So my idea was to put all of the dynamic text fields and the print button, inside a movie clip. All the text boxes have maintained their names and have embedding enabled. All of the actionscript, on any level of that frame, has been placed accordingly into the movie clip - and yet the dynamic text boxes will not populate with the score like they do outside the movie clip. Worst still, the print button wont work at all inside the movie clip.
    Clearly I'm missing something, but I can't be that far off base in thinking this would work, am I? If I can make the movie clip show the results and work the print button, then I can use instances of the movie clip in as many frames as I need, but the only place the script or label for the print button will exist, is inside the movie clip.

    What am I doing wrong?

    This is the script for the button putting the data into the text fields.


    Code:
    on (release) {
    	gotoAndStop ("resultsGK")
    {
    	warningMsg2 = clear ();
    	if (saveRecordName_var == "" | saveRecordName_var == undefined)
    	{
    		warningMsg2 = "Name doesn't exist,\nplease try again.";
    	}
    	else
    	{
    		readFieldValue_TF.text = load_TF (saveRecordName_txt.text, "General True/False Questions");
    		readFieldValue_GK.text = load_GK (saveRecordName_txt.text, "General Knowledge");
    		readFieldValue_AB.text = load_AB (saveRecordName_txt.text, "Air Brake");
    		readFieldValue_PE.text = load_PE (saveRecordName_txt.text, "Passenger Endorsement");
    		readFieldValue_SB.text = load_SB (saveRecordName_txt.text, "School Buses");
    		readFieldValue_CV.text = load_CV (saveRecordName_txt.text, "Combination Vehicles");
    		readFieldValue_CDT.text = load_CDT (saveRecordName_txt.text, "Doubles/Triples");
    		readFieldValue_HM.text = load_HM (saveRecordName_txt.text, "Hazardous Materials");
    		readFieldValue_FL.text = load_FL (saveRecordName_txt.text, "Fork Lift");
    		readFieldValue_TV.text = load_TV (saveRecordName_txt.text, "Tank Vehicles");
    		//
    		readFieldDate_TF.text = getnow_TF (saveRecordName_txt.text, "General True/False Questions");
    		readFieldDate_GK.text = getnow_GK (saveRecordName_txt.text, "General Knowledge");
    		readFieldDate_AB.text = getnow_AB (saveRecordName_txt.text, "Air Brake");
    		readFieldDate_PE.text = getnow_PE (saveRecordName_txt.text, "Passenger Endorsement");
    		readFieldDate_SB.text = getnow_SB (saveRecordName_txt.text, "School Buses");
    		readFieldDate_CV.text = getnow_CV (saveRecordName_txt.text, "Combination Vehicles");
    		readFieldDate_CDT.text = getnow_CDT (saveRecordName_txt.text, "Doubles/Triples");
    		readFieldDate_HM.text = getnow_HM (saveRecordName_txt.text, "Hazardous Materials");
    		readFieldDate_FL.text = getnow_FL (saveRecordName_txt.text, "Fork Lift");
    		readFieldDate_TV.text = getnow_TV (saveRecordName_txt.text, "Tank Vehicles");
    	}
    };
    }
    Last edited by stargazer1682; 08-23-2011 at 12:27 AM.

  2. #2
    Junior Member
    Join Date
    Apr 2011
    Posts
    25
    Okay, I don't know why this worked, but I copied all of the keyframe on each layer of the results frame and pasted it into a new movie clip, and everything more or less works as designed ...

    The problem is, is that not everything works the way it's supposed to and worse, the printer button/script doesn't really work well at all inside the movie clip.

    For whatever reason, even though the script says to populate the identified dynamic text boxes, which I would expect it do wherever they may be, or however many instances there are - instead, it doesn't fill the text fields inside the movie clip automatically. In fact the name, that is filled in on the previous screen and saved, doesn't automatically appear as it does everywhere else, and always has (the results populating their respective fields is a new addition, including the script to do so into the button that navigates to the results screen) If you type the saved name in and hit the results button, the fields in the movie clip display the input data, but it needs to be automatic - it SHOULD be automatic. The button effectively says, "put this data here," which it does, outside the movie clip.

    The biggest problem is the print button. When used from inside the movie clip, it makes the program go nuts. When it's just by itself inside the MC, it'll start making the program run through frames like crazy. When the dynamic text fields are included in the MC, it looks like it stays on the same frame, but you can hear sounds from other parts of the program run, which tells me it's still making it go crazy, you just can't see it now; and I don't know what kind of problems that could cause.
    On top of that, even after you manually populate the results field, once you hit print and the printer properties window opens, all of the dynamic text fields go blank; and continuing to print from there a display of the program with empty result boxes - AND it proceeds to try and print every single frame in the program

    Seriously, can ANYONE please help me sort this out?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center