IDE :: Can't Create A Variable
Jul 28, 2009
I'm trying to declare a new variable within it, but its not working... When I list the variables after, they have not been added?
[AS]var curDepth:Number = 0;
var someNumber:Number = 9;
function makeImage(){
[code]...
View 2 Replies
Similar Posts:
Jan 3, 2006
f you know PHP...then you know that you can create a string variable...and then use the value of that variable to declare another variable. like this:
PHP Code:
<?php$foo = "haha";$i{$foo} = "success";print $i{haha};?>
and it would display "success"...or like this:
PHP Code:
<?php$foo = "haha";$$foo = "success";print $haha;?>
and it would also display "success".
View 6 Replies
Dec 4, 2005
I'm currently working on an advanced preloader and i'm creating loads of different variables etc. based on the percentage loaded. I need the variables to be named Number + percentage, so in the end I will have Number1, Number2, Number3, Number4 etc. How can I create variable names using my percentage variable? Can't seem to find anything that answers my question.
View 2 Replies
Jan 28, 2010
I want to be able to have a number displayed on the screen that when one of the arrows next to it (up/down) is clicked it adds 1 to the original number (lets say 72). Then when they click the "save" button that really just takes them to the next frame (or a frame somewhere else in the movie), which is a confirmation page, I want the number they ended at to display on the confirmation screen.
I'm thinking that it is partially because I don't know what to search for.I know I have to create a variable and get the button to add one to that variable.
View 2 Replies
Feb 24, 2010
I have a [code]...
in the end of code i have 2 variables 'iconFace' and 'splice'.This variables without var.. so first question this is ok practice?
Second question: maybe need create 2 classes for this variables? and in class declare variable?
View 8 Replies
Aug 8, 2009
I want to create several "buttons" (which are actually MovieClips) that are all identical apart from an image and the link. My thought was to create a movieclip button that contains a var that will represent a movieclip, then in each instance of the movieclip button set that variable to be the movieclip image that will correspond to the button.
Geez my query seems so simple until I try and put it into words...The gist of it is, how do I name a movie clip variable? Something like, in the main movieclip, instead of inserting a specific image into the movieclip, insert a variable named innerImage, then in each instance of that movieclip name the image to be inserted by specifying the variable
var innerImage:MovieClip = the movieclip I want for this instance.
If the var was a number, it would just be:
var innerImage:number = 4;
If the var was a string:
var innerImage:string = "word";
So for a movieclip:
var innerImage:MovieClip = ???
View 10 Replies
Jun 30, 2010
Is it possible to create variables with a function? I don't mean create my own variable in a function but actually have the function create a unique variable name (eg. exam1, exam2 and so on) they would all have the same data type.
View 1 Replies
Dec 13, 2010
I want to create random objects on to the stage through and xml.
If u refer the image attached. each circle represents a data from the XML.
i want these to get generated on to the screen randomly with easing animation.
note: circles should have random 3-4 colors as mentioned.
View 3 Replies
Feb 7, 2011
I have an XML variable with a bit of content and I want to completely overwrite that content.I thought by calling "new XML" that I'd have an empty variable and could replace the content.Is that not the case?If it's not what method would I use to overwrite the variable content?
View 11 Replies
Jan 17, 2010
I need to know how I can parse a variable path in Flex 3 & e4X. For example, I have two XML strings where the name of one element is the only difference.
[Code]...
View 3 Replies
Mar 17, 2011
I am trying to create a xmllist variable in action script like this:
var _menuData:XMLList;
<menuitem label="File">
<menuitem label="Backup Schedule"/>
[Code]....
How do I assign this xml to _menuDAta in actionScript? I dont want to create a string first and then do it all by fixing line break errors.
View 1 Replies
Feb 18, 2011
Is it possible to create a function that creates variables?[code]...
View 5 Replies
Sep 30, 2011
[code]...
Basically, I need to create variables with dynamic names. How might I go about doing this?
View 3 Replies
Oct 6, 2011
i'm new to flash, as & xml and have to create a litte quiz game. now i have a problem, i don't know how to create a variable in as2 from xml data. i want to create a variable called flags, it should read in the xml file the attribute flag, if true or false.
[Code].......
View 9 Replies
Apr 11, 2006
ok so this is probably really easy. But how do you add a random end to a variable like say
Code:
for(i=0; i<5; i++) {
d = i;
}
but I want the variable not to be d but it create a new variable each time so I can
[Code]...
View 3 Replies
Jun 13, 2008
I need to set a variable and create a loop with this to optimize.I can get it to trace what I want, but the code isn't working properly.
mainAccordion.s1.menu_btn1._alpha = 90;
mainAccordion.s1.menu_btn2._alpha = 90;
mainAccordion.s1.menu_btn3._alpha = 90;[code]....
View 3 Replies
Oct 7, 2004
I need to create a variable and declare it (I presume you need to declare in Flash?)Basiclay my buttons on the site will link to lots of different movie clips which contain content for each button. For example teh About button will tell the about MC to play. For my transitions though each MC has a beginning, middle and end seqence so i wangt to create a varibale that goes something like this. I am wriing in my crazy logic not actions cript. "MyCurrentMC" is my intended variable and is the name of a movioe clip (instance?)
[Code]...
View 6 Replies
Feb 18, 2009
How do I create an instance name that includes a variable?
In AS2 I could use:
i = 0;
_this['btn'+i].name = 'btn'+i;
How would i do that in AS3?
View 2 Replies
Oct 20, 2009
I just started in as3 after a long break from flash and I have run into a slight problem and couldn't find any readily available solutions online so I thought I'd ask, I'm trying to do something like this:
Code:
switch(characters[ps[1]])
{
case 0:
[code]....
I want to create a different object of the same variable name with the switch statment but it gives me "1151: A conflict exists with definition player in namespace internal" which is of course because I'm redeclaring the variable. I'm not 100% sure it technically exists in the current scope though (but it must because I am getting this error.) I also tried a few ways of initializing as just MovieClip up topside and then just try and typecast it down here but as can be assumed that didn't work either.
Is there a way to get my intended effect or am I gonna have to make some like an above class containing all these other classes on it's various frames and just instantiate those?
View 3 Replies
Mar 10, 2010
I have a question regarding the use of variable identifiers when using SharedObjects, I will explain. I want to have the identifiers of a SharedObject as variable names, so: I create a variable: var destinationLoc = ["destination"+mySharedObject.data.numRuns]; I write to SharedObject: mySharedObject.data.destinationLoc=destination;
Unfortunately the above script does not see the variable, destinationLoc as a variable and instead views destinationLoc as a "hard-coded" identifier Is there a way to create a variable sharedObject identifier?
View 2 Replies
Aug 21, 2010
create and send a variable called "return." But that conflicts with a word used in actionscript.[code]is there anyway to work around this naming conflict?
View 1 Replies
Apr 15, 2012
I am trying to have a more dynamic function and would like to allow the functions instance name were it outputs the text to be changeable.for example
function example_function(url,instance_name){
instance_name.text = url;
}[code]....
View 2 Replies
Nov 7, 2010
how to create an object if the name is stored in a variable.
var className:String = 'Config';
var MySprite:Sprite = new ???
class Config extends Sprite {
...
}
View 1 Replies
Feb 21, 2012
I am trying to pass a variable to a method in one of my Classes so I can use it to create the correct movieClip (image).
My Class code looks like this:
package {
import flash.display.MovieClip;
import flash.display.Sprite;
public class SlideShow extends MovieClip{
public function SlideShow() {
[Code] ....
I am getting the following error:
SlideShow.as, Line 30
1046: Type was not found or was not a compile-time constant: Background.
View 1 Replies
Aug 7, 2009
I have created a function that creates a pop-up text box: I have named instanceName as a String but sadly it doesn't work. The only way I can get it to work is to name the instance within the function. Is there any way of creating a variable for the instance name? [code]...
View 3 Replies
Jul 12, 2010
Is there a way to get something that would do this?
ActionScript Code:var newPlayerObject:Object = mapContainer.map_mc.("p" + 1);newPlayerObject.x = 5;
View 1 Replies
Sep 12, 2011
I am writing a code where I am trying to create a sprite variable in one class, and create several new instances of that sprite variable in another that all need to be on the stage at the same time. For example I created a variable like this, var ball:Sprite = new Sprite(), then drew the sprite in the same class that that variable was created in, then using encapsulation (i.e. _myNewInstance:AddNewInstance = new AddNewInstance(ball)) I am trying to reference that variable and create several new instances of it in the "AddNewInstanceClass" through for loops.
View 5 Replies
Aug 9, 2009
I am just starting to learn Flash. I am trying to make a "simple" Flash menubar to add to a basic html/css site I am building, as a learning project. I figured out how to make the navigation "buttons" using frame labels and event listeners. All the nav buttons will be identical, except for an image and the link destination. I know enough about ECMA based code to be dangerous to myself, so rather than make 7 individual buttons, each with there own AS and objects, I am wanting to make it more efficient by reusing the redundant information.
This is the logic than I am trying to use:
Create a generic button named "button_mc" that has a child which is a variable instead of actually pointing to a specific object. Then, create 7 different instances of that object (button1, button2, etc), and in each instance assign the proper image (contained in a mc) to the variable that is in the parent object.The problem I am having, is that I can't figure out how to make a variable that will reference a movieclip or graphic.[code]...
View 4 Replies
Mar 26, 2010
I trying to create a global variable which apparently must be defined using a new classe.g.: I have just been adding AS code to event, etc. I have not had need to create any new classes. I don't know how to do this in AS3.I'm sure I could reference the variables from there. First of all, where do I create such a package"?Here's what I've tried so far. I created an actionscript file, buffaloGlobals.as in the com folder of my flash root. It contains the following:
package com.buffaloGlobals
{
public class GlobalVarContainer
[code]....
View 3 Replies
Jun 22, 2010
I want to create 1 variable for the Graphic's instead of the current script wit 4. I've been using an array with loop but t no avail.[code]...
View 2 Replies