-
Hi,
I have five instances of a movie clip say fish1, fish2, fish3, fish4 and fish5 I want to change another movie clip say called dog’s visibility to true when all five fish are clicked. I have put an invisiable button in a movie clip and have put that moive clip on top of fish movie clip. Invisable movie clip buton instances are called button1, button2, button3, button4 and button5. This is the code in the button movie clip
------------
On (Release)
Set Variable: "/:name" = GetProperty ("" , _name)
Set Variable: "/:num" = Substring (/:name, 7, 1)
Set Variable: "/:fish"&/:num = "clicked"
If (Eval ("/:fish"&/:num) eq "clicked")
Set Variable: "/:countdown" = /:countdown + 1
End If
If (/:countdown = 5)
Set Property ("/dog", Visibility) = 1
End If
End On
---------------
The problem is that it counts clicks each time a button is clicked. How can I make it check that all five buttons are clicked and not the one button five times. I am sorry if I cannot explain my problem and have confused you but any help is much appreciated. I could send you the fla if required. What is the best and efficient way to do this in flash 4?
Regards,
Bill
-
on(press)
if(Eval("/:pressed" & Substring(_name,7,1)ne "true")
set variable:"/:pressed" & Substring(_name,7,1)="true"
set variable:"/:pressedcount" = /:pressedcount+1
End if
If(/:pressedcount = 5)
set property("/movieclip",visiblity)=false
End if
End on
Hope that helps!
Regards FlashGuru
-
Thank you very much. It works and it is much simpler.
-
On (Release)
If (mepressed ne 1)
Begin Tell Target ("/main")
Set Variable: "/mainressedcount" = pressedcount + 1
End Tell Target
Set Variable: "mepressed" = 1
If (/mainressedcount eq 6)
Set Property ("/main/text2", Visibility) = true
End If
End If
End On
this code does the same thing but is a little easier to
understand. Just add it into each button.
-
On (Release)
If (mepressed ne 1)
Begin Tell Target ("/main")
Set Variable: "/mainressedcount" = pressedcount + 1
End Tell Target
Set Variable: "mepressed" = 1
If (/mainressedcount eq 6)
Set Property ("/main/text2", Visibility) = true
End If
End If
End On
(oops smiley faces interviened!!)
this code does the same thing but is a little easier to
understand. Just add it into each button.
-
Hi colmroche,
Thank you for you help but i think this code does not work. My problem has been solved by Flashguru's reply; thank you very much for your time.
-
On (Release)
If (mepressed ne 1)
Begin Tell Target ("/main")
Set Variable: "/main/ressedcount" = pressedcount + 1
End Tell Target
Set Variable: "mepressed" = 1
If (/main/:Pressedcount eq 6)
Set Property ("/main/text2", Visibility) = true
End If
End If
End On
Just to amend: the / & : symbols were missing from the 'main pressedcount' variable.
All this script does is detect if mepressed is 1 (has been defined as 1 when clicked), adds 1 to global variable called 'pressedcount' if it has been clicked, and when pressed count = 6 then make text2 visible true.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|