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


Similar Posts:


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 3.0 :: Remove An Object From An Array Without Referencing Its Index

Oct 19, 2011

I was just wondering whether it would be possible to remove an object from an array without referencing its index, for example when the index is unknown, or when you want to splice it from within the class itself, like ina die function for an enemy in an array. I have a project due on Friday morning, GMT.

View 6 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 2.0 :: Referencing An Object In An Object?

Jun 19, 2003

Say I have an object MyObject which hasan XMLSocket defined in it, how I can access the Parent object from the onConnect function:

function MyObject()
{
this.ConnectionState = false;

[code].....

View 6 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 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 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 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 3.0 :: Referencing Another Object?

Nov 12, 2010

How do you reference and already existing object in as3? My below program draws 2 circles and a line to connect the two. The circles and the line are all individual objects. The line (connector class) has a function called update that should redraw the line between the two circles. It has two variables which I want to be the references to the two circles. The circles (coolcircle class) has a variable which I want to be the reference to the connector. It doesn't seem like my update() function is getting called.

ActionScript Code:
package
{

[code]......

View 3 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 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 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

Referencing Object In Differant Frame?

May 7, 2009

I have an object present in frame 3 of the main timeline. When the object was present in frame 1 i could access it from an as3 code file. But when I am keeping the object in frame 3 of the timeline (Please note that the previous frames for that layer is blank). I am getting a null value for the object. if I try to use trace the object.Logically if I am in frame 3 i should be able to access it.

View 3 Replies

ActionScript 3.0 :: Referencing An Object With A String

Apr 19, 2010

I need to know how to call or reference (not sure of the terminology) an object by way of a string. What I'm trying to do is create a loop that will add event listeners to objects named "portfolio1" through "portfolio15", and use a function.[code]If I could just reference these fricken objects through a string and an integer, I could set up a small loop like this to make the button "portfolio1" bring up a big jpeg of "bigportfolio_1", and "portfolio2" bring up a big jpeg of "bigportfolio_2", ext. While yes, I could just go through them all and set up event listeners to each one individually, but its REALLY inefficient. Also, I am still working on more advanced actions (like scrolling through the portfolio pics chronologically) that absolutely requires a different reference method.

View 5 Replies

ActionScript 3.0 :: Referencing A Parent Object?

Oct 7, 2010

I have a class attached to a movieclip in the library
 
That class is calling an instance of a new class
 
How do I reference an item in the movieclip(which is on stage) from the called instance?
 
Movieclip - class attached - calling an instance of a class (this is the one I need to reference the stage)

View 2 Replies

ActionScript 2.0 :: Referencing One Movie Object From Another?

Jan 15, 2009

I have my main flash, named "front page". Inside of it, I have 2 movie objects that have a time line, one named "About Us", and another named "Button Group". Inside of "Button Group," I've made a drop down menu that can go to a frame on the main page (in "front page") using the _root command. I was wondering if I could go from the front page into the other movie object ("About Us") by going through the main page.

Tl;dr, I'd like to know how to go to the parent of a movie clip and into another movie clip to modify where the time line is.

View 1 Replies

ActionScript 3.0 :: Utility To Indicate What Is Referencing Object

Sep 24, 2010

I have a fairy sizable class, a`nd an mx:Application that will periodically instantiate a new object of this class, which results in member functions of the class being assigned as event listeners to the application, and also other member display objects of the class being added as children to the application. When the application creates a new object of this class the old object is destroyed: to accomplish this, removeEventListener and removeChild are called on various members of the old object (to decouple them from the parent application) and then the final reference to the old object is set to null, and then finally the well known localConnection hack is called to force FP to actually free the memory.

And the thing is, the above destruction procedure always works to deallocate an object - except for the very first object allocated. it has proved impossible thus far to release the memory of the first such object created, or find out what is preventing it (i.e. find out what is still referencing it). So my question is - is there any useful utility that will tell you what is still referencing an object and keeping it from being garbage collected. Someone implied to me that the flex profiler would do this (which I do not have access to) but another 3rd party profiler I found for flex would not do this (i.e. tell you what is referencing an object and keeping it from being deleted.)

View 2 Replies

ActionScript 2.0 :: Variable Object Referencing

Jun 14, 2007

I am in no way very knowledgable with ActionScript, so this might be very simple and I am looking in all of the wrong places... but basically here is my issue: Instead of accessing an objects attributes like this, _level0.thumbnails.thumbnail0._width = 500; I want to be able to access it with _level0.thumbnails. (this.id) ._width = 500; where as (this.id) is a variable that could be equal to "thumbnail0" or "thumbnail99" depending on which object gets clicked. I have everything working to if I hardcode thumbnail0 it works fine, and this.id does get set to whatever thumbnail I click's "thumbnail" + ID

View 2 Replies

ActionScript 3.0 :: Referencing Instances Of An Object?

Jun 1, 2009

referencing instances of an object in AS3

I want to be able to build a navigation and reference each navigation item separately changing each instances properties depending on rollover actions etc.

I would have thought that once the name is assigned through the for loop that would stick, eg. the following code would create 3 vars called navItem, each with the name 0, 1, 2. But it seems if I trace the name outside of the for loop each is called 2. I think Im misunderstanding something really simple!

public function buildNav():void {
for (var i=0; i <itemNum; i++){
var navItem:NavItem = new NavItem ();

[Code]....

View 2 Replies

ActionScript 3.0 :: Flash Referencing A MC Within Another Object?

Oct 12, 2010

I've got a button which is called "playBtn", within this i have a MC called "btnlarge", If i remove the .btnlarge from the below code, then the "playBtn" is coloured correctly in my player,

Code:
var sColor:ColorTransform = player.playBtn.btnlarge.transform.colorTransform;
sColor.color = scolour;
player.playBtn.btnlarge.transform.colorTransform = sColor;

however with it in.. i'm obviously wanting the btnlarge MC to be coloured, but this isn't happening and its throwing me this error:

ReferenceError: Error #1069: Property btnlarge not found on flash.display.SimpleButton and there is no default value. at f4:layer/skinCompleteEvent()

Is there something really obvious i'm doing wrong? I've tried changing the "playBtn" into a MC and all kinds of things, but nothing seems to work, i can't seem to reference anything within another object.

View 5 Replies

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







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