13 Replies Latest reply on Dec 6, 2007 1:50 PM by Greg Dove

    Loading a movie

    Kirstii86
      Loading a movie


      I have a main file and three sepearte files. The seperate files are interactives quiz's using

      loadQuestions = new LoadVars();
      loadQuestions.load("circuitquiz1.txt");

      actionscript. I need to be able to put these into the origional file (which also has interactive elements to it) There will be a button to click to send it where the quiz is. I am not sure how I can go around this. Ive tried just copying the frames straight into the file. And also just droping the .swf into the frame. but non of that works can anyone help me please

      Thank you
        • 1. Re:  Loading a movie
          Greg Dove Level 4
          For each of your quiz text files... how are they formatted... what does the data look like inside?
          LoadVars normally expects a certain format of data inside your textfiles, like:
          question1=This is question one&question2=This is question 2&
          etc

          But you can do it other ways as well.

          So just a quick check... how are they currently set up?
          • 2. Re:  Loading a movie
            ldicn
            Hello everyone!
            Good Morning

            I am no programmer so please accept my apologies if I sound daft.
            Is it possible for some one to send a flash template, which will play video files on our website.
            www.ldicn.org.uk
            Ou content Management System doesnot allow us to upload video file. But it does let me attach flash (html) files that will play the video files. I don't know the code which goes behind this flash html template. So please please help.

            regards

            sukhi
            • 3. Re:  Loading a movie
              Kirstii86 Level 1
              hiya the quiz files have a loading frame with the script

              stop();

              loadQuestions = new LoadVars();
              loadQuestions.load("flashquiz2.txt");

              loadQuestions.onLoad = initQuestions;

              function initQuestions(questions) {
              topic = loadQuestions.topic;

              qArray = loadQuestions.questions.split(String.fromCharCode(10));

              for(i=0;i<qArray.length;i++) {
              qArray = qArray.split(":");

              qArray [1] = qArray[1].split(";");
              }

              _root.gotoAndPlay("start game");
              }



              And on the third frame there is the following script

              stop();
              initGame();

              function initGame() {
              questionNum = 0;
              numRight = 0;

              displayQuestion();
              }

              function displayQuestion() {
              if (questionNum >= qArray.length) {

              finalScore = numRight + " out of " + qArray.length;
              gotoAndPlay("game over");

              } else {

              question.text = qArray[questionNum][0];
              answer0.text = qArray[questionNum][1][0];
              answer1.text = qArray[questionNum][1][1];
              answer2.text = qArray[questionNum][1][2];
              answer3.text = qArray[questionNum][1][3];

              questionNumDisplay = questionNum+1;


              correctAnswer = int(qArray[questionNum][2]);


              animateIn();
              }
              }

              function animateIn() {

              question.xstop = 300;
              question._x = 800;

              answer0.xstop = 400;
              answer0._x = 1000;

              answer1.xstop = 400;
              answer1._x = 1200;

              answer2.xstop = 400;
              answer2._x = 1400;

              answer3.xstop = 400;
              answer3._x = 1600;
              }

              function selectAnswer(n) {
              if (n == correctAnswer) {
              triggerSound("right");
              numRight++;
              } else {
              triggerSound("wrong");
              }

              questionNum++;
              displayQuestion();
              }

              function triggerSound(soundName) {
              soundfx.stop();
              soundfx = new Sound();
              soundfx.attachSound(soundName);
              soundfx.start();
              }

              thanx again for having a look

              Kirstie
              • 4. Re:  Loading a movie
                Greg Dove Level 4
                OK....so let me just double check your original request, it this what you want to do :

                Instead of loading the questions from the external files, you want them (the questions) hard coded inside your swf... so they are not loaded from the external files.

                • 5. Re:  Loading a movie
                  Kirstii86 Level 1
                  I did because I wasnt sure if it could handle loading the .swf then the .swf oading the text file. but I have now made it all work thank you for looking at it for me and the help that you gave me a few days ago that is my project officially finshed and I would like to thank you loads

                  Kirstie x
                  • 6. Re:  Loading a movie
                    Greg Dove Level 4
                    You're welcome. And well done!
                    • 7. Re:  Loading a movie
                      Kirstii86 Level 1
                      hey I no i said I had fixed it and I thought I had but I have one last problem. Is there anyway to keep the origional swf open when it loads the new one. As the user will need to go back to it after the quiz is complete
                      • 8. Re:  Loading a movie
                        Greg Dove Level 4
                        I think from memory you just had one main swf? And it was just going to different frames within it.
                        If its loading data from the text files at the start that won't change the swf.
                        Do you mean you want to go back to the first frame or something like that?

                        If so you could just put a button on stage with myButtonName as the instance name in the property panel... and this code on a separate layer ('actions layer' or somthing like that) at the same frame number as the button.

                        myButtonName.onPress = function() {

                        _root.gotoAndStop(1); //if you want it to go to frame one.

                        }
                        • 9. Re:  Loading a movie
                          Kirstii86 Level 1
                          Origionally I did have just one main .swf but now I have one main one which loads three quizes when the appropriate button is clicked. They now work fine but once you are in the quiz there is no way to go back to the main file. I have added home buttons to two of them and used
                          on (press) {
                          loadMovie("ElecTest2.swf",_root.elec);

                          }
                          which works but on the third quiz it wont load it no matter what file I ask it to load all the quizes are the exact same just different text files.

                          I was wondering if there was a way where when you click to open the quiz the main .swf file can stay open rather than closing to open the new one.

                          I'm sorry I think ive made this sound more complicated than it is I hope you can understand what I mean.
                          • 10. Re:  Loading a movie
                            Greg Dove Level 4
                            For this:

                            "I was wondering if there was a way where when you click to open the quiz the main .swf file can stay open rather than closing to open the new one. "

                            Sure. But I think you might already be doing that because you're targeting a child clip of the _root, which means you're not replacing the whole swf.

                            Instead of loading your new swfs into the _root level, you can (and seem to be already) load them into a movieclip container.

                            You need to consider:Do you want your menu controls visible or active for choosing which movie/quiz to load when each quiz is visible? Because maybe the loaded clip is covering them up and perhaps they're just not visible.

                            You could try putting your control buttons on a layer above the one that contains
                            the elec movieclip instance.

                            Other than that its a little difficult to picture exactly what you're doing in my head - my fault I'm sure.
                            It sounds almost like you could do what you want to achieve by loading the different text files instead of loading different swfs which load different text files... if that makes sense .
                            • 11. Re:  Loading a movie
                              Greg Dove Level 4
                              If someone else thinks they can help out here, please don't hold back... I'm away for a couple of hours.
                              • 12. Re:  Loading a movie
                                Kirstii86 Level 1
                                hey I know you said that I'm loading a child clip but i'm slightly confused when I click the button to open the quiz file it opens a new .swf and closes that one I have over come this by adding another button that re loads the origional file but on one of the quiz's this again does not work. I dont think i'm explaining it right it is very confusing sorry I think its flash as my code on all three files is the same two of them work and the other 2 dont. any ideas???
                                • 13. Re:  Loading a movie
                                  Greg Dove Level 4
                                  You have a movieclip on the stage called elec?

                                  when you do this:
                                  loadMovie("ElecTest2.swf",_root.elec);

                                  its loading /replacing a movieclip on the maintimeline called elec with the swf called ElecTest2.swf. The 'main' clip/timeline doesn't change.

                                  just email me your latest fla if you want me to take a look it might be easier if I see what you're doing as well.