I have a MovieClip that has a bunch of MovieClips inside it. I am trying to figure out how wide the MC is at a specific y value. Not sure if there is an easy way to do this.
For an example.
Code:
OOOOOOOO
O O
O O
OOOOOOOOOOOO
O O
O O
OOOOOOOOOO
This is the shape of the MC. It is not solid all the way through, it has MCs strewn about inside this outline. I am trying to figure out how wide it is from, say the second 'O' from the bottom. Left to right. The actual MC.width would be 12 'O's wide. But at that bottom portion, it would be 10 'O's wide. I'm not sure how I can do this.
I'm not quite following you. How does this actually work?
For something a little different, someone had suggested using a point to count the number of pixels were in a gap using hitTestPoint. I'm not sure if this is something like that or not, but I'd love to hear how that works if you have a way to explain it a little better.
If you could that would be very helpful!
Thanks, ~Bill L.
I was having trouble opening the fla you sent. "unexpected file format". I'm using CS3 if it might be a compatibility issue.
Also, I've been trying to get it to work with the code you posted here but I could only get it to work once. I'll attach the fla so you can see what I'm working with. It's a little messy, but I was basically trying to have it recognize how wide it is at the stages 200th pixel or so. Around the center.
I have it tracing back the width whenever it changes floors, but I couldn't get it to work on the next floor up for some reason. And once you are up there, when you go back down it isn't right either.
I'm pretty sure it has something to do with the "walls" clip's x value but not certain.
Hopefully this will help. (Arrows to move, Space to Jump, Orange bars are Ladders)
Ok - took a little digging but I found the source of the errors...you're using a set of Points to keep track of your floor positions and the third floor was never defined - so when you tried to go up, the level had no idea where the point of reference was.
PHP Code:
var floor3:Point = new Point(-420, -960);
Moving forward, I recommend you put those points into an array instead of seperate vars - that way you can keep it all together and look up the values like so:
PHP Code:
var floor:Array = [];
floor[1] = new Point(0,0);
floor[2] = new Point(-420, -480);
I'm not quite sure what you mean by turning on bitmap caching the walls. And I was having a problem in my file with the bitmaps themselves.
I tried to trace the "width" that was being pulled from the bitmap thing, and the first floor worked fine telling me the correct width. But the second floor was coming up with a very low number.
Is there any suggestions for that? Cause I'm pretty sure it has something to do with the walls object actually moving around the stage.