PDA

View Full Version : comparing Variables within mov clips using IF statements.


cheeky_monkey
04-01-2003, 10:41 AM
I think it's a simple problem but i've probablt not got the syntax correct...

A have a contact-menu button on my stage
(for opening and closing the mov clip called: contact_mov)

I've tried the following, upon click it opens the menu. Good! BUT...
Click the button again and instead of it closing the menu, just opens the menu again (re-runs the open animation).
Please help...
On (Release)
If (/contact_mov:menustatus="false")
Set Variable: "/contact_mov:menustatus" = "true"
Begin Tell Target ("/contact_mov")
Go to and Play ("contacts-menu_open")
End Tell Target
Else If (/contact_mov:menustatus="true")
Set Variable: "/contact_mov:menustatus" = "false"
Begin Tell Target ("/contact_mov")
Go to and Play ("contacts-menu_close")
End Tell Target
End If
End On


Thanks in advance.

cheeky_monkey
04-01-2003, 10:50 AM
My Contacts button on the stage I placed the following statement...

On (Release)
If (/contact_mov:menustatus=false)
Begin Tell Target ("/contact_mov")
Go to and Play ("contacts-menu_open")
End Tell Target
Else If (/contact_mov:menustatus=true)
Begin Tell Target ("/contact_mov")
Go to and Play ("contacts-menu_close")
End Tell Target
End If
End On


Then... within my menu item mov clip: contact_mov
I set the frame labels:

contacts-menu_open
and
contacts-menu_close

AND at these frames I placed the following statements...
Set Variable: "/contact_mov:menustatus" = true
and
Set Variable: "/contact_mov:menustatus" = false

Hope this has helped someone.

;)

tg
04-01-2003, 02:11 PM
in your if statement, you need to change your '=' to '=='

the single = assigns a value.
the double == compares two values.

to it would be:

If (/contact_mov:menustatus==false)


or you could use:

If (! /contact_mov:menustatus)
// which means if not _root.contact_mov.menustatus

catbert303
04-01-2003, 02:13 PM
No, I think he's okay with that. Flash4 Actionscript used = for comparison too (I think *tries to remember what using flash 4 was like* ;))

tg
04-01-2003, 02:17 PM
hmmm.... flash 4

hmmm... *draws a blank*

didn't realize that.

thanks cat.

cheeky_monkey
04-01-2003, 05:49 PM
I appreciate your help Cat & TG.

Yeah, I explained somewhere (perhaps it was another post) as to why I'm using Flash 4. Client wanted the end .FLA for lots of reasons.

Anyway, Flash 4 gives out error messages when trying to use ==.

What you can do i think is put "eq" instead of the "==".
I've sorted it anyway cheers!!:)

by the way... I don't think you can set a variable whilst within the (condition) of an IF statement...
eg. If (/contact_mov:menustatus=false)

Cheers both, hope you're doing well !!
Steve.:D