12 Replies Latest reply on May 14, 2008 2:05 PM by 8Lucky

    Mask causing dynamic image to disappear

    0degreesK Level 1
      I found this a bit difficult to describe and you'll probably need some more information. Below is a link to the example I'm speaking of, along with a screen capture of my Flash project build, so you can see the layering and what's happening:
      http://www.60bpm.com/apple_forum/dancingboy/

      I'm attempting to do something along the lines of the Officemax "Elf Yourself" and the various JibJab greeting cards where you can upload a picture of your own head to put in place of an actor's head in a video. During the course of a video, there are instances where an object passes in front of the head, which requires it to be masked-out, so the object can pass in front of the head.

      So, my SWF has a short video embedded in the bottom layer of the timeline. I track the placement of the head with a Movie Clip using motion tweens. The layer containing this Movie Clip is masked by the layer above it. At load time, the head image uploaded by the user is loaded into the Movie Clip using the loadMovie function.

      At the beginning of the video, the masking layer is completely filling the stage, revealing the head below it. However, upon reaching the first keyframe where the mask changes (because something is passing in front of the head), the dynamically attached head image disappears.

      I thought it could be the level at which the head was loaded, but I placed a new layer below the mask but above the head with a red ball. It covers the dynamically loaded head properly, so it's on a layer below the mask.

      Like I said, it's difficult to explain the situation, but you can see what's happening at the URL above. I'm baffled.

        • 1. Re: Mask causing dynamic image to disappear
          clbeech Level 3
          it's difficult to say what's happening here. it seems as though that either something is replacing it at the depth or that the 'holder clip' is running off of it's timeline (guesses entirely) I don't think this has to do with the mask since the smiley is being masked properly. do you have a stop(); on the head clips timeline? how are you calling loadmovie() is it just straight on the timeline or within a method? perhaps it's getting called more than once and replacing the depth with something else. another thought: is the instance of the 'head holder' clip the same on the main timeline - i mean is it being 'replaced' on the next keyframe by a 'different' instance of the same clip?

          just thoughts. it would be helpful to see the fla itself.
          • 2. Re: Mask causing dynamic image to disappear
            0degreesK Level 1
            clbeech -- I sent you a link in a private message. Let me know if you didn't get it.
            • 3. Re: Mask causing dynamic image to disappear
              clbeech Level 3
              yes I did - i will investigate shortly.
              • 4. Re: Mask causing dynamic image to disappear
                clbeech Level 3
                ok - I've been able to get this functioning. I believe that much of the issue was the fact that the mcHead only had an instance name on the first frame, and the image loading was being performed from the main timeline. to remedy, I've removed the tweens creating keyframes in all frames of the head layer, and constructed the loading code within the mcHead mc itself. this certainly was an odd problem. you can download the revised file HERE to take a look.
                • 5. Mask causing dynamic image to disappear
                  0degreesK Level 1
                  clbeech -- This is working, but the image is in the library of the movie, which will not be the actual situation. How would I do this if the GIF is living on the server in another directory?
                  • 6. Re: Mask causing dynamic image to disappear
                    clbeech Level 3
                    yeah - i did that while debugging and trying to find the problem, however i do 'think' that it 'may' give a slight performance benefit, but I can't be certain.

                    I would think that when using as many tweens as were there - the processor will be spending some extra time 'calculating' the tweens at run - whereas if it's keyframed the positions are absolute and the processor only needs to implement the render. However all of this, either way, may be compiled to the swf on publish - and then would make little difference on runntime performance - so really I can't be certain. my instinct tells me keyframes are better - but I have no tests or real basis for this either lol!! :)

                    kglad? ... PHA HA!!!
                    • 7. Re: Mask causing dynamic image to disappear
                      0degreesK Level 1
                      Sorry, I realized something about the revised project shortly after submitting the reply and revised it. Is there a way for the loadBitmap to load a GIF on the server? Do I just use a URL in there instead of a reference to the linkage in the library?
                      • 8. Re: Mask causing dynamic image to disappear
                        clbeech Level 3
                        yeah - i had just done that to simulate a loaded image file - unfortunately the loadBitmapData method only supports a Library image file with an ID - so in order to bring in an image from an external URL we've got to change a few things, and use the MovieClipLoader class. Also in doing so I've found that the problem 'reappeared' - I believe this had something to do with the image being a bitmap data object. well the truth is that one can't really use more that a 'single' mask - so to resolve this problem you take all of the frames an place them within a MC - however then the MC timeline also needs to be controlled in order to sync with the main video. So using the MovieClipLoader handlers I've designed a system that will allow you to load different images by changing a variable on the main timeline. You'll find a new version posted to the forum listed above.
                        • 9. Re: Mask causing dynamic image to disappear
                          0degreesK Level 1
                          cbeech -- Thanks again for the effort. This is working and I understand how it's working. My only concern is with the masking being contained in it's own Movie Clip because the Movie Clip will run on its own timeline. Is there any danger... something that would cause the masking Movie Clip to run out of sync with the parent Movie Clip / SWF that contains the content?
                          • 10. Re: Mask causing dynamic image to disappear
                            clbeech Level 3
                            np, you're welcome - that is why it will be important to call both to play at the same time, if done so they should 'render' at the same frame rate, and i think will mostly be ok - I'm fairly certain that even if there was some intense processing need, the frames will move in unison, even if the rendering is slowed because of it.
                            • 11. Re: Mask causing dynamic image to disappear
                              0degreesK Level 1
                              Okay, I have a test here:
                              http://greekme.60bpm.com/masked/index.php

                              I noticed on a co-worker's computer that if he hit the play button immediately, without giving the SWF a chance to load completely, it wasn't reliable. I'm guessing... if build a "Loading..." movie in frame one that shows progress before presenting the play button, this should work okay. What do you think?
                              • 12. Re: Mask causing dynamic image to disappear
                                8Lucky
                                Hi, we worked on some project and had a similar difficulties on this web site: http://calinsurancequote.com/
                                What do you think?
                                Best regards
                                Adam