# Question regarding grouping with AS

**URL:** <https://forum.kirupa.com/t/question-regarding-grouping-with-as/185338>\
**Category:** Uncategorized\
**Created:** [April 12, 2006, 3:53pm UTC](https://forum.kirupa.com/t/question-regarding-grouping-with-as/185338 "2006-04-12T15:53:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joran420](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joran420/32/2329_2.png) [@joran420](https://forum.kirupa.com/u/joran420)\
**Post date:** [April 12, 2006, 3:53pm UTC](https://forum.kirupa.com/t/question-regarding-grouping-with-as/185338/1 "2006-04-12T15:53:41Z")

</div>

Is there anyway to group ojects with AS  
like

```auto

var Hat:MovieClip = attachMovie("Hat","MyHat",1)
var Head:MovieClip = attachMovie("Head","myHead",2)
//place head in middle of screen
Head._x = 300
Head._y = 300
//place hat on head
Hat._x = Head._x - 15 
Hat._y = Head._y - 30 
//this is what i need help with

createGoup("myHead","MyHat") // forms a group of the two objects

```

now when i do

```auto

_root.myHead._rotation = 45

```

would it rotate myHat so that its always on myHead?

---

<div class="post-metadata">

**Author:** ![Mirandir](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Mirandir](https://forum.kirupa.com/u/Mirandir)\
**Post date:** [April 12, 2006, 3:58pm UTC](https://forum.kirupa.com/t/question-regarding-grouping-with-as/185338/2 "2006-04-12T15:58:56Z")

</div>

Wy not put the Hat and Head movieclips into a movieclip. Then any transformation done to that movieclip would apply to both movieclips inside.

/Mirandir

---

<div class="post-metadata">

**Author:** ![joran420](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joran420/32/2329_2.png) [@joran420](https://forum.kirupa.com/u/joran420)\
**Post date:** [April 12, 2006, 4:03pm UTC](https://forum.kirupa.com/t/question-regarding-grouping-with-as/185338/3 "2006-04-12T16:03:23Z")

</div>

cause I need the hat to fly off the head towards the mouse and do hitTests  
when you click a mouse(it would ungroup and move towards mouse)

ok so its more of a bullet than a hat

the head has its own set of hitTests and they are two different objects that just need to move like one object…using only AS  
[edit] the only movement involved is rotation
