ActionScript 2.0 :: Dynamic Variable Names When Out Of Root?

Jan 11, 2010

This is an example of the kind of issue I'm trying to solve. Say I'm looking to set 10 text fields (text_field_1 to text_field_10) within my movie clip 'myMovieClip' to the value of i. Now if the for loop and the text fields are in the place (_root) all I would have to do is:

ActionScript Code:
for (i=1; i<10; i++)
{

[code]....

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Dynamic Names For Class And Variable?

Sep 20, 2009

How do you make a new instance of a class with a dynamic name.

var dynamicname = new dynamicname()

i try something

var this["test"]:Class = new ["Test"]()
 
but offcourse its not this...

I need this couse i have a librairy with SWC fonts they are only reference.. I get the font name from a CSS file and after i need to make a instance of the SWC file so the font is embedded.

View 3 Replies

ActionScript 2.0 :: ASP And Dynamic Variable Text Box Names

Nov 23, 2005

Having a problem with a Flash/ASP/Database project.I've seen tutorials that pulls address book listings dynamically from the DB. When you hit "next" button it just populates dynamic text fields with variable names like "name" "address" with the appropriate info. Problem I'm having is.. what if you want to display all the entries on the same screen.If the variable names on the dynamic text fields are hard coded named "name" "address" "phone number" etc. , how can the second set of info display underneath the first one properly and not just pull the same text from the first record into the text fields? (name2, address2, etc.)

Is there a way to dynamically change the variable name of a dynamic text field? I'm thinking you should be able to have it note how many records there are, then loop until it reaches the end of the record set. So, can the variable names be dynamic so it will populate the text fields with the appropriate info?

View 1 Replies

ActionScript 3.0 :: Dynamic/unique Variable Names In A For Loop?

Jun 24, 2009

am trying to load xml and make button for its length, and try to make function for each button i have i make buttons and i give them a unique name , but i can't make function for every one?here is the code
 
/////////////////////////////
var xmlLoader:URLLoader = new URLLoader();var my_Arr:Array= new Array();var arr_posX:Array =new Array();//= ["350","350","350","350"]var arr_posY:Array=new Array();//= ["80","120","160","200"]xmlLoader.addEventListener(Event.COMPLETE, showXML);xmlLoader.load(new URLRequest("Models.xml"));function showXML(e:Event):void {    XML.ignoreWhitespace = true;    var songs:XML = new XML(e.target.data); 

[code]....

View 3 Replies

ActionScript 3.0 :: Dynamic/unique Variable Names In A For Loop

Oct 4, 2011

im trying to load xml and make button for its length, and try to make function for each button i have i make buttons and i give them a unique name , but i can't make function for every one ?

/////////////////////////////
var xmlLoader:URLLoader = new URLLoader();var my_Arr:Array= new Array();var arr_posX:Array =new Array();//= ["350","350","350","350"]var arr_posY:Array=new Array();//= ["80","120","160","200"]xmlLoader.addEventListener(Event.COMPLETE, showXML);xmlLoader.load(new URLRequest("Models.xml"));function showXML(e:Event):void {    XML.ignoreWhitespace = true;    var songs:XML = new XML(e.target.data);   

[code]....

View 2 Replies

Flash :: Dynamic Variable Names In Static Function?

Dec 14, 2011

Is there any way that you can have dynamic variables inside of a static function considering that you can't use "this" inside a dynamic function.

What I am trying to do:

public static function convertToDynamicString(pString:String):String
{
if(pString == "" || pString == null) return "";

[Code]....

View 3 Replies

ActionScript 2.0 :: Dynamic Variable Names When Loading Objects?

Jan 19, 2009

I am trying to create a new "BitmapData" object via a variable name. The following code is an example of what I am trying to do, but of course it doesn't work.
Code:
import flash.display.*;
this.createEmptyMovieClip("bmp1", this.getNextHighestDepth());
var BitmapNAME = "bmpData1"
var BitmapNAME:BitmapData = new BitmapData(200, 200, false, 0xaa3344);
bmp1.attachBitmap(bmpData1, 2, "auto", true);

View 4 Replies

ActionScript 2.0 :: For Statement Using Incrementing Variable - Dynamic Names

Dec 10, 2004

I have a for statement, using an incrementing variable "a." A dynamic amount of herbs are generated, so here is the for statement.
Code:
for(a=1; a<_global.herbAmount+1; a++) {
var herbMC = _root["herb"+a];
trace(herbMC);
}
When I trace "a," it traces 1, 2, 3 or however many numbers there are up to the global herbAmount number. When I trace _root["herb"], _level0.herb pops out. When I add "a" onto _root["herb"], undefined is traced....why?

View 8 Replies

ActionScript 3.0 :: Instance Names And Variable Names: It Goes Deeper

Mar 20, 2011

I started a thread about a reference to a symbol House, in the output window, which was: House_1. A lot of people said some useful things about that. All day I've been thinking about it, and I came to the conclusion that I don't understand things, at a very basic level.

Consider:I make a movieclip which I give the Symbol name Drawer. (I don't export it for AcitonScript.)On the stage I manually place two instances of this Symbol. The first one I give the Instance Name drawer (in the properties panel). The second one I leave nameless.Now if I trace the names of both these clips, by

trace(this.getChildAt(0).name);
trace(this.getChildAt(1).name);

the output window gives me

drawer
instance2

Now I know that the so-called "instance name" which I gave in the Properties Panel (drawer) is, in reality, a variable name which Flash gives my first instance behind the scenes. And instance2 is a name that Flash gives my second instance. What exactly the nature of that name is, I do not know.My point is: both names (drawer and instance2) are the .name property of these movieclips. Otherwise I could not have traced them through asking for the .name property, in the above. Yet only the first of these two can be manipulated:

drawer.x can be set;
instance2.x can (as we know) not be set.

But...why? What is the real difference between these two kinds of names? How can they both be the .name property of their underlying movieclip, yet be of such a different nature? What IS the nature of the instance2 name? If it's a String, how come the .name property of one movieclip can be a variable name, while the .name property of another (but identical) movieclip is a String?

I've searched every bit of web page on the net I could find. But it looks as if nobody addresses this issue. We all just work with it - but it makes no bloody sense. A name property = a name property, you'd think. Whether Flash set it or I set it should not make a difference. The x property of a clip, for example, does not change in nature according to who set it - me or Flash.So, again, just to emphasize the problem: how can a property (the name property) of a movieclip change in NATURE depending on who set it? After it's been set, shouldn't the name property of a clip be of exactly the same nature as the name property of another clip?

View 8 Replies

ActionScript 2.0 :: Pass URL String From External File To AS Variable (dynamic File Names)

Nov 17, 2004

I have a movie player that works fine when i hard-code the url value in the video function, but when i try to pass that url/file path from an external file, the video doesn't load. I suspect that there is something i'm doing wrong with the quotes. What am i doing wrong?

[Code]...

View 5 Replies

ActionScript 3.0 :: Combine Multiple Variable Names Together To Target New Variable?

Jan 31, 2012

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]...

View 2 Replies

Actionscript 3 :: Combine Multiple Variable Names Together To Target New Variable

Jan 31, 2012

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)

So my buttons as well as loading the image have the event listener:

image1_btn.addEventListener(MouseEvent.CLICK, setCurrentSelection);
image2_btn.addEventListener(MouseEvent.CLICK, setCurrentSelection);
(and so on..)
function setCurrentSelection(e:MouseEvent):void {

[Code]...

So within the rotateClockwise and rotateAntiClockwise functions i need to be able to recognise which is the currently active loader and have that number instead of the X - so if it is image1_loader - it needs to be image1_content, if 4 - image4_content... I had tried to do it as this but it doesn't like it being a string:

rotateAroundCenter((activeLoader+'_content'), 10, ptR);

View 3 Replies

ActionScript 3.0 :: Combine Multiple Variable Names Together To Target New Variable

Jan 31, 2012

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)So my buttons as well as loading the image have the event listener:[code]So within the rotateClockwise and rotate Anti Clockwise functions i need to be able to recognise which is the currently active loader and have that number instead of the X - so if it is image1_ loader - it needs to be image1_content, if 4 - image4_content.I had tried to do it as this but it doesn't like it being a string:[code]

View 3 Replies

ActionScript 2.0 :: Create Variable Names Using My Percentage Variable?

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

ActionScript 3.0 :: Dynamic Hit Testing Against Dynamic Instance Names?

Jun 22, 2010

Ok, Background. I have two objects both of which im spawining in though code. We will call them bullets and wolves. They have their own .AS files which tells them everything they need to know about themselves. I figured i would do most of the hit testing on the bullet.AS file, hit testing against the wolves as there were going to be a set number of wolves but not a set number of bullets.o, I named them by running a loop and putting the linenewWolf.name = i.toString();Yes, new wolf is a declared variable, and i is the name of the variable that makes the loop run. I also have a test in it, and it works fine.

However, The hit testing is where i come into an issue. Remember, its on a seperate .AS file. The wolf maker and namer is on the main flash page.The hit testing function isif(this.hitTestObject(a)){i changed up my variable name to run a second loop. first variable name is "i" and the second variable name is "a"And for some reason i get a type error 1034, which from what i understand is an error that you get when two instance names are the same. Also, If possible, i would like to add letters to the name of the object, but im not sure if flash will let me as i belive the code would look something like this

View 1 Replies

ActionScript 2.0 :: Send Variable Outside Of A MC To Root?

Nov 30, 2008

I brought a pre-built shopping cart and I'm trying to put some buttons in another MC but when I click them the cart don't update.

The original setup of the cart was:

The 'Add to cart' buttons are on the root and the cart was inside an MC also on the root.

Now I understand that it's not not working due to me moving the buttons into a MC.[code]...

View 10 Replies

ActionScript 3.0 :: Access To Variable In Root

May 29, 2010

I have a button in the frame 1 when i clicked it,it goes to the nextframe in nextframe i have movie clip named "circle". in frame 1 in action layer i have variable named "i" it has a number equal 20; now i'm in "circle" movieclip in the action layer i want to write a command for checking "i" if it's equal 20 the "circle" movieclip play but i can't find "i" how can i access to "i" variable in frame 1 ?

View 4 Replies

ActionScript 2.0 :: Using XML For Variable Names?

Jun 19, 2007

I'm attempting to build a menu using a XML. I have read the tutorial on the site and I am attempt to do it in a slightly different manner. Anyways, I am trying to make dynamic variable names for my text fields. And because of the way I am doing this I found it easier to try to use XML to hold the field name. But when I try to use the name from the XML file it won't work. I can trace it and get the proper word but when used in the script it breaks.Below I want to replace 'popMenu' with the fieldName variable.

Code:
mainMenu.menu1.onRollOver = function(){
listLength = menu_xml.childNodes[0].childNodes;

[code].....

View 1 Replies

AS3 :: IDE - How To Concatenate Variable Names

Nov 24, 2007

How do I concatenate variable names in AS3?Something like this:

for(var i:int=0 ; i<5 ; i++) {
var "myVar"+i:Array = new Array();
}

View 5 Replies

ActionScript 1/2 :: PHP Variable Loads On Root Text - Need To Put It On MC

Aug 20, 2009

I get a variable from a PHP like: "MyMessage". But I need to put this textfield on an MC, could you tell me what I need to do to lead this variable into the MC? (In a graphic object works ok but I need MC to control its X, Y).

View 5 Replies

Actionscript :: Can't Access The Variable From Root Timeline

Mar 11, 2011

I created a movieclip called holder in my Stage and I name it, inside them i put a variable called

name = "whatever"

Now I can't access the variable from root timeline, I try this:

trace(holder.name);

The result gives me undefined! what mean this?

View 1 Replies

Flash :: Expression For The Root Variable In Swf File?

Jan 29, 2012

I know nothing about flash. I only need to change a few variables in a swf file. the swf file uses ../ for root directory, so, when I play this swf from other places than its designed directory, it will querry wrong URL.Edit: the swf are in this directory:root/domain/content/swfthe swf file has some ../url to querry files under the content directoryroot/domain/content/stuffs/items/filesIf I play the swf in another directory, for example, root/domain/topics/stories/jokes/then, the swf will querry root/domain/topics/stories/jokes/files, this is wrong. So I want to use a fixed expression to replace ../

View 1 Replies

Actionscript 3.0 :: Grab A Variable That Is Declared In My Root SWF?

Mar 12, 2009

I'm trying to access Flashvars that I declare in my HTML from a SWF that gets loaded after an intro animation.

I am able to access one of my Flashvars in the opening SWF just fine, but when the next SWF loads, I'm unable to access my Flashvars.

HTML Code Snippet: Code: Select all<script type="text/javascript" src="js/swfobject2.1.js"></script>
<script type="text/javascript" src="js/swffit.js"> </script>
<script type="text/javascript" src="js/swfaddress.js"> </script>[code].......

Am I not targeting it properly?Alternatively, I've tried storing the flashvars URL in a variable in my root SWF and accessing it from the loaded SWF, but I can't seem to grab it. How would I grab a variable that is declared in my root SWF?

View 1 Replies

ActionScript 3.0 :: Use A Variable In Root For Nested Movieclip?

Jun 10, 2009

I want to use the same movieclip different times (different instances). The only thing that has to change in this movieclip is a string. I tried to solve this creating a variable.To be more concrete, on root timeline i have Code:var RespJpeg:String = "bandlang2.jpg"and inside the movieclip (actually inside a movieclip in a movieclip in a movieclip in a movieclip: 4level nested) i have

Code:
loadImage("RespJpeg")
This obviously didn't work. What i tried was the following:

[code].....

View 6 Replies

ActionScript 3.0 :: How To Target Variable Defined At Root

Jul 13, 2009

I want to find out the value of an index of an Array defined on the main timeline, from within a MC on the stage. In AS2.0 this would be as simple as trace(_root.mk_contArray[0]). In AS3.0, naturally something like trace(root.mk_contArray[0]) just doesn't work, nor any other variation I've tried. Is it something to do with addChild()? This instance is named, but I haven't used that method.

View 3 Replies

ActionScript 2.0 :: Passing Variable From Root Timeline Into MC?

Aug 15, 2009

I'm guessing this is pretty simple, I just can't find the solution through my google searches.

Bascially I created a variable and gave it a value in the first frame of my main timeline.

Now I just want to pass that variable into a MovieClip. When I trace the value of the variable within the movieClip I get undefined.

Is there something else I have to do to make it recognize the root timeline's variable?

View 1 Replies

ActionScript 3.0 :: Evaluate A MovieClip(root) Variable?

May 21, 2010

[Code]...

"newbie" is the name of the var ( a URL )and the trace function works ... so that being said i know the function has access to the variable the problem is w the

Code:
URLRequest( MovieClip(root).newbie )how can i get this to evaluate as a URL ...

heres the error i get:

TypeError: Error #1034: Type Coercion failed: cannot convert "http://www.yourfacesucks.com/newbishness" to flash.net.URLRequest.

at ShattrF3_Alpha_fla::squareExpand_WEB01_53/openPage()

View 3 Replies

CS3 : Automatically Assign Variable Names?

Jan 27, 2010

I'm working on a project using google maps. For part of it the user must enter coordinates and click a button in order to add a marker to a map. The code I have written so far allows this to be done once:

play_btn2.addEventListener(MouseEvent.MOUSE_DOWN, submitdata);
function submitdata(e:Event){
var marker9:Marker = new Marker(

[code]....

As it is the only one marker can be added as it keeps getting replaced. I want to make it so that the variable name changes each time a marker is to be added.

View 2 Replies

Flash :: Use Variable Names In Actionscript 2?

Feb 19, 2011

I'm looping over an array named shopData and need to use values within that array to create new variables. Inside the loop, I'm trying something like this: shop_(shopData[i].shopName).keyword = shopData[i].keyword; but I'm having trouble with the portion in () and can't seem to find the right syntax for this. Assuming shopData[i].shopName = "foo" I need to create a variable named:

[Code]...

View 1 Replies

Flash :: How To Concatinate Variable Names In AS2

Jan 27, 2012

I'm trying to loop through a set of textFields that I created in the Flash IDE, and named them through the property panel with name called "dot_text1, dot_text2, etc...). These textfield elements are nested in another movieclip called "bouquet".

My issue is that I'm trying to loop through all of them and store them into an Array for later use, but I keep getting undefined when I trace it out. I'm writing the script in the root of the file.

[Code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved