ActionScript 2.0 :: Use A Variable To Name A Movie Clip?

Mar 19, 2004

I am trying to duplicate a move clip and then set some of it's properties with actionscript. What's the notation to do this?

Here is my guess:

Code:
duplicateMovieClip(_root.event, ("event"+i), i);
[event+i]._y = ([event-i]._y)+([event+i].height);
[_root.event+i].eDate = ("4/2"+i);

[Code].....

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Delete A Variable Containing A Movie Clip Class And Recreate It With A Different Movie Clip Class?

Jul 1, 2009

In my project are pages of text with each word having a button that when pressed will display a movieclip presentation about that word (its pronounciation and spelling etc..). In the project I am working on now I have over 450 unique presentations of words to deal with. I don't want to have all of these hundreds of movie clips on the stage and tell them one at a time to stop and rewind and then have one play each time a word button is pressed. That seems to be very inefficient to me.

add movieclips to the stage using addChild(movieclipname) and remove them using removeChild(movieclipname) but there is a problem. I have hundreds of unique movieclips and I don't want to have to manage hundreds of variables containing the indivudual movieclip instancess. It is a real pain having to figure out what instance is still on the stage before i delete it.In Adobe Director all I have to do is this:

View 5 Replies

ActionScript 2.0 :: Set Variable Within Movie Clip?

Oct 30, 2010

On frame 1 of the main timeline I have a movieclip. The 1st frame of the movieclip stops, and requests a password. When the password is correct, the movie clip plays and stops again on frame 2 - where the user enters their name. I've named this variable 'name_txt', and the submit button will only continue if the variable is defined.

The problem comes when I try to get a dynamic text box in the main timeline to show the user's name - it just stays blank even through i've experimented setting the var / instance names to 'name_txt'. I think I have to set the variable to global or something, but cant seem to get it to work.

View 7 Replies

ActionScript 2.0 :: Accessing Variable From A Movie Clip

Aug 30, 2009

I've got a simple ActionScript 1 FLA. The SWF will take incoming variables from SWFObject. e.g. txtVar01, txtVar02, txtVar03 On the first keyframe on the main stage, I have a dynamic textfield, whose 'Variable' name is 'txtVar01'. When I view the SWF in a web page, via SWFObject, the value in the textfield matches that taken from the SWFObject variable. BUT - I have a MoveClip in the FLA, which has 2 other dynamic textfields, called txtVar02 and txtVar03.

When I view the SWF in the web page, these are empty, even though variables are being passed via SWFObject. I guess because the dynamic textfields are within an MC and not on the main stage, they can't access the variable names. I tried adding this to the first frame on the stage:

[Code]....

View 2 Replies

ActionScript 1/2 :: Referencing A Movie Clip By Using A Variable?

Jun 2, 2009

I have been using this line of code to fade in a movie clip:

new Tween(background_mc, "_alpha", None.easeNone, 0, 100, .5, true);

Now, I want to accomplish the same thing, only this time by using an element from an array (bg_array[currentSlideNumber]) that stores the instance name "background_mc"
 
I've tried the following, but it doesn't work:

new Tween(bg_array[currentSlideNumber], "_alpha", None.easeNone, 0, 100, .5, true);

View 3 Replies

ActionScript 2.0 :: Using A Variable To Target A Movie Clip?

Jul 29, 2010

I found this tutorial which seems to do exactly what I'm trying to do (the only one I've found to date), except his technique doesn't seem to work for me at all. It doesn't really seem to say anywhere which version of Actionscript he uses, but at least it seems to show that what I'm trying to do is possible for someone, which is a start.I'm trying to do exactly what he describes--I have several squares on a grid that are numbered, eg.grid_0101, grid_0102, grid_0103, and so on, for about 100 squares altogether, and I want to be able to target a given square dynamically.This is the basis of the code I started with:

Code:
var digsquare_x:String = "01";
var digsquare_y:String = "03";

[code]......

View 2 Replies

ActionScript 3.0 :: Displaying A Variable In A Movie Clip?

Jan 21, 2010

I've been animating with flash for a while but I've recently wanted to get into game programing. I've learned a lot in the past month and I'm trying to create a fairly simple point and click adventure game with some basic stats and scoring. I'm facing a somewhat simple problem and I'm not sure how to get it to work in AS 3.0.

At the beginning of the flash I've established my variables to keep score while exploring the game.

var Health:Number = 1000;
var Day:Number = 1;
var EXP:Number = 0;
var Money:Number = 1000;

