Ask a Question related to Macromedia Director Lingo, Design and Development.
-
Michele #1
Sprite "name"
Hi,
a question:
I can use label to identify a frame instead of number, therefore I can
change my score without problem...
I can use cast member name to identify cast member, therefore I can change
my member position without problem...
How can I have the same with sprite. All lingo seems to call sprite with
number, but if I move vertically my sprites, my lingo point to wrong sprite.
There are a "relative" way to call sprite, instead of number?
Thanks for help.
---
Michele
Michele Guest
-
CFINPUT type="radio" w/ "value" requires "label"
On a Flash form, when you specify type='radio' and value='whatever', the value of the 'value' attribute will be displayed as a label if no 'label'... -
set the member of sprite x to "quicktimefile"
I have a 400 x 300 pix image on the stage in sprite x, and a button with a script that changes the member of sprite x to a Quicktime VR file (also... -
some type of "after sprite plays" command?
I have a menu background .swf that slides in. After that shockwave is done playing, I need the buttons to appear. Is there any type of "after sprite... -
Using Lingo to "focus" an editable text sprite
Hi all. I'm using a few editable text sprites, and would like to make a behavior that detects when someone hits the return key, then make the next... -
"Start" "Program" "Menu" list is empty
For what ever reason my list of installed programs in my "Start" "Programs" menu is empty. Anyone know how to restore the list. Thanks for your... -
Loren Schwarz #2
Re: Sprite "name"
Hello, Michele,
Yes, you can. Just click above the frame number on the Director time line> I can use label to identify a frame instead of number
and enter a label for that frame. After you've done that, say you called a
frame "startFrame", you can go to that frame using
go to "startFrame"
You can find out the label of the currently shown frame at runtime using the
property "the frameLabel".
Yes, you can, and you should. For example:> I can use cast member name to identify cast member
member("mySampleMember").backColor = 0
That's a bit more difficult, you should use variables to store the sprite> How can I have the same with sprite.
number or a reference to the sprite you want to address: For example:
-- somewhere at the beginning of your code,
-- maybe use a global variable (using keyword "global")
theBitmapSprite = sprite(31)
-- then you can address the sprite using:
theBitmapSprite.visible = true
or
-- somewhere at the beginning of your code,
-- maybe use a global variable (using keyword "global")
theBitmapSpriteNum = 31
-- then you can address the sprite using:
sprite(theBitmapSpriteNum).visible = true
Another hint: Except for the last question, it would have been faster if you
just had tried things out yourself :-)
Nonetheless, good luck!
L.S.
Loren Schwarz Guest
-
Michele #3
Re: Sprite "name"
Thank you Loren,
but perhaps I'm not explained well, sorry.
I already know how use label and cast member name. They are only examples
because I need the same relative mode to call sprite.
If I use variable to store the sprite number I don't solve my trouble
because if (when I am authoring) I need to shift down my sprites in the
score to make room for new sprites (and with this action my current sprite
20 becomes sprite 25), my old script that call sprite(20).blend now change
blend of a different sprite.
I need to have a sprite name (or other relative reference to it).
For example if I call the sprite 20: "background", I can use
sprite("background").blend even if I change the sprtites position in the
score.
Thanks to anyone that help me.
---
Michele
"Loren Schwarz" <loren.schwarzNOSPAM@tiscali.de> ha scritto nel messaggio
news:br58vg$rt$1@forums.macromedia.com...the> Hello, Michele,
>> Yes, you can. Just click above the frame number on the Director time line> > I can use label to identify a frame instead of number
> and enter a label for that frame. After you've done that, say you called a
> frame "startFrame", you can go to that frame using
>
> go to "startFrame"
>
> You can find out the label of the currently shown frame at runtime usingyou> property "the frameLabel".
>> Yes, you can, and you should. For example:> > I can use cast member name to identify cast member
>
> member("mySampleMember").backColor = 0
>> That's a bit more difficult, you should use variables to store the sprite> > How can I have the same with sprite.
> number or a reference to the sprite you want to address: For example:
>
> -- somewhere at the beginning of your code,
> -- maybe use a global variable (using keyword "global")
> theBitmapSprite = sprite(31)
> -- then you can address the sprite using:
> theBitmapSprite.visible = true
>
> or
>
> -- somewhere at the beginning of your code,
> -- maybe use a global variable (using keyword "global")
> theBitmapSpriteNum = 31
> -- then you can address the sprite using:
> sprite(theBitmapSpriteNum).visible = true
>
> Another hint: Except for the last question, it would have been faster if> just had tried things out yourself :-)
>
> Nonetheless, good luck!
> L.S.
>
>
Michele Guest
-
gabriel #4
Re: Sprite "name"
well ..
you attach a behaviour to the sprite that
has a property for the name defined through the getpropertydescriptionlist
handler and then use a sendallsprites with parameter the name of the sprite
you want
for example
-- behaviour code
-- the name you want to call this sprite
-- will be assigned a value later
property pName
on getPropertyDescriptionList me
pList = [:]
pList[#pName] = [#format:#string,#default:" a default name ",
#comment:"What should this sprite be called"]
return pList
end
on GetSprite me, aName
if aName = pName then
return sprite(me.spritenum)
end if
end
-- end behaviour
now when you drop this behaviour on a sprite
it will pop a window asking for a name for that sprite
now from anywhere in your code you can call
aSprite = sendAllSprites(#GetSprite, "a name you gave to one of the
sprites")
now aSprite contains a reference to the sprite you want and all command
valid to the sprite are valid for this variable
like
aSprite.loc
etc...
be careful not to givetwo sprites the same name because you will only
receive the one when issuing the above command
hope this helps
gabriel
gabriel Guest
-
Loren Schwarz #5
Re: Sprite "name"
Michele,
the sense of using a global variable to store a reference to a sprite or the
spriteNum is that you have to hard-code the sprite number only once in your
movie. You can do that at a single central location (for example in an
prepareMovie script) If you have to rearrange your sprites, you have to
adjust hard-coded "magic numbers" only once, at that central place.
global mySprite, myOtherSprite
on prepareMovie me
mySprite = sprite(12)
myOtherSprite = sprite(14)
end
Throughout your movie all references to your sprites are done using the
global variables, for example:
on mouseDown me
mySprite.blend = 50
myOtherSprite.member = member("whichever")
end
I think this solution is quite simple and practical...
L.S.
Loren Schwarz Guest



Reply With Quote

