# Scripted mc registration point

**URL:** <https://forum.kirupa.com/t/scripted-mc-registration-point/186128>\
**Category:** flash\
**Created:** [April 19, 2006, 7:46am UTC](https://forum.kirupa.com/t/scripted-mc-registration-point/186128 "2006-04-19T07:46:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![liquidFusion](https://avatars.discourse-cdn.com/v4/letter/l/4bbf92/32.png) [@liquidFusion](https://forum.kirupa.com/u/liquidFusion)\
**Post date:** [April 19, 2006, 7:46am UTC](https://forum.kirupa.com/t/scripted-mc-registration-point/186128/1 "2006-04-19T07:46:52Z")

</div>

I’m importing an image that I’ll use as my pointer(arrow) in a speedometer.  
My problem is that I need to manually set the movieClip’s registration point so that I’ll get the rotation right.

If I manually drag the image on stage and use F8 to convert it to a MovieClip, I can set the registration point in the dialog box popping up. The only thing I’m trying to do is just that, \*\*[COLOR=black]but [/COLOR]\*\*with ActionScript since I create this thingie dynamically :sleep:

See attachment for more details 🙂  
[![](http://img208.imageshack.us/img208/1194/regpoint9ci.th.gif)](http://img208.imageshack.us/my.php?image=regpoint9ci.gif)  
Any suggestions?

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [April 19, 2006, 8:17am UTC](https://forum.kirupa.com/t/scripted-mc-registration-point/186128/2 "2006-04-19T08:17:24Z")

</div>

You’ll have to make the content of the movie clip into a movie clip, then align that relative to its parent movie clip.

---

<div class="post-metadata">

**Author:** ![liquidFusion](https://avatars.discourse-cdn.com/v4/letter/l/4bbf92/32.png) [@liquidFusion](https://forum.kirupa.com/u/liquidFusion)\
**Post date:** [April 19, 2006, 9:50am UTC](https://forum.kirupa.com/t/scripted-mc-registration-point/186128/3 "2006-04-19T09:50:48Z")

</div>

> [@TheCanadian](#):
>
> You’ll have to make the content of the movie clip into a movie clip, then align that relative to its parent movie clip.

Hey TheCanadian, and thanks for taking time to help me out! 😃  
I didn’t quite get that I’m afraid. Please have a look at the code below:

```auto
class speedometer {
    private static var target_mc:MovieClip;
    private static var container_mc:MovieClip;
    
    private static var bgImg:String;
    private static var pointerImg:String;
    
    /* ---------- CONSTRUCTOR ---------- */
    public function speedometer(c:MovieClip, i:String, p:String){
        container_mc = c;
        bgImg = i;
        pointerImg = p;
        
        setBackground(bgImg, pointerImg);
    }
    
    /* ---------- FUNCTION: setBackground ---------- */
    private function setBackground(bgImg:String, pointerImg:String):Void {
        container_mc.createEmptyMovieClip("background_mc", 1);
        container_mc.background_mc.loadMovie(bgImg, this);
        
        container_mc.createEmptyMovieClip("p_mc", 2);
        container_mc.p_mc.loadMovie(pointerImg, this);
        
        container_mc.p_mc._x = 150;
        container_mc.p_mc._y = 180;
    }    
}

```

When the p\_mc is created, I try to rotate it by using:

```auto
container_mc.p_mc._rotation = 45;

```

This works, but it rotates it from the top registration point, not the bottom one - which is, like you already know, where the problem lies 😃

One last thing though. I create a new speedometer object this way (from the FLA file):

```auto
var bgImage:String = "img/someImage.jpg";
var pointerImage:String = "img/someImage.gif";
var speedo:speedometer = new speedometer(this, bgImage, pointerImage);

```

And there’s pretty much everything! Thanks again.
