ActionScript 2.0 :: Target Movieclips In An Array
Aug 27, 2007
i have an array called movieList that's made up of nine movieclips ("one_mc" for example). when something happens in my timeline, i want to send each of the movieclips to their fifth frame. i tried the following code and it didn't work:
[Code]...
View 2 Replies
Similar Posts:
Nov 16, 2009
I did this:
Code:
var mc_array:Array;
mc_array = new Array(3);
mc_array[0] = mc1;
[code]....
I want to use arrays to shorten things, but I don't know how to get and set the properties of individual entries of the array (with a mouse click).
View 2 Replies
Dec 17, 2008
I've read that the best way to "comunicate" with dynamicly created movieclips is by pushing them into an array.
For example:
Code: Select allvar itemArray:Array = new Array();
for (var i = 0; i < 5; i++)
{
var newItem:MyItem = new MyItem();
[Code]......
View 7 Replies
Feb 13, 2012
i basically have some images of logs (for a bridge) setup inside a movieclip called log_mc, inside log_mc each log has its own movieclip log1_mc, log2_mc and so on
[Code]...
View 29 Replies
May 31, 2011
I think this solution should be simple but I think I am missing something about using event.target.name.I have multiple (over 30) MovieClip images on stage with alpha of zero and I would like to have them fade in on MouseEvent.CLICK while removing the current image showing. While I can code it to work for a single image I want to use this.target.name to have more efficient code.
[Code]...
View 3 Replies
Nov 19, 2007
in a actionscript file, is there anyway to have different codes target different movieclips? For example, if i want one movieclip to tint to red and another to tint to blue, can I do that in the same actionscript file or do I need to do that in separate actionscript file?
View 3 Replies
Sep 23, 2010
I have a bunch of movie clips in my main timeline with at least 2 nested clips inside them, MyMc.nested1.nested2 etc. I have given the top most movie clips that sit on the main timeline instance names. In a document class I created a private variable typed as an array and placed all those MC names in that array. I then looped through the length of the array and assigned 2 event listeners to each instance. Example:
for (var i:uint = 0 ; i < _activities.length ; i++){ _activities[i].buttonMode = true; _activities[i].addEventListener(MouseEvent.MOUSE_DOWN, pickUp); _activities[i].addEventListener(MouseEvent.MOUSE_UP, dropIt);}
in the event pickup() is were my trouble seems to come in.In the pickup function I have the following:
event.target.startDrag()
This seems to work, but only on the lowest nested Movie clip......nested2I can use event.target.parent.parent.startDrag() and that seems to work.... Except when I place another movieclip in the second layer of the of the MyMC , if that is accidently clicked, it will now drag the Stage.I attempted to use the event.target.mouseChildren = false but that only seems to work on the lowest nested object... nested2 as that seems to be the one I am clickingIs there something I am missing to say, click only the top level mc then ignore all nested mc?
View 3 Replies
Sep 5, 2011
I have been working with AS2 for a long time, but are a total newbie when it comes to AS3.On my stage I have placed an empty MC with instance name "holder".In my library I got a MC linked by the name "sektor".
"sektor" has several movieclips and buttons with instance name, e.g. "corner1", "corner2", "corner3"....
I have nested "sektor" inside "holder" by writing this code:
Code:
var newClip:sektor = new sektor();
newClip.name = "sektor1";
holder.addChild(newClip);
What I want to achieve is to control those movieclips inside "sektor" by turning dem on/off.I have tried to do this with this code:
Code:
holder.sektor1.corner1.visible = false;
but I keep on getting this error:
"TypeError: Error #1010: A term is undefined and has no properties."
I have figured out that by tracing holder, I know it�s excisting (Result: [object MovieClip]) but if I try to trace holder.sektor1, I got the result "undefined". So it seems like "sektor1" is not excisting. Why?
View 7 Replies
Jan 3, 2007
I have a script that loads images and text from an XML file into movieclips.The following code is what creates the movieclips that contain the elements:
Code:
var thumb_mc:MovieClip = _root.mc_conteudo.createEmptyMovieClip("thumb"+(1+i), _root.mc_conteudo.getNextHighestDepth());
var img_mc:MovieClip = thumb_mc.createEmptyMovieClip("img", 0);
I can't seem to find a way to target the thumb_mc or the img_mc so they have rollover effects and actions (they are created for each set in the xml file, so there are multiple mc's)mc_conteudo is the content mc that scrolls.The swf is here: http:[url].....
View 13 Replies
Nov 7, 2011
I've made a loop that is creating 9x movieClips that is loading external images and I have also added eventListeners to those movieClips to make it possible to change the movieclips image. My problem is that i can't access the target of the "first eventListener". Here is the code to browse for the new image, i want to access the movieclip of this function in a later eventListener, like this: event.CurrentTarget
Code:
file.addEventListener(Event.SELECT, onFileSelected);
function mUp(event:MouseEvent):void{
file.browse(new Array(new FileFilter( "Bild (JPG och JPEG)", "*.jpg;*.jpeg;")));
}
The second eventListener. This function is called when the new image is selected
Code:
function onFileSelected(event:Event):void{
file.addEventListener(Event.COMPLETE, loadCompleteHandler);
file.load();
}
The third and last function, this function is called when the image is loaded and is ready to be used.
Code:
function loadCompleteHandler(event:Event):void{
file.removeEventListener(Event.COMPLETE, loadCompleteHandler);
var loader:Loader = new Loader();
loader.loadBytes(event.target.data);
// Here is the problem!
event.target.addChild(loader)
}
If if put this code, it will target the second function's event.
Code:
event.target.addChild(loader);
I am searching for a code looking like this to replace the old image with the new one
Code:
event.target.target.addChild(loader);
View 5 Replies
Jun 1, 2011
Its easier explained if I just write down the code:
function loadMc(frame:Number){
aNum = "array"+frame;
array1 = ["mcname", "identifier", "200"];
[code].....
View 1 Replies
Apr 11, 2010
varObjectBarriers=arrayBarriers[i-1].hitspot
The nested mc is hitspot. Do I target it like this? Flash says no. But I don't know how else to.
View 6 Replies
Apr 23, 2010
I have an array with 3 objects and added a click event to them, when clicked the 3 objects move 200 pixels down, but i would like to become that the objects that werent pushed get an alpha of 0.5
View 1 Replies
Nov 18, 2009
I received help on this site on this info-graphic im doing and the solution was to use an "array" which im not familiar with at all. the person that helped me added the following code that worked:
var city_arr:Array = new Array("louisville");//filll that array with all nedded cities//make all the boxes invisible at startfor (i=0;i<city_arr.length;i++){ var [code]...
since i dont know how to use arrays im stuck. i need to add at least 30 more cities to my info-graphic but don't know how to use the naming conventions of an array.Only one of the houses works (when you click on it a pop-up appears, is draggable and has an x to close the pop-up)
Attachments:
relocation_working.fla.zip (975.1 K)
View 1 Replies
Apr 25, 2009
Down the end of the code I try to trace(english[j] but with undefined the result. However I can trace(english). How comes I can't target an index.
function Article(imagen, sonido) {
this.imagen = imagen;
this.sonido = sonido;
[code]....
View 4 Replies
Oct 30, 2010
I have my code in the root first frame. I would like to know is it posible to attach movie from the library to array, but tu have that array created in some movie clip so the path to the newly created instance would be _root.some_movie_clip.array[i].
the code goes like this:
Code:
for (i=0; i<11; i++){
displayed_icons[i] = attachMovie("my_library_mc"+i, "new_mc_"+i, this.getNextHighestDepth());
[Code].....
View 3 Replies
Jul 14, 2010
I have one main array of 10 elements, inside each element there's another array of 3 elements. So, I must click on any of those 3 elements and compare its index with another array.Problem comes when I try to get its index since it gets it wrong.. I've try with this:trace(_choicesArray[_counter].indexOf(e.target));I even created a temporarly array that gets that specific array elements, but I always get -1. After many tries, I realized it's not a problem of the array or the index, but the event target somehow doesn't know what it index is.. or something like that.. still not so sure.his is the code:
ActionScript Code:
private function addChoices():void {
for (var i:uint=0; i<_choicesArray.length; i++) {
[code].....
View 2 Replies
Nov 11, 2011
Is there any way I can target the next and previous items in an array? For example, if I wanted to make a gallery where there's one main image and next/prev buttons to switch between the images in the array.
View 3 Replies
Apr 25, 2009
I can't trace(english[1]); ie: an index of the array BUT I can trace(english);
function Article(imagen, sonido) { this.imagen = imagen; this.sonido = sonido;}function makeArray1(success) { var i, j, mainTag; if (success) { for (i=0; i<=moXML1.childNodes.length; i++) { if (this.childNodes[i].nodeValue == null && this.childNodes[i].nodeName == "appear") { mainTag = this.childNodes[i]; } } num_reg = mainTag.childNodes.length; // numero de ejercicios for (i=0;
[code]....
View 1 Replies
Apr 2, 2009
How can I target a movieclip that is inside each item in the array using getChildByName. Heres my code so far:
var aMC:Array=new Array(letter, envelope, parcel);
if(i< aMC.length){
var myTargetName:String = aMC[i].target.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
trace("Stamps Target: "+myTargetName);
if (evt.target.dropTarget != null && evt.target.dropTarget == myTarget) {
// do what ever here
i++;
}}
View 1 Replies
Aug 2, 2010
does anyone know if it's possible to target values stored in an array in a function from anywhere in a movie? e.g var Pressed:Array = item trace(Pressed)
if i trace the Array name within the function it spits out values, but when i try and access the Array from outside of the function it doesn't work.
View 1 Replies
Apr 15, 2011
lets say i have dynamically duplicated movieClips ID's stored in array list. i want to add a onPress event to them. how do i do it?
[Code]...
View 5 Replies
Feb 5, 2011
I am animating a number of items using the Move effect. I am adding each item to an array after it has been added to the display list and once all items are added calling the play method, passing an array of the items to it. Only the last item plays in my animation.
Here is my code:
MXML: s:Move id="coinFall" yFrom="-400" duration="2000" />
public function showCoins(n:Number):void{
holder.removeAllElements();
var targets:Array = [];
if (n>=2.5){
[Code] .....
View 1 Replies
May 1, 2009
Is it possible to load up an array with movieclip instances from the library and use that as a reference to go to a certain index, snag that mc, and display it on the stage?
View 5 Replies
Jun 8, 2009
I have 2 arrays i.e.:[code]Is it possible to set the color of the moviceclips (mcclipsArray) to the relevant colors from the second array (mcclipsColorArray), so movieclip a becomes blue, b becomes red etc.
View 2 Replies
Jul 15, 2008
I want to put each movie clip created with this for loop into an array so that I can load images into each movie clip in a later script.
var total1:int=2;
var spacing:Number = 100;
var box_mc:MovieClip;[code].....
View 3 Replies
Mar 14, 2010
I'm having problems making a loop of different movieClips. I've been able to find info about duplicating the same movieClip but I can't seem to get it to apply to this. This is what I am working with: I have 13 different movieClips of an animated character. They are titled montyDog_mc, montyBear_mc, montyCat_mc, etc. I also have a next and a previous button. What I need to happen is for the movieClip animations to cycle through, one at a time, each time the user clicks the next or previous button. I think I should be creating an array of some sort but I am very confused about how I list the movie clips in an array and apply it to the button.
This is what I have:
montyArray = new Array();
montyBear[0] = "montyBear_mc";
montyBee[1] = "montyBee_mc";
montyCow[2] = "montyCow_mc";
montyDog[3] = "montyDog_mc";
[Code] .....
Am I targeting the movieClips properly?
View 4 Replies
Nov 29, 2010
Just started to make the switch from AS2 to AS3 and am having a few problems, most of which I've managed to fix but this one has got me stumped.
I'm trying to create some buttons dynamically that are spaced out evenly.The clip is in the library and exports as NavButton. I've created an array with all the button clips inside it. This is called navButtonArray and when traced shows the NavButton clips. My problem is when I try and add them to stage. I can't tell if it's only adding 1, or just placing them in the same place, or if it's continually replacing the previous navButton.[code]...
View 2 Replies
May 14, 2009
I'm creating multiple movieclips, containing a TextField and an image as a background. In order to keep track of them I'm storing them in an array. The problem is that I can't add the movieclip to the screen >.< What I'm doing is
PHP Code:
addChild(movieclips[0]);
but it's not displaying. I know it's not the movieclip as I can addChild that and it shows, but trying to call it out of the array is not working and it's REALLY frustrating the nark out of me .How do I add the selected movieclip out of my array?
View 4 Replies
Mar 31, 2011
Ive created a array to hold an instance of the Zombie movie clip, the movie is given an instance of "Zombie" + 1, 2, 3..... But now i can't work out how to add the movie clips from the Array to the stage. [code]...
View 3 Replies