Professional Web Applications Themes

Triggering a backdrop on a 3D object with button/lingo - Macromedia Director 3D

Hi, I'm trying to learn the 'why' as much as the 'how'. I have a 3D castmember "3dobject" and a bitmap castmember "background". I've discovered that the following lingo makes the "background" image appear behind the "3dobject". bkgdImage = member("background").image bkgdTexture = member("3dobject").newtexture("bkgdTexture",#fromI mageObject, bkgdImage) member("3dobject").camera(1).addBackdrop(bkgdTextu re, point(0,0),0) member("3dobject").camera(1).removeBackdrop(1) --makes the backdrop go away Ok. So I was wondering if I could create a button on the stage that basically turns that backdrop on and off. I've attempted the following (please don't laugh). member("showBackground") is the button castmember. I want the text of the button to toggle from "show background" ...

  1. #1

    Default Triggering a backdrop on a 3D object with button/lingo

    Hi, I'm trying to learn the 'why' as much as the 'how'.

    I have a 3D castmember "3dobject" and a bitmap castmember "background". I've
    discovered that the following lingo makes the "background" image appear behind
    the "3dobject".

    bkgdImage = member("background").image
    bkgdTexture = member("3dobject").newtexture("bkgdTexture",#fromI mageObject,
    bkgdImage)
    member("3dobject").camera(1).addBackdrop(bkgdTextu re, point(0,0),0)

    member("3dobject").camera(1).removeBackdrop(1)
    --makes the backdrop go away

    Ok. So I was wondering if I could create a button on the stage that basically
    turns that backdrop on and off. I've attempted the following (please don't
    laugh). member("showBackground") is the button castmember. I want the text of
    the button to toggle from "show background" to "hide background" based on
    whether or not the backdrop is already showing. This is the "showBackground"
    cast member script:

    global bkgdImage, bkgdTexture, isShow

    on loadBackdrop
    bkgdImage = member("background").image
    bkgdTexture = member("3dobject").newtexture("bkgdTexture",#fromI mageObject,
    bkgdImage)
    member("3dobject").camera(1).addBackdrop(bkgdTextu re, point(0,0),0)
    end loadBackdrop

    on mouseUp
    if isShow then
    isShow = 0
    member("showBackground").text = "Show Background"
    loadBackdrop()
    else
    isShow = 1
    member("showBackground").text = "Hide Background"
    member("3dobject").camera(1).removeBackdrop(1)
    end if
    end

    It kinda works. I do get the 'error: object with duplicate name already
    exists' when I try to click on the button several times. So I realize I must
    need to clear something out because it's recreating that bkgdImage/bkgdTexture
    stuff. And unfortunately I have to click "Show Background" twice to get the
    backdrop to appear.

    Perhaps I'm approaching this scenario all wrong.
    I do appreciate your help. Hopefully I'll get this lingo stuff eventually. :>
    Thanks so much.

    Briannimator Guest

  2. #2

    Default Re: Triggering a backdrop on a 3D object withbutton/lingo

    Hi brian i seem 2 b having the same problem if u get your code to work ?let me know cheers
    thunderkatz Guest

  3. #3

    Default Re: Triggering a backdrop on a 3D object withbutton/lingo

    You need to check if the "bkgndTexture" already exists: you cannot create two
    textures with the same name.

    You can find a demo at:

    [url]http://nonlinear.openspark.com/alpha/Backdrop.dcr[/url]

    Source at:

    Mac: [url]http://nonlinear.openspark.com/alpha/Backdrop.sit[/url]
    Win: [url]http://nonlinear.openspark.com/alpha/Backdrop.zip[/url]



    openspark Guest

  4. #4

    Default Re: Triggering a backdrop on a 3D object withbutton/lingo

    nice 1 dudeI will check it out now
    thunderkatz Guest

  5. #5

    Default Re: Triggering a backdrop on a 3D object withbutton/lingo

    create the texture once, with the button you must add and remove the overlay
    ensamblador Guest

Similar Threads

  1. 3D object oriented lingo
    By bgsBS in forum Macromedia Director 3D
    Replies: 1
    Last Post: July 25th, 11:46 AM
  2. adding lingo to a flash button
    By 2ndrnd webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: January 29th, 12:42 AM
  3. Customizing Lingo for a Back Button
    By ScottE in forum Macromedia Director Lingo
    Replies: 4
    Last Post: October 23rd, 03:18 PM
  4. Custom Lingo For Return Button
    By ScottE in forum Macromedia Director Lingo
    Replies: 3
    Last Post: October 10th, 08:10 AM
  5. Lingo vs. Object Oriented language
    By Herman Hodbsi in forum Macromedia Director Basics
    Replies: 0
    Last Post: October 4th, 03:42 PM

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