I suggesting a different approach altogether. Rather than creating text members on the fly, have a set of "pre-made" text members (ones that you make at author time), which you place on stage. At author time, you attach a single behavior to each of these text members.

Then, at run time, you give these text members their values on the fly. That is, you put new text into the existing text members. You can also send the behavior a name of a sound to play when clicked on using sendSprite.

Does this make sense for your application?

What is the maximum number of text items that there will be on screen at any time?

Irv

At 10:20 AM +1000 1/24/03, universal2001 wrote:
Thank you Irv!

yes, certainly that would be very useful.

At the moment I'm trying to make a list of vocabulary with the translation
next to it, then when the user click on a perticular word, the sound
tiggered (how to pronounce the word).

Because I have got about 50 words each list, tried to make textmember on the
fly and then fill them with words that I retrive from a PropertyList.

Now, my next step problem is how to attach a behaviour on each text member
that I created on the fly so that when the suer click on the sprite it will
trigger the sound to play.

Thanks !

Uni
----- Original Message -----
From: "Irv Kalb" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 24, 2003 9:55 AM
Subject: Re: <lingo-l> Create TxtMember ON THE FLY - adding
mouseUp -CONTINUE


 I'm sorry I haven't followed this thread, but I'll make a guess as
 what you are trying to do and give you an alternative approach it.
 This sounds like a program where you pose a question and have a
 limited number of answers, and ask the user to click on the proper
 answer.  If this is the type of program then...

 Rather than creating a new Text member on the fly for all possible
 answers to all questions, create n Text members where n is the most
 that you will ever have on the screen at one time.  For example lets
 assume that you had a question and 4 potential answers.  In this
 case, you can create a Text member called Question, and four answer
 members called Answer1, Answer2, Answer3, and Answer4.  You drag
 these onto the stage and position them appropriately.

 Now, when you are ready to pose a question, you get the question and
 answer text, and you have a routine that puts the text into these
 members for display:

 on PoseQuestion sQuestionText, sAnswer1, sAnswer2, sAnswer3, sAnswer4
 -- "s" for string
    member("Question").text = sQuestionText
    member("Answer1").text = sAnswer1
    member("Answer2").text = sAnswer2
 >    member("Answer3").text = sAnswer3
 >    member("Answer4").text = sAnswer4
 > end
 >
 > Then you need some variable that remembers the correct answer (i.e.,
 > 1, 2, 3, or 4)
 >
 > Each of the Answer sprites would have a simple behavior that either
 checks against the right answer, or calls some handler that checks
 against the right answer.   You could just use the last character of
 the name to determine the "value of the response:

 property pValue
 property spriteNum

 on beginSprite me
    sName = sprite(spriteNum).member.name
    theValue = value(the last char of sName)
 end

 on mouseUp me
    SomeHandlerThatWillCheckForCorrectness(pValue)
 end

 Hope this helps,

 Irv


 At 8:05 AM +1000 1/24/03, universal2001 wrote:
 >Hello again!
 >
 >now, I have a further question.
 >
 >If I created my text fields on the fly, and then put it on the stage, and
 >then how do I insert the MouseUp script into each of the text field on
the
 >stage - ON THE FLY?
 >
 >The reason I asked is because I want to make each text field on the stage
 >that I have created on the fly responses to user mouse click so that
users
 >can play the sound when users click on the text field.
 >
 >I hope this explaination is clear enough to understand - excuse my messy
 > >English.
 >
 >Thanks!
 >
 >Uni
 >
 >
 >[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!]


 --

 Lingo / Director / Shockwave development for all occasions.

    (Home-made Lingo cooked up fresh every day just for you.)
 [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!]


[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!]

--

Lingo / Director / Shockwave development for all occasions. (Home-made Lingo cooked up fresh every day just for you.)
[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!]

Reply via email to