ActionScript 2.0 :: Dynamically Assigning Variable Names?

Mar 29, 2007

dynamically assign variable names from XML? For instance, if I have an XML file with a list of variable names and their respective values, can I make my Flash movie create these variables?

View 5 Replies


Similar Posts:


Actionscript 3 :: Dynamically Creating And Assigning Names To Movieclips?

Oct 28, 2011

I have a movieclip that I need to duplicate dynamically based on an outside variable.e.g. clip1, clip2, etc This variable changes so I can't hardcode the number of times it occurs.Is there a way to dynamically create this movieclip multiple times and align it according on the screen?

View 3 Replies

ActionScript 3.0 :: Dynamically Assigning Instance Names To TextField

Mar 31, 2011

Is it possible to add a textField dynamically but have different instance name each time this is created? In other words if I have a button that whenever its click it will add a textField to the stage and assigns a new instance each time this is added.

ActionScript Code:
button.addEventListener(MouseEvent.CLICK, addField);
var inputWidth = 200;
var inputHeight = 20;
function addField(event:MouseEvent):void{
[Code] .....

Something like this but instead of textFieldName this would be different each time.

View 8 Replies

ActionScript 3.0 :: Dynamically Created Variable Names?

Jan 22, 2009

After some further testing, I found out that under Actionscript 3 XML (E4X) I'm unable to use dynamicaly created variable names...

The famous:

Code:
var i:number = 111
this["someVarName" + i] = "actual_value"
trace(someVarName111) // = actual_value

does not work for me with E4X lingo...

Code:
var myXML:XML
myXML = "...." //asume valid XML content here
trace(myXML.XMLData.@Memo_EN)

[code]....

View 0 Replies

ActionScript 3.0 :: Dynamically Creating Variable NAMES?

May 8, 2009

use a loop to create a set of variable names. The forums have figured out how to do this in AS2. This works in AS2...

PHP Code:

for(var x=0; x<3; x++) {    this["var"+x] = x;}trace(var1); // 1trace(var2); // 2 

View 4 Replies

ActionScript 3.0 :: Generate Variable Names Dynamically To Get The X Coordinate?

Sep 28, 2010

I am trying to generate variable names dynamically to get the X coordinate for many MovieClips on my stage.
 
This sort of works:
 
stop();
var End_X_mcArm01_Dot0:Array = [];
for (var Four_counter:int=1; Four_counter<=1; Four_counter++)
{

[Code].....
 
It stores the X coordinate in the variable End_X_mcArm01_Dot0[Four_counter] which is great. But I want to store these values for use later in my FLA.
 
If you turn the comment off on the second trace it errors although it appears to have created a variable called "End_X_mcArm01_Dot01".

View 4 Replies

ActionScript 3.0 :: Unable To Use Dynamically Created Variable Names?

Jan 27, 2009

It seems that under Actionscript 3 XML (E4X) I'm unable to use dynamicaly created variable names...

this is ok:

Code:
var i:number = 111
this["someVarName" + i] = "actual_value"
trace(someVarName111) // = actual_value

[Code].....

View 3 Replies

ActionScript 3.0 :: Dynamically Create Arrays With Variable Array Names?

Jun 17, 2010

i need to dynamically create arrays with variable array names.
 
for example, something like this:
  
for (var n=0 ; n < nodeContainer.length ; n++) {
nodeObj = nodeContainer[n];
var name:String = nodeObj.nodeID;

[Code]....

View 16 Replies

ActionScript 2.0 :: Load Variable Data From An External XML File And Dynamically Displays The Item Names In A Menu - Arrays - Functions

May 18, 2005

I have been working on a Flash movie that loads variable data from an external XML file and dynamically displays the item names in a menu which may then be clicked to display other dynamically-loaded content that corresponds to the menu item that was clicked. I have now come to a standstill in the project as there is something I'd like to achieve but simply cannot work out how. This is my first attempt at working with XML in Flash and one of my early attempts at using variables. What I'm trying to achieve is; once the user has viewed the item's content, they can simply click "next" and "previous" buttons to display all of the content for the next or previous items in the XML document.

I know it probably sounds simple and I'm sure some of you could achieve this in 5 minutes (!) but I can't get my head around some of the coding. I assume previousSibling and nextSibling would come into play here as well as some sort of functions which access arrays of data for the previous and next items, but I'm just not sure how to correctly put these things to use. Rather than post my code and example images of the stage up here on the forums, I've created an html page here: [URL]

View 2 Replies

Shortcut To Assigning Instance Names?

Oct 22, 2010

I have a 4x4 set of square buttons that I need to give instance names to. They will be named 'btn_1' thru 'btn_16'. Is there any shortcut to assigning the names or do I have to go through 16 times clicking on the button and clicking down to the 'instance name' text box?

View 2 Replies

ActionScript 3.0 :: Assigning Names To Movie Clips In Loop?

Mar 21, 2009

im trying to run a loop and assign all my new movie clipswith different names. i have tried .name and ._name they dont seemto be working..

for (var i = 1; i<=5; i++) {
imageName = new ImageMovie();
this.addChild(imageName);

[code].....

View 1 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 :: FMX - Assigning External Variable To A Local Variable

Sep 10, 2003

I have a LoadVars object called loadText in which an external variable is loaded from a text file. Now, the whole thing works, I just want to create a template to optimize the system, so here is what I need: The external variable (in an external text file) is called page1. I am assigning that external variable to a local variable (at this point the external text has already been loaded in loadText, of course):

[Code]...

View 2 Replies

ActionScript 2.0 :: Assigning Instance Names For Clips After "LoadMovie" In A Button Script?

Oct 30, 2003

I'm a second day action script student with a specific goal. I would like a button to load a movie clip to a specific place. I have a button with the "LoadMovie" script and it loads the movie onto level 1, but I don't know how to give whatever it loads an instance name so that I can direct it specifically where to load.

View 1 Replies

ActionScript 2.0 :: Assigning Instance Names For Clips After "LoadMovie" In A Button Script

Oct 30, 2003

I'm a second day action script student with a specific goal. I would like a button to load a movie clip to a specific place. I have a button with the "LoadMovie" script and it loads the movie onto level 1, but I don't know how to give whatever it loads an instance name so that I can direct it specifically where to load.

View 1 Replies

ActionScript 2.0 :: Dynamically Assigning MC Positions?

Jul 25, 2005

I have a navigation section built in Flash and am trying to position headers dynamically, based on variables passed from each page.

For example, the HTML on the HOME page, will have an swf with a variable like : nav.swf?dynHEAD=home

and NEWS will have a variable like : nav.swf?dynHEAD=news

then in flash, I guess something like this should work - but doesnt!

dynHEAD._x = 27;
dynHEAD._y = 211;

View 6 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 :: Dynamically Assigning Hyperlinks To Buttons

Jul 22, 2005

I have some basic knowledge in PHP and am learning XML, and basically have decided to prepare my site for the future by switching to strict XHTML / php (plus it needs to be updated anyway). It is a hybrid site with HTML and Flash elements, and each HTML (soon to be .php) page has a single .swf as the nav bar. Is there a way to externally assign hyperlinks to the nav buttons within this .swf? I've done basic external assigns (with .txt files into dynamic text boxes), but this seems a bit trickier. Basically, I want to be able to update the .swf without opening flash, changing the links, and then publishing a new .swf.

View 6 Replies

ActionScript 2.0 :: Dynamically Assigning An Event Handler?

May 16, 2005

I'm creating a photo gallery script with 3 categories (people, places, and things). The 3 categories all share the same thumbnail movie clips whose onRelease handlers I want to change depending on whichategory is selected If you look at the newCat() function at the bottom of the script you'll see my comments as to what is happening and when Apparently the event handlers being assigned to the thumbnails are using the local variable 'pict' inside the 'newCat()'function which is being overwritten each time the function goes through a loop? Does anyone know why this is happening or another approach I can take?

Code:
//set up picture categories and file names
people = ['mittens.jpg', 'penny.jpg', 'selfportrait.jpg'];

[code]....

View 2 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 :: Assigning Custom Class To Loader Dynamically

Jun 5, 2009

I have a question regarding custom classes. I have created one named HrollBtns with a some scale and alpha roll over behaviors. When I load a jpg using a loader obj. Can I dynamically assign this custom class to the loader? If I had to do this loading an object from the library ...I would first assign the custom class through the linkage prop inspector and then simply add the Child(with my class behaviours) to the stage. Loading external files dont know how to do it...

View 2 Replies

ActionScript 2.0 :: Assigning X / Y Positions To Dynamically Attached Clips

Jun 29, 2008

As you can see I am attempting to assign x,y positions to clips that are being "attached."
var clipArray = new Array();
clipArray = [189, 275, 361]; // x positions
for (var i:Number = 1; i < 4; i++) {
this.attachMovie("clip"+i,"butt_"+i,i,{_x: [clipArray(i-1)], _y: 142});
}

View 4 Replies

ActionScript 3.0 :: Variable Losing/not Assigning Value?

Jul 26, 2010

I followed a dynamic gallery scrolling thumbs tutorial and then changed it quite a bit to fit my needs.

I basically added a previous and next button and image title box.

It all works great apart from one thing.

e.g. I click on thumb 5. I then use the next button and go to say... image15. I then click on thumb 9. When I use the prev or next button again it will resume from image15, but it should then carry on from thumb 9 as that was the last change I made.

I thought this would be as simple as assigning the thumb variable value to the image number variable. i.e myID = id; but it doesn't work. my variable myID actually loses its value when I click the thumb image (I used the trace to clarify).

Here is the code.

PHP Code:

function bttnClick(event:MouseEvent):void{
bttn.gotoAndStop(1);
root.logo.visible = false;
myID = id;

[Code].....

View 4 Replies

ActionScript 3.0 :: Assigning XML Data To A Variable

Mar 23, 2009

Having a problem getting an mc to read variable data. URL...

View 1 Replies

ActionScript 3.0 :: Assigning Value To Variable From XML Data?

Sep 19, 2010

I have a problem which i hope some one can help me with. I am loading in data from an XML file. This works fine, i can trace the contents of the XML file. The problem i have is this. I want to save each attribute to a class variable so i can call upon it with a getter method.The code is below:

Code:
package XML
{
import flash.events.Event;
import flash.net.URLLoader;

[code]....

If i trace(path) inside the processXML() its displays as expected. but if i fire my getter method path() im returned a value of null.

View 6 Replies

ActionScript 3.0 :: Assigning Dynamic Variable Name?

Nov 15, 2011

I have a for loop - for (var i:int=0; i< results.length; i++)

and in this for loop a button is created - var multiplereportButton:Button = new Button();

I would like the integer value from i to be appended onto the name of the variable, so I thought this would work: var multiplereportButton + i:Button = new Button();

View 3 Replies

ActionScript 2.0 :: Assigning Variable Name To TextField

Jun 5, 2005

I've seen many times the following procedure to assign a variable name to a text field:
- We create a generic movieclip which contains a dynamic text field called "tittle" (for example)
- We add 4 instances of this movieclip to frame 1 in our main time line.
- We give them a different name (testMC1, testMC2, testMC3 and testMC4)
- We also add this little AS into frame 1:
testMC1.tittle = "Hello";
testMC2.tittle = "How";
testMC3.tittle = "are";
testMC4.tittle = "you";

If we run the fla we'll have the 4 movieclips on screen "Hello How are you". So far, it's ok, no problem and everything's understood. However I'm trying to implement a variation for this method which I need to use, but I'm not succeeding. I'd like to assign the variable values from a plain text file instead.

Hence, I create a plain text file called "Exampletext.txt". Inside this file I put the following variable values:
&variable1=Hello
&variable2=How
&variable3=are
&variable4=you

I add this piece of AS lo load the variables from the text file:
this.loadVariables ("Exampletext.txt");
And finally, I modify this bit too:
testMC1.tittle = variable1;
testMC2.tittle = variable2;
testMC3.tittle = variable3;
testMC4.tittle = variable4;
And well, it does not work at all!

View 5 Replies

ActionScript 2.0 :: Assigning Variable On Different Timeline?

May 7, 2011

I'm using Flash CS4 Professional. I'm new to Flash, taking an on-line college class, and we 've gotten to ActionScript. The entire second page of 'web site' is a movieclip. The mc includes 2 input text boxes and a button. Clicking the button is supposed to take the movie to page 3, a frame on the main timeline. Finally got that to work with 'with (_root) gotoAndPlay ("frame label")'. Page 3 contains 2 dynamic text boxes and I've tried several versions of _root and _parent dot syntax paths and tried 'with (_root)' but I cannot get values from the input boxes in the movieclip to show up in the dynamic boxes on the main timeline.

View 2 Replies







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