homepage Welcome to WebmasterWorld Guest from 54.161.202.234
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

    
if else, display.
I need help!
PokeTech




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

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!

 

rocknbil




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

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;

PokeTech




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

Lets say I had an image I imported. How would I make that invisible if myVariable = yes?

rocknbil




msg:3712611
 2:22 am on Aug 1, 2008 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved