Few Newbie Questions

OK I have 3 issues I cant work out on my own, I’ve only been using flash about a week or so and have learned most of what i know about it from the built in tuts, messing around, and 2 websites (this one and flashkit).

There are 3 problems I cant seem to figure out on my own.

1st problem - I have a button that I will assign an action to (Its a sound on and off button, however I havent added sounds to my site yet, so for now I just want it to toggle the on / off image, I have 2 pictures on top of each other, and when the button is clicked, picture one will no longer be visible, and picture 2 will then become visible, and vice versa when the button is clicked again… I pasted this code in the button, which I came to find out is wrong… lol… but I gave it the good ol college try…

on (release) {
if (Off_alpha==100) {
return On_alpha=100;
return Off_alpha=0;
} else {
return On_alpha=0;
return Off_alpha=100;
}
}

That code, after screwing around with AS, seemed logical to me, but Flash didnt think so…Any help here would be great.

2nd Problem - I setup the chromeless window from the tutorial provided here, and there are 2 things I’d like to do to it if possible…

Make a Flash Button that will close the window, and have a Minimize button along side the close ‘x’ at the top

Sorry for so many questions in one thread, I pretty much did all I could without help now I’m trying to get rid of all my problems =).

Thanks in advance for all help provided

Can view what I’ve done so far at www.sierrafalls.net (the first page is very generic just to initialize the javascript window) … none of the links work yet, I do web design but never used flash til now, figured it was time to update =p

You could use that to make the effect, but there’s a much better way. Anyway, here’s the correct code (assuming that you gave the instance names On and Off to your clips)

on (release) { 
  if (Off._alpha==100) { 
    On._alpha=100; 
    Off._alpha=0; 
  } else { 
    On._alpha=0; 
    Off._alpha=100; 
  } 
}

Or better

on (release) { 
    On._visible=!On._visible; 
    Off._visible=!Off._visible; 
}

The main problem with your code is that you missed the dot syntax. And return isn’t used in Flash, except if you want a function to return a value to be used somewhere else.

But as I said, there’s a better way to do that : create a movie clip with 2 frames in it with 1 picture in each frame, and make your button gotoAndPlay the corresponding frame. Doing so, you won’t have to deal with _visible, which is good politics, since it’s CPU consuming.

pom :asian:

thanks a lot for the advice =) i guess i made that just a little bit harder than it needed to me =) Now if i can get the other two probs solved i’ll be in business.

If you know your javaScript this is the handiest way to manipulate browser characteristics:

getURL (“javascript:window.close()”);

However you’ll need to spawn the window using javascript or eles you’ll get a “The web page you are viewing is trying to close this window” alert in IE