Welcome to WebmasterWorld Guest from 54.147.217.76

Forum Moderators: open

Message Too Old, No Replies

if else, display.

I need help!

   
5:06 pm on Jul 30, 2008 (gmt 0)

5+ Year Member



Well I'm kind of new to flash so thats why I'm asking, anyways I have a little flash thing I made and I uploaded it to my server along with another file myText1.txt so that the flash program uses Loadvariables() to get the variables from the .txt file. Once I have the variables I want to use and if else statement to determine whether or not and object such as a text box can show up.

So if I do this:

if(myVariable == yes) {

}

Then I want it to tell the text box to appear or display itself if myVariable will equal "yes" and when it equals "no" the text box won't be visible. How do I do that?

Thanks in advance!

4:14 pm on Jul 31, 2008 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Assuming the instance of the text nox is named myTextBox,

if(myVariable == yes) {
// You'll need to toggle in case it's been made invisible
myTextBox._visible = true;
.......
}
else {
myTextBox._visible = false;
}

A shorter version, shortcut evaluation rocks:

myTextBox._visible = (myVariable == yes)?true:false;

4:33 pm on Jul 31, 2008 (gmt 0)

5+ Year Member



Lets say I had an image I imported. How would I make that invisible if myVariable = yes?
2:22 am on Aug 1, 2008 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Well, the way I would do that is create a movie object, place it on the stage with a name, then attach the imported image to the movie object, then set the _visibility of the movie object. The slide show [webmasterworld.com] I use does that, but it uses the _alpha attribute to fade the image in and out.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month