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


Similar Posts:


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 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 3.0 :: Changing A Variable In A Class From A Movie Clip On The Stage

Jan 14, 2012

I'm trying to change a varialbe in a seperate class from inside a movieclip that I have on the stage in the timeline, but the variable I'm trying to change keeps coming up as null instead of what I am trying to change it to. How is this usually done?

View 6 Replies

Actionscript 3.0 :: Catch A Variable Content (set On The Main Timeline) From A Movie Clip Added To The Stage?

Sep 23, 2010

I'm trying to catch a variable content (set on the main timeline) from a movie clip added to the stage. I need to set a condition with that variable, so here's my line :

Code: Select allif (MovieClip(root).screenMode == ("full"))

But it's not working, I'm also trying to trace the variable with that command :

Code: Select alltrace(MovieClip(root)[screenMode]);

But this doesn't work too.

View 1 Replies

ActionScript 3.0 :: Flash - All Movie Clips To Be Placed On Stage With Equal Gap Between Each Movie Clip?

Sep 19, 2011

I have some (Eg. 10) Movie Clips on bottom of the Stage (aligned horizontally) with different sizes (different width & height). I want them to align vertically on middle of the stage with same gap (irrespective of their sizes) in between 2 Movie Clips. Is it possible using AS3 code?

View 3 Replies

ActionScript 2.0 :: Initialize The Object With A String Variable Which Holds The Initialization Properties (without Parsing The Text)

Dec 5, 2005

I initialize the "point" object like:

point = {x:'209', y:'270'};
trace(point.x);

this is working fine, But I have to initialize the "point" object with a string variable which holds the initialization properties like:

[Code]...

I know this is not working. Is there any method to initialize the object with a string variable which holds the initialization properties (without parsing the text) ?

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

Actionscript 2 :: Flash - Adding To A Variable And Removing A Movie Clip?

Mar 23, 2012

The portal in my game is suppose to be unlocked after you collect all the coins. The portal is locked but when I go over a coin it neither adds to the variable or removes the movie clip by instance name of coin1 coin2 and coin 3.also if the remove movie clip doesnt need _root I've already tried it without it I know that is not the problem.

var openportal = 0;
function moveStuff() {
//-Very long code that is working. [code]..........

View 1 Replies

ActionScript 3.0 :: Flash - Calling Variable From Scene To Movie Clip?

Dec 9, 2011

tes is a movie clip.when i click zkanada button. movie clip will appear and play from frame 1.

Code:
//scene 1
var detail_temp:String=null;

[code].....

View 1 Replies

ActionScript 3.0 :: Flash Game - Can't Add Level Movie Clip To The Stage

Apr 10, 2010

I'm creating a game, here is a screenshot: I'm trying to implement a scene system in an easy way (I'm a beginner). In this tutorial the author adds scenes as movie clip. So I tried making a movie clip with action script export name the same as my main .as file. When I add it to the scene manually, dragging and dropping from the library, it works. But when I try adding it from a new starting .as file, I get a #1009 error. Adding a test movie clip with the same code works.

[Code]....

View 4 Replies

Actionscript 3 :: Flash CS3 - Start Whole Stage / Movie Clip From Beginning

May 4, 2011

I have a flash CS project. I have one stage and some frames. How can I start all project from beginning using AS3? Or start all stage's content from beginning?

View 1 Replies

ActionScript 3.0 :: Alert Flash To Determine Which Movie Clip On The Stage Is Clicked?

Apr 13, 2011

I have a group of movie clips, each placed randomly on the stage. I want to be able to click one of the movie clips and move them around. They are stored in an array.

View 5 Replies

ActionScript 2.0 :: Load A Random Movie Clip From The Library To An Empty Clip On The Stage Called (bg_graphics)?

Oct 20, 2004

I want to load a random movie clip from the library to an empty clip on the stage called (bg_graphics). the clips in the library are called (green, blue, yellow).

View 5 Replies

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 3.0 :: Load An Image Or Clip To Stage Depending A Variable?

Jun 11, 2010

Is it possbile to make 'bumblebee' a variable?
 
var mybee:bumblebee = new bumblebee();

View 5 Replies

ActionScript 3.0 :: Movie Clip By Clicking On Movie Cilp On The Stage

Jul 5, 2009

I could code in movie clip by clicking on movie cilp on the stage but in As3 I could not do . Is this restricted to code on movie clip ?

View 7 Replies

ActionScript 3.0 :: Reaching A Movie On The Stage From Inside Another Movie Clip?

Dec 28, 2009

I'm trying to reach a body of text which i turned into a movie clip which is on the main stage, and have it scroll up/down whenever it rolls over the designated hot spots. Here's what i have.

stage.addEventListener(MouseEvent.MOUSE_MOVE,down1,false,0,true);
function down1(e:MouseEvent):void {
if (mouseX>=0 && mouseX<=42 && mouseY>111.1 && mouseY<146.1) {

[code].....

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

Flash Using Xml As Database That Holds Value Of Name Of User

Jul 24, 2011

Does anybody knows how to use the XML as a holder for the values that will be given by the user for example. Parent's name: _. then whatever the user's input i should move that and hold that by the xml. i just dont how. i read lot of books but i can't find any answer. This is for my senior project.URL...

View 2 Replies

ActionScript 3.0 :: Flash - Movie Clip To Play Unless The Person's Mouse Curser Is On The Movie Clip For More Than A Second

Jun 24, 2010

I am pretty new to ActionScript 3 and Flash. I don't want my movie clip to play unless the person's mouse curser is on the movie clip for more than a second. If the person just runs their curser over the movie clips really quickly, then it should do nothing. It must be more than a second. How do I code that?

[Code]...

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







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