Clars <[EMAIL PROTECTED]> wrote

> I'm trying to create a shape on the fly from a behavior, and slap it on
> stage. The first part works fine - the member is created and the puts
> come out the same whether "popup1" is in the cast or not- but then:
> 
> We enter the twilight zone.
> 
> Two things don't work:
> 1.
> The sprite never shows on stage.
> 2.
> The new cast member shows up in the cast, but cannot be dragged from the
> cast after the movie is stopped.

Confirmed here, and it should always be remembered that shape members
are strange beasts. John Dowdell talks about first class and second
class citizens in Director. 

Shape members are neither of these, they are anachronistic, but still
essential 'foot soldiers', and certainly see a lot of service in even
the most modern Director movies.

I was able to get your script working by setting two extra member
properties, rect and pattern.

new #shape members have a pattern of 0, which seems to mean 'invisible',
and of course there is really no such pattern because patterns are
indexed from 1. If you want a solid fill, you need to use 1, and of
course there are 64 patterns to choose from.

Why not setting the rect of the member fails even though you set the
rect of the sprite (using width and height or just rect) I don't know.

You should also use 'forecolor' instead of 'color', which means using a
palette index, not an rgb color.

Anyway, here's a working version...

on mouseDown me
  createShape(me, "popup1", #rect, TRUE)
end

on createShape me, aName, asType, aFilled
  if member(aName).name = "" then
    mem = new(#shape)
    mem.name = aName
    mem.shapeType = asType
    mem.filled = aFilled
    mem.rect = rect(0,0,50,50)
    mem.pattern = 1
  else
    mem = member(aName)
  end if
  
  puppetSprite (20), TRUE
  sprite(20).member = mem
  sprite(20).loc = point(10, 10)
  sprite(20).forecolor = 185 -- mac palette index for rgb (0, 255, 0)
  sprite(20).width = 50
  sprite(20).height = 50
  updateStage
  
end 

on endsprite me
   puppetSprite (20), FALSE
end
-- 
_____________

Brennan Young

Artist, Composer and Multimedia programmer

mailto:[EMAIL PROTECTED]

If you're not part of the solution, you're part of the precipitate.
-Steven Wright


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to