Changing the cast member of a sprite
Hi, I have the following code so that when a user clicks on a
shape (acting as a button), it changes the cast member of an
existing sprite called "base" on the stage to an image cast member
called "Italian Lira". However the code does not work, any
suggestions what I have done wrong?
on mouseUp me
currency = "Italian Lira"
sprite("base").member = member(currency)
end
Thanks for keeping me sane Mike. I've always used a global
list with sprite
assignments so I never had to deal with whether or not the
sprite names
feature worked. But I guess you've dispelled the myth.
Thanks.
I guess we still don't know whether "base" is a sprite name
or mistakenly
and cast member name. I see that we haven't heard back from
pete_484 on
this.
Craig Wollman
Lingo Specialist
Word of Mouth Productions
212-928-9581
www.wordofmouthpros.com
"Mike Blaustein" <[email protected]> wrote in
message
news:enthgu$22c$[email protected]..
> Yes they did. I am not sure why so many people are
saying not to do it,
> because I name sprites in practically every project I do
these days.
> Assuming that you sprite is named correctly, this should
work (I just
> removed the word member in the 2nd line):
>
> on mouseUp me
> currency = "Italian Lira"
> sprite("base").member = currency
> end
Similar Messages
-
Change cast member of another sprite on rollover?
There is probably a really easy answer for this question but I just have NO IDEA how to approach it and am about ready to blow my brains out ... (new at this, yes) so ANY HELP would be greatly appreciated.
When rolling over or "on mouseEnter me" of a certain sprite, I would like to change the cast member of ANOTHER sprite as well as the current one (having no problems with the current one as it's all set up in the behaviours lol) is this possible? and how would the lingo go for this?
thanksDon't do what Multiduck suggests. Sprites should never change the properties of other sprites. That is a bad practice prone to creating nasty bugs.
Create a behavior for the second sprite that has a handler for changing its member. You might call it "showRollOver". Then your first sprite simply calls that handler.
sprite(x).showRollOver()
If you want the second sprite to react to mouse overs, then just use the mouseEnter method and call that handler from the first sprite.
sprite(x).mouseEnter()
Note: You can directly call any handler that is added to a sprite, ie,
sprite(x).mouseDown()
sprite(x).beginSprite()
sprite(x).setText()
sprite(x).fadeOut() -
Hello:
I need to change images in the stage from the cast member.
The problem is that when I change the image, the previous
image on the stage
appears and quickly the new appears.
How can I desappear the previous image before to show the
new?
Thank you very muchThank you:
The problem is that I am stopped in frame 10 for example, in
this frame I
change the cast member image by Lingo and send the head to
frame 1 and the
image that I had before I see it and then change to the new.
"JB" <[email protected]> escribi� en el
mensaje
news:[email protected]..
> Not understanding exactly what your are doing, one can
temporarily had
> the sprite by setting the blend prop to 0 or by setting
the vidoble of
> >
> A sprite triggered by an on EnerFrame handler could
switch te member
> before the score assigned mbmer makes it's initial
appearance. -
How to intersect with any sprite of a certain cast member?
Hi. I am trying to script a simple 2d platformer engine for a larger University project. I have movement sorted with W and A and gravity. I can get collision detection with the floor by doing
if sprite 1 intersects sprite 2 then
gvGrav = 0
end if
Sprite 1 is the player and sprite 2 is an instance of the cast member called ground. How would I get this to work with any sprite that is ground? Ill paste the full code below.
global gvRight
global gvLeft
global gvGrav
global gvDown
on enterFrame
-----------MOVE LEFT---------------------
if keyPressed("a") then
sprite(4).locH=sprite(4).locH+gvLeft
_movie.updateStage()
gvLeft = gvLeft - .5
if gvLeft < - 15 then
gvLeft = -15
end if
end if
if not keypressed("a") then
gvLeft = 0
end if
-----------MOVE RIGHT--------------------
if keyPressed("d") then
sprite(4).locH=sprite(4).locH+gvRight
_movie.updateStage()
gvRight = gvRight + .5
if gvRight > 15 then
gvRight = 15
end if
end if
if not keypressed("d") then
gvRight = 0
end if
-----------GRAVITY-------------------------
gvGrav = gvGrav
sprite(4).locV=sprite(4).locV+gvGrav
_movie.updateStage()
gvGrav = gvGrav +.5
if gvGrav > 30 then
gvGrav = 30
end if
-------------GravityCollision----------------------
if sprite 4 intersects sprite 1 then
gvGrav = 0
end if
if sprite 4 intersects sprite 2 then
gvGrav = 0
end if
end ifI dare say there's a better way to do this, but an easy way is to set a global variable, do a sendallsprites message, and check the global variable again.
So, if you had an extra global in your man control script:
global hitman
then in your collision checking part you would say this:
hitman = false
sendallsprites #checkcollision 4
if hitman = true then
gvGrav = 0
end if
The #checkcollision message would get sent to all sprites, and if you had a behavior placed on the floor sprites, that was like this:
global hitman
property mysprite
on beginsprite me
mysprite = the spritenum of me
end
on checkcollision me,s
if sprite s intersects sprite mysprite then
hitman = true
end if
end
any one of those sprites that intersected with the sprite you ask about would then change the global 'hit man' variable to be true. To make a sprite behave like floor, you would just attach that behavior script.
Notice how the floor sprite makes a note of its sprite number when it first shows up on the stage, you could do the same with your other script, if it's attached to the man character. Then you wouldn't have to have it hard coded to '4', which would save some headaches later if you have to change the sprite layers. -
Making dynamic sprites from a cast member
Hello ,realy I am making a movie that it has the words and
the meanings and the pronounciation and the image of the word of 20
lessons ,realy I make a propertly list for the words and the
meanings for each chapter in a text document for each lesson and
retrievet the words and the meanings on the stage and assign the
them into separate sprites made by a text cast member ,Now I have a
problem ,the number of words and new words are not equal for each
lesson ,there fore I look for a way to make the sprites same as the
number of the words of each lesson from the cast member , is it
realy possible ?
Thank you very much
Sincerely yours MohsenaHello and thank you for your attention ,yes as you mentioned
I should change the content of the text members ,in this way when I
want tthe words and the meanig of lesson 2 ,I should change the
content ,But my problem is in this phase exactly ,for example if
the lesson 1 has 30 words and meaning and lesson 2 has 20 meaning
,one way is to predefined 30 sprites froem the cast memeber and use
object oritented programming that make just 20 new object for
lesson 1 (I can do it) but realy what is in mind is that ,is it
possible to make the sprites as needed? for example for lesson 1
make 30 sprites ,the somehow destroy them ,and for lessson 2 make
20 sprites?
thank you very much for your attention sincerely yours
Mohsna -
Creating a new instance of a cast member
I want to create an instance of a cast member on stage, that
will not exist as a new member in the cast.
I read some stuff about child objects, but I wasn't
successful in getting it to work.
I also want to be able to create more than one instance, and
to be able to manipulate them separately.
Can someone help?
Thanks a lot,
IsaacThere is a variety of ways to accomplish this ("is" agreeing
with "a
variety" not "of ways"). You can puppet as many sprite
channels as you need
and assign the one cast member to each. Each will function
independently
although any modification to the cast member itself will be
reflected in
each sprite instance.
The following code takes the first cast member in the first
castLib and
places it on the stage 10 times using channels 1-10. It
places the sprites
side by side horizontally. The position is not important but
I showed that
each sprite can be treated independently, in this case by
setting the loc
property. Of course you can do this with any sprite property.
The
significant lines are 2 and 3.
repeat with x = 1 to 10
sprite (x).puppet = TRUE
sprite (x).member = member (1)
xPos = member (1).width * (x - 1) + (member (1).width / 2)
sprite (x).loc = point (xPos, member (1).height / 2)
end repeat
Craig
"ytlevine" <[email protected]> wrote in
message
news:ggk8be$fr7$[email protected]..
>I want to create an instance of a cast member on stage,
that will not exist
>as
> a new member in the cast.
> I read some stuff about child objects, but I wasn't
successful in getting
> it
> to work.
> I also want to be able to create more than one instance,
and to be able to
> manipulate them separately.
> Can someone help?
> Thanks a lot,
> Isaac
> -
How to export a embedded sound cast member in Director
I have some sound effects and music files that have been embedded into the cast members of Director. I'm not familiar with director and
can get to the cast member but I need help on how I can export the sound out. I tried Audio Xtra and copy and paste function but couldn't get it to work
Regards,
JeffYou can't copy and paste with the AudioXtra, but rather write code that will export sound cast members. I know I've provided such code on one of these forums to do exactly that - try searching on 'Audio Xtra' or 'AudioXtra'
-
Simple import of PDF as cast member
I believe that there used to be a method to import PDF and
DOC files into Director Cast members. Does anyone remember if this
did exist and where they may be currently found.
I want to be able to hold the content of an exisiting PDF or
DOC document inside a Director Cast (Dir 8.5) and then view / print
from the cast member. This is as opposed to turning them into
straight bitmap images. I am not wishing to have the user being
able to access the output via either a PDF reader or Word.
Thank youif you use the gotonetpage script and put your pdf in an
external folder along with any videos etc it works e.g. for a
button link
on mouseUp me
gotonetpage "xxx.pdf"
end
this worked for me:)
Paula -
Change the bend of a cast member
Hi guys, I've a problem with the blend of one of my members
cast.
I created one filled rectangle (by tools: default). I'm
trying to change his blend value by a click in other one. Also I
Know the solucion is similar to:
member("myButton").blend = 100 or
Can somebody help me?> member("myButton").blend = 100 or
You have to change the blend of the sprite, not the member:
-- assuming your #shape is in channel 5
sprite(5).blend = 50 -
Load flash cast member in the root of flash sprite (is possible?)
load flash cast member in the root of flash sprite, is
possible?i explain better, the user must download the projector from
internet and i
want protect the swf files include these in one exe
application
this is what my client want
tnanks
"Rob Dillon - Adobe Community Expert"
<[email protected]> ha
scritto nel messaggio
news:[email protected]..
> I'm not sure when or where you would need this
functionality. If you are
> creating a projector, then how are you distributing it?
If you are using
> a CD, then it doesn't matter how many files you have.
>
> If you want to bundle everything together for a
download, then just use
> an installer.
>
> --
> Rob
> _______
> Rob Dillon
> Adobe Community Expert
>
http://www.ddg-designs.com
> 412-243-9119
>
>
http://www.macromedia.com/software/trial/ -
Have just brought an apple iPad off a family member and I want to change the ID that is need to download and update apps in the store.
Tap Settings > General > Reset > Reset All Settings
Reconfigure for new settings. -
How to change the order of parent member on data forms
Hi,
Is there any way to show parent on top of its children in data form row level?
By default data form display members like this:
__Child 1
__Child 2
+Parent
Instead of above i want this sequence:
+Parent
__Child 1
__Child 2Have a read of
Can we change the display order of member set functions like @Idescendant?
Re: the order of member showing in dataform
Cheers
John
http://john-goodwin.blogspot.com/ -
How can I save a cast member to the hard drive?
Hi,
I am using 'canvas' from the Paintbox library.
I found a line of code on the forum to create a 'new' cast member.
Now, I'd like to save that new cast member to the hard drive.
BuddyApi doesn't have an option to do that, and I haven't had any luck with the Xtras lists I've found.
How can I accomplish this?
Thanks in advance for your assistance,
BigDaddyTo elaborate, this is how you would call the Xtra in your code:
-- create the instance of the xtra
objImg = xtra("ImgXtra").new()
-- get the member's image we want to save
imgToSave = member("foobar").image
-- set the path and filename for the bitmap
strFileName = the moviePath & "foobar.jpg"
-- call the ix_saveImage method, with required parameters
success = objImg.ix_saveImage(["image": imgToSave, "filename": strFileName])
-- returns 1 if successful, 0 if not
if success then
-- something here
else
-- something else here
end
-- clear the xtra object instance
objImg = VOID
The other optional parameters such as format and flags can be set, if you like, and the info can be found in the imgXtra.txt document. -
Change the language of a new CC member invitation
Is it possible to specify the language a new CC member received, when I invite him to join CC. We are based in the Netherlands, but most of my colleges only speak English. They now receive a message in Dutch, they do not understand.
Found it
Go to your Adobe ID account page.
Click Overview (if not already there).
In Agreements and Products, click Show all-button.
Click Manage Agreement on the agreement you want to change the language of.
Click Edit at Standard language for e-mail.
(May have to be primary administrator) -
Gave hubby my old Macbook Pro a few years ago. We want to change the admin name but can't figure out how. We did change the password by starting up from the Snow Leopard install disc.
When you reinstall the OSX, you can change not only the password but the administrator as well.
Ciao.
Maybe you are looking for
-
Multiple users, and two ipods on one Imac g5
I have an Imac g5 with 2 gigs of ram have multiple users and two Ipods, I have looked through the discussions pages about this but still cannot make the music in my account show up in my daughters account also I cannot get her ipod to work on her acc
-
why does my iphone 5s not displaying apps on my jvc car stereo. these apps worked with my iphone 4s?
-
Problem with non-ASCII characters on TTY
Although I'm not a native speaker, I want my system language to be English (US), since that's what I'm used to. However I have a lot of files which have German language in their file names. My /etc/locale.conf has en_US.UTF-8 and de_DE.UTF-8 enabled.
-
Table Scroll bars disappearing in IE8
We are facing this strange problem with af:table in IE8. We have this table with properties autoHeightRows="50" contentDelivery="immediate" set while the fetchSize is set to iterator value. In pagedef, we have set RangeSize="25". When screen opens, t
-
UPRE to replicate User Profiles and Managed Metadata to High Availability backup farm
I'm working on a HA project, and have been tasked with replicating our User Profiles and Metadata to a newly created farm. I'll call the current production farm FarmA and the new HA farm FarmB. I've installed SharePoint2010AdministrationToolkit on Fa