ActionScript 2.0 :: Targeting Different Movieclips With A Variable?

Apr 7, 2010

On my stage, I have a bunch of movieclips with sequential instance names ("toggle1", "toggle2", etc.). I also have another bunch of movieclips, each with their own sequential instance name ("name1", "name2", etc.).How can I set it so that when I click on a "toggle" movieclip, a specified property changes on the "name" movieclip with the same number.Here's what I have so far.

ActionScript Code:
for (var i = 1; i <= 16; i++) {[code]....

What am I missing/doing wrong?

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Targeting Code Placed Movieclips?

Oct 14, 2010

I am still sorting out how things translate to AS3 so here it goes:
 
In the land of AS2:
 
Say you for looped 5 times and placed movieclips on the stage (attachMovieClip) each one having an mc inside called box_mc. You named them in the loop mc_1, mc_2, mc_3, mc_4, mc_5.Then later you wanted to rotate that box in them you could for loop again and target/rotate the box with a line like this:

this["mc_"+i].box_mc.rotation +=5;

Now in the land of AS3:I place 5 movieclips using addChild and the way I later target the box_mc inside them is to use two lines something like this:

[code]...

I know this method works, but is this the most efficient/correct way of doing this? I tried to get to the box_mc level when assigning the targetMc var, but never found a way that didn't error.Compounding question, how do you make an old line of AS2 work in the AS3 world like this:

this["mc_"+i]["child_mc_"+j].box_mc.rotation +=5;

View 11 Replies

ActionScript 3.0 :: Targeting Movieclips On Stage?

Apr 19, 2010

before it was just
somemc._x = someotherMc._x
but as3 doesn't know how to identify someotherMC

[code].....

View 5 Replies

ActionScript 3.0 :: Targeting MovieClips From A Class?

Mar 3, 2010

how to target MovieClips from a class. If I have a MovieClip on the stage named recMc and I want to manipulate it using a class, I know that if I attach my class in the Document Class field in my .fla file and then just do something like this... it works

- class and fla are in the same folder -

Code:
package {
import flash.display.*;
import flash.events.*;

[Code]....

how to target this object without attaching the class to the Document class?

View 4 Replies

ActionScript 3.0 :: Targeting Nested MovieClips Outside Of Scope

Oct 12, 2009

I have a movieclip added to the stage through a function.
ActionScript Code:
function myFunctionOne():void{
var myClipA:clipA = new clipA();
myClipA.name = "myClipA";
addChild(myClipA);
}

To access this item on the stage I have to use:
ActionScript Code:
getChildByName("myClipA");
I have some other movieclips INSIDE this clip that have also been dynamically added. If I want to reference one of those clips I have to reference them by name using getChildByName.
[Code].....
But is there a better way to reference movieclips if they are created inside a function, or is there a way to create them so they are always globally accessible?

View 1 Replies

ActionScript 3.0 :: Targeting Individual Movieclips Created From Xml?

Nov 19, 2009

Im creating movieclips based on the items in an xml file. It pulls the data in ok, and loads in an image from the given description, and poisitions the clips ok.

Where i'm falling down its assigning button functions to these clips. I can not reference the clips indivually it always refers to the last clip created.

code sample below

files attached also

// Import Classes and Tweening
import gs.*;
import gs.easing.*;
import fl.motion.easing.*;

[Code].....

View 1 Replies

ActionScript 2.0 :: Targeting MovieClips As Vars From Main Frame?

Nov 4, 2011

I have the MovieClip named dessin, which loads another MovieClip named dessin (dessin.dessin). Now, there is a MovieClip named displayPlane, in the new MovieClip (dessin.dessin), in the MovieClip named displayPlane, there is a variable, which goes as follows:

Actionscript Code:
var _loc3 = displayPlane.attachMovie("displayNode", "displayNode_" + projectCount, projectCount);

inside that clip, there are multiple MovieClips in vars, I am trying to specifically target one var, the following:

Actionscript Code:
var _loc8 = this.attachMovie("closeBtn", "closeBtn", 5);

I have tried this code to target that specific MovieClip with no success.

Actionscript Code:
_root.dessin.dessin._loc3._loc8

View 2 Replies

ActionScript 2.0 :: Targeting AS Generated MovieClips Instance Names?

Oct 2, 2006

Right check this:

/////////////////////////////////////
/////////////////////////////////////
///////////////FUSE//////////////////
/////////////////////////////////////
import com.mosesSupposes.fuse.*;

[code]....

But the problem is the thumbMov movies will obviously have a uniquely generated instance name i cant target directly due to the "for" loop..How can i modify what ive done to target any of the thumbMovs with the FUSE functions?

View 3 Replies

ActionScript 2.0 :: Targeting Dynamic Movieclips For OnPress Actions

Aug 15, 2007

I'm generating movieclips based off of an xml file. The images load fine but I can't figure out how to target them for onPress actions.

[Code]...

View 4 Replies

ActionScript 3.0 :: Targeting Dynamically Created Nested Movieclips?

Feb 17, 2010

I'm dynamically creating movieclips with dynamically created movieclips inside them and am having trouble with targeting them.

Below is a simplified example of what I'm trying to achieve, in the real file there are a lot more movieclips and I'm creating and naming them with a for loop.

This one is just one Sprite created inside another sprite. I can target the top level sprite named "testname". However when i try target the nested MC it throws an error.

The bottom couple of traces are just test MCs I've made to make sure i got the syntax right, on targeting nested movieclips.

PHP Code:

var holder:Sprite = new test1(); 
holder.name = "testname"; 
this.addChild(holder); 

[Code]....

View 5 Replies

ActionScript 3.0 :: Controlling Variable Movieclips (within Variable Movieclips?

Nov 3, 2009

on my main timeline there is a movieclip ("sampleMc") which contains a number of labeled frames containing movieclips of gallery images (for example "dyerBikiniMc"). in turn, each of THESE movieclips contain a number of frames of detail shots of the main image (for example "dyerBikini00Mc, dyerBikini01Mc, dyerBikini02Mc, etc.").on the main timeline i have a gallery navigation bar with thumbnail buttons determining which image will be displayed. there's also a right arrow shaped button "detailsBtn" that i'd like to allow the user to click frame-by-frame through the detail shots of the image. i also have a before/after toggle button on the main timeline that needs to control the movieclip one level below that, where the before/after images of that particular detail shot are stored!

View 9 Replies

ActionScript 1/2 :: Global Variable Not Targeting?

Jan 8, 2010

I am trying to set up a global variable. On the root of my timeline, I have this;

_global.floorVar = "0";
trace(floorVar);
 
which seems to trace fine to say 0.
 
Then, inside of a movie clip on the main timeline, I have a button function:
 
floor1.onRelease = function() { _global.floorVar = "1"; trace(_global.floorVar) _root.gotoAndStop(2);};
if (_global.floorVar == 1) { trace("it works");
}
 
It traces as 1 once I press the button, but the if statement doesn't trace "it works" is my global variable set up wrong?

View 7 Replies

ActionScript 2.0 :: Targeting A Variable Inside A MC?

Jul 7, 2008

I have a movie clip called curtain_mc with this actionscript inside:

[Code]...

I would like to change the variable 'f' from true and false by clicking a button but the actionscript on my keyframe doesn't recognize the actionscript in my movieclip? I know its a targeting issue, but not sure how to alter it in order for the two to talk to each other??

View 6 Replies

ActionScript 2.0 :: Targeting Attached Movieclip - Variable It Doesn't Recognize Its Path

May 6, 2004

i have a problem adressing or targetting a attached mc when i target de mc directly it works fine but when i try it trough a variable it doesnt recognise its path anymore??? hopefully a part of the code is gonna explain the situation a litle better... this piece works fine:

[Code]...

View 3 Replies

ActionScript 2.0 :: Targeting Attached Movieclip - Variable Doesn't Recognise Its Path Anymore

May 6, 2004

i have a problem adressing or targetting a attached mc when i target de mc directly it works fine but when i try it trough a variable it doesnt recognise its path anymore???

[Code]...

View 3 Replies

ActionScript 2.0 :: IF And Variable Passing Across Movieclips?

Jun 13, 2003

I have six movie clips, in a navigation movie clip, on the main time line, here they are:

_root.nav._home
_root.nav._ourFirm
_root.nav._onepartnership

[code].....

View 1 Replies

ActionScript 3.0 :: Loading Movieclips With The Same Variable?

Apr 11, 2010

I have this function that loads swfs dynamically using the same variable

var Xpos:Number = 420;
var Ypos: Number = 155;
var loader:Loader = new Loader();

[Code].....

I want to use the same idea for movieclips that I have in my library They are already imported for as.30, but I can't figure how to dynamically place them and take them out of the stage using the same variable.

View 4 Replies

ActionScript 2.0 :: Storing A Movieclips Instance Name In A Variable?

Feb 21, 2010

I have a movie clip and inside that movie clip there is a button. I will be copying this movie clip 40+ times. When you click the button it must seek out the reference name of the movie clip it is nested in. The point of the script on the button is to make all other boxes but its self vanish. The script needs to know what box it is so it can make all boxes but it's self vanish. I know that _name returns the name of the object the code is on but what about the movie clip the object is in maybe _parent._name?

View 5 Replies

ActionScript 2.0 :: Dynamic Variable Inside Movieclips

Jan 21, 2011

I recently started learning Flash and Actionscript and now I'm trying to write an actionscript for the first time. Im doing this in Actionscript 2.0.I have a movieclip that consists of two images and one dynamic text field with a variable. The name of the images are "VS1_P1_RUN" and "VS1_P1_OFF" and the name of the dynamic text field is "pumptext". In the dynamic text field I have the variable "VS1_P1_Ind". VS1_P1_Ind is probably a boolean variable as it shows 1 or 0 in another program but in Flash it shows True or False (not sure if Flash thinks it's a text/word or a boolean).My script is supposed to display the image named VS1_P1_RUN if the variable of the dynamic text field pumptext shows the text True and it goes like this:[code]

So I'm completely stuck in what to do. The bottom code works as it should but I want the images to show depending on the value of the variable VS1_P1_Ind. I thought just changing the text field to dynamic and typing the variable name in the variable field would do it but no.If it could be a clue to the solution I'll also share that the value of the variable is not seen/shown in textfield while inside the movieclip. Creating a dynamic textfield outside of the movieclip shows the value of the variable just fine, True/False.

View 1 Replies

ActionScript 2.0 :: Reusing Variable Names For Different MovieClips?

Jun 28, 2011

I'm creating a pacman game and basically I'm having trouble coding the enemies (ghosts), the code works perfectly with just one ghost, as soon as I add another it starts to go wrong.Firstly I've got this function which places the enemies:

Code:
//places the enemies
function placeEnemies() {

[code].....

View 2 Replies

ActionScript 2.0 :: Make A Variable Equal Two Movieclips?

Sep 2, 2004

Can I make a variable equal two movieclips? Like:

nav1 = _root.nav.nav1 & _root.map.map1;

And then run a function that would control both? Like:

function closeout() {
nav1.gotoAndStop(3);
}

View 6 Replies

ActionScript 3.0 :: MovieClips - Dynamic Naming Links To Variable

Jul 26, 2009

I am doing the following
Code:
Select allvar a:MovieClip = new MovieClip();
addChild(a);
Now what I want to do is I want to create six more mc i.e., a2,a3,a4,a5,a6. I want to accomplish this using loop like this:
Code: Select allvar i:Number = 0;
while(i < 6){
var a:MovieClip = new MovieClip();
addChild(a);
}

So with above method how can I give different names link above to var a? Then I am using all of these var as following:
Code:
Select allvar cube:Cube = new Cube(new MaterialsList({
front:a , left:a2, right:a3, top:a4, bottom:a5, back:a6}),200, 200, 200,10, 10, 10);
scene.addChild(cube);
How can I use those dynamic name here?

View 1 Replies

ActionScript 3.0 :: Variable Of Nested MovieClips Global Coordinates

Apr 24, 2009

I have a MovieClip ("mc3" that moves dynamically) inside of a MovieClip ("mc2" that moves dynamically) that is on the stage ("stage" that is static). I need to find the value of mc3's x in relation to the stage? I need to make it into a variable. I am trying to do the math, can't figure it out. Also tried localToGlobal and failed.

View 5 Replies

IDE :: Making A Global String Variable Visible To MovieClips?

Jun 4, 2009

I mostly use flash for the animation, so my action script tends to be mostly functional.

I am now however having an issue, i am using a variable called language which I am setting in frame one as "dutch", "english" , "german" etc... Im then using this to set dynamic text as appropriate in each frame as necessary.(and yes i may switch this to case statements )

if (language == "dutch")
{ tcMC.peasantBubble1.peasantSpeech.text= "Bescherm je een schat?"};

My problem is however that one Movieclip does not see the language variable.

Is there anway in CS4 i can direct it to where it is, or define the varibale instead to be global (perhaps id have to change it from a string though)?

View 2 Replies

ActionScript 3.0 :: Use A Variable(text) To Reference A Movieclips Instance Name?

Nov 28, 2010

i want to use a variable(text) to refrence a movieclips instance name

Code:
function InventoryShow(event:Event):void
{
var SC:URLVariables = new URLVariables(event.target.data);

[Code].....

View 1 Replies

ActionScript 2.0 :: [MX04] Referencing Multiple Movieclips With Single Variable?

Jan 25, 2009

Is there a way to reference multiple movieclips using a single variable name? For example,I'm making a side-scrolling game, and there's going to be many platforms, and I have some code that tells the player not to fall through these platforms, but I don't want to copy and paste the same "platform" code every time I add a new platform.

View 3 Replies

ActionScript 3.0 :: Removing And Adding MovieClips To/from Arrays Based On A Variable?

May 8, 2009

On my stage I have 5 items labeled item1_mc, item2_mc, item3_mc and so forth...they all have two keyframes on their respective timelines, one labeled "active" and the other "inactive". My code contains 2 arrays, inactiveArray and activeArray and a variable known as energy that regularly goes to and from 0 - 100.What I am looking to achieve is basically the function of...if energy >= "insert given items 'active threshold' 20, 40, 60, etc..." then add it to the activeArray, if it is not, remove it and add it to the inactive array.

all objects in activeArray gotoAndStop("active");
all objects in inactiveArray gotoAndStop("inactive");

I have tried many different ways of achieving this effect but I always end up with duplicates and extras or something doesn't move when it's supposed to, where it's supposed to, it just ends up into a giant cluttered mess and I start from scratch.

View 2 Replies

ActionScript 2.0 :: Flash 8 - Remove Attached MovieClips Contained In Variable

Jul 26, 2009

I need to remove some movieclips that are attached dynamically so they do not show up underneath the new movieclips that will be attached when a user clicks the next button. I've tried removeMovieClip with little success. I am able to remove one or two of them, but not all. I need all of the previously attached movies gone.

Here is the as2 for it.
PHP Code:
//Set functions
function show_movie() {
menu_mc._visible = true;
buttons_mc._visible = false;
teacherinfo_mc._visible = false;
} function displayInfo() {
[Code] .....

View 4 Replies

ActionScript 2.0 :: Moving Movieclips With MoveN Variable Doesn't Work

Aug 2, 2009

I have several movieclips which name is assigned to the variable MoveN when clicked on. But moving them with MoveN variable doesn't work.

[Code]...

View 4 Replies

ActionScript 3.0 :: Attach Eventlisteners To Dynamic Movieclips And Pass A Variable?

Dec 8, 2008

I have a mc (changeColorMc) and three movieclips. The three movieclips are created on the fly (so there could be more movieclips) and filled with a color from an Array. This works fine.

Now I want to add an eventlistener for each movieclip, so when someone push one of the movieclips the movieclip with the name "changeColorMc" gets that same color from the colorArray.

My question is: How can I pass the color value from the colorArray to the buttonPressed function? Is this possible?

I was also thinking that I had to create three buttonPressed functions ie. buttonPressed1, buttonPressed2 and buttonPressed3 and attach these to the created movieclips.. but how? Because I don't know up front how many movieclips there will be..

View 5 Replies







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