ActionScript 2.0 :: Switch Vs. If Else?

Sep 14, 2007

I'm currently building a Flash Game for my work. I made a switch to check if my items fell into the right bucket. But when I was developing all my other functions I realized that I could handle this in an If Else instead...So the question is: What is faster (less CPU intensive), a switch or If Else?Here is my switch:

Code:

function getPoints(naam,orgNaam,baksoort):Void {
switch(baksoort){
case "bak_B01":[code]....

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Switch / Case And Nested Switch / Case

Oct 30, 2011

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:

[Code]...

View 1 Replies

ActionScript 2.0 :: Can Default From Switch/case Be Used In Another Switch/case

Dec 10, 2003

I want this on an MC:

[AS]
i = 0;
switch(thing){
case 0:

[code]....

Basically what I'm wondering is, will I lose the value of i in the first switch once I'm out of the switch? Can the second switch read the 1st switch?

View 8 Replies

ActionScript 3.0 :: Switch/Case And Nested Switch/Case?

Oct 29, 2011

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.

[Code]...

View 1 Replies

Switch Between Different Music?

Dec 19, 2009

how I can switch between different songs?The idea is that an animation will loop continuously (graphic, not a movieclip), and there is one button that will allow the user to change the background music.

View 1 Replies

ActionScript 3.0 ::can't Switch To Page?

Mar 2, 2012

I followed a tutorial about how to create a simple website. The buttons i've created SHOULD fade out the current page and fade in the new page. In it's current state it fades out the m1 instance (mainmenu_mc) but won't fade in the new page selected(p1,p2,p3orp4). After it's faded out if i click in the same area the button was the mainmenu_mc page flashes onto the screen. and when i let go of clicking it, dissapears again.

Code:
var m1:mainmenu_mc =new mainmenu_mc;
var p1:page1 =new page1;
var p2:page2 =new page2;[code]......

View 1 Replies

ActionScript 3.0 :: Up Down And Switch The Result

Jul 25, 2009

I am trying to create a weekly calendar. I have a 'switch' statement that shows the week dates and the name of month the week relates too. I have three functions

1. takes the pc date and converts it into the day of the year. eg between 1 and 365

2. it takes the day from 1. and assoicates it to the week number eg 1 - 52

3. functions that are associated with a previous and next button that use the current week number based on the pc date and count up and down.

This is where I have come unstuck. This is the code for my 'next' button.

Code:
function onClickNext(event:MouseEvent)
{
if(currentWkNum != 53)

[Code].....

View 5 Replies

ActionScript 3.0 :: Important To Switch To OPP?

Dec 21, 2009

I am a pretty good programmer in as3 - but I don't know OOP. -- and I am not so good that I don't have a ton learn -- when I look at all the differnt script commands I know my knowledge is tiny. I am now at the point where I could look at a website and make a pretty good attempt at coppying it and most my programming is dynamic driven. So I was wondering by making the leap to OOP would I have relearn a lot of what I know -- and what are the advantages

View 3 Replies

ActionScript 3.0 :: Use Switch With Range?

Dec 26, 2009

I've got a variable called coins which contains the amount of coins you have.I've also got a movieclip called customer_marker_mc which I want to change color depending how much coins you've got...I want 100 (or more) - 91 to give one color and 90 - 81 another and so on.[code]...

View 6 Replies

ActionScript 2.0 :: How To Make A Switch

Mar 15, 2011

how I could create a switch in Flash. I have the movieclip, but I don't really know how to program it. I want it to work something like: if hitTest with "char" (our character) and the user is pressing space then gotoandstop(2);. Obviously, that's just the basic idea of how the switch would work EDIT: Here's my current code:

[Code]...

View 0 Replies

ActionScript 3.0 :: Can't Switch To Page?

Mar 2, 2012

I followed a tutorial about how to create a simple website..The buttons i've created SHOULD fade out the current page and fade in the new page. In it's current state it fades out the m1 instance (mainmenu_mc) but won't fade in the new page selected(p1,p2,p3orp4). After it's faded out if i click in the same area the button was the mainmenu_mc page flashes onto the screen. and when i let go of clicking it, dissapears again.

Code:
var m1:mainmenu_mc =new mainmenu_mc;
var p1:page1 =new page1;
var p2:page2 =new page2;[code]......

View 1 Replies

Switch Language To English?

Jun 6, 2009

I installed the new Flash Builder.Does anybody know how to switch the language to english?Looks like the installer installs eclipse in the langauge of the os.in my case that was german.I know you can change the language for FlashBuilder in Windows by editing one of the dll's. How to get the same result on MacOs?

View 1 Replies

ActionScript 2.0 :: The Switch Statement - How Does It Look Like?

Feb 13, 2005

is there any switch statement in actionscript? if there is, how does it look like?

View 3 Replies

IDE :: Switch Animation Per Time Of Day?

Mar 27, 2009

I have a job where the client wants to switch an animation (movieclip) on the stage between the times of 10 a.m. and 12p.m. EST then the off time will just revert back to the original animation.

View 4 Replies

IDE :: Buttons To Switch Between Clips?

Jun 26, 2009

I need to include a swf file on my client's web page. The swf file includes 4 movie clips appearing one by one. Each clip links to their designated page. I want to have small buttons to let viewers to click and switch to the clip they want. When click, the still shot (may be the last frame) of the clip appears. [URL]

View 4 Replies

IDE :: How To Switch Off Stroke Color

Jan 20, 2010

How to switch off Stroke Color in Flash CS4. I am a learner.

View 2 Replies

ActionScript 3.0 :: Make Switch From As2 To This?

Jan 28, 2010

I'm trying to make the switch from as2 to as3 and I'm having a hard time.

View 3 Replies

ActionScript 2.0 :: How To Switch Off The Pen Tool

Feb 5, 2010

I've been having a problem for the past month or so, and for the life of me I can't work out how to switch off the pen tool I have in actionscript. I have the following code in frame 2, and frame one doesn't have anything, meaning it doesn't allow the user to draw. However, after returning to frame 1 from frame 2, you can still draw. Is there anyway to turn off this drawing actionscript completely when going back to the first frame?

[Code]....

View 2 Replies

ActionScript 2.0 :: Switch Between 2 Sounds?

Feb 19, 2010

How would I switch between 2 sounds in Actionscript?I need something where depending on a Boolean, a certain song is playing (a loop) and every time you switch, it saves the time so when you go back,instead of it starting at the beginning,it starts where last stopped.Say I was playing Sound one and stopped it at 0:25.And when I went back to Sound one it started at 0:25.

View 2 Replies

ActionScript 2.0 :: [CS3] : Making A Switch (button)?

Feb 18, 2009

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:

Code:
switch1.onPress = function() {
switch1.gotoAndStop("on");
_root.onEnterFrame = function() {

[code]....

is there a way to make it so that the switch works continuously, not just one time?

View 1 Replies

ActionScript 3.0 :: Switch Case And Text?

Mar 18, 2009

I need to replace some text - it's actually a bunch of textInput area data captured and placed together {inputArea1.text}{inputArea2.text} style - and have it placed in an mx:Text text="{inputArea1.text}{inputArea2.text}".So I have the smart idea to pull a switch case, where the case condition is the id of the canvas and it's pulling from the textInput areas.My output from the aforementioned string into my text just yields: Code:function Function() {}I complete this, I can sleep.

View 11 Replies

AdobeFlash : Using Scenes To Switch 1 Scene To Another

Mar 19, 2009

i do not possess any knowledge in using of scenes and i got a proj which requires me do so and i been using the alpha-ing and tweens to do the button switching its really tiring and confusing

so can anyone enlighten me on how to use scene to do switching of 1 scene to other along by using a 'next button' and 'previous button'

View 1 Replies

ActionScript 2.0 :: CheckBox As Switch For Button On/off

Jul 23, 2011

never really used checkBoxes much and wondering what the best AS2 is to use one as a "switch" ?

i.e. place a checkbox which is default unchecked and if the user checks it {do something} and if the user then unchecks it {undo that something}.

I'm thinking about the _alpha of a button or an MC as an example / test.

Check the box: anMC = _alpha 100, unchceck the same box: anMC = _alpha 50.

I'm happy either way with code on the checkbox or an even listener on a frame (preferred) but would like to learn how to use checkBoxes as a switch.

View 2 Replies

ActionScript 3.0 :: Add Tween To Switch And If Statements?

Mar 10, 2009

In this example, is there anyway to fade in and out 'mcContactAmer' and 'mcY' as well as place them at specific coordinates, other than externally load them as swfs? This is the only thing holding me back from moving forward on this project and my boss would like to move forward,

View 3 Replies

ActionScript 3.0 :: Using Buttons To Switch To Different Scenes?

Dec 8, 2009

I am working in CS4 and am trying to use AS3.0 to make buttons that go to different scenes. I am not using "Scene 2" in my AS; instead, I am labeling frame 1 of Scene 2 and am using that frame label in my coding.
 
Unfortunately I cannot get it to work properly. I am about 8 hours into trying to fix it and cannot seem to get it resolved.
 
I have attached the .fla file for your reference. I have also pasted my AS coding below in case it is a simple thing (probably not!). The movie needs to stop at a certain frame so the buttons are available for the users. 
 
stop();
btn2_btn.addEventListener(MouseEvent.CLICK, showimage);
function showimage(event:MouseEvent):void {

[Code]....

View 2 Replies

ActionScript 3.0 :: Switch Statement For Flash CS3

Mar 11, 2010

I currently have a code of a switch statement for as1- as2.[code]This code is for a dynamic tet with the var 'hint' (No ' ' )But in as3 there is no var and I am having trouble converting it to AS3 coding, can someone show me the correct conversion of the code to make it work with AS3. I will make the instance name 'hint'.

View 7 Replies

ActionScript 1/2 :: Use Switch In Reference To An Array?

Mar 18, 2010

I have an array which changes with a pop and a push on button clicks:
 
var nextLoad = ["img0"]; It will always contain img0, or img1, or img2, etc
 
Then I'm trying to control another element on the stage by checking which img# is in the array:
 
trace (nextLoad); // this correct shows the new value in the array

[Code]...

View 5 Replies

ActionScript 3.0 :: Function To Go To The Next Case On The Switch?

Apr 19, 2010

i have created a switch that assign different case to different toggle  buttons. so when each case is activate, it loads a different swf.so  far it works fine..It's going to be like a sub menu thing, the toggle  button remains activated so viewer know which page they are at right  now..until they click the next toggle button..so on and so on.

[Code]...

View 5 Replies

ActionScript 3.0 :: Button To Switch On A Video?

Jun 7, 2011

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;

[Code].....

View 11 Replies

ActionScript 3.0 :: Evaluate An Expression In A Switch?

Sep 7, 2011

So why can I evaluate an expression in a switch like so:

[Code]...

If I trace vidList[currentIndex].video before the switch I get "city" but tracing vid after the switch I get null Quickly solved by just assigning to a variable and then using that in the switch... but it still seems odd I can't just do it directly.

[Code]...

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved