A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Quick setMask() question/clarification...

  1. #1
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662

    Quick setMask() question/clarification...

    If you set a mask on a container clip intitally, when you load a new movie into that container clip, you have to set the mask again correct?

    If i use layer masking.... that eliminates having to re-set a mask, but then anything (especially text) that may be masked in the loaded movie doesn't work correctly... why is that?... because it's a mask within a mask?

    finally.. can I set a mask on the container clip from inside the loaded movie? maybe using using something like this.setMask(_parent._parent.transition) or _root.transition??
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

  2. #2
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    1) correct, because if you load something into a movieClip, the whole MovieClip gets "resettet", BUT: you can of course put another movieClip into the container and load the movieclip into that one.

    2) Layer masking is timeline based, with all the different things you can do in it.. keyframes shapetweening and so on.. So its rendering is just slightly different. But as you could nest that timeline animation and use setMask with it, i just think the programmers screwed up something..

    3) sure.. But: this.setMask(_parent._parent.transition) wont work, i am not 1000% sure, but the masked MC + the mask need to be on the same level in hierachie,
    so i.E:
    this.setMask(_parent.transition);
    or
    _parent.setMask(_parent._parent.transition);

    and i highly suggest using relative paths, as constantly targetting "_root" is a) not very clean and b) might run you into problems on bigger projects.
    My letters on the F1 key have faded, how are yours today?

  3. #3
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    thanks... I'm still trying to work out my issues... For the most part everything works fine.... except when i first load the site. The first external file is loaded in,, butnever plays properly. WHen i navigate to another section, and back to the first...everything works perfectly. It's frustrating as hell... I can't find any reason for the bug...
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

  4. #4
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    are you using a movieClipLoader object or loadMovie()?

  5. #5
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    unfortunately I'm using loadMovie().... I can't seem to convert the preloader I am using into a usable effect with the MovieClipLoader() (which would have been my preference for loading)

    The odd thing is that i have it all working fine locally... but online when it initially tries to load the first section, it fails when it comes to playing the file... after navigating elsewhere and returning back.. it all works fine..
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

  6. #6
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    that's probably because you can't set a mask to something that doesnt exist yet. Your loaded movie doesnt 'exist' until the code cycle before frame 1. Thats why I like the mcloader object so much. It has both an onLoad and onInit funciton. Maybe post your preloader code as you have and I can suggest an alternative.

  7. #7
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    i am not trying to set a mask on something that doesn't yet exist... when the main site shell loads (which pretty much just contains the menu, container clip, transition clip and preloader) it goes through a short set-up animation, when that finishes, it starts my loader mc. The loader mc stops, the preloader starts and the container clip's visibility is set to false. When the bL==bT, the transition clip is set as a mask on the container, the container's visibility is set back to true. and the loader clip starts playing again. At the end of the loader clip, i trigger the transition clip to start playing and the mask reveals the content of the movie just loaded.

    the only time it doesn't work is on the initial load. Every time after that, everything works fine....
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

  8. #8
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    I can't say for sure, but I always set it as bL>=bT because flash can miss sometimes so at least if its greater than or equal to you're sure to get a response.

  9. #9
    Qwaizang:syntax_entity_ Q__Hybrid's Avatar
    Join Date
    Aug 2005
    Posts
    270
    Madzig,

    I think I may understand your problem more clearly now that you've mentioned using the _visible property.

    Instead of setting the container's _visible to false, set it's _alpha to zero. When you set a clip's _visible to false, Flash ignores that clip when it renders frames. For all intents and purposes, the clip "no longer exists", at least in terms of items that are to be displayed on screen. You're setting your mask on a clip that doesn't exist at render time, but still occupies memory in every other respect. Avoid this by doing the following...

    1. You can still set _visible to false, but set _alpha to zero first:
    Code:
    myContainer._alpha = 0;
    myContainer._visible = false;
    2. When you are about to call setMask(), re-enable rendering, call, and reveal:
    Code:
    myContainer._visible = true;
    myContainer.setMask(myMask);
    myContainer._alpha = 100;
    I hope this helps,
    +Q__
    Qwai•zang \kwî-'zan\ n [origin unknown] 1 : abstract designer, esp. of complex real-time experiments, c. 21st century

  10. #10
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    ahhhh... that makes perfect sense.. i can't believe i forgot about that... let me give it a shot and see what happens...
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

  11. #11
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    ok.. that didn't solve the problem either....
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

  12. #12
    Qwaizang:syntax_entity_ Q__Hybrid's Avatar
    Join Date
    Aug 2005
    Posts
    270
    Madzig,

    You can go ahead and send me your project in a PM. I'm not sure I can help otherwise, I'm as stumped as you.

    +Q__
    Qwai•zang \kwî-'zan\ n [origin unknown] 1 : abstract designer, esp. of complex real-time experiments, c. 21st century

  13. #13
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    ok...i'll do that. in the meantime... i have noticed that once my external files have been cached... everything loads/plays fine. it's only the initial load/play of the swf that gets screwed up...

    maybe it is my preloader after all....

    anyway... i'll strip down the files and zip them up for you.

    thanks for the help
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

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