ActionScript 3.0 :: Dynamic MovieClip Naming?

Dec 22, 2008

I am just getting started with AS3 and have run into a problem. I had a way of attaching movieClips from the library to the stage in AS2 that used the old attachMovie() function where I would run a for loop and it would duplicate the moviclip to the stage and dynamically create new names for the new instances.I now am using this:

var myCube = new cube();
addChild(myCube);
Then, I can access the myCube instance's properties like this:

[code]....

View 9 Replies


Similar Posts:


ActionScript 2.0 :: Dynamic Movieclip Naming (clip Inside The Clip)

Oct 19, 2006

i've got 48 small movieclips named "1clip", "2clip", etc. all the way up to "48clip." I want to do something with them all and use a loop to affect them all the same way.

[Code]...

but that doesn't seem to work. are variables and instance names interchangeable? my lClip var traces out of course, but the lClip.imagHolder.loadMovie never happens (clip inside the clip).

View 1 Replies

ActionScript 3.0 :: Dynamic Naming Of Mc's?

Jul 25, 2011

i have an array of coins that are layed out on a map for a character to come pick up.i have the coins displaying on screen but i cant get a simple hit test to work. it only seems to work on the last coin created, i presume because the 'i' value hasnt been appended to the name. i knew how to do this in as2 but dont know the syntax for as3. ive attached the file for you to have a look at.

code:
rectangle_mc.startDrag();
rectangle_mc.x = mouseX;
rectangle_mc.y = mouseY;

[code]...

View 4 Replies

ActionScript 3.0 :: Dynamic Naming Or Whatever It's Called?

Nov 7, 2009

I'm curious if there is dynamic naming for variables, arrays, functions and whatnot in AS3. Below are Perl examples of what I'm asking about. It should be pretty explanatory.

[Code]...

View 3 Replies

ActionScript 3.0 :: Id / Naming Dynamic Instances

Aug 4, 2010

I'm producing an array of thumbnails onto the stage from xml, all works fine, but I need to give them a unique number, starting from 0 etc. I believe I'm doing this right but I'm trying to trace back the ID/number from a mouse event...and keep getting the highest number for all of my instances.[code]

View 6 Replies

ActionScript 2.0 :: Flash8 : Dynamic Instance Naming Of MC's?

Jun 5, 2009

