ActionScript 1/2 :: Using Dynamic Names For MovieClips

Jul 3, 2009

I am trying to simplify things by using dynamic MovieClip names. I have three MovieClips on the stage.

1) mcPage1
2) mcPage2a
3) mcPage2b

But my code isn't working. I'm guessing the "this" part is what is messing it up. Thinking that the computer doesn't know which MC is "this". It traces fine outside the function, but inside the function it traces undefined.[code]

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Dynamic Hit Testing Against Dynamic Instance Names?

Jun 22, 2010

Ok, Background. I have two objects both of which im spawining in though code. We will call them bullets and wolves. They have their own .AS files which tells them everything they need to know about themselves. I figured i would do most of the hit testing on the bullet.AS file, hit testing against the wolves as there were going to be a set number of wolves but not a set number of bullets.o, I named them by running a loop and putting the linenewWolf.name = i.toString();Yes, new wolf is a declared variable, and i is the name of the variable that makes the loop run. I also have a test in it, and it works fine.

However, The hit testing is where i come into an issue. Remember, its on a seperate .AS file. The wolf maker and namer is on the main flash page.The hit testing function isif(this.hitTestObject(a)){i changed up my variable name to run a second loop. first variable name is "i" and the second variable name is "a"And for some reason i get a type error 1034, which from what i understand is an error that you get when two instance names are the same. Also, If possible, i would like to add letters to the name of the object, but im not sure if flash will let me as i belive the code would look something like this

View 1 Replies

ActionScript 3.0 :: How To Instantiate MovieClips With Sequence Names

Mar 4, 2009

I'm rewriting a game that came from AS2, and passing it to AS3. The problem is that I have several different MovieClips in the Library, with a sequence name ("s_0", "s_1,...).

how can I use the addChild to instantiate these movieclips, using these names, sequencially, using a FOR loop?

I'm trying to get a way, that I don't have the remake all movieclips, or else I'll be stuck on the desk for a week :P

View 1 Replies

ActionScript 3.0 :: See MovieClips, Sprite Names In Debug?

Mar 23, 2011

I'm trying to track down some bugs in my code and need to see what movieclips and sprite are creates at runtime - is there a way to see a list of those with properties in flash?

View 1 Replies

ActionScript 3.0 :: Multiple Movieclips With Same Export For Names?

Dec 14, 2011

Since the demensions of some of them, i.e. phones as opposed to tablets, have a much smaller screen, wanted to use different sets of mc's depending on screen size (device dimension wise, not resolution).So a smaller device would use the mc's with larger gfx so they would still be decipherable and the larger devices could use smaller gfx so to be abale to get a larger part on the screen at the same time- I could just scale the entire screen clip all the time, but this will slow it down too much i think- I could create multiple instances and use different names and then sort them out run time in AS, but this would also steal processor time. Im not really for that.

- I could publish multiple versions, depending on device its for. But this would require me to maintain multiple sources on upgrades. I can feel the hurt already.I was hoping it is possible somehow to export the movieclips as .swf's or something and then sorting out run time wich one to import/use/load.Then, hopefully i can refer to them in my code with the same name's but they will be different sizes depending on wich i had chosen to include/load.

View 12 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 2.0 :: Preloading Movieclips With Linkage Names?

Dec 17, 2006

I have a flash movie with a lot of linked movieclips in my library (mc's with linkage names). I have a preloader in the beginning of the flash movie. However, the preloader doesn't show until (I guess) all those linked movieclips are downloaded first. Then the preloader starts showing, starting at something like 40% . How can I include the linked movieclips in my preloading, such that the preloader shows straight away, from 0% ?

View 4 Replies

ActionScript 3.0 :: Attaching Movieclips Through Code With Different Names?

Mar 21, 2009

Alright, so I'm trying out AS3.0, or learning to and I got some questions, which I think should be (and probably are) easy to do.Say I have an .as class file "Animal"and in the Library I have MCs - "Cat", "Dog"in AS2.0 - the MC in the library would have the class of "Animal" and I'd useattachMovie("Cat", ...) or attachMovie("Dog", ...) and it would eference the functions/script of the "Animal" .as Class.Now from what I understand, in AS3.0 - the MC in the library would have the class as "Cat" or "Dog" and I'd change the base class to "Animal" (and have my Animal.as 'class Animal extends MovieClip')Least that's how I think it works.Now let's say in my library I have "Cat1", "Cat2', "Cat3" and I wanted to attach these to the stage through a function

in AS2.0
createCat(catType:String){
this.attachMovie(catType,...)

[code].....

View 3 Replies

ActionScript 2.0 :: Reusing Variable Names For Different MovieClips?

Jun 28, 2011

I'm creating a pacman game and basically I'm having trouble coding the enemies (ghosts), the code works perfectly with just one ghost, as soon as I add another it starts to go wrong.Firstly I've got this function which places the enemies:

Code:
//places the enemies
function placeEnemies() {

[code].....

View 2 Replies

Actionscript 3 :: Dynamically Creating And Assigning Names To Movieclips?

Oct 28, 2011

I have a movieclip that I need to duplicate dynamically based on an outside variable.e.g. clip1, clip2, etc This variable changes so I can't hardcode the number of times it occurs.Is there a way to dynamically create this movieclip multiple times and align it according on the screen?

View 3 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 :: 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 :: How To Add Dynamic Names To MC's

May 27, 2010

I am trying to create a pretty simple image script for a flash website. What it does is to create a container named mc and then loads in an image into the mc from XML. It goes through the XML file like in a for each loop. But the problem I have is that every image container then gets the name mc. So then now when I try to build the function which makes it possible to press on one of the image containers to enlarge them, it only makes the last image larger since that is the last one to be created with the name mc. So how do I give every movieclip that I create a different name such as mc1, mc2 etc.[code]

View 8 Replies

ActionScript 2.0 :: AS 2 Dynamic Array Names?

Dec 14, 2010

I was wondering if it was possible to create the name of a NEW array dynamically. I have tried the following with no success. Does anyone know if this can be done?

Actionscript Code://Tried and failed_global["newArray"+newArrayNumber] = new Array();//Tried and failed_this["newArray"+newArrayNumber] = new Array();//Tried and failednewVariable = _this["newArray"+newArrayNumber];newVariable = new Array();

View 1 Replies

ActionScript 1/2 :: Dynamic MovieClip Names?

May 18, 2009

I have an array that houses the names of six movieclips. I randomly select three of them. I am trying to get my randomly chosen movieClips to do what I want them to do. I have tried the following code to get the first to fade in:

[Code]...

But it does not work. The trace comes back with the full movie clip name ex: mcTom, but even though that value comes up in the trace, the AS doesn't see it as a movie clip. Any thoughts on how I can correct this?

View 4 Replies

ActionScript 2.0 :: Dynamic Movieclip Names?

Aug 1, 2005

I've got this code but apparently the reference to the button doesn't work since i get an AS error upon execution.

PHP Code: [code].....

I've already tried without the brackets but that yields the same result.

View 3 Replies

ActionScript 2.0 :: Dynamic Sprite Names?

Nov 27, 2006

Is it possible to have dynamic sprite names? For example if I am constructing a tile map from an array how can i give each sprite object a different name and referense it later?

in actionscript you could just do

attachMovieClip("blah"+i+"_"+j...

and reference it with root[name]

how could I achieve this with actionscript 3?

View 1 Replies

ActionScript 2.0 :: How To Set Dynamic Background Names

Jul 23, 2008

All the nav links are correct but i am having problems with the background color and placing the submenu nav links.For the background color i am have created a function drawBG. At the moment i have set the name static, but i realise that sometimes i have 3 submenu.So i can't use the same name over and over again. How do i create the names dynamicly for say 3 submenu'sso i have something, likemainMenuBG - submainMenuBG - subsubmainMenuBG - subsubsubmainMenuBG

Code:
function generateMenuNew(container, name, xPos, yPos, depth, node_xml, bgMenuDepth, bgName) {

[code].....

View 6 Replies

ActionScript 3.0 :: Creating Dynamic Var Names?

Jun 22, 2010

Is there a way to make dynamic var names? Cant remember how to do this.

Something like:
NameCount = 1;
Obj.eval("Item" + NameCount)) = "hello world";
Obj.Item1 // trace "hello world"

View 3 Replies

ActionScript 3.0 :: Dynamic Array Instance Names

May 28, 2009

This should be simple but I can't come up with or find the answer anywhere. All I want to do is create a series of Arrays with instance names generated on the fly. I then want to reference these later. I have a "for" loop with a variable "count" that I want to add to a base name of rowArray and use the result to create an Array. I would think that it would look something like this:

[Code]...

View 2 Replies

ActionScript 3.0 :: Creating Clips With Dynamic Names?

Apr 6, 2009

the error I recieve i:Instantiation attempted on a non-constructor.

Relevent Code:
private var hoverText:MovieClip;
private function createTexts():void{ for (var i:Number=0;

[code].....

View 4 Replies

ActionScript 3.0 :: Dynamic MovieClip (Loader) Names?

Jul 8, 2009

I have an array of data that I'm using to create thumbnails and labels  I'm using "Loader" to load the thumbnails (sample code below) but what I'm wondering is how I can make the name of the loader dynamic so that each child gets named "image1, image2, ...". I tried adding "[i]" after the "image" for each item in the code but it complained about missing semicolon before left bracket.

var image:Loader = new Loader();var target_image:URLRequest = new URLRequest("images/" + xmlData.Product[i].id + ".png");image.name = "image_"+[i];
image.load(target_image);

[code].....

View 3 Replies

ActionScript 3.0 :: Dynamic Names For Class And Variable?

Sep 20, 2009

How do you make a new instance of a class with a dynamic name.

var dynamicname = new dynamicname()

i try something

var this["test"]:Class = new ["Test"]()
 
but offcourse its not this...

I need this couse i have a librairy with SWC fonts they are only reference.. I get the font name from a CSS file and after i need to make a instance of the SWC file so the font is embedded.

View 3 Replies







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