> I need to create a set of new sprites at run-time and then put them on the
> stage. What I want to do is read a list of songs from a database and then
> create buttons on thy fly based on the content of that.
> -carlos
Hi Carlos,
(in Movie script):
on putOnTheStage myMember, location
pSprite = sprite(firstEmpty())
pSprite.puppet = TRUE
pSprite.member = myMember
pSprite.loc = location
return pSprite
end
on firstEmpty
-- searching first empty sprite channel in Score
repeat with i=1 to (the lastChannel)
if sprite(i).member = member(0) then return i
end repeat
-- If there is no empty channel show alert
alert "There is no empty channel!"
end
for example if you have a member "myPicture", you can put it on the Stage by:
1. starting movie CTRL+ALT+P :-)
2. writing in Message Window: putOnTheStage (member("myPicture"), point(10,10))
you can call 'putOnTheStage()' in other hanlers (f.e. mouseUp, prepareFrame,...)
To attach some behavior to new sprite:
s = putOnTheStage (member("myPicture"),point(10,10))
someBehavior = script("myBehaviorName").new()
s.scriptInstanceList.add(someBehavior)
Szymon Drejewcz
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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!]