ActionScript 3.0 :: Include Dynamic Name In Variables?
Jun 26, 2009
I am trying to loop through several lines of code and replace certain parts of the variables with a number in a loop. You can see what I have here:
Code:
for (var j:int=0; j <= bootArray.length; j++) {
switch (j) {
case 1 :[code]....
Is there a way I can trim this down? I have these cases through 7. It works the way I have it but it's obviously very poor coding. I know how to do it in AS2 but I just keep getting error after error in AS3.
I am doing a simple form "POST" and I need to include some hidden field information. My problem is that my hidden field identifiers are formatted like this: 00N3000001NzMD. So when I declare the variable I get a syntax error. var 00N3000001NzMD = "eMarketing" I'm assuming this is because you are not supposed to have a variable that starts with a numeral? The logical (to me) work around would be to do this:
i have a project to do on flash..its about laws of physics and i want to include dynamic graphs.. e.g projectile motion.. the guy enters the distance and the angle and a graph is plotted from the calculations it makes.. erm..thing is that i dont even know to make a graph in flash..now i have to make a dynamic one is there any tutorial around
I am trying to include a Variable from PHP which queries a database with a dynamic file..Obviously I have marked out passwords with "*"Here is My Php file to display the variables I need
[Code]...
What I need to do is have the flash file pull in videoid which is a string on a dynamic link from the page where the player resides. VideoID is dynamically created in the Mysql Database..how to get this dynamically into the flash file?
picture: [URL].. I am making a boardgame in flash Action Script 3 each position on the board is a buttons like this: button_1_1, button_1_2 etc. Whenever a character is selected you want to move it so the script has to add event listeners for positions around the selected unit
[Code]...
In the rest of the code I have:
function userClickedPosition(position_x:int, position_y:int) it selects or deselect a unit function selectUnit(position_x:int, position_y:int):it uses the listentoButton(1) function to add 8 listeners (the positions around the clicked unit)function deselectUnit(position_x:int, position_y:int): it uses the listentoButton(0) function to delete 8 listeners (the positions around the clicked unit)
My question: adding eventlisteners is no problem but removing them dont seem to work? What did I do wrong?
I am using an include file, and I've noticed that sometimes the the fla file does not refresh new changes to my include file. When exporting with "Ctrl, Enter" Is Flash loading the include file from the cache?
Code: function myFunction(val0,val1,val2){ trace(this["val"+0); trace(this["val"+1); trace(this["val"+2); } myFunction("hello","test","hi")
All i get is undefined. If i just put "trace(val0)" i will get "Hello" -- so i cannot work out how to get the value of the dynamic variable inside hte function?
How am i to get the variables zombData.zomb0, & zombData.zomb1 from inside the "for loop"
I want this trace command dynamic
Quote: trace(zombData.zomb+i);
it works when i put zombData.zomb0 (a variable sent from a PHP script)but if i want to make it dynamic how it is; It fails & outputs NaN How do i make it dynamic for the loop?[code]...
I am trying to create dynamic variables.I read a file where I have this strings: building, restaurant and hotel.Then, will load them like
X = building. Y = restaurant Z = hotel.
Now I want to create variables like: building = 123; restaurant = "abc"; hotel = 2.5; So on how to use the value (building, restaurant, hotel) on naming or creating variables to use them later?
eval() is a usefull method or function in javascript.. Because we may define our variables via dynamic way..! There are following code is for understanding that how can define dynamic defining variables in javascript.. And Are there a dynamic way for evaluting variables in as3 like following javascript code?[code]
I've been working in a new proyect and i came to this problem that is really getting me tired. I'm supposed to make a given number of items (constructed from an extended Sprite)[code]...
i've been trying to make stock program in flash. i searched if i could use database with as3 but i did not find any. than i created Objects in as3 and give them all their detail.
[Code]...
most annoying thing for me is as3 does not allow dynamic variables (i've searched a lot but could not find, and i dont think arrays can be used by the way). this is the whole plan. how it can be filtered (categorised)?
AS3 newbie here finally trying to make the transition from AS2. I have a little application that I am trying to build which has some basic math in it based on user input. I have the numbers stored in dynamic text boxes and now I need to have the results shown after the user hits submit.
I have this code on the results page frame.
ActionScript Code: var resultsmin:Number = Math.round((Number(devsize.text))*(Number(typemin.text))); var resultsmax:Number = Math.round((Number(devsize.text))*(Number(typemax.text)));
This probably wasn't even the best way to do it in AS2 but it worked, now in AS3 it doesn't. Something to do with the way var is used now?
A simple input text field at the end of Scene1 then displays the user name in Scene2. How do i detect if they have filled the feild in or not, if they don't I want the resulting text be different.
I have a PHP script that dynamically passes some variables to my .swf. The variables come into the .swif named like: imageCount1, ImageCount2, imageCount3 etc. I am trying to put these into an array to work with. Heres what I have so far
[code]...
The problem I'm having is when I goto .push the array it combines the strings instead of calling the imageCount variable with the correct number attached. Can anyone think of a technique to work around this or some where I can look to get an id.
How to do the: _root["file" + var] thing, I was wondering how to do a multidepth thing. I want to create a new movieclip in the location _root.scene.location called "box", and I'm using a function that I pass "_root.scene.location" under the variable location, so I could just use _root[location].createEmtpyMovieC... Unfortunately it doesn't work... I know I can use _root["scene"]["location"].createEm... But I don't need that...
Im trying to create a very generic, very easy to use TextField subclass. I want it to be useable 'out of the box' without having to set any options beforehand. I also want the ability to set all kinds of options, if I choose. I'm implementing this by having a static Object, for which you can set any number of variables.
Im looking to have something along these lines, different variables that build the path to the object so that I can have it change dynamically.I'd like to have something like:
function foo(e:MouseEvent):void { var1.var2.var3+_button.gotoAndPlay(2); }
A simple input text field at the end of Scene1 then displays the user name in Scene2. How do i detect if they have filled the feild in or not, if they don't I want the resulting text be different
Inside I have: myText1=This is test 1. &myText2=This is test 2.
I tested it out with my dynamic text. If I made the variable myText1, it loaded the first line. If I made it myText2, it loaded the second line. All seemed to be fine.
I have a dynamic textbox, variable named names. I want to be able to change the variable in order to get it to load whichever line of text I want.
But that's not working. I've tried playing around with it in various ways, like names = eval(myText1);
and such, but nothing is effectively getting it to change. I've been trying to look it up and tried all the different ways people told other people to use, but it's not working for me.
Once I get this work I everything should fall into place easily.
Passing Text Variabes to a form PHP script for emailing.If a user makes a number of selections from visual indicators on frame 1 of a Flash 8 file and textual descriptions of those selections are then actionscripted into dynamic text boxes as text values in a form on frame 2, can the text values of the dynamic text boxes be given variable names that can be sent to and processed by a server side PHP script as regular input type text box variables would be processed?
Example: User selects 3 images on frame 1 via a mouse on(release) event. the actionscript being: on(release) {[code]....
On the form frame (frame 2) would be a movie clip (form_mc with instance name form) with the normal Name, Email, Message input type text boxes along with dynamic text boxes dynamicTextBox1, 2 and 3.On the form Submit button the actionscript would be:
on(release) { var sendVar = new LoadVars (); var receiveVar = new LoadVars ();[code]...........
Would this work? All indications I have seen through many Flash/PHP email tutorials indicate not using dynamic text boxes but components like combo boxes etc use variables and not input boxes.