westykid Posted June 5, 2013 Share Posted June 5, 2013 Hi guys, So i've made a draggable object that looks like a top down view of a tire, it has a blitmasked artwork mc inside, this mc wraps so that when you drag it gives the illusion of the tire rolling. That all works fine but i want the user to be able to switch between a few styles of tires by changing to a new frame of the artwork mc like so: blitMask.dispose(); artworkMc.gotoAndStop(whichTire); artworkMc.x = 0; blitMask = new BlitMask(artworkMc,-artworkMc.width/2,-artworkMc.height/2,artworkMc.width,artworkMc.height,false,false,0,true); some of the tires are different sizes so i was hoping stating 'artworkMc.width' would get that information, but the mask is staying the original size. Also is seems that the artwork of the original tire frame is still in the background behind the new frame. I reckon it's more a problem with my logic than anything else but if anyone can throw me some pointers that'd be great! Thanks Link to comment Share on other sites More sharing options...
Carl Posted June 5, 2013 Share Posted June 5, 2013 Hi and welcome to the GreenSock forums. Sorry to hear you are having trouble. Based on the code you provided, I was a touch doubtful it would work. I thought perhaps the graphical data on a "future" frame of your new BlitMask's target might not be totally accessible at the time the new BlitMask was created. I made a very basic test where frame 2 of mc, contains smaller and much different artwork than frame 1. This test shows that you can dispose of a BlitMask and instantly create a new one based on the contents of another frame of the target clip. import com.greensock.*; //create a 200x200 BlitMask positioned at x:20, y:50 to mask our "mc" object and turn smoothing on: var blitMask:BlitMask = new BlitMask(mc, 20, 50, 200, 200, true); //position mc at the top left of the BlitMask using the scrollX and scrollY properties blitMask.scrollX = 0; blitMask.scrollY = 0; //tween the scrollY to make mc scroll to the bottom over the course of 3 seconds and then turn off bitmapMode so that mc becomes interactive: TweenLite.to(blitMask, 3, {scrollY:1, onComplete:createNewBlitMask}); function createNewBlitMask() { blitMask.dispose(); mc.gotoAndStop(2); //make a smaller blitMask from frame 2 of mc (note frame 2 contains smaller artwork too) blitMask= new BlitMask(mc, 0, 0, 50, 50, true); //position mc at the top left of the BlitMask using the scrollX and scrollY properties blitMask.scrollX = 0; blitMask.scrollY = 0; //tween the scrollY to make mc scroll to the bottom over the course of 3 TweenLite.to(blitMask, 3, {scrollY:1}); } I have attached a CS5 fla and swf. Perhaps you can assess somewhere that you are doing something drastically differently. If you need more help, feel free to post a very basic example that illustrates what is wrong. It doesn't have to be your full production files, in fact, the simpler the better. blitMask_frame2_CS5.zip Link to comment Share on other sites More sharing options...
westykid Posted June 7, 2013 Author Share Posted June 7, 2013 Thanks Carl, just glancing i can see a a couple things i've done differently that might be messing things up (such as changing mc.x rather than using scrollX) i'll check the file out and let you know what happens Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now