This content has been marked as final. Show 3 replies
" and I think this will be a more efficient use of lingo. "
No, it will not be a more efficient use of Lingo, but you can indeed attach
scripts to cast members. Simply right-click (if using Windows) on the cast
member in the cast window and select the Cast Member Script option from the
"Shadowhawkserenity" <firstname.lastname@example.org> wrote in message
> I'm fairly new to Lingo and trying to put a script onto a cast member that
> will cause the cast member to switch to a different one. I know how to do
> with a sprite script, but I'm hoping to do it with a cast member script
> I'm creating a game in which the user pops balloons by clicking on them.
> want to attach the script to the cast member instead of the sprite because
> cast member will behave the same way every time and I think this will be a
> efficient use of lingo. Unfortunately I'm not getting it right and I'm
> sure if it can be done. Here is the sprite script that worked:
> on mouseDown
> set the memberNum of sprite 1 to 2
> Cast member 1 is an image of a balloon
> Cast member 2 is an image of a number 1 (the score increment the user
> gains by
> popping the balloon)
> the idea is that the score image remains on screen for a brief time (a
> or less) and then the user is returned to the game play to click another
> So...all that to ask a simple question: Is there a way to attach that
> to the cast member instead of the script?
> Shadowhawk's serenity
As Dave mentioned, no, this is not more efficient. You don't explain a
lot about your design, but, here are a few of the reasons why writing
modular code and attaching it to sprites is a better, and ultimately,
If you write code directly to a cast member, then that code will only
work for that member. So, if you have one red balloon member, for
instance, and you want to write code that will control that member's
sprite, you will have unique code for that member. If you want a second
red balloon, then you have to repeat the whole process: make a second
member and write unique code for it. You will have to repeat this
process for every balloon in the movie.
Now you have to place the instances of each of these members on the
stage. If you get any of them in the wrong sprite channel, the code
won't work correctly.
With this method, you will need to make 10 unique cast members to have
10 sprites on the stage. Most of a Director movie's file size is based
on the bitmap members' size. So, more members, bigger file.
If you use standard Director authoring methods, you can create one
balloon member, place as many instances on the stage as you need and
then attach a single behavior to each sprite instance. Each sprite will
know its own channel number, so that won't need to be assigned. You can
color each of the sprites using Lingo, so you only need one original
Adobe Community Expert
Thank you, Rob!! That changes everything. I didn't know I could color the balloons using lingo! *scrambles for her manuals* I kind of figured there was a reason it wasn't easy to put that code on the cast member but I tend to do things the hard way so...
Dave, thank you for taking some time to answer my question. I know how to access the script for a cast member, I was talking about the syntax of the code itself though.
*heads back to the drawing board*
Thanks again, gentlemen!