View Full Version : Is getProperty necessary?(at least in this case)
ommmm
01-03-2002, 04:35 AM
In the ActionScript tutorial on getProperty I found that:
_root.xpos = _x ;
works just as well as the example used in the tutorial:
_root.xpos = getProperty ( _target, _x );
Am I missing something? Will I live to regret taking this kind of shortcut?
Be kind, I'm new. Thanks!
Ricod
01-03-2002, 07:29 AM
The first is part of a bigger script where the target is already specified. The second is the old Flash 4 syntax, with the exception of the _root and dotsyntax. get and setProperty aren't preferd anymore. Its not a crime though.
friz2002
09-10-2002, 04:16 PM
So, which of these is the newest syntax (they all seem to work)
Which one should I use? I'm using FlashMX
_root.yposition = _y;
_root.yposition = this._y;
_root:yposition = this._y;
_root.yposition = getProperty(_target,_y);
/:yposition = this._y;
/:yposition = _y;
thx
Ricod
09-12-2002, 04:37 PM
_root.yposition = _y;
_root.yposition = this._y;
_root:yposition = this._y;
these are all pretty much the same, except that with this you specify which _y. The first is usuable if you already established the target I believe. (like in a function that affects a mc)
The difference between the 2nd and 3rd is that : is only used for variables
_root.yposition = getProperty(_target,_y);
this one is very odd. The first part is Actionscript from Flash 5 and up, and the 2nd from Flash 4 ... not neat coding ...
/:yposition = this._y;
/:yposition = _y;
this rings a bell ... but once again, not sure. I believe its Flash 4 syntax ?
When I want to set a variable the value of an mc's _y value, I usually use absolute path and the most recent syntax. So, that would be :
_root.myVariable = _root.myMc._y;
friz2002
09-13-2002, 12:09 PM
thx :)
Ricod
09-16-2002, 10:15 AM
You're welcome ! :)
tweaknee
05-13-2004, 04:45 PM
I'm using Flash MX and am working through Jesse's tutorials. The solution, _root.myVariable = _root.myMc._y; , seems to require each movie clip to have a unique instance name. The getProperty in the tuturial was able to use a generic _target which is applicable to all the clips, so you don't have to change the script for each instance. I tried to use _root.myVariable = _root._target._y; to no avail. Is there a way to use the same infix-style script for multiple movie clips?
if you want to grab a property from an mc, then the mc needs a unique instance name.
tweaknee
05-13-2004, 05:54 PM
thanks, tg,
I was wondering, though, if there's a way to use that _target call like they did in the tutorial, so the script on each clip can be the same for each instance?
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.