ActionScript 2.0 :: Dynamic MovieClip Referencing Using Array Notation

Feb 23, 2009

I know that a dynamic mc can be referenced using array notation
viz: myArray['someName'+i]
My question is ... can mcs that have been placed on the stage and given instance names be referenced in some similar way? If I have placed 10 mc's with different instance names eg mg1, mg2, mg3 etc, can I reference them using array referencing?

View 6 Replies


Similar Posts:


ActionScript 2.0 :: Looping, Then Referencing Dynamic Clips From Array?

Jan 4, 2006

i'm looping thru xml nodes and using this to attach clips to an empty mc:Code:item = _root.mainHolder.links.linkHolder.attachMovie("linkClip", "linkClip" + i, i);my question is how can I reference the previously attached clip so I can determine the _y property of the current item(clip).I'd like to do something like this.item._y= previously attached clip._y-previously attached clip.height

View 10 Replies

ActionScript 3.0 :: Referencing Movieclip In Array

Jun 13, 2011

Just learning as3. For testing purposes, I duplicated a movieclip 4 times on the stage and gave each mc a different instance name and put them in an array ("line1","line2","line3","line4"). Then I just want one movieclip to move 200 pixels based on the conditions of the array. Here is the code:

var stuff:Array = new Array("line1","line2","line3","line4");
for(var i:int=0;i<stuff.length;i++)
{
if ((stuff[i]) == "line4") {
trace(stuff[i]);
var duke = (stuff[i]);
[duke]y += 200;
}
}

It traces out the correct mc (line4) but ALL the movieclips move 200 pixels instead of the one (line4). Do you know why this is? I have a feeling that [duke]y is not the correct way to reference the movieclip.

View 2 Replies

ActionScript 2.0 :: Referencing MovieClip Properties From An Array?

Mar 20, 2007

Code:
container_mc = _root.createEmptyMovieClip ("Page_Container_mc",100);
pageContent = new Array ();

[code].....

View 3 Replies

ActionScript 2.0 :: Referencing A Dynamic Movieclip (button)

Oct 15, 2009

how do I reference a button that has been loaded dynamically?Furthermore, is it possible to use the removeMovieClip() method with a button that is inside the movieClip you are trying to remove?Simply put, I've got a movieclip that is loaded via the "attachMovie" method. There is a button inside that says "Close". I am trying to use the removeMovieClip() method on that button, but it's not working. I can put a button on the stage, and use the same method, but it doesn't work.

View 4 Replies

ActionScript 2.0 :: Tweening With Dynamic Movieclip Referencing?

Oct 22, 2009

First of all: this is my first post at actionscript.org *happysound*. I'm working on this flash gallery since a couple of days and something is drinving me crazy in actionscript.

The concept: in this part of the flashfile i'm loading thumbnails in dynamicly created movieclips on stage (1.jpg, 2.jpg, 3.jpg). Everything is working fine, but now I wanted to add some fancy fading when the loading of a single thumb completes. For some reason I can not get the tweening class working and I'm sure it's a problem with the referencing to the clip. I know this cause when I change "thumb"+i to thumb1 it is working. Googled for hours without result..

[Code]...

View 5 Replies

ActionScript 3.0 :: Dynamic Referencing Of Items Within MovieClip?

Feb 19, 2010

I am building a drag and drop application. I have a few items within a movie clip that are movie clips. They each have their own instance name.

I am trying to access them from the document class using 'event.target.name'.

That works and I can pick up the name of the movieclip.

I put it in a string var called tName.

Then I try to modify a property of the selected movieclip:

itemList.items.tName.x+=23;

thats when i get, 'A term is undefined and has no properties' error.

I know itemList.items.tName is the correct navigation to the clip, because if i replace the var and hard code the correct name, it works.

whats funny is my tName var is tracing out the correct name of the movieclip.

Or a better way to dynamically access mc's within mc's.

View 1 Replies

ActionScript 2.0 :: Using Array Notation And This Keyword

Feb 19, 2006

I am trying to create a number of movie clips in my main movie but I don't seem to be able to access these movies using array notation and the 'this' keyword. Here's some example code in a main timeline.
var i=0;
createEmptyMovieClip("clip"+1,0);
trace(this["clip"+i]);
////undefined - why?????
var clip=createEmptyMovieClip("clip_holder",1);
clip.createEmptyMovieClip("clip"+i,0);
trace(clip_holder["clip"+i]);
/////_level0.clip_holder.clip0.
This is ok. What's wrong with this["clip"+i] ?

View 1 Replies

ActionScript 3.0 :: Flash - Referencing A Movieclip In An Array And Calling A Method?

Nov 12, 2010

Is it possible to refference a movieclip in an array and then calling a methodfor ex.The movieclip i want to refference: main.box.mymovieclip

var current:array = new array();
push(main.box.mymovieclip);
and then like calling a method on it:

[code].....

View 1 Replies

Flash :: Referencing Mc's From An Array To Then Assign Further Array Properties?

Oct 15, 2010

