At 02:30 -0800 03/12/2002, nitin sharma wrote:
>can anybody tell me how i can put cast member to stage
>by scripting. (but don't replace any sprite)
I do it all the time with a monster mammoth piece of code that likely
will eventually swallow my brain. You've seen another suggestion, and
making things visible/not visible is another option, but if you're
talking about having *nothing* in the channel initially, you'd create
the sprite on the fly.
I puppet the sprite first, then set its member and type, then the
scriptInstanceList (if I want behaviors) and finally its loc.
Let's assume your circle is sprite 1. You can attach a behavior like
this to it:
on mouseUp me
puppetSprite 2, TRUE
sprite(2).member = "box"
sprite(2).loc = point ( 100, 100 ) -- or wherever you want
sprite(2).ink = 36 -- bg transparent
oCode = new ( script "boxBehavior" )
sprite(2).scriptInstanceList = [ oCode ]
END mouseUp
The oCode reference is to anoter behavior you have resident in your
Cast, named "boxBehavior". It can go something like this:
on mouseUp me
sprite(me.spriteNum).member = 0
sprite(me.spriteNum).scriptInstanceList = []
END mouseUp
...in *theory* this will make the box go away again when it is
clicked. This is off the top of my head though so I'd recommend you
toy with it a little and use it with some caution. With some
modification you can test for empty channels and make assignments
based on that, perhapos randomly setting the loc and color for the
boxes, allowing a large variety of sprites to appear without any of
them actually being coded into your score.
--
Warren Ockrassa | http://www.nightwares.com/
Director help | Free files | Sample chapters | Freelance | Consulting
Author | Director 8.5 Shockwave Studio: A Beginner's Guide
Published by Osborne/McGraw-Hill
http://www.osborne.com/indexes/beginners_guides.shtml
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]