PDA

View Full Version : object with duplicate name already exists


dsdsdsdsd
01-03-2005, 01:03 PM
hello;

I have
-- movie script ---------------------------------------------------
on preparemovie
it=member("3dworld")
it.resetworld()
end preparemovie
-----------------------------------------------------------------------
-- movie script ----------------------------------------------------
on startmovie
go to frame 1
end startmovie
---------------------------------------------------------------------
-- frame 1 behavior -----------------------------------------
on enterframe
make_model_resources
end enterframe
----------------------------------------------------------------
-- movie script ---------------------------------------------
on make_model_resources
atr = it.newmodelresource("atr",#sphere,#front)
atr.radius = 100
end make_model_resources
-------------------------------------------------------------------------------


when I run this I get the error: "object with duplicate name already exists"

any thoughts?

thanks
Shannon Burnett
Asheville NC USA

wowens
01-03-2005, 05:14 PM
dsdsdsdsd -- Is your Director movie looping back to frame one?

dsdsdsdsd
01-03-2005, 08:58 PM
hello wowens; thanks for responding;

no it does not loop back;

I did not mention that on frame 5 I have a "go to the frame";

thanks
dsdsdsdsd

Whit
01-04-2005, 11:18 AM
I'm not sure why you have "go to frame 1" in your "on startMovie" handler. The movie will go to frame 1 without any instruction. Is your movie going to frame 1 twice? If so, it would execute "make_model_resources" twice, giving the error.

Try commenting the whole "on startMovie" handler and see if that doesn't solve the problem.

--Whit

wowens
01-04-2005, 06:21 PM
Select "Insert > Media Element > Shockwave 3D" from the Director top menu. Place the new 3d member from the cast to the stage. Then attach this script:

on beginSprite me
sprite(me.spriteNum).member.resetWorld()

-- create the model resource
myModelResource = sprite(me.spriteNum).member.newModelResource("My Box Resource",#box)

-- create the model
myModel = sprite(me.spriteNum).member.newModel("My Box",myModelResource)

-- rotate to see it better
sprite(me.spriteNum).member.model("My Box").rotate(45,45,0)
end

This is from Gary Rosenzweig's book "Using Macromedia Director MX"

dsdsdsdsd
01-05-2005, 09:56 AM
Whit and Wowens, thanks for your responses;

Whit, I use the on "startmovie go to frame 1 ..." because I have found that if I do not then when I play a movie the movie will begin on the frame that it had been on the last time I stopped the movie;

Wowens, I have found a solution; I have removed the "on preparemovie" movie script and replaced it with an "on enterframe" frame behavior that I put in front of the other frame behaviors that I mentioned above;

thanks
Shannon Burnett
Asheville NC USA