I have a number of 'items' (mc's) contained in a scrolling mc that can be drag-dropped to other matching mc's. The items names are listed in an array and I wish to assign variables of suitability and feedback to each mc from the array also. I think this is called an associative array?

Having some trouble correctly referencing the items from the array. To explain, here's a working script with a simple array and an inefficient workaround:

[Code]...

View 4 Replies

ActionScript 3.0 :: Referencing Loaders In An Array?

Jun 28, 2010

I have a project that needs 4 levels of zoom, each with its own image loading in. So, to make things easier on myself, I made an array of the Loaders, so I can instantiate them and hide/display them when I need toHowever, this doesn't work as I had expected. I.e. (using just two level for simplicity):

Code:
private var photo:Loader;
private var photoLarge:Loader;

[code].....

View 4 Replies

ActionScript 3.0 :: Referencing Array Element By Name?

Mar 9, 2009

I've got an array containing various sprites... I'm wanting to reference the sprite I want by its name rather than its index in the array, and was wondering if theres a simple way of doing this? I know I could do a for loop through all the array elements and see which one has a name that is equal to the name im looking for, but is something along the lines of myArray[elementName] possible?

View 5 Replies

ActionScript 3.0 :: Referencing Objects In Array?

Feb 25, 2010

I've created a for loop to do the following:add instances of button MovieClip from library to stagename the instances via name propertyadd instance names to array for later referenceadd event listenershese 4 steps are working peachy, however, I'm having troubles referencing these instances later on through my code. I'm pretty sure that the problem is in my data types not matching, but I'm not sure how to fix it.

var menuBtn:mc_menuBtn;var menuBtnList:Array = new Array();
for(var b:int = 0; b < numFiles; b++){  //add instances to stage  menuBtn = new mc_menuBtn();  testClip.addChild(menuBtn); //adding button instances to

[code].....

View 5 Replies

ActionScript 2.0 :: Referencing An Object In Array?

Nov 3, 2009

I was wondering if anyone could tell me how to access a certain object in an array. for example, I created an array of buttons displayed on the stage. Now I need to attach an onRelease command to each one to launch a new image on the stage.e going round in circles with this. I have attached the code below for reference:

thumArray = [];
function thumbs(){
for (i=0; i<totalImages; i++) {

[code].....

View 1 Replies

ActionScript 2.0 :: Referencing Array Index?

Aug 25, 2011

I have three placeholder images, the contents of which are populated by an array ("galleryArray").These three placeholders are titled "placeholderLeft", "placeholderCentre" and "placeholderRight".

the contents of "placeholderLeft" will be: "galleryArray[n-1]"
the contents of "placeholderCentre" will be: "galleryArray[n]"
the contents of "placeholderRight" will be: "galleryArray[n+1]"

[code]...

View 6 Replies

ActionScript 2.0 :: Referencing To Array In Parent?

Jan 4, 2007

I have an array defined in the main timeline to store some values. At some point of time, I am dynamically adding a movieclip to stage using attachMovie and then using a movieClip.onEnterFrame event to set one of its values by referencing to one value from the main array.(Sorry if the following description sounds a bit confusing. I am attaching a part of the code below to help describe the situation) The problem is that it is not able to retrieve the value from the main array no matter what I try. I tried adding a "_root" befor the array name and the index array id but it did not work. Not only that but the trace shows that it is able to retrieve the index id as well as the full array but not any particular value from the array - as in, trace(arrayname) outputs all the values from that array but trace(arrayname[a][b][c]) gives an output 'undefined'.

I have managed to make it work by creating a temporary variable to store that particular value just before the onEnterFrame event kicks in, but I would love to know why it is not working the way I thought it should. Here is a part of the code. If someone needs more info about the code then please ask and I will give it in the next post (The full code is way too large to be posted here)

ActionScript Code:
//------In main timeline
var movesNum:Number = 0;

[code].....

View 3 Replies

ActionScript 2.0 :: Referencing An Array Value Globally XML?

Mar 2, 2007

I have been trying to get this right for a few days now, but I am stumped. This code runs on the first frame of my movie:

Code:
_global.headingText = new Array();
_global.captionText = new Array();
_global.contentText = new Array();

[Code].....

View 1 Replies

ActionScript 3.0 :: Referencing From An Object Within An Array?

Oct 16, 2011

I have a several objects nested within an array. I'm trying to reference a property of one specific object (intel).

function eventGenerator():void
{
var randomArea:Number;
randomArea = Math.ceil(Math.random()*5);

[Code].....

ainPlace names is the array's name. The random area variable contains the co ordinate on the array for the object. Each object on the array has a property called intel. The idea is I want to able to store the value of intel in a number and use in an equation. I would also like to be able to adjust the number. the trace function here returns an error saying it is undefined so eventArea.intel for some reason isn't referencing the intel property of the object.

View 3 Replies

ActionScript 2.0 :: Array Name Referencing With A Variable?

May 2, 2005

fairly simple question (with a long explaination). I have an array, created from the results of another array and it's position in that array. There are actually multiple arrays It can be created from.

Eg.
Array1: clientName1, clientName2, etc.
Array2: clientType1, clientType2, etc.
Second Array: [clientName1,0], [clientName2,1] OR [clientType1,0] etc.

[Code]...

My issue is, I would like to be able to dynamically adjust the array that it is generating from. This would mean changing the bold bit of the code above. I have tried declaring a variable (type = names+"[i]") and using it in the linkArray declaration, however it will not see this as an array reference, only as a variable. What I want to know is, how do I reference the name of the original array as a variable so I can update it dynamically?

View 5 Replies

ActionScript 2.0 :: Referencing A Movieclip Within An Attached Movieclip?

Nov 29, 2006

I am trying to reference a movieclip within a movieclip that I am loading using "attachmovie". In the first frame of the root, I am attaching the movie. Then, from the attached movie I am calling a function that is also in the first frame of the root. In the function I am tring to set the property of a clip within the attached movie to visible using the following code:

_root.logIn.loginMessage._visible = true;

I have also tried _root["logIn"].loginMessage._visible = true; with no luck.

(logIn is the name of the clip I am attaching using attachMovie and loginMessage is the clip I am trying to reference in the attached movie)

This is how I'm loading it and I know that part is working: _root.attachMovie("login_mc","logIn",getNextHighes tDepth());

View 1 Replies

ActionScript 3.0 :: Referencing Array / Main Timeline

Dec 23, 2009

This used to work in flash 8.I just purchased CS4 and am trying to learn a few basics.I have nested arrays on frame 2 of the main timeline. [code]I can no longer use _root. on the mc to reference the main timeline.If I trace myQuestions from the mc I get an error.

View 14 Replies

ActionScript 3.0 :: Referencing Embedded Sounds In An Array?

Dec 30, 2009

I want to play an embedded sound referenced from an array.In flash 8 I would simply use this code.Quote:

var mySound = new Sound();
mySound.attachSound(myArray[0][8]);
mySound.start();

[code].....

View 11 Replies

ActionScript 3.0 :: Correct Syntax For Referencing Array?

Sep 6, 2011

I have a number of XMLList objects:
 
_xml.group1..image[i]
_xml.group2..image[i]
_xml.group3..image[i]
_xml.group4..image[i]
_xml.group5..image[i]
 Im trying to reference each object thus:
_xml.group[myVariable]..image[i]
 
But it doesnt work. What's the correct syntax?

View 3 Replies

ActionScript 3.0 :: Referencing Array Through Static Property

Nov 28, 2010

The behaviour looks little weird for me and dont know how to get valus through static property from an array:

[Code]....

but if I initialize missions with values not in the construtor but through variable initialization I gets output = 4; why is that? Doesnt static class initialize its variables in the constructor statement??

View 3 Replies

Actionscript 3.0 :: Referencing Movieclips Inside An Array?

Dec 16, 2010

I am trying to reference a movieclip located inside an array to add an eventlistener and function... I am using array[0].add...ect. The code for the first movie clip works, but for the rest I get an error 1010.

Code: Select allvar image:MovieClip = new Image();
addChild(image);
const MAX_ITEMS:uint = 6;

[code].....

View 1 Replies

ActionScript 3.0 :: Flash Referencing Loaders In An Array

Jun 28, 2010

I have a project that needs 4 levels of zoom, each with its own image loading in. So, to make things easier on myself, I made an array of the Loaders, so I can instantiate them and hide/display them when I need to.However, this doesn't work as I had expected.I.e. (using just two level for simplicity):[code]Is there any way I can reference the loaders dynamically so I can load/show/hide them on the fly, instead of hard coding it for each level?

View 5 Replies

ActionScript 3.0 :: Use Dynamic Referencing To Cut Down On The Number?

Sep 22, 2010

I'm making a flash game in which I need to spawn movieclips and I am attempting to use dynamic referencing to cut down on the number of lines I need to write.

[Code]...

View 7 Replies

ActionScript 2.0 :: Dynamic Referencing On OnRelease?

Oct 24, 2008

The following code is my attempt to fade out current clip then to fade in selected clip via one onRelease command. Here's the code. Can someone set me straight?

Code:
import gs.TweenLite;
import gs.easing.*;
var whoIsOn:Number = 0;
var clip:Array = ["orange","cranberry","melon","mango"];

[code].....

View 1 Replies

ActionScript 3.0 :: Error #1010 In Referencing Items In An Array

Dec 6, 2010

when I try to move my "stars" I get a 1010 error. when I try to loop a singular item, it works, but dynamically...

Using FlashDevelop.
main()
Actionscript Code:
package {  import com.gfx.mainContainer;  import flash.display.MovieClip; import flash.display.Sprite; import

[code]....

I can trace starArray, but I can't loop to each individual element and move it.

View 1 Replies

ActionScript 3.0 :: Error #1010 In Referencing Items In An Array?

Mar 14, 2011

when I try to move my "stars" I get a 1010 error. when I try to loop a singular item, it works, but dynamically...Using FlashDevelop.

[code]...

I can trace starArray, but I can't loop to each individual element and move it.

View 2 Replies







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