A simple way to create a marquise that displays a different
message every time the mouse rolls over a sprite
-- rolling over the dot will change the contents of the field
on mouseWithin me
member("storefront").text = "Red"
end
The problem with this is that you may need to have to
put the code with the special name in EVERY sprite
that affects the marquise. Wouldn't it be better
if we could
accomplish this with just one script?
Let's say that the cast members are named correctly (e.g. "Red")
When you are on top of the sprite that represents the
red dot cast member, you can access the name of that
sprite by the expression member(the
mouseCast).name
So
your script could be common for all the dots:
on mouseWithin me
member("storefront").text = member(the mouseCast).name
end
You can take this one step further by defining a
function called marquise:
on marquise
member("storefront").text = mouseMember().name
end
Note that we used a synonym of the command above. Any
time you want to use the marquise, you can just call
it:
on mouseWithin me
marquise
end
Where do you put the definition of marquise?
It has to be in a place visible from all
the sprites. Remember
the hierarchy? It needs to be
in a higher
level in the hierarchy. The easiest way would be to put
it in a separate MOVIE script.
|