ActionScript 2.0 :: Button To Switch The Variable Off
Dec 17, 2003
Here's a really easy (Not so easy for me) question for you. First person to answer rules the. I have a button that switches a variable from 0 to 1.
on (press) {
_root.pageone = 1;
}
I want the same button to switch the variable off. I've been trying "if else", but my syntax is rubbish. How do I code this statement On Press Button > if _root.pageone = 1 change to 0 > if _root.pageone = 0 change to 1.
I just started in as3 after a long break from flash and I have run into a slight problem and couldn't find any readily available solutions online so I thought I'd ask, I'm trying to do something like this:
Code:
switch(characters[ps[1]]) { case 0:
[code]....
I want to create a different object of the same variable name with the switch statment but it gives me "1151: A conflict exists with definition player in namespace internal" which is of course because I'm redeclaring the variable. I'm not 100% sure it technically exists in the current scope though (but it must because I am getting this error.) I also tried a few ways of initializing as just MovieClip up topside and then just try and typecast it down here but as can be assumed that didn't work either.
Is there a way to get my intended effect or am I gonna have to make some like an above class containing all these other classes on it's various frames and just instantiate those?
I am trying to switch a boolean variable to true after a mouse click on a movieclip.
I want an animation to continue after the user has clicked both btn1 and btn2.
After researching this topic it appears that changing a variable inside a function will only effect code within that function and not the code outside of it - therefore my main Btn1Var and Btn2Var do not update to flase.
ActionScript Code: stop() var btn1Var:Boolean = false; var btn2Var:Boolean = false;
[Code].....
Is there an easy way to change the original variable for each button to true after being clicked?
I have made a button to function like a switch in that it has both an on and off state. However, I can only get it to switch between the on and off state once when it's pressed, with nothing happening after it has been turned off.The code is as follows:
I'm very basic at flash, but sofar I've created a little portfolio page with a video background as a front page. I want to add a button to the background which will turn of the current video and play another video and when the button is pushed again it will play the first video again.[URL]
here's my as for the videobackground:
import VideoBg; var videos:Array=new Array('videos/bird_short.f4v'); var num:uint=1;
I am really new to Flash n Actionscript and have been dropped in to make a switch that will make a light come on in the first click and off on the second, on on the third and off on the forth etc... I have created the switch as a button and the light on/off as two movie clips.... What coding would i be looking to add to make this switch work...
Previously I have been given this... but its not working //this is for the button (switch) on(release) { if (_root.light_on:active == 1) { setProperty("_root.light on", _visible, "1"); _root.light_on:active = "0"; } else { _root.light_on:active = "1"; setProperty("_root.light_on", _visible, "0"); }}
//This is for the light on onClipEvent (load) { active = "1"; setProperty("_root.light_on", _visible, "0"); }
I'm a designer struggling to learn advanced actionscript. It's quite a challenge, One of the challenge i'm having right now is: I have my main timeline(swf). i'm loading in 2 separate swfs into two separate holders on the main stage/timeline/swf. whatever it's normally called. One of the loaded swfs is a menu and the other is a page. Basically i'm designing a learning application. The menu alllows you to jump to a specific place in the course rather than a next button of sorts which is also in the course.
When a different page is loaded i need for a button(movieclip) that's located in the menu swf to swith out with a new button that's located off the stage somewhere.(these buttons are located in the menu swf off stage) so i need the loaded page swf, to talk to the other loaded swf(menu) everytime it or another page is loaded. I've seen simular references to having a loaded swf talk to the main timeline swf but i haven't been able to find a reference for two loaded swfs thats loaded inside holders, to talk to each other.
n Actionscript and have been dropped in to make a switch that will make a light come on in the first click and off on the second, on on the third and off on the forth etc... etc...
i have created the switch as a button and the light on/off as two movie clips... what coding would i be looking to add to make this switch work...
previously i have been given this... but its not working //this is for the button (switch) on(release) { if (_root.light_on:active == 1) {
What is the best way to switch a video to fullscreen from a button in AS3? Like the fullscreen button in FLVPlayback component - I'm aware the FullScreen tag needs to go into the HTML...
I'm pretty new to this and racking my brains on the following problem: I have a movieclip-button, with 3 states (normal, over and clicked). I want to disable the functions in actionscript 3 that switch between the normal and over-states after the button is clicked, and not enable these functions for this button until another button is clicked. What's the best/ simplest way to do this?
I am working on a video player that will have different Languages. The problem that i am have is that i can get the video to switch but i cant get the video to switch back. I have uploaded the file and here is the code that i have have a problem with.
lang.onRelease = function() { if play = English) {
Any reliable full screen code for actionscript 2.0. I have search but can't get any thing that works proper. I just need a button type toggle that switches the screen to full screen and back.
I want to implement having a movie clip randomly change color.How can I make my movie clip randomly switch colors with a push of a button??By the way I'm using flash MX and I am still intermediate when it comes to coding.
I want to be able to have a number displayed on the screen that when one of the arrows next to it (up/down) is clicked it adds 1 to the original number (lets say 72). Then when they click the "save" button that really just takes them to the next frame (or a frame somewhere else in the movie), which is a confirmation page, I want the number they ended at to display on the confirmation screen. I'm thinking that it is partially because I don't know what to search for.I know I have to create a variable and get the button to add one to that variable.
What I'm trying to do is create a program that, depending on 2 variables, multiplies another variable by a static number. Heres the code I have so far:
Im trying to create a program that, depending on 2 variables, multiplies another variable by a static number. A friend suggested I use case/switch instead of if/else statements,which is what I was using before.
i was wondering if i set a variable on a button (the button is on level 5)
Code: _level5.current_selection = "credits"
and i would like the movie on level 1 to recognize that this button (on level 5)has been pressed,is this script correct on an empty keyframe in level 1.
I have a mc button which when click should set the variable associated with it. Here is the code I have on the first frame of the AS2 MC Button, the idea is when clicked this button sets q1a to 30 and q1b and q1c to 0 so when the SUBMIT button on main timeline is click it advance to next frame on with dynamic text and appropriate variable label on the main timeline.
I would like to use a couple of buttons that I made to set a variable. I'd like to use the instance name of the button(s) as the value stored as the variable. how can i code this?
i was wondering if i set a variable on a button (the button is on level 5)
Code: _level5.current_selection = "credits" and i would like the movie on level 1 to recognize that this button (on level 5)has been pressed, is this script correct on an empty keyframe in level 1.
I'm making a contact form, and I keep getting two errors when I try previewing it in a web browser.
ReferenceError: Error #1065: Variable Button is not defined. ReferenceError: Error #1065: Variable ComponentShim is not defined.
I don't know what these errors mean. Can anyone give me an explanation? I am using Flash CS4 with ActionScript 3.0. The first function is for the contact button to go to the contact page. The code following is the code for the contact form.Here is my code for the contact form:
Code: function onContactClick(e:MouseEvent):void { gotoAndStop("contact");[code]............
I need to change one variable at the click of a button the problem is that when I enter the first frame i declared a _global var _global.conteudo =null;
In the second frame: this equal a _global to : _global.conteudo = "enterprise.swf";
But when I click a button , i need change my _global var for example:
on (release){_global.conteudo="my variable declared";}
I'm working on a game, where if you click an answer, it will double check to see if that's the one you really want. So I tried to set a variable when that button is clicked. On another set of buttons, I placed an if / else statement, but it doesn't seem to be working.[code]
I have several buttons I need to turn on and off (visibility and alpha) but the function I have written that determines if a given button should be turned off works based on a few variables. I need to be able to control which button is turning on and off with these variables.
I have tried this ("btn" + i)._visible or alpha but does not work. how I can accomplish this?