I'm trying to change the registration point of a movieclip so that I can rotate it around that point.
I found setTransformationPoint() but I can't get that to do anything and the code is not coloured as a function when I type it in (I have MX2004 pro) and anyway I'm not sure if that is the function I want.
If anyone knows how to do this or a workaround please let me know
Parameters
transformationPoint A pair of floating point numbers that specifies values for each of the following elements:
Shapes: transformationPoint is set relative to document. 0,0 is the same as the Stage (upper left corner).
Symbols: transformationPoint is set relative to the symbol’s registration point. 0,0 is located at the registration point.
Text: transformationPoint is set relative to the text field. 0,0 is the upper left corner of text field.
Bitmaps/videos: transformationPoint is set relative to bitmap/video. 0,0 is the upper left corner of the bitmap or video.
Groups: transformationPoint is set relative to document. 0,0 is the same as the Stage (upper left corner)
Returns
Nothing.
Description
Method; moves the transformation point of the current selection. See document.getTransformationPoint().
Example
The following example sets the transformation point of the current selection to 100, 200:
i dont think that there is a way to change frame rate and interestingly you perhaps dont want to go too fast because slower pc's might not be able to handle it. this is a bit of code i came across - never tried it - do what you will with it.
The question was exactly the same as yours.......
no, but you can fake it. if you add the code below the dotted line to a frame in your flash file, you can use:
mc.playF(m,n,fps); /* to play movieclip mc from frame m to frame n at fps frames per second */
Err, I think you must have misread the question or posted in the wrong thread, I don't want to change the framerate and I think you can using Javascript document.frameRate anyway but I could be wrong, I've never tried it.
Not sure if this is what you had in mind, but you can change the registration point (_x,_y)of the child clip relative to the parent clip and then rotate on the parent clip.
This .fla shows the reg point of the parent clip as a black dot. The reg point of each child clip (red square, green square, blue square) is repositioned relative to the black dot. Rotation is performed on the parent.
OK, I thought I'd found a workaround but it doesn't work.
I think that example goes part way to doing what I want but I haven't fully understood it yet, I'm sure I will after a bit of a think and a cup of coffee.
I'm trying to drag things round with inertia like This Site so things need to rotate around the point that you drag by.
That works fine for the first time you drag, you just move the child one way and the parent the other.
But once you have rotated it and released, the next time you grab, you have to start thinking about trig functions to find how much to move it by.
I've found the code to do it by decompiling the example I posted, but damn, that's a lot of code. It must have been a college project because it has force, weight and inertia and uses proper physics. There's no way you'd put in that much effort for a client
I guess I'll just pick through his code and try to sort it out. I'll update this thread with the code when I do, thanks for the help guys.
Sounds like the script for your site is complex. This one is relatively straightforward and may be "good enough".
The .fla for a modified example which comes close to your implementation is attached. There are 3 mc's being used to calculate the position of the visible mc (the blue one). You can uncomment the other two to see the positioning relationship. Red is the topmost mc, then green, then blue. Rotation is performed on red. And then you can play with the parameters to adjust the sensitivity.
Hmmmm! Looks like globalToLocal() makes life much easier. sergwiz, thanks for that bit in your code. So now, attached is an updated script which is not looking so bad as a rough approximation of the referenced site.