9 Replies Latest reply on May 7, 2006 8:39 PM by Newsgroup_User

    Looping

    mcafe
      hi,

      got some problem need you guy to help, hope you all can help me.

      1) how can i control the info from text file and assign to text(member)??

      e.g.

      text1.txt
      Movie1
      Movie2
      Movie3
      Movie4

      2) how can i assign the link to text member after i load the info from text file??

      3) When i playing some movie or clip how can i disable the mouse pointer??

      very sorry first for the problem, this quite urgent and i can't think any solution for it.

      sorry again i still newbie in director. hope someone can help me.

      thank you very much
        • 1. Re: Looping
          Level 7
          Hi Mcafe,

          First, to get text from an external file, you can use teh FileIO Xrea. Here's
          info on how to use it:
          http://www.fbe.unsw.edu.au/learning/director/Lingo/FileIO.asp
          The above explains how to load the text file and insert it into a text member.

          If you wnat to change the cursor at a certain frame, you can use:
          on exitFrame
          cursor 200
          end

          200 represents a blank cursor.

          Here's all the cursors you can use via Lingo:
          http://www.fbe.unsw.edu.au/learning/director/resources/FAQ/lingo.asp#4

          regards
          Dean

          Director Lecturer / Consultant
          http://www.fbe.unsw.edu.au/learning/director
          http://www.multimediacreative.com.au

          • 2. Re: Looping
            mcafe Level 1
            Hi Dean,

            thank you for answer my third question.

            For loading the text file.. ya i done it.. but i need to assign to text member... and i don't know how many info at the text file.

            like e.g.
            in text1.txt got
            Movie1
            Movie2
            Movie3
            Movie4

            i need to assign the wording into the member.

            for the question 2.. after i assign can i assign the the text member as link to another fame??

            this my idea for that, but i don't know can it be done or not.

            in text1.txt

            Movie1;C:\Movie\Starting.mpeg
            Movie2;C:\Movie\Theme.mpeg
            Movie3;C:\Movie\Action.mpeg
            Movie4;C:\Movie\Ending.mpeg

            on the info on text1.txt i need to assign into text member and the text member link to 'PlayMovie' fame and i need to change the path on the 'PlayMovie' movie clip as the link i click

            sorry for my poor english, hope you can understand.

            thank you again for you time and sorry for my noob problem
            • 3. Re: Looping
              Level 7
              Hi again,

              Another way you can insert your text into Director is through 'importFileInto'. For
              example:
              importFileInto member("TextCastMember"), the moviepath&"text1.txt"

              The above will import the text member and create a text cast member with taht text.
              Ths text cast member will now be named "text1"

              To extract say 'movie1' from your text and jump to that line, you can do the
              following:
              fullText = member("text1").text
              movieLink1 = fullText.line[1]
              go to movie movieLink1

              In the above, I used variables to store the data - fullText is the whole text
              member, movieLink1 is line 1 of that text. f you had say quotes separeting each
              item in your text, you could use 'the itemDelimiter'
              the itemDelimiter = QUOTE
              movieLink1 = fullText.item[1]

              If you use the above, you can have your text as:
              "movie1"movie2"movie3"
              instead of having it on different lines.

              I hope that answers your question. Let me know if i've missed anything.

              regards
              Dean

              Director Lecturer / Consultant
              http://www.fbe.unsw.edu.au/learning/director
              http://www.multimediacreative.com.au

              • 4. Re: Looping
                mcafe Level 1
                Hi Dean,

                sorry to disturb you. i tester with you coding but i can't catch your idea yet. Hope you can explain more details, sorry i very noob here, use director for 2~3month only less doing project using director.

                quote:

                importFileInto member("TextCastMember"), the moviepath&"text1.txt"

                as you saying this code will auto create text member??? i fail to auto create, as i understand you need to create a text member and allow it to assign into it.

                but the text membe[name] will change after 'importFileInto'...so is it need to change member("TextCastMember") to member("Text1") for give any problem

                quote:

                fullText = member("text1").text
                movieLink1 = fullText.line[1]
                go to movie movieLink1


                how can i know the total amount on fulltext.line[1], because if i assign from text file i don't to control it i need to using loop to know how many of them for easy doing the work.

                and in macromedia got any function to split the variable.

                e.g.

                abc = "a123;b456"

                i need to split it from to variable if can, so i can catch the value from the whole string.

                quote:

                the itemDelimiter = QUOTE
                movieLink1 = fullText.item[1]


                for this i not so understand.

                very sorry for the problem and sorry for wasting your time.... hope can learn more from you
                and thank you for the problem
                • 5. Re: Looping
                  Level 7
                  Hi mcafe,

                  Here's more info.

                  importFileInto member("TextCastMember"), the moviepath&"text1.txt"
                  This will import the external text file called 'text1.txt' and will insert it into a
                  text cast member called "TextCastMember". One that happens, the cast member will now
                  be named 'text1'. So, what's really happening is that the internal text member is
                  getting replaced with the external text file.

                  The above assumed that the 'text1.txt' file is in the same folder as the movie
                  that's calling it. The part 'the moviepath' defines the current path location
                  location of teh dDirector movie, then the '&' adds to that. So, you can put the
                  'textfile1.txt' into a subfolder called 'text' by using:
                  the moviepath&"\text\text1.txt"

                  Now, let's say your text file simply contains the following text:
                  movie1
                  movie2
                  movie3

                  In Director you could use:
                  1. importFileInto member("TextCastMember"), the moviepath&"text1.txt"
                  2. fullText = member("text1").text
                  3. movieLink1 = fullText.line[1]
                  4. go to movie movieLink1

                  Line 1 you import the text as explained.
                  Line 2 inserts all the text of this imported file into a variable called 'fullText'.
                  Line 3 grabs line 1 of that text and inserts it into a variable called 'movieLink1'
                  Line 4 tell Director to jump to the movie with the name of the variable from line 3.

                  So, what the 4 steps have done is identify the first line of text as the movie name
                  you want to link to.

                  Question 1. Are you clear up to this point?

                  Now, if your text file is more complex than just a single word on each line. Say it
                  was
                  movie1,sound1,
                  movie2,sound2,

                  You can use 'the itemDelimiter' to separate items in a single line. 'the
                  itemDelimiter' lets you define a character that identifies where the separation
                  occurs. So, if we want to separate 'movie1,sound1,' into 2 parts we can do the
                  following:

                  1. line1 = fullText.line[1]
                  2. the itemDelimiter = ","
                  3. movieLink1 = line1.item[1]
                  4. soundLink1 = line1.item[2]

                  Line 1 gets the full line of text from the text member and inserts in into a
                  variable called 'line1'.
                  Line 2 sets a comma ',' as the separation character.
                  Line 3 finds the 'movie1' part from the line as it is item 1.
                  Line 4 finds the 'sound1' part from the line as it is item 2.

                  Question 2: Do you understand what I've explained in this second part?

                  Now, if you want to create a loop to go through all the lines of your text, you can
                  do something line:
                  repeat with i = 1 to the number of lines in fullText
                  -- write your instructions here
                  end repeat

                  I won't go through all this now as it may be too much for one email. Here's one last
                  question for now.

                  Question 3: Do you want to create a loop like what I did above and do you understand
                  the concept of 'repeat with'?

                  Answer my 3 questions so I can better understand what is clear and what isn't being
                  understood.

                  regards
                  Dean

                  Director Lecturer / Consultant
                  http://www.fbe.unsw.edu.au/learning/director
                  http://www.multimediacreative.com.au

                  • 6. Looping
                    mcafe Level 1
                    Hi Dean,

                    sorry for late replay and thank you for your info. For the question 3, i found that way.. thank you very much.

                    below is my idea of the app, this the full story. Suppose the app. is playing one video clip, i make it flexible can change to different by paste from exist. But now the customer want to play few(not confirm how many), and my manager told me to do the flexible way to customer that easy edit and add new. Sorry first my manager don't know a macromedia or graphics how their run it and i still new in macromedia. That make me headache now, that way i calling help here to make it success. i hope this can settle ASAP, later need start database part... haiz

                    e.g. (sorry can't complete it, still finding the function)

                    importFileInto member("MovuePath"), the moviepath& "MoviePath.txt"
                    fullText = member("MoviePath").text

                    repeat with h = 1 to the number of lines in fullText
                    line1 = fulltext.line[k]
                    the itemDelimiter = ","
                    repeat with j = 1 to ????(suppose want to know the max item in line1, i can't find function)
                    if k= 1 then
                    member("MovieText1").text = line1.item[j]
                    _movie.member("MoviePlay1").filename = line1.item[j] 'here can't assign the path from line1.item[2]
                    MovieFrame1 = line1.item[j]
                    else if k= 2 then
                    member("MovieText2").text = line1.item[j]
                    _movie.member("MoviePlay2").filename = line1.item[j]
                    MovieFrame2 = line1.item[j]
                    else if k= 3 then
                    member("MovieText3").text = line1.item[j]
                    _movie.member("MoviePlay3").filename = line1.item[j]
                    MovieFrame3 = line1.item[j]
                    else if k= 4 then
                    member("MovieText4").text = line1.item[j]
                    _movie.member("MoviePlay4").filename = line1.item[j]
                    MovieFrame4 = line1.item[j]
                    end if
                    end repeat
                    end repeat

                    sorry Dean, can you give me some info how to use global variable?? i need assign the value in MovieFrame and when the end user click on the MovieText it will know which frame it go.

                    thank you again and sorry always disturb you
                    • 7. Re: Looping
                      Level 7
                      Hi mcafe,

                      I'm still not clear about what exactly you're doing but here's some advice based on
                      what i understand. It sounds like you're adding an external text file to give the
                      client control on adding or changing content. While this may make the application
                      flexible, it also does involve extra complexities of the coding and ensuring it
                      works the way you want. So, since this is your first attempt, at some point, you
                      should limit the 'flexibility' factor. The more involved your script, the more
                      chance you can create a bug, especially since you're a beginner with this program.
                      So, make your boss aware of these things.

                      Anyway, here's some more info. As I said, I couldn't really understand your last
                      email fully.

                      OK, so, you have imported the text and assigned it to a variable.
                      fullText = member("testName").text
                      line1 = fullText.line[1]

                      Total number of lines in fullText can be represented as
                      the number of lines in fullText
                      or
                      fullText.line.count

                      You seem to understand 'the itemDelimiter'.
                      The total number of items in a line can be represented as
                      line1.item.count

                      Now, if you're keeping track of multiple items, the best thing to use is lists. I
                      have info on lists at:
                      http://www.fbe.unsw.edu.au/learning/director/Lingo/lists.asp

                      Look at my tutorial on user tracking with lists.
                      http://www.fbe.unsw.edu.au/learning/director/Lingo/usertracking.asp
                      The above tutorial saves the each place you visit into a list and then enables you
                      to go to a specific previously visited page. This concept may come in handy with
                      what you're doing.

                      I won't say too much more for now. I hope i've given you some helpful info and
                      answered what you 're after. However, as I said before, since I did not follow your
                      email and so do not know what info you're grabbing from the text file and how it
                      will be used, i can't say much more at this time.

                      regards
                      Dean

                      Director Lecturer / Consultant
                      http://www.fbe.unsw.edu.au/learning/director
                      http://www.multimediacreative.com.au


                      • 8. Looping
                        mcafe Level 1
                        Hi Dean,

                        sorry for my poor english, where should i start from... erm...

                        this app i done for last month, all info is load from text file and some particular info i fixed it can't be change until their call us to add or edit particular info that their can't edit. From pervious application inside got one video that represent their company profit however i heard their change to new video clip but their highest management complain the pervious video clip is good and the new is the updated profit. So their desire wanted to play both of the video clip. Then my manager ask me to do the flexible part for changing the video clip. This the story, my plan now is to load the info from the text file and list out in the screen so their can click on the info that show in the screen.

                        But my problem is how do i assign, or split the value according to the text file. First that i know, sure this got bug. But i told my manager that marcomedia not like other programming language, but he told me sure got solution to do this. Until today i haven told my manager. I more in visual basic. Graphices i very less, just started 1~2month.

                        i hope that u understand the problem i facing now.

                        sorry Dean, always disturb you. I still got one more question need to ask you.

                        How do i change path filename? (you try import any *mpeg video) and then how do i change the path of the video clip that i import?

                        *thank you for your knowledge, it very good to learn from you

                        regards,
                        mc
                        • 9. Re: Looping
                          Level 7
                          mcafe wrote:

                          > How do i change path filename? (you try import any *mpeg video) and then how
                          > do i change the path of the video clip that i import?

                          Would you like to email me directly at d.utian@unsw.edu.au
                          That way, it may be easier for us to correspond and resolve this isue for you.

                          regards
                          Dean

                          Director Lecturer / Consultant
                          http://www.fbe.unsw.edu.au/learning/director
                          http://www.multimediacreative.com.au