ActionScript 3.0 :: Flash Is Flagging All Of The Functions Within The Switch/case Function?
Oct 25, 2010
I keep getting this message from Flash: "Scene 1, Layer 'A', Frame 1, Line 411136: Incorrect number of arguments. Expected 1." and for the life of me, I can't understand why. I simplified the name and number of the buttons called but otherwise the code is intact. Flash is flagging all of the functions within the switch/case function, telling me that an argument is expected there. Why? I've tried the switch/case functionality with other requests (e.g., trace), but I cannot make it run a function.
Code:
var clicked = MouseEvent.CLICK;
country01_btn.addEventListener(clicked, butClicked);
country02_btn.addEventListener(clicked, butClicked);[code]...............
View 8 Replies
Similar Posts:
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
Jan 20, 2009
ActionScript Code:
function changeBox(event:MouseEvent):void {
switch(box.boxclass.whichboxvar) {
[code]......
View 3 Replies
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
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
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
Nov 10, 2010
I have a set of switch case conditions. On the last one, i want it to run a function called mainMenu, so i put:
[Code]...
View 2 Replies
Oct 31, 2010
The switch case doesn't works with function. This is the AS3 code:
ActionScript Code:
var med:Number, mdi:String, op:int, tot:String;
bt1.addEventListener(MouseEvent.CLICK,yardas);
function yardas(MouseEvent:Event):void{
op=1
[Code] .....
View 1 Replies
Feb 4, 2010
Is it possible to call an independent function from a switch case?
I'm using an instance of the slider component to trigger a variable function via the switch statement.. The compiler throws an error, incorrect number or arguments.[code]...
View 2 Replies
Aug 4, 2011
I have multiple movieclips (ml1, ml2, ml3 and ml4) to which I attach various clips out of the library to. Each movieclip uses a switch statemtent then attaches the appropriate movieclip from the library... so I got thinking, why can't I do a function rather than all this scripting? And I must have had a really long weekend because whatever I try just isn't working. Here's my code at the moment....
Code:
switch (supp1) {
case "bu" :
[code].....
View 2 Replies
Aug 29, 2009
i have many buttons(they are actually movieclips) and for each i made separate listener function.. is it posible to optimize that code and make some kind of switch case inside the function. I don't know how to find out who called the function... is there way to find out. I don't want pass the additional argument with events because it wouldn't be optimization at all.I put only two buttons to reduce code:
Code:
button1.addEventListener(MouseEvent.CLICK, idi);
button2.addEventListener(MouseEvent.CLICK, idi2);
function idi(event:MouseEvent):void {[code]....
View 3 Replies
Feb 3, 2011
A quick review of the project, I am importing information from an xml file into an array. From there I have passed the information from the array to a variable.I find it that when I try to match the variable to a string letter, that it is not running through the case switch properly and going straight to the default bit. I have tried numerous solution to check where the problem lies;I have trace the actual position of the array to check if it is the correct letter I am trying to match.Did a length check on the variable that it is only 1, and not containing any spacesWhen I hardcode the letter into the variable, the case works perfectly.Any idea on why this is happening would greatly be apreciated. I have pasted a sample of the code below;
var switchTest = initialSlide_array[1];
switch (switchTest) { //switch case used to check template type
case "A":
[code].....
View 2 Replies
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
Sep 25, 2009
In other programming languages that use switch/case, I was often able to set a range. In the documentation (flash help) they do not show the syntax for this. Is it possible to do so, such as:
Code:
switch (theAnge)
{
[code].....
View 7 Replies
Oct 21, 2010
I want to create a application for a website, that can calculate a persons daily energiexpenditure. The user of the application has to put in his/her height, weight and sex. So I want the program to switch between diferent formels depending on the input given. For example the formel for a girl, age 8, 38 kg and 1.40 cm is: (0.071*38)+(0.68*1.4)+1.55
And the formel for a man, age 30, 75 kg and 1.80 cm is: (0.064*75)+2,84
how would you do the coding?
I considering making a if-else construction, that checks whether the sex is male og female. And within this if-else construction i want to make a switch case, thats switches between different forms depending on the age input.
This is what i've done so far:
ActionScript Code:
public function energyintake()
{
var h:uint = 180; // The persons height in centimeters
[Code]....
View 0 Replies
Feb 5, 2011
I've got flash page with a spherical design, cut into pieces like a pie. Underneath that I'm putting a series of square buttons that are color chips. What I'm wanting to do is be able to select a cut piece (one at a time) of the design by clicking on it (each piece is a button) and, once that piece is selected by clicking on it, be able to click a color chip button to color it.
Theoretically, I could click on the top right quadrant of the sphere design, then click on the black color chip beneath and it would turn black. Then if I decided to click on the red color chip I could click it and it would turn red, and so forth. Then after tiring of coloring on the top right quadrant, I could click on the bottom left quadrant, then click a color chip and colorize to my heart's content. Same with any other part button of the sphere that I click on. Only one part of the sphere design could be colored at a time.
What I'm seeing is that I'd need to set the individual sphere design button components as triggers, then write my own switch/case statements for the color chip buttons to say, if this trigger's selected, then color it "mycolor", etc.
View 1 Replies
May 27, 2011
I would like to use a switch statement i.e.
[Code].....
What I am trying to do is to say that the condition is if the name property has an A character in it and anything afterwards. Is this possible or am I nuts.
View 6 Replies
Mar 13, 2007
I have an array of movie clips that are placed on the stage (this works fine) but I want to give each movie clip a value so that I can check what the user types.
Ex.
Code:
_root.createEmptyMovieClip("Placement", 2);
var shapes:Array = new Array("square", "circle", "triangle");
function selectshape():String {
[code].....
View 2 Replies
Jul 7, 2010
I have an object that contains times to call a function. Would like to use Switch/Case to test against video stream time. Right now using a For loop every second to test against 50 times is causing super sluggishness. Hoping there is a better way that doesn't require so much testing. So is it possible to use a Var as a Case testing numeral? Meaning...
[Code]...
View 1 Replies
Dec 10, 2003
I am doodling at work and wondering if this is possible. Unfortunately I don't have flash in front of me so I can't test it but since my AS.
I want this on an MC:
[AS]
i = 0;
switch(thing){
case 0:
some action; break;
[Code] .....
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
Dec 17, 2008
I'm trying to use the value from a combo box in a switch case statement but it isn't working
Code:
var switchValue:int = 0;
switchValue = int(cmbColour.selectedItem.data);
switch(switchValue) {[code]....
View 4 Replies
Jan 13, 2010
I've got the following code (what it should do: on keypress, loops through movieclips, scaling each one toward center stage). However, where it says "this" is making the program think I'm referring to the stage, so it's scaling that instead. 1. How do I specify "whatever the current case/movieclip it's working on now"?
2. How do I add sound to switch case transitions/tween? (meaning when each mc is tweened or transitioned, it also makes a sound)
[Code]...
View 8 Replies
Oct 17, 2011
I have a string "52x + 60" and i want to extract 52x and 60 using regular expressions and a switch case
Is this the right way of doing it?
var equation:String = "32x + 5"
var numberExract:RegExp = /d+/
var xExtract:RegExp = /d+/x/
for(var i:Number=0; i<equation.length; i++)
[Code]...
View 5 Replies
Jan 2, 2011
i have the following switch case:
switch (appModel.currentPage){
case "Programma":
case "Winkelwagen":
case "Films":
case "Contact
[Code]...
View 2 Replies
Jan 19, 2011
after coding a custom event in AS3, i've come across a curious problem:
override public function toString():String
{
switch (type)
[Code].....
i can remedy the problem easily by adding return null; at the end of the function, but that's redundant and it annoys me that it seems to be the only solution.
why is returning a value from a switch case not seen by the compiler? is this an issue specific to the AS3 compiler or am i actually attempting something here that is so completely dangerous and adverse that it shadows counterculturists the world over.
View 2 Replies
Jan 16, 2009
I'm trying to use switch/case staement instead of if/else but it's not working. Here's the code.
ActionScript Code:
//working code
function checkTarget(drag){[code].............
View 3 Replies
Apr 25, 2011
Im trying to make a small program that convert characters into others. (it is useful when some program doesn't recognize Cyrillic characters and give back strange symbols as "_˛". The problem im facing is the impossibility to specify 2 characters under "case"
[Code]...
View 2 Replies
Dec 14, 2005
Is it possible to make a multiple switch to check more than one case at a time? I'm trying to use a case statement to check both frameName and buttonNumber to check boxes ticked for multi-choice quiz (there can be more than 1 ticked per question).
I've used various combinations but they only partially work. This is one of the latest (I'm still tinkering).
[Code]...
View 4 Replies
Feb 18, 2004
How do you do a range using switch statement in ActionScriptFor example:
score = txtScore.text
switch(score)
{
[code].....
View 3 Replies
Jun 1, 2004
I think I understand how to use switch/case conditions in Actionscript for concrete values. Can the same be done with ranges? - case > 5 - or something like that? Perhaps even - case > 5 < 10 - ?
View 14 Replies