# Simple scaling problem

**URL:** <https://forum.kirupa.com/t/simple-scaling-problem/57452>\
**Category:** flash\
**Created:** [July 13, 2004, 1:05pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452 "2004-07-13T13:05:26Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fraggs](https://avatars.discourse-cdn.com/v4/letter/f/c37758/32.png) [@Fraggs](https://forum.kirupa.com/u/Fraggs)\
**Post date:** [July 13, 2004, 1:05pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452/1 "2004-07-13T13:05:26Z")

</div>

I have a mc within a mc, on this inner mc I have the following code, I know it works as when I use the trace command I get an output, but when I replace trace with a function, nothing happens, anyone able to help?

```auto
onClipEvent(load) {
        this._rotation += 20;
        origWidth = _root.myRotation._width;
        origHeight = _root.myRotation._height;
}
}onClipEvent(enterFrame) {
        if(Key.getCode() == Key.UP) {
                _root.myRotation._xscale += 5;
                _root.myRotation._yscale += 5;
        }else if(Key.getCode() == Key.DOWN) {
                _root.myRotation._xscale -= 5;
                _root.myRotation._yscale -= 5;
        }
}

```

Regards,

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 3:16pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452/2 "2004-07-13T15:16:05Z")

</div>

I don’t know if you noticed that extra close bracket there beside the onClipEvent (enterFrame) {, that may or may not be your problem.

Also, it would be more efficient if you had a listener for the keys instead of an enterFrame:

```auto
keyListener = {}; // initiate object
keyListener.onKeyUp = function () {
if(Key.getCode() == Key.UP) {
                _root.myRotation._xscale += 5;
                _root.myRotation._yscale += 5;
        }else if(Key.getCode() == Key.DOWN) {
                _root.myRotation._xscale -= 5;
                _root.myRotation._yscale -= 5;
        }
};
Key.addListener(keyListener);

```

all of which you would simply place inside the onClipEvent (load).

But that aside, what’s the function you’re trying to replace the trace with?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 7:35pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452/3 "2004-07-13T19:35:24Z")

</div>

I know my code works because have tested it using the trace command and when I press the up key I get the relevant output. Yet when I replace trace with the above code for scaling the clip, nothing happens. It’s really odd.

Regards,

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 7:44pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452/4 "2004-07-13T19:44:47Z")

</div>

do a trace(\_root.myRotation) and see what it outputs. If it says “undefined” you’ll need to find out what that clip is called.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 9:27pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452/5 "2004-07-13T21:27:33Z")

</div>

the clip is called “myRotation”

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 9:33pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452/6 "2004-07-13T21:33:57Z")

</div>

did you actually try the trace? or are you just saying that?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 9:36pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452/7 "2004-07-13T21:36:09Z")

</div>

thats the name of the clip I am trying to manipulate.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 9:37pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452/8 "2004-07-13T21:37:12Z")

</div>

yes, but replace the scaling code with trace(\_root.myRotation) and see if it even recognizes the clip you’re trying to manipulate.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 9:42pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452/9 "2004-07-13T21:42:04Z")

</div>

I owe you an apology (sorry) I was trying to be clever (with me thats never a good idea). When I did try it, the trace came up undefined.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 9:48pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452/10 "2004-07-13T21:48:28Z")

</div>

no problem. find out what that clip is called and you should be good.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 9:48pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452/11 "2004-07-13T21:48:32Z")

</div>

I think I know whats wrong.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 9:55pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452/12 "2004-07-13T21:55:42Z")

</div>

nope, still undefined 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 9:58pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452/13 "2004-07-13T21:58:18Z")

</div>

What I have is a clip (MC name = Circle) with the instance name myCircle, then inside that mc is another mc called myRotation, I’m looking to rotate this clip by said amount per frame. When I tried using \_root.myCircle.myRotation += 5; and \_root.Circle.\_myRotation += 5; and did that trace thing you told me, it still came up undefined.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 10:16pm UTC](https://forum.kirupa.com/t/simple-scaling-problem/57452/14 "2004-07-13T22:16:24Z")

</div>

Well, if Circle is on the root, and myRotation is inside Circle, this should be valid:

trace(\_root.Circle.myRotation);

and not output undefined.

However, if the code you posted above is contained in Circle, all you need to do is refer to myRotation as myRotation, no need for \_root.
