[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Flash 8 Professional - Load Movies, Time, Remove

Posted on 2006-05-09
13
Medium Priority
?
283 Views
Last Modified: 2008-02-01
Thanks to a lot of help here I have my graphics creation and motion capabilities, I have the ability to format, load, and display XML, and the ability to ask the question and decide if the answer is correct.  I have learned a lot so far.

Now I need to load a movie based on correct or incorrect answer (that is the only thing on stage) and clear it out for the next question.  I was thinking the best way to do this is with individual layers and hiding the question layer and making one of the movie layers visible.  I am quite unsuccessful in hiding layers through code, though.  Is this the best way of handling this?  Please give sample code of hiding and displaying different layers or code (with explanation) of the best way to accomplish swapping out different movies.
0
Comment
Question by:slink9
  • 7
  • 3
  • 2
  • +1
13 Comments
 
LVL 11

Expert Comment

by:Buffon
ID: 16639196
why dont you hide movies? Why to hide layers?
0
 
LVL 23

Author Comment

by:slink9
ID: 16639296
If there is a better way, tell me and give code examples.  That is why I asked.
0
 
LVL 11

Expert Comment

by:Buffon
ID: 16639317
How do you load movies right now?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 23

Author Comment

by:slink9
ID: 16639424
I haven't added any movies as of yet.  I have created a simple text box on the stage but can't get it to hide properly using code.  The name is corrgrf and all it does is display a big green CORRECT.  When the question is displayed it is shown also.  I have the following code at the top of the AS code in an attempt to hide it.

_parent.corrgrf.visible = false;

I have tried it with this. in place of _parent. and without anything in front.  I can't get access to it.  If I can hide it and the questions then I can alternate visibility and create more movies with the same effect.
0
 
LVL 17

Accepted Solution

by:
Dushan De Silva earned 1000 total points
ID: 16639760
0
 
LVL 2

Expert Comment

by:rythmik1
ID: 16639763
Can you post you current FLA somewhere so we have something to start with?

0
 
LVL 2

Expert Comment

by:rythmik1
ID: 16639912
Or.. if want to get away with doing it pretty simple.. here's kindof an easy way to make what you want by hiding them offstage and just changing the _x and _y to make them 'appear' onstage in a set position, then after clicking the answer they get moved offstage and you can set your question to the next question in your xml or whatever.

http://www.paulsandersdesign.com/flash/question_answer_mcs.fla

This way you can see what you're doing, and you can then take the 'correct' and 'incorrect' movie clips and load any external movie into them also if you want. It's not poetry, but it works and doesn't make you have to learn a ton of code.

0
 
LVL 23

Author Comment

by:slink9
ID: 16639946
Now I have it working.  The combination I had not tried was just the name with _visible on it.  Now how do I put a pause in there so I can display, play, etc and then reset visible attributes and reload another question.

I have everything covered other than the pause, wait for ... next, whichever.
0
 
LVL 23

Author Comment

by:slink9
ID: 16640091
I am all for learning code and new development methods.  That is why I jumped on this project.  I get extra credit in a class I am taking, get to help out a local science museum, and learn new stuff in the process.  I have no problem developing each one in it's own FLA and then integrating into the full version when each one is complete.
0
 
LVL 23

Author Comment

by:slink9
ID: 16640270
I have come across a command that is supposed to allow a pause.  It is setinterval() but I can't seem to get it working.  What would the proper format to use for this command for the purpose of a simple pause?
0
 
LVL 23

Author Comment

by:slink9
ID: 16641513
Each item can go on it's own layer and still be activated from another without a problem.  That definitely makes development much easier since the layers are easily hidden in the development environment.

I still can't figure out how to put in a PAUSE, WAIT, or something so that it will display the movie for two seconds and then make it invisible again while making the questions and answers visible.
0
 
LVL 11

Assisted Solution

by:Buffon
Buffon earned 1000 total points
ID: 16643412
testmovie._visible = true;
var interval:Number = setInterval(foo, 2000);
function foo() {
      testmovie._visible = false;
      clearInterval(interval);
}
0
 
LVL 23

Author Comment

by:slink9
ID: 16661772
I give up on solving this myself!!!  I thought I could load the movie as suggested, run it once, and then return to program execution.  NO GO.  I have the code listed below for my correct answer section.  What is wrong?  I want to run the movie once (and add a sound), stop the movie and make it invisible again, and then view the next question.

corrans = function() {
      nbrcorr ++;
      nbrqst ++;
      pctnbr = Math.round((nbrcorr/nbrqst)*100)
      pctcorr.text = "Questions = " + nbrqst + "   Percent = " + pctnbr;
      qdisplay._visible = false;
      a1display._visible = false;
      a2display._visible = false;
      a3display._visible = false;
      a4display._visible = false;
      Answer._visible = false;
      maincorr.loadMovie("brainswell.swf");
//      brainswell._visible = true;
//      corrgrf._visible = true;
//      var nhld = setInterval("holdit",2000);
//      }
//      stop;
      qdisplay._visible = true;
      a1display._visible = true;
      a2display._visible = true;
      a3display._visible = true;
      a4display._visible = true;
      Answer._visible = true;
      corrgrf._visible = false;
      a1display.selected = false;
      a2display.selected = false;
      a3display.selected = false;
      a4display.selected = false;
      displayData();
}
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses
Course of the Month17 days, 14 hours left to enroll

829 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