Τρίτη 5 Μαΐου 2009

If and ELSE (How to) Tutorial









OR









1st Draw a rectangle with width:90 and Height:35 . After press CTRL+K and go to Align menu and press to align it. Press f8 to convert it to a symbol (Button) name it Symbol 1.



2nd Draw a text box, go to properties panel, make it input text and put variable: t1. After that go again to Align menu and align it to the center.



3rd copy this text box, press Shift and 5 times the down arrow and set it as dynamic text box. Go to Variable and name it t2



4th press once at your button and write the below code


on(release){

                if (t1 == "Flash") {

                                t2 = "OK";

                } else {

                                t2 = "ENTER THE VALID WORD";

                }

}

 

THIS IS MEANING:

if (t1 == “Flash”), This is our condition and we are telling to flash that if our input text (t1) == (the double == in flash means that you have to have exactly that and it is not an mathematic equal) Flash

go to t2 (our Dynamic text) and write OK

 

ELSE

Go to t2 (our Dynamic text again) and write ENTER THE VALID WORD.

You can also download the source file from here

This is a nice way to make passwords in flash. The only that you have to do is these. go to Behavior at t1 and change the Multiline to password.


After that you can go to the Action Script and you can change your code on the button with this:

on(release){

if (t1 == "Flash") {

gotoAndStop (2);

} else {

t2 = "ENTER THE VALID WORD";

}

}

And for last you have to add another one layer and write with action script stop(); On the first frame. With that way if you write Flash you will go to the second frame and you can make your photogallery or watever you want to lock it... Have a nice day...

Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου