Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing sprites 1

Status
Not open for further replies.

xird

Technical User
Nov 15, 2006
15
DE
Hi, Is it possible to automatically replace an existing text sprite with another one of the same name, so the original is deleted and the new one takes its place and behaves as the original?

please advise.
 
You can't replace a Sprite Member with another Member with the same name, because Director cannot tell which is which as both Members have the same name.

However you can replace it with a Member with the same name but resides in the different Cast. Say you have a Text Member "Text 1" in Sprite 1:

[tt]sprite(1).member = member("Text 1", "Cast 2")[/tt]

This will replace the "Text 1" (in the main Cast) with "Text 1" (in the "Cast 2").

But I have a feeling you just want to replace the text. If so, you can replace it with another Text Member with a different name:

[tt]sprite(1).member = member("Text 2")[/tt]

Or you can just change the text of the existing Member:

[tt]sprite(1).member.text = "Some other text"[/tt]

Kenneth Kawamoto
 
Thank you Kenneth, at least I know it is possible to change text locally. But is their any examples of this anywhere ?

The overall objective is to change text in sprites but remotely. I am not sure if this can be done remotley. ie if a server is running director and a remote user want to change sprite text?

regards


xird
 
no, sorry for the confusion.

I have a basic quiz, with questions and mulitple choice answers.

I want integrate an easy to use interface which would allow administrators to change questions and answers. My initial concept was that the administrator creates a .txt file, which could be uploaded or on a local machine, to a running director which would automatically import the .txt files, change the text in the questions and answers sprites, and finally publish a new quiz application with the edited questions and answers.


To begin with, I just want to find out if its possible just to change text in a sprite this way.



 
Yes a common practice is to create a Director movie which reads external text file (usually XML) so that you can update the contents of the movie without editing and recompiling the movie.

Kenneth Kawamoto
 
could you point me in the direction of a tutorial or primer for this technique?
 
Thanks for the link to fileIO Xtra,I now understand the principles behind reading and writing to a .txt file. The examples given, read contents of a .txt file and append these contents to a "field cast member" (text field) , BUT i want change the actual text of sprite. How do i reference the .txt file in the fileIO handler to include this command , where "Some other text" is the content of the .txt file.

sprite(1).member.text = "Some other text"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top