I have 4 Mc's on the stage, and they have instance names 'mc1' - 'mc2' etc.The MC's have links in them (they are kind'a navigation items) and i need to change the functions of the 'rollOver, and mouseDown events', but keep the MC's the same.The MC's are referenced by instance name and given functions in the first few frames of he movie. for example

---------------
mc_1_0.onRollOver = function() {
if (_root.mc_1_0._currentFrame == 1) {

[code]...

Now, what i want achieve is to change the instance names of the MC's (mc_1_0 for example) so that when the user interacts with this MC on the stage, they are taken to locations of my choice (and the actions of another MC), by switching the instance names. IE, i want to change the instance name of 'mc_1_0' to 'mc_2_0' at runtime, BUT i want to do it with a variable from a .txt file.i would need to start with a script that looks for the MC with a certain instance name

-- look for instance mc_1_0, and then change the instance name to 'mc_2_0'

The effect would be that the user would instigate the same actions, regardless of which of the two MC's they rolled over.Maybe i could call the instances initially 'MC_1_Temp' and 'MC_2_Temp' etc: and then i would need a script to change them to 'mc_1_0' and 'mc_2_0' at runtime.SO in the text file i would need something like this

--------------------------
&MC_1_Temp_name=mc_1_0&
--------------------------

this way the behaviour of the MC on the stage wil take on the functions of another MC.should i be looking at something like this placed on the MC.....

onClipEvent(load){
//make this instance called - var = MC_1_Temp_name
}

View 3 Replies

ActionScript 3.0 :: Naming And Accessing Dynamic MovieClips

Sep 26, 2009

I'm trying to dynamicly create movieclips that I can drag and drop. Here's what I'm trying to reproduce dynamically: (I placed 2 movieclips on my stage and named them mandible_mc and vertibral_mc)

mandible_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);mandible_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);vertibral_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);vertibral_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
function pickUp(event:MouseEvent):void {
[Code] .....

Here's what's happening:
Unless I have actually placed two movieclips on the stage and named them mandible_mc and vertibral_mc, I get an error. If I DO have those to movieclips on the stage, I get no error and I get my instances of "name_box". But, I can't drag them. I CAN drag and drop instances of mandible_mc and vertibral_mc so I know the addEventListener and buttonMode "thingys" are being created.

View 7 Replies

ActionScript 2.0 :: Dynamic Naming TextField And Refering It?

Mar 8, 2004

I am generation a textField by_root.createTextField("some"+randomNumber,1);Now I want to assign some text to the textField, how do I refer to it???

I tried using a variable first like
var myText="some"+randomNumber;
_root.createTextField(myText,1);

[code].....

View 3 Replies

ActionScript 2.0 :: [CS3] Naming Dynamic MovieClips Individually?

Jun 6, 2008

Code:
for(var i=0;i<10;i++){
var skeet:MovieClip = attachMovie("skeet", "skeet" + i, i);

[code].....

View 5 Replies

ActionScript 2.0 :: Dynamic Object Naming From Xml In Array?

Jan 20, 2009

This is the object array target structure I am looking to create

myObject.myArray[0].data=value;
myObject.myArray[0].data2=value2;
myObject.myArray[1].data=value;

[Code]....

View 2 Replies

ActionScript 2.0 :: Dynamic Naming TextField And Refering It ?

Mar 8, 2004

I am generation a textField by

_root.createTextField("some"+randomNumber,1);

Now I want to assign some text to the textField, how do I refer to it? I tried using a variable first like

var myText="some"+randomNumber;
_root.createTextField(myText,1);
myText.text="something";

it doesnt work it gives me an error

View 3 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 2.0 :: Dynamic Text Field Naming And Assignments?

Sep 22, 2008

Probably a lack of knowledge on my part (no, definitely...), but how do I go about loading dynamic text fields from an array, using dynamic variable naming?

for(j=0; j<count; j++){
this["contacts_mc.nameText"+j+".text"] = inputArray[j][0];
}

"nameText0", "nameText1", etc are the instance names of dynamic text fields in the contacts_mc movie clip, which is on the root level of my timeline.I get no return at all when tracing the target dynamic text field as trace(contacts_mc.nameText1.text), for example. Dynamic naming examples I've come across don't seem to work here - perhaps a difference in how dynamic text fields are assigned?

View 2 Replies

Data Integration :: Naming A MovieClip From FlashVars?

Oct 17, 2006

I have a Flash file containing a floor plan over my office. I want visitors to be able to locate the room for a specific person by clicking on the room nr.In my HTML-code I give the FlashVars a value equal to the chosen person's room number like this:

<param name="FlashVars" value="roomNr=G207" />

Then I have the script in my Flash file where I first declare a variable fetching the value from my FlashVars:

myRoom = roomNr;

After that I have the code to produce a different color to a movieclip, thus indicating which room it is:

import flash.geom.ColorTransform;
var myCT:ColorTransform = new ColorTransform();
myCT.rgb = 0x009900;

I have made a movieclip for each room and named their instances like the values that will be passed when selecting a room.For instance: G207, F106E, U123 and so on. let the instance name of a movieclip be the value from my FlashVars which I declared earlier. I wrote the next line:

myRoom.transform.colorTransform = myCT;

BUT... this will not work. I have tried two things to understand the problem:

1. I put a dynamic text field on stage, naming it and assigning its text to be the value from FlashVars:

testTextField.text = roomNr;

And it works perfect. It gets the correct value and writes it out on stage.

2. I tried to hard code the myRoom variable to be equal to G207 (myRoom = G207; ), and that works fine as well.WHY won't it recognise my FlashVars value as an instance name of a movieClip?

View 2 Replies

ActionScript 2.0 :: Call All Buttons Within A Certain Movieclip (without Naming Each Instance Individually)?

May 21, 2008

how can i call all buttons within a certain movieclip (without naming each instance individually)?

View 5 Replies

ActionScript 3.0 :: Flash - Dynamic Curved Tween On A Dynamic Movieclip?

Aug 2, 2010

I'm trying to make this game and in trying to make it look more realistic, I'm trying to get the balloon to curve upwards before coming down and hitting the target. Is that even possible? Also, the target are dynamically created with random x and y points, so is it possible to make the end points the x and y point of that target?

View 1 Replies

ActionScript 3.0 :: Dynamic Movieclip With Dynamic Mask - Not Showing

Nov 8, 2011

first I had:

maskedImg = getChildByName("current") as MovieClip;
maskedImg.mask = mymask;

and everything worked properly. Then I removed the movieclip from the scene, exported it to Actionscript, and changed the code to

maskedImg = new mymovieclip();
addChild(maskedImg);
maskedImg.mask = mymask;

and now I don't see anything on the scene. If I comment out the line assigning the mask I can see the movieclip although. The mask is created dynamically in both cases.

View 1 Replies

Actionscript 3 :: Calling MovieClip(root) From A Dynamic MovieClip Instance Produces Error 1034

Jan 14, 2012

For some reason, the same code works now, without any problem at all. I don't know what happened, or why, but I no longer have this problem Here's the original post: To put simply, I created a MovieClip, put it with addChild() to stage, and when I tried to call this piece of code:

[Code]...

View 2 Replies

ActionScript 3.0 :: Dynamic Text In Dynamic MovieClip?

Feb 11, 2010

1) I've created a MovieClip and placed a Dynamic Text into this clip. I've named the text "text_txt";2) I've exported my MovieClip for action script (made it a class) and gave it name "ImageContainer"; And I deleted MovieClip prototype from stage (to create it dynamically later)

