Flasher Archive
[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]
Subject: | Re: [flasher] Movie organization question |
From: | Helen Triolo |
Date: | Thu, 08 Feb 2001 21:48:09 -0000 |
Werner Sharp wrote:
>
> I currently have 40 MCs (to contain
> the properties) with 40 buttons (the graphic) inside of them. Each button
> handles press and release and sends the event back to a function at the
> root level. This function, using the context of the MC, does all the
> work. Is this the best solution? Or can I put something else in the 40
> MCs (like another MC) that only has one instance in the library. Then in
> that MC, I can put the generic actionScript. I'm trying to avoid having 40
> copies of the actionScript around while still keeping a nice
> object-oriented framework in place.
Werner,
Your solution sounds like the best one to me for keeping code to a
minimum: keep a function in the main timeline (and any global vars you
might need) and call that from the mc's as needed. Eg, if you have 40
mc's that you want to move right by some amount that may be specified
elsewhere in the movie, then stick variable howmuch in the main timeline
and this code on the button in the mc:
on (release) {
_root.goright(this._name,_root.howmuch);
}
and this function in the main timeline:
function goright(whichmc, moveAmount) {
_root[whichmc]._x += int(moveAmount);
}
(Code works; I checked to make sure before posting this. Sounds like
you've already got working code, but thought I'd stick it in anyway)
Regards,
Helen
-----------------------------------------------------
i-Technica � http://i-technica.com � 301.424.6037
developer resources: http://i-technica.com/whitestuff
[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]