|
From: damienmcogo on 20 Apr 2008 15:31 Im trying to do something that i think is very simple to do, im just having one of those silly moments where i cant think straight. Assuming i have a 'text box' cast member called "display". I want the text for this box to be the name of the most recent cast member to be clicked. Can anyone help me with this? Thanks
From: Dave C on 20 Apr 2008 16:34 I don't think Director normally tracks which sprite was last clicked, but you can achieve what you want fairly easily. You just need a behavior that on mouseUp uses the sendSprite function to send a custom message to the sprite that has the text box member. That sprite then needs a simpler handler to receive the message and set it's member's text property. Something like this (assuming the text box is in channel 1). If you have a later version of Director that supports sprite naming, that could be used instead of hard coding the sprite channel. Of course you have to attach the sender behavior to each and every sprite that you want to send the message. I included the pass command in case you have other mouseUp behaviors attached, but then this behavior has to be attached first so that the mouseUp event gets passed to other behaviors. ------------- SENDER CODE ---------------- property spriteNum on mouseUp sendSprite(1, #updateName, sprite(spriteNum).member.name) pass end ------------- RECEIVER CODE ---------------- property spriteNum on updateName me, LastClickedMemberName sprite(spriteNum).member.text = LastClickedMemberName end damienmcogo wrote: > Im trying to do something that i think is very simple to do, im just having one > of those silly moments where i cant think straight. > > Assuming i have a 'text box' cast member called "display". I want the text for > this box to be the name of the most recent cast member to be clicked. > > Can anyone help me with this? > > Thanks >
From: wherold on 20 Apr 2008 19:26 sorry the (a,1).name belongs to the same line member("........ unexpected linebreack Wolfgang
From: wherold on 20 Apr 2008 19:24 Try this a =( castLib(1).selection[1][1]) member("display").text = "member" && a && "of Castlib 1, NAME:" && member(a,1).name works only for a defined castlib, so you have to add a box for everx castlib you have Wolfgang
From: Andrew Morton on 21 Apr 2008 04:08 damienmcogo wrote: > Im trying to do something that i think is very simple to do, im just > having one of those silly moments where i cant think straight. > > Assuming i have a 'text box' cast member called "display". I want the > text for this box to be the name of the most recent cast member to be > clicked. "the clickOn" gives you the number of the last sprite clicked on, so something like ------------------------------------------ property lastSpriteNum on exitFrame if (the clickOn)<>lastSpriteNum then lastSpriteNum=the clickOn member("display").text=sprite(the clickOn).member.name end if end exitFrame ------------------------------------------ But each sprite seems to need to have some sort of handler on it to register for the clickOn, even if it's only on mouseDown nothing end mouseDown HTH Andrew
|
Pages: 1 Prev: Text Xtra error after D11 update Next: Stainless Steel Carving Ring KR294 Wholesaler |