This content has been marked as final. Show 27 replies
you cannot mask the same object twice or with two masks existing in the same timeline - however you can change the 'size' or 'shape' of a mask on the fly - simple by changing it with a keyframe on the same mask layer.
however - just wondering why not use the _visible property of the object to 'hide' it until you wish it to be viewed.
additionally i seem to have no problems with constructing a mask within a mask - as long as the 'second' level mask is within the timeline of the object and not on the main timeline.
Thank you for your reply. I think that is what I have done, this is a link to the .fla if you have time to look at it.
Link to File
If you scrub the circlemask library item it works as expected, but when you view the flash file, well it is apparent. I've looked at this in many different ways, but I just can't seem to make it work.
sorry your link doesn't work - throws an error.
Link should work now. Really rank cold going on, wasn't fully paying attention. Which might explain.........
sure does thanks. ok the problem here is that you need to remove the 'blank keyframe' in the mask layer on the main timeline - when you do the mask covers all the frames of the clip and it runs just fine.
however there is an easier way to do this - I'm assuming your building a preloader. here is a way to do it entirely with a little code and no mask or animation - to run this code make a new doc and place it in the actions panel on the first keyframe - nothing else is needed. you can adjust the 'size' and 'spd' vars to change it as well as the 'color' of the sweep in the lineStyle code there. One could also incorporate this with a percentage value returned durring a load using the onLoadProgress handler of the MovieClipLoader class.
Actually, it is not for a preloader. I just want to reveal certain objects using this sweep. It still does not work like I would want and, stupid me, couldn't figure it out. What is happening is that the mask in the animation is showing the object underneath where the animation mask is. Well duh on me.
Going to work with your code to see if I can get it to work as a mask. That code was what I was looking for. Haven't had the chance recently to upgrade my math chops.
I appreciate the time you took reviewing this for me.
np - you're welcome :)
you can use this as a mask if you do a few things. first set the 'image' in an MC - then set the cacheAsBitmap property for both the imageMC and the sweepMC to true with code as in:
then use setMask() to mask the clip as in:
Thank you for the additional info. I will work with that today to see if I can get it running. Prefer using a code-based solution, rather than my 'old way' of doing it.
Got it running as expected. Absolutely brilliant. Thank you again for the time.
So, I have a problem where I cannot get more than one to work at a time. I have renamed each of the sweeps differently, and named each of the masked MCs differently, but only one will work.
ok - in that case your going to want to put this code together a little differently - either within a MC that is the 'sweep' or within a prototype - in either case I would also suggest that it be constructed within a method that can be controlled.
are you currently 'reusing' the same code multiply within that first frame? how did you construct this.
I have each on a separate layer, with the appropriate code. The code works for each if I delete the other codes.
I will try the sweep code as an MC, I am not competent with 'prototype' constructions.
yeah this is most likely because the instances of the 'sweep' clip are conflicting - as well as the onEnterFrames terminating each other improperly without a greater degree of control in place. so I've converted this into a class file which will operate even better than a prototype - as it keeps track of the instances used, and keeps them from getting 'confused' - and with very little code in the timeline needed to call the effect. you can download the fla, swf and class file HERE and the fla contains some comments on how to use the class. enjoy :)
Thank you. Nothing like having a FlashGod at your side.
LOL!!! you're welcome :) you're welcome to join our community there as well - we do offer a 'Live Support chat' where we are able converse quickly about problems of this nature and others, as well as have a little fun.
Thanks for the info beech! I myself might join up tomorrow. :)
I have Flash 8, so the file won't open. Poop!
lmao!! I've posted a Flash8 version to the thread listed above for you.
beech, solid as an oak. Thank you.
Finally had a chance to work with the file, sweet. Thank you very much.
Sometimes my design concepts get ahead of my actual ability to execute them.
lol - np you're welcome :)
don't worry about it - i like to go by the philosophy of 'learn something new every day' and you'll get there.
cl: One last question, what code would I add to the as file, so that when the sweep mask is finished, it would go to the next frame?
I tried several things, but it only got progressively worse.
sure - change this line in the as file:
(spd<360) ? spd+=speed : delete sweep.onEnterFrame;
which is really a 'shorthand' conditional statement, to:
//do you action here - probably
I didn't think of if/else, so I was shorthanding the longhand.
I noticed that you change the last value in: new sweepMask(LetterC, 0, 0, 60, 12); you can change if/when the sweep will finish before entering the next frame.
That I will play with myself (hmmmmm, that doesn't sound exactly right!).
well in this case, as soon as the condition is satisfied it will advance. If you would like a delay before it does so - you could initiate a setInterval to hold for a duration previous to the advance. one could build this into the constructor so that you could pass a value for this purpose. in the above, the last parameter passed is for the 'speed' - however this relates to the speed of the 'sweep' itself in degrees.
I've constructed a new example of this and will post it to the board as soon as our server is back up (currently down - power out)
Chris: I moved each FLA statement to a different frame with a number marker, it works as expected. Hmmmmmmm, seems a good nights sleep makes you see things differently.
My initial thought was that the position of 360° defined in the sweep was different from that in the root, but hey, I know that was wrong too. I had to take a 1½ years off, so my Flash skills are a little decrepit. Need to get a new AS book to understand better how to use it and import it. Things have changed since the beginning.
lol - yeah that can do wonders! lol
I've got the new AS file and example posted to the thread - I included another parameter to call to a user defined method on the main timeline - I thought that would be a handy feature, in case one wished to evoke a different action on the completion of any sweep.
There's still plenty of improvements that could be made to the script as well - but it's an interesting little class :)
....but it's an interesting little class :) and I'm an eager student. I think the concept has a lot of applications.