Professional Web Applications Themes

Determining if CastMember exists? - Macromedia Director Lingo

the problem with this syntax memberSearch = member("RDR").number if there is no such member it will pop-up a script error. I am pretty sure that Glen wouldn't want the user to see a script error to pop up. Which I think they are very anoying myself. if you are allowing the user to type in a search you might be able to do something like this which you would place this behaviour on your search button sprite... on mouseUp if member("your text box member name").text <> EMPTY then results = checkSearchResults() sprite(x).member = member(results) -- where "x" is the spriteNum ...

  1. #1

    Default Re: Determining if CastMember exists?

    the problem with this syntax
    memberSearch = member("RDR").number

    if there is no such member it will pop-up a script error. I am pretty sure that Glen wouldn't want the user to see a script error to pop up. Which I think they are very anoying myself.

    if you are allowing the user to type in a search you might be able to do something like this which you would place this behaviour on your search button sprite...

    on mouseUp
    if member("your text box member name").text <> EMPTY then
    results = checkSearchResults()
    sprite(x).member = member(results) -- where "x" is the spriteNum of your displaying result image
    else
    alert "You must type something in before clicking on the search button"
    end if
    end mouseUp

    on checkSearchResults
    repeat with i = 1 to the number of members of castLib(1)
    if member("your text box member name").text = member(i).text then
    return i
    end if
    end repeat

    -- if the repeat loop didn't find any results then return the number of the "NOPIC" member
    return member("NOPIC").number
    end checkSearchResults



    Roofy webforumsuser@macromedia.com Guest

  2. #2

    Default Re: Determining if CastMember exists?

    On 29 Aug 2003, "SafariTECH" <contactsafaritech.com> wrote:
    > In CF, I can code a page to show a default image if a specified image
    > is not actually found on the server (i.e. ImageNotFound.gif if
    > PROD2234.gif is not found)
    >
    > I am trying to figure out a similar task for a Director projector.
    If this member is imported as Standard in a castLib...

    if member("PROD2234.gif").type = #empty then
    sprite(x).member = member("ImageNotFound.gif")
    end if

    There may be issues if this is running in Shockwave Plugin mode and the
    relavent castLib hasn't downloaded yet.

    On the other hand, if it is linked to an external image, you would need to
    determine whether the file exists where you expect.

    If this is a non-web server, then BuddyAPI, FileXtra, DirectOS, and Lingo's
    own getNthFileNameInFolder() can do it.

    If the file is on a web-based server, then I'm pretty sure the topic of
    getting a list of files from the server has come up before. I would have to
    google the newsgroup to find the suggestions.



    --
    Mark A. Boyd
    Keep-On-Learnin' :)
    Mark A. Boyd Guest

Similar Threads

  1. making a castmember move x,y
    By ShaolinWood webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 5
    Last Post: December 7th, 11:10 AM
  2. method name exists, property value exists, calling method fails
    By Phil Powell in forum PHP Development
    Replies: 0
    Last Post: October 27th, 07:34 PM
  3. castmember number problem
    By JPrice in forum Macromedia Director Lingo
    Replies: 0
    Last Post: September 25th, 12:02 PM
  4. Flash castmember won't leave!
    By JemJam webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 2
    Last Post: August 3rd, 10:20 PM
  5. exporting .wav files from .mp3 castmember
    By Dario Volaric in forum Macromedia Director Basics
    Replies: 0
    Last Post: July 22nd, 10:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139