Property name expected in GetProperty

Well I'm very much so a beginner and this is my first time working with relatively advanced actionscript.  As expected, I've run across a problem that I need help with.  Below is the script I'm working with:

if (75>_rotation) {
      angle=(75-_rotation)*.2+_rotation+1;
      setProperty("", Rotation, Int(angle));
}
else if(75<_rotation-1) {
      angle=_rotation-((_rotation-75)*.2)-1;
      setProperty("", Rotation, Int(angle));
}



And following is the error it throws:

Symbol=Animated Needle, Layer=Actions, Frame=1: Line 3: Property name expected in GetProperty.
           setProperty("", Rotation, Int(angle));

Symbol=Animated Needle, Layer=Actions, Frame=1: Line 7: Property name expected in GetProperty.
           setProperty("", Rotation, Int(angle));


Does anyone know what I'm doing wrong?  Any help would be greatly appreciated.

Thanks in advance,
--Anne
Goddess6942Asked:
Who is Participating?
 
moduloConnect With a Mentor Commented:
PAQed with points refunded (500)

modulo
Community Support Moderator
0
 
nishasrilankanCommented:
Usage
setProperty(target:Object, property:Object, value/expression:Object) : Void

I thunk you are setting a property of something...I think here you are trying to rotate the needle..( I asume needle is a movie clip...so the way to do this is..
setProperty(_root.needle, _rotation , Int(angle));

//You dont have a property as "Rotation"...that should be "_rotation"
0
 
subhailcCommented:
there's no need to use setproperty for what you're doing; this is more than sufficient

movieclipinstancename._rotation = whatevervalue;

if you wish to increment or decrement, use standard operators, but remember that rotation isn't entirely scalable (i.e., if you set _xscale to 1000 it makes the object 10 times larger; if you set _alpha to 20, it sets the opacity to one-tenth: both logical and sensical.  if you set the _rotation of an object to a value greater than a particular radix (unsure of my verbiage there), the results might be unpredictable...

also a lot of ppl try to 'flip' with rotation - this is actually accomplished using scaling - if you want to flip something horizontally (like turning a page), use _xscale = -100; if you wish to flip it vertically: _yscale =-100;

hth gl
0
 
Goddess6942Author Commented:
I actually managed to figure out how to get the script I'm using to work for MX:

var needle = 0;
if (needle>_rotation) {
        angle=(needle - _rotation)*.2+_rotation+1;
        this._rotation=int(angle);
} else if (needle<_rotation - 1) {
        angle=_rotation-(( _rotation-needle)*.2)-1;
        this._rotation=int(angle);
}

Now the only problem I'm having is this script seems to only allow for a rotation of 180 degrees.  Anything larger than 180 degrees causes the needle to rotate 360 degrees continuously.  Any ideas as to how that can be fixed?

Thanks,
--Anne

0
All Courses

From novice to tech pro — start learning today.