Skip navigation
rmacatee
Currently Being Moderated

Quick question from someone new to flash....

Jul 21, 2012 4:31 PM

Hey guys,

 

  I'm having a very weird problem with a project I'm working on.  I have a multi-scene project and on one of the scenes there are three buttons which the user can interact with.  Each button takes the user to a difference scene that starts with music, text fade ins, and pretty simple stuff.  Two of the buttons worked fine, and I duplicated the scene I used for the second button when I started on the third since they have the same general format.  What is really weird is that when I have the third button link to the second scene (via actionscript), everything works fine...but when I use actionscript to link the third button to an EXACT duplicate of the second scene, there is a brief burst of sound before the main track that is supposed to begin starts...almost as if it tried to play a sound file for a brief second and then abruptly stopped - any ideas what could be going on?  It just doesn't make sense to me that the annoying 1 second sound would only be there when I make a copy of the scene, but not when I link to the original....

 

 

Also, since my project contains many scenes, is there a way for me to preview only one scene that will still let me click on a button to link me to another scene - seems like that only works when I compile the entire movie, when I preview a scene in isolation it gives me a compiler error saying the scene I'm linking to can't be found (likely because when you preview a scene in isolation it doesn't compile any of the button-linked scenes)...

 

Hope this made sense!

 

Thanks!

 

-Ricky

 
Replies
  • Currently Being Moderated
    Jul 23, 2012 5:07 AM   in reply to rmacatee

    Using scenes is always problematic. You really shouldn't be using scenes, that's a methodology that was abandoned at about Flash 2. The central problem is that when a scene based Flash file is saved as an .swf, Flash concatenates all of the scene timelines end to end to make one, long, timeline. One of the resulting problems is that you may end up with duplicate frame labels, and function and variable names.

     

    While Flash will warn you about duplicate frame labels, it may have difficulty resolving the duplicates, even if your code refers to the scene and the frame label.

     

    Another problem with using scenes is that you end up with one large .swf file that may not download quickly or efficiently and can result in unpredictable playback. At runtime, when Flash will always use the first named thing that it finds, so, if there are two frame labels with the same name, Flash will always go to the first one in the timeline. If it gets completely confused, Flash will always go back to the first frame of the movie and start over, this is the looping that you may see when there is a problem in playback.

     

    A better method for producing a movie made of many parts is to produce each section as a unique Flash movie. Then, at runtime, load each of these movies separately. This may seem more complex, but it will yield a more predictable user experience, a simpler production process, and a simpler testing process.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 24, 2012 5:07 AM   in reply to rmacatee

    Yes, when you add a child object to the display list that new object will be placed on top of whatever is already on the stage. If you don't position this new object, it will be positioned with its upper left corner at the upper left corner of the stage.

     

    Working with the display list and loading new objects is a complex subject, but simply put, loading in a new .swf works pretty much the same as opening a new .swf in a browser window. When you call for that new .swf it will begin to stream into your existing movie. It will begin to run or not depending on how it was coded. One difference between loading an .swf into a browser and loading an additional .swf into an existing .swf is that the background for that additional .swf does not load. The background, the color layer that you define in the movie's properties, is only used for the first movie that is loaded into the browser. This means that if you create a movie with a blank first frame and a stop(); directive at that first frame, and then load that movie, the user will not see anything on the stage as that movie loads.

     

    Alternatively, you can set an x and/or y position for the newly loaded movie that is off the visible area of the stage. I often load in new movies with a y position of -1000. Then, when I want to actually use that movie, I change its y position property value so that it shows on the stage.

     

    You can then either move that movie back off the visible area or you can use removeChild() to get rid of the movie if you no longer need it.

     

    When you load new content, how you make the new content appear on the stage and how you remove that content are all part of the design of your website. You can load in all of the individual parts at the start and then show and hide each piece as needed, or you can wait until the user asks for a particular part and then load that part as it is asked for.

     

    Does that help?

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 25, 2012 6:02 AM   in reply to rmacatee

    Yes, that is one way to load in new content and display it. Without seeing your movie's content it's difficult to know what the best method might be. The way that you display your content relates to the design of that content. You need to consider what parts are constant, if any, what parts change, how the user interacts with the individual elements, the randomness of the interaction, the pacing, etc.

     

    Say, for instance, that you have three sections to your movie and you want to move from one section to another when the user clicks on a button. Further, you want to show a transition between each of these sections.

     

    You can create each section as a different flash movie. Likewise you can create the transition as another unique flash movie. Finally, you can create a container movie that does nothing except to load in these content movies.

     

    Let's call these movies "container", "content1", "content2", "content3" and "transition". Have the movie container, load in each of these movies with transition as the last to be loaded. So now you have four .swf movies stacked on top of your container movie. Content1 can play when it loads. When the user calls for the movie content2, you can play the movie transition and when it finishes, play the movie content2. When the transition movie begins, you can remove the movie content1. If you no longer need the movie content1, then you can use removeChild() to get rid of it. If you think that you will need it again, then just rewind it back to frame 1.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 29, 2012 1:44 PM   in reply to rmacatee

    It sounds like you may have a couple of problems. The first is that you are addressing the wrong movie and the second is that you may be addressing a movie before its ready to be used. There may be other problems. Can you send me a copy of the movies so that I can see what's going on?

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 30, 2012 7:52 AM   in reply to rmacatee

    Yes, the .fla files will be the useful things for me to look at.  Send me a private message through this forum and I'll send you an address to my file uploader. That way I'll get the files directly.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points