Flash :: 2 MovieClips With The Same Instance Name

Jan 27, 2012

I have 2 copys of the same Movieclip on the timeline and I need them both to do the exact same thing, so I figured I'd give them the same instance name.

I have an event listener on the stage that listens for a mouse click and then checks what has been clicked usiing a switch statment, but the switch statment only picks up one instance of the movieclip, the other one comes up as the default.

Mainly what i'm asking is, is it possible to have to movieclips on the timeline with the same instance name?

public function Main() {
stage.addEventListener(MouseEvent.CLICK, doStuff);
}
public function doStuff(e:MouseEvent):void {

[Code]....

View 2 Replies


Similar Posts:


Flash :: Same Varible In An Instance Of Multiple Movieclips

Feb 4, 2010

It might sound confusing so let me explain the situation. I made a movieClip. And in that movieClip I have a dynamic textfield set. I called this textfield "AmmoCount".I dragged this movieClip onto the stage several times and each time I called on the AmmoCount varible in each movieclip and gave it a different value. I get the following error TypeError: Error #1009: Cannot access a property or method of a null object reference.[code]

When I trace these objects, weapon1.AmmoCount works, but weapon2.AmmoCount shows as empty. Yet they both contain a value in them. Ive used the weapon1 property and weapon2 property countless times and there is no doubt that it works. so why doesnt it work for weapon2. but for weapon1. Below is some code that I called on earlier that shows they work.[code]these worked! but when I called on the AmmoCount text box within them, I get the error. The following image you can find within the weapon1 movieClip

View 1 Replies

Actionscript 3 :: SWC Instance Name On Movieclips?

Feb 18, 2010

Is it possible to compile movieclips to swc with the instance name as property name? This happends when I add a dynamic text field, but i would like this also on some UI elements.

View 1 Replies

ActionScript 3.0 :: Same Instance Name In Different MovieClips?

Aug 28, 2010

I've been working on a game recently. I wanted to know if I can have two movieclips (Tabl1_ON & Table2_ON) have the same instance name, as long as they are in different movieclips. Will it cause an error? or will AS3 be kind to me.

View 1 Replies

ActionScript 2.0 :: MovieClips On Stage - Get Instance Name (Box)

Feb 3, 2009

I have one MC on stage with instance name "box". That MC duplicates by using this script:
Code:
duplicateMovieClip (box, newname="box2", this.getNextHighestDepth());
box2._x = xPoz;
box2._y = yPoz;
So the new MC is now called "box2".

Inside original MC "box", I have one button. After click on that button, I need to know on which MC I clicked. box, or box2. I tried to use:
Code:
trace (this._name);
But, that get me only instance name of the button.

View 4 Replies

ActionScript 3.0 :: Different Movieclips Same Instance Name - HitTest

Jan 3, 2011

I'm creating a platform game, and I have those boxes which needs hitTests on all sides - including the bottom.I want my hit areas to have the same instance names. With that I mean, that I want only one instance name for all the bottom hits, one instance name for alle right hits - and so on. If it's possible. 'Cause else there will be so much actionScript code to write.I've been trying to simply make a normal hitTest on for example hitGround, and then place two movieclips with the instance name hitGround, but the hitTest function only works on the last added movieclip with that instance name.I have also been trying to look up some for each in-arrays, but I don't really get the meaning of how to use them.

View 2 Replies

ActionScript 3.0 :: Multiple MovieClips With Same Instance Name?

Apr 27, 2011

I'm following a tower defence tutorial and part of the code is set up so I can build towers on the "grass" movie clip. I wanted to add more patches of "grass" and gave them all the same instance name so I can be able to place towers on them, but I have the problem that I can only place towers on the first item I placed and has the instance name of "grass". I can't seem to place towers on the other patches of grass.I removed the instance name of the first patch of grass and it let me build towers on the second patch, but the second patch only.

[Code]...

View 1 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 3.0 :: Generate Movieclips / Instance Name And Position

Nov 1, 2010

I've got a movieclip in my library called primaryCommMC.I'm loading these 5 times onto the stage and naming them commMC0-4 using the following:[code]Right now they're all obviously loading on top of each other. I want to stack these movieclips on top of each other so the first movieclip will be at y=0 and the following at y=(the height of the proceeding MC + 5 (a little gap)).

View 1 Replies

ActionScript 2.0 :: Using SetInterval With MovieClips - Instance Not Been Scoped

Dec 18, 2009

I have created a number of Movieclips as part of my Navbar such as About Us, Contact etc. I'm using setInterval to send them to a function that springs them open one after another using the tween class. The they are dynamically generated and positioned using the following code, however when I want to use them as buttons by using onRollOver or onRelease they act like I'm not scoping them correctly. In other words the cursor does not change into a hand when over them. This is a setInterval issue as if I have them open just using attachMovie, the scoping works just fine.

The actual code is as follows:
function aboutUs () {
var mcAboutUs:MovieClip = this.attachMovie("mcAboutUs", "aboutUs_mc", 20, {_x:197, _y:520});
var x_elasticTween:Tween = new Tween (aboutUs_mc,"_xscale",Elastic.easeOut,0,100,1,true );
var y_elasticTween:Tween = new Tween (aboutUs_mc,"_yscale",Elastic.easeOut,0,100,1,true );
clearInterval(_global.intervalID1);
} function setIntervals() {
_global.intervalID1 = setInterval(this, "aboutUs", 1000);

There are more in here, each going to its own function to attachMovie and Tween them. This all works fine.

setIntervals();
this.aboutUs_mc.onRelease = function() {
OnRelease is suppose to activate another function that generates the "About Us" page but nothing happens as if the instance is not been scoped.
page_aboutUs();
}

View 2 Replies

ActionScript 2.0 :: Cat 1 And Cat2 Are Instance Names Of Movieclips

Oct 28, 2010

cat 1 and cat2 are the instance names of the movieclips when using the trace command to find out the values of the array this returns both movieclips undefined.Is that correct output window (undefined; undefined)how can trace name of movieclips in the array.[code]

View 5 Replies

ActionScript 1/2 :: Adressing Multiple Copies Of Movieclips With Same Instance Name

Jun 13, 2009

Is it possible to iterate through MV copies with the same instance name? It would be very useful for my project.

View 5 Replies

ActionScript 2.0 :: Getting Angles Of Two Movieclips That Are On Stage With Instance Names

Jun 1, 2004

getting angles, of two movieclips that are on my stage. With instance names: circle1,circle2. I read that I should use the function Math.atan2 to get the angle, in radians, then I convert it to degrees, but it doesn't make sense, the angles aren't correct.. Here I paste the code I use (its AS not PHP don't know how to add the AS tags):

[Code]...

View 2 Replies

ActionScript 2.0 :: Controls The Movieclips _alpha Through Instance Names?

Nov 12, 2004

I have an actionscript that controls the movieclips _alpha through instance names. The problem is: I habe a lot of movieClips and I will use the same action in all of them. The same action, just changing the instance name.

View 4 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 :: Dynamically Loaded MovieClips And Instance Names

Mar 3, 2008

I am using attachMovie in a for(var i=1; i<50; i++) loop.Everything loads fine, but I am having difficulty referencing the dynamically created instance names.I don't want to reference individually ie movieclip1, movieclip2 etc.but more by movieclip[i].Basically - if movieclip instance 1 is rolled over I want to display image 1, and so on?

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 3.0 :: Make An Array Of Movieclips (on Stage With Instance Names)?

Oct 16, 2009

I'm trying to make an array of movieclips (on stage with instance names);My code:

PHP Code:
var regions:Array=new Array("britain.eastAnglia","britain.eastMidlands","britain.ireland");

[code]......

View 2 Replies

ActionScript 3.0 :: Creating Instance Names For Dynamically Created Movieclips?

May 28, 2011

I am trying to use a for loop, to place 5 instances of the same movieclip on the stage. In the loop I used .name to give each movieclip a unique instance name. But when I try to reference one of those instance names in an event listener I get an error. Here is an example of what I am trying to do:

Quote:

var xPos:int = 120;
var yPos:int = 60;
for (var i:Number = 1; i<=5; i++) {

[Code].....

This code generates an error saying that the cStar2 property is undefined. In the example above, does the for loop create 5 copies of the movieclip starC_moov, and give them unique instance names cStar1, cStar2, cStar3, cStar4 and cStar5?

View 1 Replies

ActionScript 3.0 :: Create Instance Names For Dynamically Created Movieclips?

May 28, 2011

I am trying to use a for loop, to place 5 instances of the same movieclip on the stage. In the loop I used .name to give each movieclip a unique instance name. But when I try to reference one of those instance names in an event listener I get an error. [code]...

View 1 Replies

ActionScript 2.0 :: Hide MovieClips At Once By Adding Instance Names To Array

Dec 1, 2004

Is it possible to hide several movie clips at once by adding their instance names to an array, and then creating some kind of function?

View 1 Replies

ActionScript 2.0 :: Change The Movieclips' Width Whose Instance Names Are In An Array

Sep 26, 2008

I want to change the movieclips' width whose instance names are in an array. However I can't change this value even for one instance.

Code:
this.holder_mc.onEnterFrame = function() {
_root.edges[1]._width = 24-_root.holder_mc._x;
trace(_root.edges[1]._width);
};

View 2 Replies

ActionScript 3.0 :: Events On Nested Movieclips Inside A Timeline Placed Instance Are Never Dispatched

Dec 29, 2011

I am an AS3 code developer but this time I need to deal with a FLA that has an instance on timeline with complex nesting of movieclips and textfields (that are named via the instance field in Flash). The problem is that events (I put in the Documentclass) on nested movieclips inside that timeline placed instance are never dispatched.
 
example code:
// my instance on Stage in all Frames of the timeline
public var thewall:MovieClip;
// event directly on thewall works

[Code].....

View 1 Replies

ActionScript 3.0 :: Events On Nested Movieclips Inside A Timeline Placed Instance Are Never Dispatched?

Dec 29, 2011

I am an AS3 code developer but this time I need to deal with a FLA that has an instance on timeline with complex nesting of movieclips and textfields (that are named via the instance field in Flash). The problem is that events (I put in the Documentclass) on nested movieclips inside that timeline placed instance are never dispatched. example code:

Code:
// my instance on Stage in all Frames of the timeline
public var thewall:MovieClip;

[code]....

View 3 Replies

Actionscript 3 :: Communicate Between An Instance Of Flash Embedded In A Browser And A Flash Instance Running In A C# WinForms App?

Dec 23, 2011

I am trying to communicate between an instance of flash embedded in a browser and a flash instance running in a C# WinForms app... I am getting a compile error that say:

1119 Access of possibly undefined property printOut through a reference with static type flash.net:LocalConnection

Here is the actionscript:

var feedback = "";
var receiving_lc:LocalConnection = new LocalConnection();
receiving_lc.connect("fromClient")

[code]....

View 2 Replies

ActionScript 2.0 :: Objects - XML - Creating A New Instance Of An Object That Uses An Identical Name To An Older Instance Delete The Previous Instance?

Mar 20, 2009

Does creating a new instance of an Object that uses an identical name to an older instance, delete the previous instance? Or should the original instance be deleted first? The code uses a ridiculous amount of XML vars. Isn't it less memory intensive to parse the XML and save the properties to an Object, and then delete the XML Object, rather than keep the XML Object around and reference it's child nodes directly? Is it better form to break up a huge XML file (>600lines/3200vars) into smaller chunks?

View 1 Replies

Actionscript 3 :: Constructor To Assign Instance Name From Super Constant When Adding Instance In Flash IDE?

Jun 17, 2010

I have a library object (SomethingMC) which extends a custom class (Something). Something, in turn, extends MovieClip.If adding SomethingMC to the stage within Flash CS3 IDE, is it possible for it's super class (Something) to assign an instance name from a class constant (Something.THE_CONSTANT)?

package
{
import flash.display.MovieClip;[code].....

The above does not work. It throws Error #2078: The name property of a Timeline-placed object cannot be modified. if the instance is assigned a name in the IDE, and it just doesn't work if no name is assigned in the IDE.

View 1 Replies

Flash :: Play Movie Clip Instance Inside Of Button Instance?

Apr 16, 2011

I placed a movie clip instance inside a button, and I want this movie clip to play when the button is released. I'm using this code on the frame containing the button:

function playMovie(event:MouseEvent)
{
this.theButton.theMC.gotoAndPlay(3);

[code].....

View 2 Replies

ActionScript 2.0 :: Possible To Scroll Graphic / Movie Instance As Well As Text Instance In Flash

Jul 19, 2004

Does anyone know if it is possinle to scroll a graphic or a movie instance as well as a text instance in flash. I want to scroll text and images as well. Actually text with imges embedded in it.

View 3 Replies

Flash :: Unable To Convert An Instance Of A Class To An Instance Of The Class's Subclass?

Sep 15, 2011

I'm using a library that has a function that returns an instance of some class Engine.

I'd like to tack on some interfaces to Engine, so I subclass it class InterfacedEngine extends Engine implements AwesomeInterface. but when I change the code that uses the classes from this:

var engine:Engine = generateEngine();

to this: var interfacedEngine:InterfacedEngine = generateEngine();

It gives me a runtime error (elision mine):

TypeError: Error #1034: Type Coercion failed: cannot convert ...::Engine@1bc2bf11 to ....InterfacedEngine.

What about AS3 classes am I misunderstanding?

View 2 Replies







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