Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send message order? 1

Status
Not open for further replies.

pittypat

Instructor
Sep 29, 2002
12
US
Hi All!

I am in way over my head here, so if my dilemma gives you a chuckle, so be it...that will probably help my headache. :) I am brand new to Director, and since I can't find any threads on my problem, it must be super simple and I'm just too dense to figure it out.

What I want to do is to have a sprite that when I mouseover, another sprite fades in...when i mouseleave, it fades out...then I want to mouseover the same original sprite, but have a second sprite fade in/out...and so on. I don't want it dependent on timing. I tried sending a message from the first sprite to the second...that works first time around, but i can't get it to go to the second one unless it does it because of the timeline.

Hope this makes an iota of sense to someone. I am so frustrated and crabby, my husband is starting to threaten me...help! :)

 
create a movie script with this handler

global gCounten

on prepareMovie
set gCounten=0
end

Now for the original sprite's behavoir

On mouseWithin
set gCounten=gCounten+1
sprite(3).member=member(gCounten&"fader")
end

on mouseLeave
sprite(3).member=member(gCounten&"fadeout")
end

Whats happening here is everytime the mouseOver occurs for the certain sprite it adds one to the value of a global variable. It exchanges the cast member of sprite 3 with a cast member named 1fader, then the second time it is 2fader.
Essentially whatever value that gCounten is, plus the word "fader". I did not know how yuo were fading the sprites in, so I assumed the cast members you use would be filmloops of your sprites fading in and out.
 
I can't thank you enough for your help...I hope I'm not hopeless! For some reason, I can't get the cast members to switch out beyond the first switch. When I mouse over the original sprite, the new image 1 appears. When I mouseleave, all sorts of weird things happen...it varies based on what gibberish I've got in there. When I mouse back in, the next image 2 appears, but it won't go beyond that. They just keep switching back and forth.

I'm afraid I've butchered your script somewhere, probably in the mouseLeave part, but I'm not sure where I'm going wrong. Have any idea what I've done? I'm not in Kansas anymore...
 
First off, what are you using for your cast members? Are they filmloops of sprites fading in and out accordingly?

I can not think of exactly what should be wrong with it. So if you don't mind, post the script here and I will take a look at it. Meanwhile, I will test it myself.
 
I checked my own script and found problems with it. This should work better.
As before the moviescript should stay the same.

However, on the behavoir script you should have.

global gCounten

on mouseEnter
set gCounten=gCounten+1
if gCounten=5 then set gCounten=1
end

on mouseWithin
sprite(2).member=member(gCounten&"fadein")
end

on mouseLeave
sprite(2).member=member(gCounten&"fadeout")
end


--The mouseEnter handler sets the variable, which is different from a mouseWithin event. And on the mouseWithin we have the sprite exchange of cast members, following the logic of variable value&"X" , where X is the common name you give the cast members that fade in. Similarly with mouseLeave.

Now there are two things i overlooked when answering the first time. How does the cycle of cast members stop. You are going to have a limit on the cast members. That is what the other line in the mouseEnter handler addresses. I have a limit of four cast members that fadein. So the if condition reads If var value equals 5 then make it equal 1, voila--- it uses the first fadein cast member.


The second thing I overlooked is the initial cast member for the sprite that excahnges for fadein and fadeout cast members. What I normally do for empty sprites that need a 'ghost' cast member is I go to Director's Paint program and I simpy type in the naming field at top "blank" or "ghost". Then I close the Paint program without drawing anything. Now you have a blank cast member you can move around the stage and position where it needs to be at on the stage.
 
OMG, Archerofloaf, you are a PRINCE!! And a genius prince, at that!! When I win the Powerball, I am sending you on a cruise!! You can't imagine how much better my self esteem is now. It's working like a charm!

I'm in Louisiana...right in the path of Hurricane Lili...so I did a quick test and it's so perfect...all I've gotta do now is tweak my images as soon as I get to high ground and I'll be oh so happy.

I'm totally amazed. It's like a medical miracle. I wish I could help you in some way some day, but I can't imagine how, so pat yourself on the back for me...you're the hero of the day!!
 
You are welcome PittyPat. Glad to hear it works well for you. And stay safe there in Louisiana.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top