Actionscript 3 :: SWFAddress, Writing A Switch/case For More Than One Level Deep?
Sep 21, 2010I'm using the following switch/case for SWF Address:
switch (e.value)
{
case "/A" :
[code].....
I'm using the following switch/case for SWF Address:
switch (e.value)
{
case "/A" :
[code].....
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]...
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?
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]...
I'm trying to get to grips with SWFaddress and struggling a littleJust trying to work out how to place the mc buttons into one movie clip.The code on the mc buttons is :
Code:
this.deepLink = '/about/';
this.onRelease = _parent.btnRelease;
[code]....
Yo. Im trying to get deep linking working with a flash website im building. Im using SWF Address (asual.com/swfaddress). In my code I can set and get the current address value my using SWFAddress.setValue(), and SWFAddress.getValue(), but I can't for the life of me get the address bar to update accordingly.
View 4 RepliesI have swfaddress (2.4) working fine on my site - the back button works, I can copy and paste urls and be taken to the correct page, etc.BUT, if I copy a url, say and paste it into a new browser window, the site always just loads to the home page after the preloader. What am I missing? Do I somehow need to check the url when the page loads?
View 1 RepliesI have sucessfully built a swfaddress site that works fine when you are navigating about, but if you go to a new url and then use back to return to the site, it goes to the correct frame, but the movie behaves as if it has lost some of the settings I made like stage.ScaleMode, and some of the functions and variables I defined on the main timeline are suddenly gone. The same thing happens when I paste in a direct link. The movie successfully goes to the page, but anything I've defined on the main 'actions' layer doesnt take any more.
View 5 RepliesI'm implementing swfaddress in my project, which starts with a main swf with various menus. When a menu item is clicked, it signals a url change, and the url change loads a corresponding external swf. All works swimmingly here. But... what if I wanted to have another menu from within the loaded external swf, and have that have its own loaded external swfs, url change etc, as well? For example, on my home page, there is a menu item called "news".
Once "news" is clicked, the url changes and loads a "news.swf" into a holder on the main swf. Now, in the "news.swf" there is yet another menu, this one with two buttons: one button says "Article 1" and the other "Article 2" and each would signal a URL change and load "article1.swf" and "article2.swf" respectively when clicked. Is there a way to get the menus on the external swf to communicate with the swfaddress that is happening from within the main swf so that every swf has it's own url address and different events triggered by that change? so the url for article 1 would look something like [URL]
I have my test site at alenelias.com/home2.html and I'm using an old AS2 class for the buttons to do the up, over, hover, selected states.When you click the back button on the browser, the selected state doesn't change and I can't figure out how to fix this and it is the most important problem here.The title of the pages has the forward slashes as well and tried to change it with no luck.And third if I keep clicking back, once I reach the intro page (loader in a different scene), if I press forward, the url changes but the page does not. Not a huge deal but would love to solve that as well.I recently looked at a form (blog.deconcept.com/2006/10/25/swfaddress/) and noticed this url spirituc.com which is very similar to my site but has the problem(s) fixed.URL...
View 0 RepliesI want to find only the first level of children. Right now I'm using e.target.name but this is also catching those targets children. How would I prevent this?
View 2 RepliesI 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 Repliesi 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]...
ActionScript Code:
function changeBox(event:MouseEvent):void {
switch(box.boxclass.whichboxvar) {
[code]......
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].....
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]....
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.
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.
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].....
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]...
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?
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]....
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]...
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]...
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]...
i have the following switch case:
switch (appModel.currentPage){
case "Programma":
case "Winkelwagen":
case "Films":
case "Contact
[Code]...
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.
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].............
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] .....
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]...