ActionScript 3.0 :: Creating Variable That Has A Variable In It's Name?
Apr 14, 2011
I'm getting really confused and trying to save myself alot of code, haven't been able to google a solution.On the timeline I need a set of variables for each number of TotalNumberas an example ill use the variable w
for (il = totalNumber; il > 0; il--){
var [w +il]:int = 100;
}
i have a variable take away another variable which makes answer1 variable i then want answer1 to be to the power of another variable how can i do this in flash
I'm trying to create a template for a drag and drop question. I want to assign which option belongs to the correct target.Each draggable option is called "drag1, drag2, drag3, etc.". (created on the stage) Each target is called "target1, target2, target3, etc." When a button is clicked, the correct answer is checked using a simple if loop and the user is told which ones are correct.
Code: if (drag1._y = target1._y) { //show if correct or incorrect
I need to create a variable inside a MoveClip. The easiest way to do this is to click on a movieclip in the editor and just enter the actionscript on a frame, but because i'm doing this with dynamically created movieclips i need to do it with actionscript.
PS: I'm doing it for sorting purposes in a slideshow.
I'm a few days into learning flash AS3 and I'm stuck. So i have movie clip that is made up of smaller clips, and I want to change the opacity of one of the sub clips. Here's my code so far
//MOUSE OVER EVENTS FOR PORTFOLIO ENTRIES function entryOver(evtObj:MouseEvent):void {
Topic title explains what i want to do. Say I have a variable roomNumber (a string) and in a game where i move about, roomNumber will change (say, room34 to room35). When a new room is visited i want a new instance of my class Room to be created, but with the instancename of what the variable currently is. (point is that i can go back to a previous room, without it being changed because the instance has already been created) so... roomNumber:RoomClass = new RoomClass(); well, it unfortunately works so that the new instance is named roomNumber, and not room34.
How do I create a new arraycollection that can generate a unique variable name? Like: AC+nu as in AC1:ArrayCollection AC+nu as in AC2:ArrayCollection AC+nu as in AC3:ArrayCollection AC+nu as in AC4:ArrayCollection nu++;
I'm making an infobox, and some radio buttons. When hovering over the radio buttons, text should appear in the infobox, and reset to default when mouseOut. This is my current code: Code: // Infobox var infoStart = ("Hold over et valg for - se utfyllende informasjon"); p_info_txt.text = infoStart // Radiobuttons & Checkboxes - mouseover [Code] .....
I want to create a component with a variable/parameter that is a method it calls when (clicked on for example). In "Flash UI Components.fla" the they do this and I studied the code but cant get it to work. The Push Button one has a click handler, but the way it is actually called in the script is like this: this.handlerObj[this.clickHandler](this); That bracket/parenthesis thing is not working.
This shouldn't be too difficult. Heres my code: for(i=0; i<30; i++){ var box[i]:Object = new Object() box[i].id = [i] box[i].name = "default" box[i].location = "default" box[i].type = "default" But its not working. I keep getting error messages concerning the var box[i] statement.
I've set up an XML file with names of objects that will be contained in my fla/swf library.I wish to position the objects on the stage at runtime using an XML file that can be quickly modified without having to recompile the fla/swf file. Of course, positioning can only be accomplished when the objects are instantiated and added to the stage. The problem is passing the parsed XML file name/class paring data into the var creation programaticallyThe XML file contains the object names and class: simple example follows:
I have some simple function in Flex in which I would like to send one of my variables to all the components used in my app... The problem is that there is lots of components in my app, and I'm not sure how to reference to my component's id... Basically, is there an easier way to do this;
private function preloadStuff():void{ // populating of bulkLoader var var preloaderItemsList:XMLListCollection = new XMLListCollection(preloaderItems.children()); var item:XML;
I have a question regarding AS3 memory management. Supposing I created an instance variable for a Class, in this case or type Sound: public class SoundStore extends Sprite{ var s:Sound; Then within various class functions I referenced this variable multiple times, each time I wanted to load in a new sound: s = new Sound(); Am I correct in thinking that each time I created a new Sound I would be overwriting the previous allocated memory?
A snippet of my code is [code]The first element in the mainOptions Array is linked (metaphorically) to tab1.The second element in the mainOptions Array is linked (metaphorically) to tab 2 and so on.I want to create 12 variables named AudioMP3, AudioHEAAC, NewsBBC, NewsTwitter, VideoVideo and so on down to PicsPics2. i.e concatenate each entry in say tab1 through 5 to the each element from mainOptionsArray and make a new variable using that name then assigning a number to this variable.[code]
My problem is how to call a specific tween to stop it, for example: onrollover stop the tween assigned to "barra3" mc for example. I can't use bot_alpha.stop() it doesn't work. I think it's because i have multiple "bot_alpha" tweens, i need something to dynamic create bot_alpha1; bot_alpha2; ... ...
Basically I have 2 classes, A and B. B derives from A. Inside A, I declare a static variable/constant to the class of B. When I run the program, I get a null object reference error, with the line pointing to the class declaration of B, i.e.
Code: public class B extends A
For reference, these are the 2 classes:
Code: package { public class A {
[code]...
Also, this error only occurs when the variable is static. If it's just a normal variable it works fine, i.e.
Code: private var OTHER:Class = B;
If I change the static variable to point to a different class, it's also fine, i.e.
Code: private static var OTHER:Class = Main;
I can probably work around this, but it's a bit of a pain in the ass. Anybody know what's causing it, or is this a Flash bug?
I'm trying to pass the contents of variable playnoyes to the long line of code below to decide whether or not to autoplay the flash movie, but doing it as I have below, the resultant line of code has the variable in quotes and therefore the code doesn't execute it as expected. My question is, how can I pass the variable so that the resulting line of code doesn't have the quotes around the variable value.
var playnoyes='true'; var testtext = "<script type='text/javascript'>AC_FL_RunContent ('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.[code]....
I want to declare a variable on the main timeline that can be called from anywhere in my movie. So, _global var should be the right approach. I want to declare a movie clip 'MC1' "open", or "closed" so that when it is revisited, my flash file knows the user has been there before and performs a different task from the one it does when 'MC1' was first encountered. So, i need a 'if' statement to run from the variable, when the playhead encounters the movieClip.
I have 2 movie clips, one being loaded into a container MC via "loadMovie();"In the main movie there is a variable with no value, in the external movie there are 5 frames, each with a value to update the variable in the main movie.
IE: if on frame 1, global value = 1 / if on frame 2, global value = 2 / etc etc I'm familiar with passing variables INTO an external swf, but am stumped on how to do it the reverse way.
I'm still learning flash and actionscript 3 and i am having trouble with variable and object names. I need to be able to combine variable names together (in the same way as php can combine by doing var1.var2).
My swf contains 4 loaders (image1_loader, image2_loader etc..) which are a child of (image1_content, image2_content etc.....)
I then have 4 buttons which load an image into the loader and while doing so they define the currently active loader.
Finally i have 4 control buttons - scale up/down and rotate clockwise/anticlockwise which should only control the currently active loader (as set by the buttons above)[code]...