Warren
Thank you for this detailed response. However, when I entered your handler I
got an error message:

"Script Error. Wrong type
mTextMember=new(#text,"Internal")

"Internal"

Could you suggest why this is so?
I'm using the internal cast.
John

----- Original Message -----
From: "Howdy-Tzi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 04, 2002 9:14 PM
Subject: Re: <lingo-l> New learner: how do write a handler that inserts text
memebers in the cast?


> On Wednesday, December 4, 2002, at 02:35 PM, John Lodge wrote:
>
> > Yesterday, for example, I wanted to write a handler which would insert
> > text
> > into the first five members of the cast. Could I do it? Not a chance!
>
> This can probably be most easily accomplished with a repeat loop,
> something that uses a counter to perform a repetitive task a given
> number of times. In your case it may be something like:
>
>    on InsertMembers
>      repeat with nMem = 1 to 5
>        mTextMember = new ( #text, "Internal" )
>        mTextMember.text = "This is member number" && nMem.string()
>      end repeat
>    END InsertMembers
>
> As you can see it begins with a 'repeat' declaration, stating in
> essence that Director is to begin with 1 and proceed through 5
> (inclusive), plugging those number values -- as it goes along -- into
> the variable 'nMem'. That's the counter.
>
> Inside the repeat loop itself, we start by calling #text members into
> existence in the 'Internal' cast library. (You can specify other casts;
> for instance if you had a movie with an additional cast called "text",
> you could specify that as your creation target.) We make the #text
> member a reality simply by using the new() keyword, passing in to
> Director's internal command set the type (#text) and target cast
> location ("Internal"). While this isn't really necessary if you have
> only one cast, it is a good habit to have.
>
> On the next line we put a little text into each member as it's created.
> As you may infer, the #text member contains a phrase that identifies
> itself as the one made within a particular iteration of the loop. You
> could also plug values into the members' names as you make them
> instead, reserving the 'text' call for something else (such as parts of
> a text file on disk or some such).
>
> We use the 'string()' specifier to make sure Director understands that
> it is to interpret the 'nMem' item as text rather than a number. That's
> not strictly necessary either, since it's being concatenated with a
> string by the '&&', and Director is bright enough to realize that you
> want the value in the 'nMem' variable to be treated as text instead of
> an integer in that case, but it's a good habit to be in.
>
> To get the above going you'd enter it in a movie script, close the
> script window and then call the function from the message window:
>
>    -- Welcome to Director --
>    InsertMembers
>
> That's the basic idea. As a somewhat shameless plug, I've got a
> beginner's guide out. Might be worth a gander. ;)
>
>
>               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://shop.osborne.com/cgi-bin/osborne/0072195622.html
>
> [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!]

Reply via email to