3) On main time line in frame 1 I've placed code:

Code:
var clip_mc:ImageContainer = new ImageContainer();
clip_mc.name = "myClip";
addChild(clip_mc);

[Code]...

ADDED: Ha, everything was easy! I should just change one string like this:

Code: MovieClip(getChildByName("myClip")).text_txt.text = "doh";When I placed MovieClip in the beginning everything works fine with Strict Mode! Problem has been solved

View 3 Replies

Actionscript 3 :: Cleaning Nested Dynamic MovieClip(Class) In A MovieClip?

Nov 14, 2011

I'm trying to do a cleaning of some classes that is added into a MovieClip, but I can't seems to set the MovieClip(Class) to null. What is the proper way to do it?

private var mcHolder:MovieClip = new MovieClip()[code].................

View 1 Replies

ActionScript 3.0 :: Naming A Variable?

Aug 26, 2009

Code:var StringMine:String = "hello";And i want to use the value of that string, 'hello' to name a new variable, i thought like this,Code:var [StringMine]:String = "One";but not supprisingly, it doesnt work...

View 2 Replies

AS3 :: Way To Array Index Naming

Mar 11, 2010

I thought that there was a way to be able to name array indexes. Like instead of myArray[0], it could be myArray["tileFour"]. I thought that instead of using index numbers one could use index words.

View 1 Replies

ActionScript 3.0 :: Naming In Loader?

Dec 13, 2009

loader is display object but I could not set name to loader. In the documentation loader does not have property of "name". How to set name for loader instance. Example

var imgColl:Array=new Array("1.jpg","2.jpg");
var i:Number=0;
while(i<tot){

[code]....

View 2 Replies

ActionScript 3.0 :: Naming From A Loop?

Aug 8, 2011

is it possible to add variables and name them according to position in a loop? for example how can I do something like this:

[Code]...

View 5 Replies

ActionScript 2.0 :: Naming The MC In A MC When Attach Them?

Apr 18, 2005

I need to change porperites on MC that is in a MC I just attached something and for some reason I can't seem to find out how to get an instance name into them or to just use the one thye have in the library.

View 7 Replies

ActionScript 3.0 :: Naming Mc With Parameter?

Feb 5, 2009

I have created a function to load up my movies what I would like to do is two things

(i) change the ldr to a movieclip

(ii) add an extra parameter to add an instance name movieclip when I call the movieclip

loadMyImage('images/headers/logo.png', 80, 20 );
function loadMyImage(imageURL, xPos, yPos) {
var ldr:Loader = new Loader();[code]....

View 4 Replies

AS3 :: IDE - Dynamically Naming Movieclips?

Sep 23, 2009

Ok, I've been climbing the walls trying to figure this out, looked everywhere for an answer, learned a few bits and pieces along the way, but still can't do it.I've made my Class which is a little movieclip called 'block', it's fine and does what I tell it to do ie. I can reposition itstretch itotate it and stuff.The problem is.. I want to make more of them and reference them individualy so I can change the properties of them individualy ie, the x and y values etc.

for (var i=0; i<2; i++){
var newBlock:blocks = new blocks();
this.addChild(newBlock);

[code].....

View 6 Replies

Actionscript :: Reference A Dynamic Movieclip From An Outside Movieclip

Feb 21, 2010

I have built a movieclip (parentMC) that houses two movieclips within it (mcA, mcB).

in mcA, i'm dynamically attaching movieclips from the library through a loop.

in mcB i'm trying to reference a particular movieclip from mcA via "_parent.mcA". Doesn't seem to be working. However, when i reference said movieclips from the loop within mcA - or even parentMC, it works fine.

View 2 Replies

ActionScript 2.0 :: Reference A Dynamic Movieclip From An Outside Movieclip

Feb 21, 2010

i have created a movieclip (parentMC) that houses two movieclips within it (childA and childB)

in childA, i am dynamically creating movieclips via a loop:

Code:
var newX = 0;
var pagTotal = 8;
for(i=1; i<pagTotal+1; i++){

[Code].....

...and in childB i'm trying to reference one of these created movieclips via "_parent.childA.pagClip01" so on and so forth.

but they dont seem to be working. when i trace the dynamic clip from within childB i keep getting "undefined" in the output. however, I can reference the movieclip from within childA, and even from parentMC no problem.

i've used _root and _level0 absolute paths and still the same failed result.

View 1 Replies

AS3 :: Variable Naming With Loops And Arrays?

Aug 1, 2009

I am wanting to create an array. 10 values in it (couting from 0 index to 9). Each 'place holder' will have a corresponding value to it;s index i.e.

myArray[0]=0
myArray[1]=1 etc...

I can do that in a for loop. But then I want to attach each value to a single variable name. I then want to change that each variable to a string. I then want access to all the variables outside of the for loop.

var i:Number;
var aArray:Array = new Array();
for (i=0; i<10; i++) {

[code]....

The output error is 1084: expecting identifier before aArray.

View 1 Replies







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