Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to make an expandable box in flash. The registration of down and up is to the left. the registration of left is in the middle. This is the code:

down.width -= 10; up.width -= 10; left.x -= 10;

When I test this, the left movie clip seems to go more to the left then the width of up and down. Why is it doing this?

To make it clear, down, up and left are all movieclips.

What I am asking is if x and y values could return the same amount when using height and width.

To make it even MORE clear I'm asking if the x increasing by the same amount as the increasing width would bring the movieclips to the same place

share|improve this question
3  
You know what would be even more clear? don't name your movie clips up/down/left – jhocking Jan 24 at 22:42
1  
Could you rephrase the problem, preferably with a sketch? What do you mean by 'registration' and 'width going to the left'? – Marcks Thomas Jan 24 at 22:46
By registration you mean the origin of the movieclips coordinate space? Why isn't it just in the middle for all clips then? – Sidar Jan 24 at 22:55
you know how you can make your registration go up middle right right corner etc. The little squares in the property panel when you press convert to symbol? And I mean the position, not left, the x is going too much – Abe Jan 24 at 22:55
Ok, solved it :) – Abe Jan 24 at 23:44
show 4 more comments

closed as too localized by Byte56, Laurent Couvidou, Josh Petrie, Trevor Powell, Tetrad Feb 2 at 1:38

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

2 Answers

This question is rather bad because it's hard to understand. So I probably shouldn't post an answer to encourage more of these types of posts. However I would like to show a little example of how the "registration" has effect on transformations:

The red + represents the origin of the movieclip the visuals are in. Or how you would call it the registration point.

enter image description here

I have no idea what you actually ceil or floor that appears to be " wrong "(taken from the answer you have given yourself). The wrong values you're getting are completely yours. Since you mentioned the registration points consider the image.

share|improve this answer
yeah that was my main confusion over his answer; ceil and floor of what? – jhocking Jan 25 at 2:59
Actually, my x and y was returning the wrong values, I fixed it with Math.ceil – Abe Jan 25 at 4:55
@Abe, you're not being clear. What are you doing in order for the "x and y" to return the wrong values? These wrong values are your doing because somewhere you setup something wrong. But you're not willing to explain what. – Sidar Jan 25 at 10:13
I told you my code. Did you find anything wrong with it? – Abe Jan 25 at 13:47
1  
You know Abe, you're obnoxious. You only showed your supposed "solution". You didn't show the rest of your code or setup to make us understand why you have to resort to ceil or floor to get the "right values". We are just trying to help and you do nothing to help us understand you. I'm done trying to help, good luck. – Sidar Jan 26 at 2:49
up vote -6 down vote accepted

When you're in a Movie Clip, you need to use math.ciel or math.floor

What I am saying is that inside a movieclip x and y values might return the wrong value so you have to use math.floor or math.ceil because they convert the value into an integer, or you could provide (int) when creating the variable.

share|improve this answer
This is not a useful answer. The question isn't even clear, so this answer makes no sense. – Byte56 Jan 24 at 23:46
It makes perfect sense! – Abe Jan 25 at 0:09
1  
I disagree. How is movieclip returning "wrong" values? Why would rounding up or down be useful? The initial question is still unclear. Asking if the x value would be the same amount as the width? If this really makes sense to you, I think it's too localized, since I can't imagine this being useful to any future visitors. – Byte56 Jan 25 at 0:39
1  
You don't understand how local spaces work. Your question and answer don't make any sense. To say it makes perfect sense while you don't even understand the problem yourself MAKES NO SENSE. If it indeed makes sense do explain so that others who have the same problem can LEARN from you. You're not helping Abe. – Sidar Jan 25 at 0:52
I'm asking if the x increasing by the same amount as the increasing width would bring the movieclips to the same place – Abe Jan 25 at 13:49
show 2 more comments

Not the answer you're looking for? Browse other questions tagged or ask your own question.