|
Prev: Variable to property
Next: Quit button
From: Darrel Hoffman on 13 Apr 2008 02:22 I have a behavior on a sprite which seems to do exactly what it's supposed to most of the time, but after about 10-20 trial runs in Authoring mode, it suddenly just stops responding. To anything. I can even add a "put" command into its beginSprite just to see if it's responding, and it just doesn't do anything. The only ONLY thing that works once this happens is to save, quit, and reload, which is getting really annoying to have to do every 10 minutes or so. So far it always seems to work in the Projector, but it's getting hard to test things on this because of the constant need to keep quitting and reloading. There's nothing fancy on this script: property my on beginSprite me my = sprite(me.spriteNum) end on mouseUp me --Set val based on mouse relative position on mouseUp sprite(my.name.word[1] && "Dropdown Act").val = (the mouseV - my.top) / 15 --Scroll Activator text to line to match line selected from Menu member(my.name.word[1] && "Dropdown Act Text").scrollTop = sprite(my.name.word[1] && "Dropdown Act").val * 15 --Menu and Selector disappear on mouseUp my.visible = FALSE sprite(my.name.word[1] && "Selector").visible = FALSE --Execute command based on val from Activator case sprite(my.name.word[1] && "Dropdown Act").val of 0: <do this command> 1: <do another command> etc. (there's 20 commands total) end case end on mouseLeave me --Menu and Selector disappear on mouseLeave my.visible = FALSE sprite(my.name.word[1] && "Selector").visible = FALSE end on mouseWithin me --Selector follows mouse on mouseWithin sprite(my.name.word[1] && "Selector").locV = my.top + (((the mouseV - my.top) / 15)*15) end The whole "my.name.word[1]" thing is because I have several dropdown lists, each having 3 parts grouped by having similar sprite names. The "Dropdown Act" is a 20-line text member fixed-height so that only 1 line shows, which you click on to activate the menu, it has a property "val" which is set by this script. (It has a mouseDown script which just makes the other two visible.) The "Selector" is just a rectangle shape with a Reverse ink to show which command you have your mouse over. Is there anything in this script that stands out as a no-no that would be causing it to so royally screw up on such a regular basis?
From: a?ex on 13 Apr 2008 04:28 search all your scripts for the word "scriptinstancelist" once the scriptinstancelist of a sprite is accessed at a time where there is no physical sprite in that channel, the whole channel will be "dead" for the rest of the session. if you find the word "scriptinstancelist" in one of your scripts, that may be the reason and I'll explain in more depth, what might be happening. From your description I would be to 70% sure, that you will find the word "scriptinstancelist" :-)
From: Darrel Hoffman on 13 Apr 2008 10:02 > search all your scripts for the word "scriptinstancelist" > > once the scriptinstancelist of a sprite is accessed at a time where there > is > no physical sprite in that channel, the whole channel will be "dead" for > the > rest of the session. > > if you find the word "scriptinstancelist" in one of your scripts, that may > be > the reason and I'll explain in more depth, what might be happening. > > From your description I would be to 70% sure, that you will find the word > "scriptinstancelist" Sorry, but no. I'm aware of what the scriptinstancelist does, but I'm not using it at all in any of my scripts. Any other ideas?
From: Mark A. Boyd on 13 Apr 2008 12:08 "Darrel Hoffman" <no.address(a)all.com> posted in macromedia.director.lingo: > I have a behavior on a sprite which seems to do exactly what it's > supposed to most of the time, but after about 10-20 trial runs in > Authoring mode, it suddenly just stops responding. To anything. I can > even add a "put" command into its beginSprite just to see if it's > responding, and it just doesn't do anything. The only ONLY thing that > works once this happens is to save, quit, and reload, which is getting > really annoying to have to do every 10 minutes or so. So far it always > seems to work in the Projector, but it's getting hard to test things on > this because of the constant need to keep quitting and reloading. > There's nothing fancy on this script: [snip] > on mouseLeave me > --Menu and Selector disappear on mouseLeave > my.visible = FALSE > sprite(my.name.word[1] && "Selector").visible = FALSE > end [snip] In my version of Director, toggling the visibility of a sprite channel manually in the score causes the symptoms you describe - sometimes. I don't use the visible of sprite property in scripting, but there's a slight chance it may be doing the same thing. Try adding another handler to the behavior. on endSprite me my.visible = 1 end This will run even if you simply hit Director's [Stop] button in Author mode. (Remember that this property applies to the entire sprite channel rather than a single sprite.) -- Mark A. Boyd Keep-On-Learnin' :)
From: Darrel Hoffman on 13 Apr 2008 12:46
> In my version of Director, toggling the visibility of a sprite channel > manually in the score causes the symptoms you describe - sometimes. I > don't > use the visible of sprite property in scripting, but there's a slight > chance > it may be doing the same thing. Try adding another handler to the > behavior. > > on endSprite me > my.visible = 1 > end I actually have a script on stopMovie which sets ALL sprites to visible whenever you stop the movie, so that might be kind of redundant. At any rate, almost all of the sprites on the stage (and all those involved here) in addition have one of two behaviors separately applied, one called "Starts Visible" and one called "Starts Invisible", which read, respectively: on beginSprite me sprite(me.spriteNum).visible = TRUE end on endSprite me sprite(me.spriteNum).visible = TRUE end and: on beginSprite me sprite(me.spriteNum).visible = FALSE end on endSprite me sprite(me.spriteNum).visible = TRUE end Does it matter that this happens in another behavior than the script that does the juicy bits? As for using the visible property, I know of the alternatives, but I don't like 'em. Setting blend to zero is useless, as it doesn't stop script from running on mouse events. Moving them off-stage works, but then you have to put in extra code to keep track of whether it's been moved or not or you end up moving it off-stage twice, or add a property telling it where its homeLoc is, etc. The visible property works on one line of code, and it's nice and simple, provided you remember to make turn visible again on endSprite. (I can't tell you how much I'd pay if the next version of Director made the visible property sprite-specific instead of channel-specific. If they released an 11.5 patch that did just that, I'd buy it on the spot.) Incidentally, I'm still using MX2004, in case that matters at all. |