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


Similar Posts:


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

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 3.0 :: Naming Multiple Movieclips Using .name?

Mar 13, 2011

I am working on a little project where I have this:

Code:
for (var py:int = 0; py < 6; py++)
{

[code]....

View 2 Replies

ActionScript 2.0 :: Hittest - Avoid Naming All Of The Movieclips

May 3, 2010

Code:
if(_root.selmovie.hitTest(this._parent)){
_root.hit.text="it worked";
}

Why doesnt this work? I want to avoid naming all of the movieclips that this hittest is to apply to but this._parent isnt working...

View 4 Replies

ActionScript 3.0 :: Dynamically Naming/referring To Movieclips?

Feb 15, 2010

I am going to have a button that when you click on it it creates a movieclip and adds a certain child to it (In this case, its linkage is set as "Rifle"). Each time you click on the button I need to give the new movieclip a different instance name then the last, such as "Riflemen1", "RifleMen2" etc.. I will need to be able to refer to each movieclip seperatly in my code, such as for example:

You spawn three Riflemen.. You click on one of them, which selects it, you then click on an "Attack" button which makes only him start firing (in my case gotoAndStop(2)), you then decide you want the third one to attack and so forth..

View 1 Replies

Flash :: Naming Instances Of MovieClips Loaded Dynamically?

Aug 18, 2010

I'm trying to name the instances of MovieClips that I dynamically load.

I tried doing this:

comp = new Comp();
// and also tried doing this--> var comp:MovieClip = new Comp();
comp.name = "comp"; // comp is the name I want the instance to be

[Code]....

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

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

ActionScript 3.0 :: Accessing Movieclips Within Other Movieclips?

Oct 5, 2008

I am still transfering from AS2 to AS3 and right now i am having a very annoying problem. THE STRUCTURE:
Maintimeline contains 2 buttons that i want to use to access children in a bunch of movieclips. rectangle_mc has circle_mc circle_mc contains xx_mc xx_mc contains wtf_mc placed on frame 1 on maintimeline Why can't flash see my nested movieclips? I remember in AS2 you could go down the line:

[Code]...

View 15 Replies

Flash :: Accessing Movieclips In Movieclips?

Jul 30, 2010

I am starting with AS3 programming icm with Flash Builder 4.I have created a "Main" class which is the initial stage.On this stage there is a movieclip called mcMain.In this mcMain is 4 other movieclips: mcStats1 mcStats2 mcStats3 mcStats4 .How can I access these mcStats1-4 from the code to make them go to another frame?I tried:

var t:MovieClip = MovieClip(getChildByName("mcMain"));
t.getChildByName("mcStats1").gotoAndPlay(3);

But that just keeps giving me null reference errors:TypeError: Error #1009: Cannot access a property or method of a null object reference.

View 4 Replies

Array's And MovieClips - Use The Naming Conventions Of An Array?

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

AS3 :: Accessing Variables Between 'movieclips'

Jun 16, 2008

I have finally started with AS3 and flip-'eck its a different animal that AS2

I have a swf called login.swf and in it have declared the variables var total:uint=0; and loginState:Boolean=false

All my scripts for logging in sending/receiving variable from/to server scripts are all working!

So... when a user supplies a correct password another swf (userLogged.swf) is loaded (note: in AS3 this process is seriously different than in AS2) swf dont seem to be loaded 'into' another movieclip anymore... and this leads me to the puzzle!

How do I access variables declared in the project.swf, from within the userLogged.swf!

the old AS2 way = trace (_root.loginState);

or trace (_root.project.loginState)!

I am stumped by this new approach of AS3 of loading in other swf files. The _root. options is no longer available in AS3 (that much I've descovered, some tuts say use root. but I cannot get that to work)

trace (root.loginState)
or

var userLoggedIn=root.loginState

gives me the error

1119: Access of possibly undefined property loginStatus through a reference with static type flash.displayisplayObject.

when I try to publish the userLogged.swf

View 4 Replies

IDE :: Accessing Different MovieClips In Array?

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

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 :: Accessing Movieclips On Different Frames?

Dec 3, 2009

i have a gallery on my root timeline. The gallery is called work_mc. Inside of work_mc I have various buttons. There is a different section on different frames.For example,ALL is on frame one, PRINT is on frame two, motion is on frame three.In the root here is the

Code:
work_mc.urbanthmb_mc.addEventListener(MouseEvent.CLICK, clickHandler);
work_mc.urbanthmb_mc.buttonMode = true;
function clickHandler(event:MouseEvent):void {[code]......

This is targeting the buttons that are on frame 1. How do I get to the buttons that are on frame 3? I tried just using the movieclip names but this doesnt seem to work?

View 0 Replies

ActionScript 3.0 :: Accessing MovieClips In A Different Timeline?

Nov 20, 2010

everyone comes across when switching from AS2 to AS3. I have two movieclips (on the same timeline)- character and walls. on the timeline inside walls, I want to access the x and y coordinates of character. How can this be done without the convenience of _root or _parent?

View 1 Replies

ActionScript 3.0 :: Accessing A Button With MovieClips?

Jul 20, 2011

I have the following code that loads MovieClips to the stage:

ActionScript Code:
var sp:MovieClip = new MovieClip();
addChild(sp);
for (var i:int=1; i<19; i++) {

[code]....

Let's say I have 18 MovieClips and on the 18th MovieClip I have a button that I need to access. How would I do that? The following doesn't work:

ActionScript Code:
sp.bm.Pag18._homeBtn.addEventListener("mouseUp", goHome);

View 5 Replies

ActionScript 3.0 :: Accessing Movieclips On Different Frames

Dec 3, 2009

i have a gallery on my root timeline.The gallery is called work_mc. Inside of work_mc I have various buttons. There is a different section on different frames. For example, ALL is on frame one, PRINT is on frame two, motion is on frame three.[code]This is targeting the buttons that are on frame 1. How do I get to the buttons that are on frame 3? I tried just using the movieclip names but this doesnt seem to work?

View 1 Replies

ActionScript 3.0 :: Accessing Nested Movieclips?

Dec 5, 2009

I have a movie clip (assigned to a class) with several keyframes. Each keyframe consists of another movieclip, which contains an animation and all use the same name. Lastly, several of the animations contain a third movieclip, which is also assigned to a class and also use the same name. I need the first movieclip to speak to the third, unfortunately, it simultaneously tells me that the clips in the second layer (the ones at the keyframes) exist and do not exist. Namely: second layer "does not exist" in that the primary movieclip has only one child: a null. If I add other movieclips to the primary's frames, they also report back as nulls depending on what frame I'm on. I've tested this in several parts of the code, though I suppose it's possible that I managed to pick five equally bad spots. It's just so bizarre I still don't know what to think about it. However, the second layer of named clips are there, but I can only prove it by deliberately breaking the code in hopes of deliberately getting a reference error (by attempting to make the clip private, which isn't allowed given my setup).

View 0 Replies

ActionScript 3.0 :: Accessing Movieclips From Class

Mar 14, 2012

I'm having a lot of trouble understanding a certain thing.I'm creating a child of a symbol in my 'main' class.[code]I have no idea how to access 'player' from a seperate class? I would like to change x and y coords from a seperate class. However when I use code like 'player.x = player.x + 2' i get the error message Line 17 1120: Access of undefined property player.I guess in the most simple words, I do not know how to access symbols or their children from a class that is not the document class.[code]Basically I just am curious as to why I can't simply access these items from another class?

View 2 Replies

ActionScript 3.0 :: Accessing Dynamically Created Movieclips

Nov 21, 2008

I have an application that I am adding movieclips to a container movieclip through a for loop and repeatedly calling myClip.addChild(theNewClip). Now I have a dozen clips in my container and it seems like the only way to access the clip is to use the getChildByName() method and cast it into a temporary clip so I can get at the its properties.

Is this the best and/or only way to do this? Does the old AS2 myContainer["theName"].property not work with dynamically created movieclips? It doesn't seem to work for me anymore.

access a dynamically created movie clip.

View 1 Replies







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