At 02:56 -0800 02/07/2002, nitin sharma wrote:
>i want to give more text option to user
>like ;
>spose he(user) click on text button he would get one
>text field.and he can make changes in that field, but
>if he again click on that button (text button)
>he should get another text field and more and more
>field after clicking the button.
Aha, yes, you want to create text sprites on the fly. That's
relatively straightforward. Here's one way of doing it off the top of
my head. Attach this behavior to a "text" button in your paint
program.
What this does is first determine if there is an open (unused)
channel in your paint program. If there is one, this behavior then
creates a basic #text member on the fly, and then drops it into a
sprite channel.
on mouseUp me
nOpenSprite = me.TestForOpenChannel()
if nOpenSprite = 0 then
ALERT "You can't add any more text to this image."
exit
else
me.CreateTextSprite( nOpenSprite )
end if
END mouseUp
on TestForOpenChannel me
nLast = the lastChannel
repeat with nOpenSprite = 1 to the lastChannel
if sprite(nOpenSprite).member = 0 then
return nOpenSprite
end if
end repeat
return 0
END TestForOpenChannel
on CreateTextSprite me, nOpenSprite
mNewText = new ( #text )
mNewText.editable = TRUE
puppetSprite nOpenSprite, TRUE
sprite(nOpenSprite).member = mNewText
sprite(nOpenSprite).ink = 36 -- bkgnd transparent
-- At this point you'd instantiate behaviors and add them.
-- For instance if you had a behavior called 'textBehavior'
-- that you wnated to add to your text sprites,
-- you would do the following:
-- oTextBeh = new ( stript "textBehavior" )
-- sprite(nOpenSprite).scriptList = [ oTextBeh ]
END CreateTextSprite
Hope the above helped. The basic breakdown for the process is this:
1. Determine if there are any open channels to put in a #text sprite.
2. If so, create the #text sprite member in the cast.
3. Then create a sprite instance for the #text member, thus making it a sprite.
4. Finally attach any code to the sprite that you need.
--
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!]