What I'm trying to do though is set up a movie clip with menu options that, when clicked, brings up a screen that displays those stats as well as a couple extra menu options. What I can't figure out to do is how do I display those variable inside the movie clip.

When I create a dynamic text field and place "info_day.text = String(Day);" i get an error unless I create a variable within that movie clip. And when I do that the variables in the movie clip are not affected by the chances of the variables in the main flash.

how do I have the variable in the movie clip to accurately display the variables established in the main part of the flash?

View 4 Replies

ActionScript 2.0 :: Movie Clip Not Getting Initial Value For Variable?

Sep 21, 2010

i am doing a photo album type site where all photos (which are movie clips) appear small and when clicked they enlarge. when the enlarged photos are clicked the movie clip continues and they go small again.

as you'll see from the code below i am doing this by basically saying if the photo is small, play the movie clip from frame 2 which enlarges it until a stop value at 30, and then change the variable value. if the photo is large and then it is clicked play the movie clip from 31 to a stop action at the end and then change the variable value.

everything is working fine except i am not receiving the initial value of the variable "picbtn_position" which is set on the main timeline to value "mainscreen". can anyone help me as to what is going wrong here? maybe i have to do something else to get a variable value from the main timeline to the mc.

here is the code on my movie clip:

on (release) {
if (picbtn_position == "mainscreen") {
trace(picbtn_position);
gotoAndPlay(2);

[Code]....

and here is the code on my main timeline for the initial variable value:

var picbtn_position:String = "mainscreen";

View 3 Replies

ActionScript 2.0 :: Using A Variable In Movie Clip Call?

Aug 4, 2011

I want to use a variable in my movie clip code. Right now I generate a random U.S. state name and assign it to "correctAnswer". Then I want to assign that to myMovieClip.correctAnswer.gotoAndStop("down"); The problem is that the variable is not recognized and is seen as correctAnswer instead of the U.S. state that was assigned to it. My code is below.

ActionScript Code:
// Correct answer is randomly generated and can be any U.S. state name
correctAnswer = "utah";
// Using the variable correctAnswer this should come out as myMovieClip.utah.gotoAndStop("down");
myMovieClip.correctAnswer.gotoAndStop("down");

View 2 Replies

ActionScript 2.0 :: [Flash5]Using Variable As Movie Clip Name?

Dec 3, 2002

I want to cycle through several movie clips for a training application. I plan to use an array to hold the clip names, and a variable (CurrentClip) to set visibility and allow me to use a single pause/ play button throughout. For the visibility, I've found that...
CurrentClip._visible = false; does NOT work. But... setProperty (CurrentClip, _visible, false); does work.

View 2 Replies

ActionScript 2.0 :: Using A Variable Name To Address A Movie Clip?

Dec 17, 2005

how to refer to a movieclip's name through a variable.If I set root variable "currentMovie = bigRed_mc;", how can I use that variable name to instruct the movie to address the movie clip name stored in said variable?

for instance "_root.currentMovie.gotoAndPlay("destroy");" wouldn't work because it would simply look for that movie clip name and come up empty.I thought "_root[currentMovie]gotoAndPlay("destroy"); would work, with or without parenthesis, but it comes up with syntax errors either way. Can you use a variable to store and refer to a movie clip name and it's properties?

View 3 Replies

ActionScript 3.0 :: Using Variable To Reference Movie Clip?

Jul 24, 2008

In AS2 I used to be able to reference a movie clip using a variable like this: Code: var target = nameofmovieclip; I've been looking for an answer on how to do the same thing AS3 but with no luck. I'm trying to create a dynamic homing missle, but unfortunately everything I've tried just generates errors.

View 6 Replies

ActionScript 2.0 :: [MX04] Using A Variable In A Movie Clip?

Nov 7, 2008

I couldn't find anything with Google on how to do this, so I'm posting it.I have a code on the first frame of a movie clip that goes to and stops at a different frame in the movie clip depending on a variable that was set outside of the movie clip. It doesn't work, and the movie clip just plays through like normal

View 2 Replies

ActionScript 3.0 :: Change A Stage Variable From Within A Movie Clip?

Jun 21, 2011

I have a movie clip that is executing some code. When this code is complete, I want it to change a variable that is defined on the stage (root?). I know how to get the condition part of it, but quite literally: what do I put to change a variable located on the stage from within a movie clip?

View 1 Replies

ActionScript 3.0 :: Call A Variable Or Function From A Movie Clip?

Apr 2, 2009

I just need to call a variable or function from a movie clip to main timeline. In AS2 I would use something like:

_root.myvar = "Hola";
or
_parent.myfunc(4,2);

But this doesn't works on AC3. I tried to remove the "_" but its the same.

View 2 Replies

ActionScript 3.0 :: How To Access Variable Within Child Movie Clip

Sep 9, 2009

I have a flash file which uses php to manipulate a database and returns a variable (data_xml) of xml formated data from the database. This happens, along with other things, within the parent. Now I have a child movieclip that displays the parsed data but I am having trouble accessing the variable from within the child movieclip. The code related to this is:

var myXML:XML = new XML();var myXML = XML(event.currentTarget.root.data_xml);

and I get the following two errors which point to the second line as the problem:

1151: A conflict exists with definition myXML in namespace internal.

Warning: 3596: Duplicate variable definition.

I have unchecked "Automatically declare stage instances" because I've seen that suggested for the 1151: error, but I still get the same two errors.

View 10 Replies

ActionScript 3.0 :: Use A Variable Made Inside A Movie Clip From Outside?

May 8, 2010

I have been searching for ages and just cant find out how to do this. i have set a boolean variable inside a movieclip and would like something to change outside the movieclip, using an if statement, depending on whether the variable is true or false, but cant find out how to do it anywhere.

View 2 Replies

Professional :: Statements And Variable Movie Clip Names?

Feb 29, 2012

(problem 1 is that I cannot call buttonmoce this way!)I am really trying to imporve my code writing and using arrays and for will save me writing this code over and over again Cheers sub

[Code]...

View 11 Replies

Flash :: AS3 Add Movie Clip To Stage Using Variable Which Holds The MC Name

Dec 1, 2010

how to add a movie clip to the stage from the library but i'm strugling to do it when the I need to load a movie clip from the library when the name of the movie clip is held in a variable.

for(var i:Number = 0; i < 64; i++)
{
var blueIconS:blueIcon = new blueIcon();
addChild(blueIconS);

[Code]....

The above code works for adding the blueIcon but I have a variable in that loop which tells which icon to load.

sectorsMCs[jewelsIDs[i]]

The above will tell me what MC name to load but how do I load a MC from library by that variable value?

View 1 Replies

AS3 :: Flash :: Access Variable Of Parent Movie Clip?

May 24, 2011

How to access variable of parent movie clip in child movie clip in Action script 3.0

View 1 Replies

Flash :: Access Variable In Added Movie Clip?

Sep 30, 2011

I'm in class file right now and made a new movie clip using the linkage name

var mc = new ExampleLinkageName();
addChild(mc);

all good, I can see mc on the stage. In the ExampleLinkageName movieclip, I have a variable defined in it (on the physical timeline) called test.

In my class, I try trace(mc.test) and I get null. how I can read that variable?

View 1 Replies

ActionScript 3.0 :: Using A Variable To Reference An Already Existing Movie Clip?

Jan 28, 2009

I have been struggling with what I suppose is a very simple issue: I am importing content into my application via a text file, this all works fine. I have about 10 different movie clips on the parent timeline that I have hidden (dc_mc.visible = false.So what I need to do is take one of the variable names that I've got from my text file and use its value to "turn on" one of these hidden movie clips.So I'm trying stuff like:

var directory = e.target.data.directory; // Grabs the data, sets var
var raceNameButton:String = directory+"_mc"; // Set data into new var
raceNamesButton.visible = true; // display movie clip with var name

[code]........

View 1 Replies

ActionScript 3.0 :: Dynamically Name A Variable Or Created Movie Clip?

Dec 10, 2009

Is there any way to dynamically name a varaiable or created movie clip? I know that I could make an array of movie clips, but what I really want to do is make a new movie clipe name based on another name. The reason I want to do so is that I want to pass a movie clip to a function and have it make a new movie clip (to contain the first) with a slight variation of the test such as "frame" or "handle" which I can then use to center the source movie clip.

View 1 Replies

ActionScript 2.0 :: Passing A Variable From The Stage To A Movie Clip?

Sep 13, 2011

I have a big bit of action script that I want to reuse on various frames. Rather than write it out on each frame I want to embed the script within a movie clip and embed that movie clip on each frame that it is required to be used on.

In order to do that I need to pass a different value into the movie clip.

Basically the script creates 20 pages on one frame, 40 pages on another frame and 60 on the last page.

This is the bit of code that needs to have the number fed to it:

ActionScript Code:
var myArray:Array = newArray(20);

The number 20 is currently set manually. I ideally want to write this within the movie clip:

ActionScript Code:
var myArray:Array = newArray(frameVal);

and on the stage I want to set the variable like this:

Frame 1:

ActionScript Code:
var frameVal:Number = 20;

Frame 2:

ActionScript Code:
var frameVal:Number = 40;

Frame 3:

ActionScript Code:
var frameVal:Number = 60;

The movie clip that contains my code has an instance name of "testStart"

how do I get it to pass the frameVal into the movie clip?

View 2 Replies

ActionScript 2.0 :: X And Y Coords Of A Movie Clip Declared In A Variable?

Nov 25, 2004

How come this PHP Code:

function drop (thumbClip, xCoord, yCoord) {
thumbClip._x = xCoord;
thumbClip._y = yCoord;
trace (thumbClip);
trace (xCoord);
trace(yCoord);


receives the variables (specified in a later function) and traces them all right, but refuses to deposit the variable thumbClip in the x and y coordinates being specified?

I replaced thumbClip with a specific movie clip, and the fucntion worked perfectly. Does this mean Flash cannot use variables to set the x and y coords to?

View 3 Replies

ActionScript 2.0 :: Pass Set A Variable When A Movie Clip Has Been Draged

May 19, 2003

I have setup a button so that when i press it, it drags this movieclip and when i release it stopsdrag.... what i wanan do is.. detect if the movieclip has been draged or not.... like how do i pass set a variable when a movie clip has been draged... so far ive set it up soo that when i press the button it sets a variable... but a user might just press the button and not drag the movieclip i wanna set the variable not when the button is pressed but when the movie clip has actually been draged... ?

View 4 Replies

ActionScript 3.0 :: Movie Clip Variable - Getting The Error : 1118?

Jun 30, 2009

having a small problem trying to build a simple little Menu Bar.I'm trying to make it so that if I click on one button (Movie Clip) it will make it look different, and then if I click on a DIFferent button (Movie Clip) it will make the old one normal, and the new one look like it is selected.I tried doing so by creating a function that checked what page I'm currently in, and changed the look of the MCs accordingly, but when I run it, I keep getting the following error:

1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:MovieClip.

The line it's pissed about is right before the "if" statement where I say

nextPage = e.currentTarget;

Code:
var startHeight:Number = home_mc.btnBG_mc.height;
var startWidth:Number = home_mc.btnBG_mc.width;
var startAlpha:Number = home_mc.btnBG_mc.alpha;[code]....

View 3 Replies

ActionScript 2.0 :: Tweenlite In A Movie Clip Called From Variable?

Jan 13, 2010

i'm trying to run a loop, so a sequence of movie clips, one after the other, should "blink" as a wave.Tried the code below, without success. nothing happens. What could be wrong? The movie clips are named "menu1" thru "menu11".

Code:
function ondaMenu (){
for (var i:Number = 1; i < 12; i++) {[code].....

View 4 Replies

ActionScript 1/2 :: Passing Variable From Scene To Movie Clip?

Mar 11, 2010

I have a problem with my actionscript. I can't pass the variable from scene 1 textbox to a movie clip textbox.My scene 1 textbox has a name of resultText. My movie clip is call over_mc which is on the symbols definition.the textbox for the movie clips is call finalResultText.here is my code:

_root.over_mc.finalResultText.text = resultText.text;

View 2 Replies

ActionScript 2.0 :: Flash 8 - Using A Variable To Target A Movie Clip

Apr 15, 2012

It doesn't really seem to say anywhere which version of Actionscript he uses, but at least it seems to show that what I'm trying to do is possible for someone, which is a start.

I'm trying to do exactly what he describes--I have several squares on a grid that are numbered, eg. grid_0101, grid_0102, grid_0103, and so on, for about 100 squares altogether, and I want to be able to target a given square dynamically.

This is the basis of the code I started with:

Code:
var digsquare_x:String = "01";
var digsquare_y:String = "03";
var digthis:String = "grid_" + digsquare_x + digsquare_y;
this[digthis]._alpha = 50;

I don't need to change the alpha specifically, I was just trying to see if I could get it to affect a given square in any way, and apparently the answer is no. I know that the value of "digthis" is accurate, but even blatantly telling it to refer to _level10[digthis] still gives me no results. Neither does _root.level10[digthis] which I tried just to see if it would work.

View 9 Replies







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