qbattersby Posted February 1, 2008 Share Posted February 1, 2008 Hey hopefully someone can help here, there is likely a simple solution but I can not get it to work.So I have 3 buttons, if you click on the first button it brings up some text, if you click the button again the text disappears. However here is my problem, if the first button has been clicked and the text is on screen and the person clicks the 2nd or 3rd button, I need the text from button 1 to disappear using my out scene, this is not a problem with simple action script but i need the option that if that text is not on the screen it will not play the out scene hope you know what I mean. Each button is a separate movie clip. I can send the flash file if that helps. Thanks in advance Link to comment https://www.insanelymac.com/forum/topic/85176-help-with-flash-action-script/ Share on other sites More sharing options...
nickg331 Posted February 4, 2008 Share Posted February 4, 2008 post some code. i'd be happy to help. Link to comment https://www.insanelymac.com/forum/topic/85176-help-with-flash-action-script/#findComment-608874 Share on other sites More sharing options...
qbattersby Posted February 5, 2008 Author Share Posted February 5, 2008 Hey that is great, I will post it up when I get home. Just at school in portfolio development. Should be later tonight, around 5PM EST. Link to comment https://www.insanelymac.com/forum/topic/85176-help-with-flash-action-script/#findComment-609489 Share on other sites More sharing options...
qbattersby Posted February 6, 2008 Author Share Posted February 6, 2008 OK so you can view what I have so far at www.qbattersby.com ... I have changed it so it isnt weird, but if you click on intrusion it fades in, if you click intrusion again, it fades out. What I want to happen is when intrusion is on screen and you click one of the other buttons for example "Contact" then the intrusion movie will gotoAndPlay frame 52 which is where the fading out begins. However I don't want it to do that if the intrusion movie isn't on frame 51. Hope you understand that. What I have is this, on the contact button. I have tried setting it to gotoAndPlay (52) in the intrude movie but then every time I click the Contact button it does that. I only want it to play from frame 52 in the intrude movie if it is on frame 51. If not I want the intrude movie to do nothing. Sorry for all the typing just trying to explain exactly what I want. As you can imagine I am pretty new to flash, actionscript particularly. on (press) { gotoAndPlay(2) _root.intrude.gotoAndStop (1) } Thanks again Link to comment https://www.insanelymac.com/forum/topic/85176-help-with-flash-action-script/#findComment-611538 Share on other sites More sharing options...
trioptic Posted February 6, 2008 Share Posted February 6, 2008 seems like it would be so much easier to do all this fading in/out with code, using something like the FuseKit http://www.mosessupposes.com other than that, your description of the app so far is confusing me, and I have no idea what it is supposed to do, or what it's doing wrong. I can def. tell that sending frames around from 1, 2, 52, etc. is probably not the best way to do this. Id be glad to help if you posted the .fla or something with more info. Link to comment https://www.insanelymac.com/forum/topic/85176-help-with-flash-action-script/#findComment-611686 Share on other sites More sharing options...
nickg331 Posted February 7, 2008 Share Posted February 7, 2008 i'd agree, this would probably be easier done entirely in actionscript, but if you really want to do it, here's the general idea: (pseudo-code) on press contact button if intrusion is on frame 51 { go to and play frame 52 start contact animation } else { start contact animation } i don't have time right now to give you any actual code, but if you really need help send me the fla and i'll see what i can do. keep us updated. Link to comment https://www.insanelymac.com/forum/topic/85176-help-with-flash-action-script/#findComment-611964 Share on other sites More sharing options...
qbattersby Posted February 7, 2008 Author Share Posted February 7, 2008 Trioptic, I think you are confused, clearly. This is what I have, a movie clip that plays when a button is pressed. It plays from frame 1-51 which is the fading in, it stops on 51, then when you click the button again it moves to frame 52 which plays the fading out. I dont understand what this FuseKit is supposed to help me with. nickg331> Hey, yea as for the code you posted that is exactly what I need to do, I have tried to play with it but it doesnt seem to work. if you could post the code I would use to do this it would be great. I would post the fla but the size is 10mb because of all the graphics, when it is exported to swf it is only about 300kb though. This is the code I have tried. on(Press) if (root_.intrude.currentframe == 51) root_.intrude.gotoAndPlay ("52") and that is not working, roughly that is the code if you get the idea. Link to comment https://www.insanelymac.com/forum/topic/85176-help-with-flash-action-script/#findComment-612151 Share on other sites More sharing options...
nickg331 Posted February 8, 2008 Share Posted February 8, 2008 on(Press) if (intrude._currentframe == 51) { intrude.gotoAndPlay("52"); <<start contact anim but i don't know the movieclip name>> } else { <<start contact anim but i don't know the movieclip name>> } without the fla, i can't really trouble shoot for you, and i don't know if this will work because i don't know exactly how you've set things up. Link to comment https://www.insanelymac.com/forum/topic/85176-help-with-flash-action-script/#findComment-613468 Share on other sites More sharing options...
trioptic Posted February 8, 2008 Share Posted February 8, 2008 ha, ya im confused - but only because of how you are going about this. It's like you are taking the scenic route, lol. This is what I have, a movie clip that plays when a button is pressed. It plays from frame 1-51 which is the fading in, it stops on 51, then when you click the button again it moves to frame 52 which plays the fading out. I dont understand what this FuseKit is supposed to help me with. with FuseKit, instead of actually making 51 frames of a clip fading in/out, you would simply write: clipname_mc.alphaTo(100); that one line of code would fade your movieclip in, without making actual frames. This is better in many ways - smaller filesize, easier to update, easier to read the code, etc. Plus, to have a action of a button change, it's even easier using a callback function... but I wont get into that. basically, this is how I would do it (in pseudo-ish code) clipname_mc.alphaTo(100); clipname_mc.onPress=function(){ if (this._alpha == 100){ this.alphaTo(0); } } that's it! but it's even easier with a callback... var blnFade:Boolean = false; function fadeIn() { clipname_mc.alphaTo(100,null,null,null,toggleFade); } function fadeOut(){ clipname_mc.alphaTo(0,null,null,null,toggleFade); } function toggleFade(){ if(blnFade){ clipname_mc.onRelease = fadeIn; } else { clipname_mc.onRelease = fadeOut; } blnFade=!blnFade; // toggles the variable } and that function can be made even shorter with a ternary! function toggleFade(){ clipname_mc.onRelease = (blnFade) ? fadeIn : fadeOut; blnFade=!blnFade; } Link to comment https://www.insanelymac.com/forum/topic/85176-help-with-flash-action-script/#findComment-614433 Share on other sites More sharing options...
nickg331 Posted February 9, 2008 Share Posted February 9, 2008 trioptic is right, there are far easier ways of doing this. it's up to you though. Link to comment https://www.insanelymac.com/forum/topic/85176-help-with-flash-action-script/#findComment-614697 Share on other sites More sharing options...
qbattersby Posted February 10, 2008 Author Share Posted February 10, 2008 Hey, thanks to both of you, as you can imagine I am very new to Flash, still trying to work it all out. I have ended up going a different route, whole site isnt going to be Flash, going the CSS route, with just my portfolio in flash. I think what you have explained will assist me in creating it so it works the way I want it too. If I run into any problems I would love to be able to post the fla (filesize is considerably smaller) and get some assistance. I have a web techniques class at school, and my teacher is good, but he is definitely point and shoot with flash it seems. I have asked him complicated questions and he always gives me the answer I'd have to play with it, or in this case he said to just put a white box over top and im like wtf? Anyways, I wanted to say thanks! and take a look at what I am working on now ... . www.qbattersby.com Link to comment https://www.insanelymac.com/forum/topic/85176-help-with-flash-action-script/#findComment-617176 Share on other sites More sharing options...
ozboi Posted February 16, 2008 Share Posted February 16, 2008 on(Press) if (root_.intrude.currentframe == 51) root_.intrude.gotoAndPlay ("52") Don't know if it was copied and pasted from your original code, but if it was then the reason it wasn't working was because the underscore (_) was in the wrong place. Also there should be no quotes around the number in your gotoAndPlay statement, unless "52" is a frame label, which would probably be more apt as "fadeOut". So your code should have been: on(Press) if (_root.intrude.currentframe == 51) _root.intrude.gotoAndPlay (52) OR on(Press) if (_root.intrude.currentframe == 51) _root.intrude.gotoAndPlay ("fadeOut") Link to comment https://www.insanelymac.com/forum/topic/85176-help-with-flash-action-script/#findComment-626591 Share on other sites More sharing options...
Recommended Posts