function question
- KLoWnXXX
-
KLoWnXXX
- Member since: Feb. 12, 2005
- Offline.
-
- Forum Stats
- Member
- Level 16
- Blank Slate
i made a function that says
function tracks(mc) {
duplicateMovieClip(_root.mc, "MC"+i, 1000+i);
_root["MC"+i]._x=_root.car._x;
_root["MC"+i]._y=_root.car._y;
_root["MC"+i]._rotation = _root.car._rotation;
_root.i += 1;
}
the mc movieclip is a dirt track that should be made by the car when it drives up, this is what i have for the car.
onClipEvent(enterFrame){
_root.carSpeed = 7;
if(this._y > 0){
if(Key.isDown(Key.UP)){
_root.car._y -= _root.carSpeed;
_root.car._rotation = 0;
tracks(mc); //right here is where i want to call that function, but i dunno how >_<
}
}
}
i tried calling it with "tracks(mc)" but i never really used functions (i really want to start to use them tho), and i tried reading the NG AS tutorials, but i couldnt make much sense out of them.
seeing as how this is a simple problem, i figure someone out there must be able to help me call that function, or fix any errors in this script
thanks guys
- Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
Basically if the function is on the main timeline, you need to call _root.tracks()
The parameter you're sending/recieving (mc) doesn't actually appear to be necessary, as it's not referenced in the function (unless as _root.mc, which would probably need to be _root[mc] instead
Hopefully that makes some kind of sense
- KLoWnXXX
-
KLoWnXXX
- Member since: Feb. 12, 2005
- Offline.
-
- Forum Stats
- Member
- Level 16
- Blank Slate
thanks for that, but now something else about it isnt working.
its probably the fact that its on a "enterFrame" thing, but the track mc just sits under my car and follows it wherever. However if i make a button that calls track whenever i click it, it creates the track under my car and the track just sits there, which is what i want.
any help?
- KLoWnXXX
-
KLoWnXXX
- Member since: Feb. 12, 2005
- Offline.
-
- Forum Stats
- Member
- Level 16
- Blank Slate
wow nevermind i forgot to declare i as 1.. my bad.
where'd i leave that key.


