Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Dynamically Reference Multiple MovieClips


I'm looking for a concise way to dynamically change the widths of 12 Movie Clips. Let's say they're named mc1, mc2, mc3, etc. Is there a way I can loop through these instance names, referencing them dynamically?

This is what I'm talking about, obviously it doesn't work:

for(i=1;i<=12;i++){
"mc"+i+"._width"-=2;
}

Trying to avoid:
function changeWidth(){
mc1._width-=2;
mc2._width-=2;
mc3._width-=2;
etc...
}




ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 11-19-2008, 11:28 PM


View Complete Forum Thread with Replies

Sponsored Links:

Dynamically Masking Multiple MovieClips
I am trying to create multiple masks to mask multiple movieclips. I have tried a couple of approaches with minimal success. I can get it to mask one movieclip with a mask, but when I try to make it dynamic it doesn't seem to want to work. I have a movieclip called thumbsMC that is a container on the stage. If anyone has any suggestions, I would appreciate them. The code I am trying to use is below.

for (counter = 0; counter < 1; counter++){
_root.thumbsMC.createEmptyMovieClip("thumb"+counte r, _root.thumbsMC.getNextHighestDepth());
_root.thumbsMC["thumb"+counter].createEmptyMovieClip("mask"+counter, _root.thumbsMC["thumb"+counter].getNextHighestDepth());
with(_root.thumbsMC["thumb"+counter].mask){
beginFill(0x000000, 100);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 100);
lineTo(0, 100);
lineTo(0, 0);
endFill();
}
_root.thumbsMC["thumb"+counter].setMask(_root.thumbsMC.["thumb"+counter].mask);
}

View Replies !    View Related
[F8 AS2] Problem Dynamically Creating Multiple Movieclips
Hi all,

I'm in need of some assistance with dynamically creating movieclips. I've some arrays housing information for all manufacturers, all purchase orders, and all sales, dependent on a customer id. There are about a dozen manufacturers against the first customer id, for example. In the middle of the page, there are two dynamic text fields called Purchase Order # and Sales.

Here's where I'm stuck.

What I'd like is for a vertical listing of all manufacturers to appear on the far left based on the customer id. I'd also like it so that whenever you click on a manufacturers name, the Purchase Order # and Sales text fields are populated with the information that matches the manufacturer id.

Though I didn't see anything exactly like what I want online, I did find enough to get me started. I've been trying to create an empty movie clip with text inside, but my code isn't working. And I'm not sure how to fix it.

Here's what I have so far:


Code:
function createNav(){
for (var i = 0; i < allManufacturers.length; i++) {
var mc:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
mc.createTextField('mfr' + i + '_txt',i,35,(300 + (i * 15)),165,30);
var mfr = this['mfr' + i + '_txt'];
mc.mfr.selectable = false;
mc.mfr.textColor = 0x000000;
mc.mfr.text = allManufacturers[i];
mc.onRollOver = function(){
mc.mfr.textColor = 0x000000; };
mc.onRollOut = function(){
mc.mfr.textColor = 0xFF0000; };
mc.onPress = function(){
mc.mfr.textColor = 0x0000FF; };
}
}


It was working fine until I added "mfr' + i + _txt' to line 4. However, I believe I need that to identify each movieclip separately. I think. I think line 5 is also a problem. I've try variations on resolving to no effect. The text simply no longer appears (and even when it did, the mouseover only worked on the last item in the list).

Can someone direct me as to what I'm doing wrong?

Thanks.

Stephen

View Replies !    View Related
[F8 AS2] Removing Multiple Dynamically Created Movieclips Simultaneously
Hi everyone,

I'm not sure why this code isn't working. Perhaps someone can see something I'm not seeing.

This is related to this: http://board.flashkit.com/board/showthread.php?t=783069

I've dynamically created movieclips via the createEmptyMovieClip method. What I'd like is when a button elsewhere on the page is clicked, all of the movies created are deleted - so that new movies can be created in their place.

Here's my code so far:


Code:
btn_qtr2.onRelease = function(){
_level0.container1.unloadMovie();
_level0.container2.unloadMovie();
_level0.container3.unloadMovie();
_level0.container4.unloadMovie();
_level0.container5.unloadMovie();
_level0.container6.unloadMovie();
_level0.container7.unloadMovie();
_level0.container8.unloadMovie();
_level0.container9.unloadMovie();
_level0.container10.unloadMovie();
};
This works just fine so far. I tried the removeMovieClip method, but had better success with unloadMovie.

Since the movie clips are created dynamically, there may be 1 ("container1") or 100 ("container100"), so the list of movies to remove needs to be dynamically determined.

I tried placing the containers in an array, so that when the button is pressed, the function loops through the array and determines what to delete. Here's what I wrote:


Code:
for(i=0; i < mc_container.length; i++) {
_level0.mc_container[0].unloadMovie();
}
...but that failed.

Is there something I'm doing wrong and/or is there a method to remove all movies on a level at once?

Thanks.

Stephen

View Replies !    View Related
How Do You Reference Other Movieclips
How do you reference other Movieclips? I'm coming back from a flash vacation and I don't remember anything.

For example, if I were to have the following code, the result is perfect.

Code:
on (rollOver) {
this._alpha = 50;
}
What I can't find out is how to reference other Movieclips, like

Code:
on (rollOver) {
this._alpha = 50;
someotherMC._alpha = 50;
}
The movie clip that I wish to affect is in another layer, if that helps.

View Replies !    View Related
Dynamic Reference To MovieClips
I have an array containing names (as strings) of already existing MovieClips, array=["a1","a2","a3",...].
Is it possible to refer to a MovieClip using the content of an array?

For example I would like to load the MovieClip "a1" into a blank MovieClip placed on the stage. How can I load the MovieClip using array[0] as a reference?

Obviously MovieClip.attachMovie(array[0]) does not work..

Any ideas?

View Replies !    View Related
Dynamic Reference For Movieclips
I have read several examples both on the web and in the Adobe help files regarding dynamic referencing.

I cannot get Actionscript to recognize a dynamically named clip such as in the attached for loop.

Any suggestions as to why thumbCan[thumbMC+i] returns undefined and therfore doesn't allow anything to be loaded?







Attach Code

for (i = 0; i < mainArr.length; i++) {

thumbCan.createEmptyMovieClip("thumbMC"+i, thumbCan.getNextHighestDepth());
trace("trace1= "+thumbCan[thumbMC+i]); // returns undefined
trace("trace2= "+thumbCan); // returns _level0.thumbCan as expected

daLoader.loadClip(mainArr[i][0], thumbCan[thumbMC+i]);
}

View Replies !    View Related
Reference Child Movieclips
I have 5 moviecips inside a main movieclip.

_cn (main cclip) and _gl0,_gl1,_gl2,_gl3,_gl4 .. inside the main clip.

i want to refer to the clild clip inside a function .. how to do that.

for example .. as below,


Code:
function _xx(_num){
trace(this['cn']); // works fine
trace(_cn.this['_gl'+_num+'']); // error
}
_xx(3);

View Replies !    View Related
Dynamically Loading Images Into Dynamically Loaded MovieClips
I'm read through many of the posts and found several on this topic, none, however, that addressed all that I need addressed. I've tried several of the suggestions but so far nothing seems to work.

What I want to do is alter the width of images loaded dynamically into a dynamically loaded set of movieclips. all of the widths of the images are different, but i want them set to the same width. The width seems to stay at zero, however, and I cannot seem to change it.

Here is my code:

for (var i:Number = 0; i < 8; i++){
var mc = attachMovie("rect_mc", "r" + i, this.getNextHighestDepth());
mc._x = 90 + (i * (mc._width+5));
mc._y = 375;
mc.img_txt.text = "image" + (i+1);
mc.img_mc.loadMovie("myPic" + (i+1) + ".jpg");

mc.img_mc._xscale = mc.img_mc._yscale = (50/mc.img_mc._width) * 100;
};

The last line is the one that does not function properly.

I'd appreciate any help anyone can provide. thanks.

View Replies !    View Related
Null Object Reference With Nested Movieclips
I've been struggling with this issue for a couple of days now, please someone help me out. Basically all I want to do is change the frame of a nested movieclip and flash is getting a null object reference and crashing. This seems like it should be a very simple thing to do in flash, but it is not. I have a movieclip linked to a class which I am attaching via code, that is working no problem. Inside of this clip is another clip with an instance name. As long as the outer movieclip is at frame 1, I can access the inner clip. However if the outer clip is at another frame number the inner clip will not be accessible.

I have created a quick little file which illustrates the problem. In the file there are 2 instances of a movieclip, called test1_mc and test2_mc. Inside this movieclip are 4 different frames, each one with a different box movieclip (a box with the text "1", "2", etc). Each one of these numbered box movieclips are given a different instance name, box1_mc, box2_mc, etc. This inner movieclip also has 4 different frames on it (with different colors). If the outer clip (test1_mc) is at frame 1 then you can access the inner clip (box1_mc) as you would expect (test1_mc.box1_mc). However if the outer clip is on any other frame the inner clip is null. If I check the numChildren, it still traces out 1, but then tracing getChildAt(0) is null. I don't get it.

Below is the code that causes the error:
Click here to download the FLA file


Code:
test1_mc.gotoAndStop(1);
test1_mc.box1_mc.gotoAndStop(3);
trace("test 1 child num: " + test1_mc.numChildren);
var child1 = test1_mc.getChildAt(0);
trace("test 1 child = " + child1);
trace("child 1 name = " + child1.name);
//
test2_mc.gotoAndStop(2);
trace("test 2 child num: " + test2_mc.numChildren);
var child2 = test2_mc.getChildAt(0);
trace("test 2 child = " + child2);
//
trace(" - - - display list - - -");
traceDisplayList(stage);
This file traces out the following:

Code:
test 1 child num: 1
test 1 child = [object MovieClip]
child 1 name = box1_mc
test 2 child num: 1
test 2 child = null
- - - display list - - -
[object MainTimeline] root1
[object TestMovieclip_1] test1_mc
[object MovieClip] box1_mc
[object Shape] instance1
[object StaticText] instance2
[object TestMovieclip_1] test2_mc
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at NestedMovieclips_fla::MainTimeline/traceDisplayList()
at NestedMovieclips_fla::MainTimeline/traceDisplayList()
at NestedMovieclips_fla::MainTimeline/traceDisplayList()
at NestedMovieclips_fla::MainTimeline/NestedMovieclips_fla::frame1()
Notice how the test2_mc numChildren is equal to 1, yet getChildAt(0) is null. I think the is the crux of the problem. Honestly, this is looking like a bug in flash9, because the crash happens even if you just traverse the display list as shown above. How is it possible that something that is displayed on the screen could be null? Or in other words, how could can an object exist on the display list, be physically on the screen, and yet be null. If anyone can give me a work around or explain what is happening here, it will be greatly appreciated.

View Replies !    View Related
Dynamically Reference Components? PLEASE Help
I'm really stuck unless I can figure this out. Any suggestions would be greatly appreciated.

I have a form with some components on it. These components all have the same name, except for the last number. I want to create a loop in which I refer to these components and retrieve their values.

The components are (they are all comboboxes):

Name1, Name2, Name3, Name4
Add1, Add2, Add3, Add4


The script looks like this:


objEventHandler.click = function(){

for(var i=1;i<5;i++){

var strName = ["Name" + i].value;
var strAdd = ["Add" + i].value;

trace(strName + " " + strAdd);

}

}

btnOK.addEventHandler("click", objEventHandler);


The problem I'm having is that ["Name" + i] never seems to refer to the comboboxes, and .value (or .data, .label) return "Undefined".

How do I dynamically reference these components?

Thanks.

View Replies !    View Related
Dynamically Reference Variable?
Is it possible to reference a variable by constructing its name by combining other vars or vars +strings? For example, in the snippet below, can I get the value of childA_X in the trace statement by constructing its name from the current array element plus the string "_X"?
PHP Code:



var mcArray:Array = new Array("childA", "childB");
var childA_X:Number = childA._x;

for (var index in mcArray) {
    switch (mcArray[index]) {
    case "childA" :
    trace("childA Original Posn: "mcArray[index]+_X);//Fails of course
... 




I've run into this type of thing a few times and have never figured out how to do it. Maybe it isn't possible?
Thanks.
Mitch

View Replies !    View Related
Dynamically Create, Name And Reference MCs
I'm fairly new to AS3 and have what I think is a simple issue, but I can't find anything online. so...

I have the following


Code:
for(var i=0;i<4;i++){
var img:MovieClip = new MovieClip();
addChild(img)
}
in this example I want to loop through and create 4 movie clips...I need to figure out how to give them unique and referencable names. Ive tried img.name=... but I can't reference the MCs with the given name

thanks for any help!!

View Replies !    View Related
Dynamically Reference Classes?
is it possible to dynamically reference classes?
i'm not talking about dynamic classes...
hmmm... to explain what i mean, here's an example:
1.say you have a clip in your library with class square(previously known as linkage identifier)
2. you have a String variable called shape which contains the word square.
3. you would like to create a new variable newShape which is of the type contained in the variable shape

i have a feeling this isn't possible but i'm curious to know. anyone with any ideas how to do this? thanks in advance.

i've made unsuccessful attempts such as:







Attach Code

var shape:String="square";
var shapeClass:Class=new Class(shape);
var newShape:MovieClip=new shapeClass();

























Edited: 10/09/2007 at 06:28:46 PM by Craig Grummitt

View Replies !    View Related
Dynamically Reference A MovieClip?
I have a variable setup for a specific movieClip and i want to be able to reference that movieclip with an i++ ....I am specifically talking about the "new_mc" variables.....they don't seem to be picking up in the function.....when i trace them they are correct, but just aren't working.....there must be something wrong with my variable declarations, I can't figure it out.....below is some of my code.....any help is appreciated...

i = 0;
maxpics = 50;
maxer = maxpics - 1;
pic_slider = "easeOutCirc";
mask_slider = "easeOutCirc";
speed = 1;

var new_mc = "_level0.mc.m1.p"+ (i+2);
var new_mc2 = "_level0.mc.m1.p" + (i+1);

_global.forwarder = function() {
if (i == i && i == maxer){
break;
}
else if (i == i) {
mc.slideTo((mc._x-((new_mc._width/2)+(new_mc2._width/2))),mc._y, speed ,pic_slider);
mc2.slideTo((mc._x-((new_mc._width/2)+(new_mc2._width/2))),mc._y, speed ,pic_slider);
masker.tween("_width",new_mc._width, speed ,mask_slider);
i++;
}
};

View Replies !    View Related
[AS2] Dynamically Reference Components?
I have a form with some components on it. These components all have the same name, except for the last number. I want to create a loop in which I refer to these components and retrieve their values.

The components are (they are all comboboxes):

Name1, Name2, Name3, Name4
Add1, Add2, Add3, Add4


The script looks like this:


objEventHandler.click = function(){

for(var i=1;i<5;i++){

var strName = ["Name" + i].value;
var strAdd = ["Add" + i].value;

trace(strName + " " + strAdd);

}

}

btnOK.addEventHandler("click", objEventHandler);


The problem I'm having is that ["Name" + i] never seems to refer to the comboboxes, and .value (or .data, .label) returns "Undefined".

How do I dynamically reference these components?

Thanks.

View Replies !    View Related
Dynamically Reference Variable?
Is it possible to reference a variable by constructing its name by combining other vars or vars +strings? For example, in the snippet below, can I get the value of <b>childA_X</b> in the <i>trace</i> statement by constructing its name from the <i>current array element</i> plus the string "_X"?Code:

var mcArray:Array = new Array("childA", "childB");
var childA_X:Number = childA._x;

for (var index in mcArray) {
   switch (mcArray[index]) {
   case "childA" :
   trace("childA Original Posn: "mcArray[index]+_X);//Fails of course
...
I've run into this type of thing a few times and have never figured out how to do it. Maybe it isn't possible?
Thanks.
M

View Replies !    View Related
Can I Dynamically Reference Movie Clips?
I'm trying to create a for loop that runs an if statement a number of times. I want the argument of the if statement to contain the variable that the for loop uses. Is this possible?


Code:
for(var i:uint=1;i<=4;i++) {
if(parentMC.childMC+i.hitTestPoint(myPoint.x,myPoint.y)) {
// do stuff
}
}
Of course the above returns an error. And it seems there is no way to coerce a string into a movie clip reference that exists on the stage. I could go through and hardcode all the If statements I need, but the idea is to save time. Is there anyway to accomplish what I'm trying to do? FYI parentMC is on the main timeline, childMC is within parentMC.

View Replies !    View Related
Trying To Reference A Dynamically Named Object
Hi. I'm trying to make an interactive deck of cards and am mostly done (http://cards.positivedesign.co.uk ) but i'm having a slight problem. If you click on the link above you'll see a pile on the right, click on the pile and the top card lifts and flips into the center. Click on the right pile again and the center card moves down to a pile on the left, and the next card flips up to the center, and so on. The problem occurs when you click on the right pile the 3rd time, the center card moves down to the left, but goes BELOW the pile rather than on top of it.

I know WHY its doing this - i'm using the child index of the cards to select which cards to flip, so if you click on a card on the right and it has an index of 5, it moves the card with index 6 from the center to the left, etc. - I'm just not sure of another way to do it. I tried naming the cards by numbers, so the top card has a name of '1', and then I used a currentCard variable to keep track of which cards I should be moving. However this wouldn't work when I tried to select which object to tween, because I was referencing 'cardLayer.currentCard' rather than say, 'cardLayer.card1'...

Hope that all makes sense. I'd appreciate any suggestions on where I'm going wrong, or a better way of doing it?

View Replies !    View Related
Dynamically Change The Reference Point
hey does anyone know a way to dynamically change the reference point of a moveclip i create dynamically? i think by default, its top left...

View Replies !    View Related
How To Reference To Dynamically Created Sprites?
Hello.

I have a problem with creating dynamically some sprites that act as buttons and then referencing to them later on. Basically I just create three instances of my own buttonClass that has some rollOvers and outs. I use a for loop for that. Later on I want to change let's say the second and third instances y coordinate. How do I reference to those instances? Here is my code:

ActionScript Code:
private function createMainButtons()        {            var btnTextArrayMain:Array = new Array("first", "second", "third");            for(var i:int = 0; i < 3; i++)            {                btn = new buttonClass();                btn.name = "mainBtn" + String(i);                btn.txt_mc.teksti.text = btnTextArrayMain[i];                btn.addEventListener(MouseEvent.CLICK, bclick);                btn.x = 60;                btn.y = 150 + i * 20;                addChild(btn);            }        }

I tried to use mainBtn1.y = 100; as I set the name property for each btn "mainBtn" + String(i) but it seems that I can't use the name property for referencing to that instance.

Sumo

View Replies !    View Related
Dynamically Reference Move Clips
Say i have a system that names my moveclips, mc_1 mc_2 mc_3.

How can i dynamically reference themdetect if they are there or not

Help is much appreciated

View Replies !    View Related
Dynamically Create And Reference TextFields?
I have been working on porting a dynamic text effect generator to Flash 5. Right now it works perfectly in Flash MX. It uses createEmptyMovieClip and createTextField to create TextFields for each character in a given string and then applies a particular effect to the characters. My problem arises in that Flash 5 does not support the createEmptyMovieClip and createTextField methods.

I have attempted to change my code by creating an dummy MovieClip with an empty TextField inside of it, then using duplicateMovieClip to create subsequent MovieClips for each character in the string.

This seems to be working, but I am having trouble referencing the TextField inside of the MovieClip. As I understand it, in Flash 5 you need to assign a TextField a variable name in order change its value. If I have set up the empty TextField inside of the dummy MovieClip, given it the variable name "field" and duplicated the MovieClip, giving it an instance name of "letter," how would I reference the TextField? I have tried letter.field, but the trace merely returns an undefined value.

Or maybe there is a better way I could be doing this?

(I should probably note that I am developing this in the Flash MX environment.)

View Replies !    View Related
[F8] How To Reference Images In Script That Are Dynamically Loaded
I really need help with this one. I have six png files that are dynamically loaded via xml file into a container and placed on the stage to form a menu. How can i reference them in script so i can tell each one that on release to go to a specified frame??? This is the last part of my project that I've got to figure out and it's driving me insane!!! I'm so close! I really appreciate your time and help. I've attached the files i'm working with.

View Replies !    View Related
Can I Reference A Mc In The Dynamically Load Text File?
I can load text but not align pictures. Also, how can I reference a mc to load into the scroller (text file)?

View Replies !    View Related
Another OOP Question Reference One Dynamically Created Object From Method Of Another
Hi,
I am getting confused with "this" and its meaning and scope when used within a prototype method of a class as opposed to when referencing a movieclip.

I have an array from which I wish to create a new object for each value in the array. Ultimately these will be used to create a collapsable tree navigation system and, therefore, in order that one value in the tree can get its position from the value above I would like to be able to reference the object that controls the movieclip of the one above. Maybe that would be cleare if you see the beginnings of the code:


Code:
function MenuItem(myName, myID, myObjName) {
trace("--- New MenuItem created:: myName = " + myName);
this.myObjName = myObjName;
this.myID = myID;
this.myName = myName;
this.myClip = NewDynamicClip();
this.myClip.creator = this;
}

MenuItem.prototype.myInit = function() {
trace("--- myInit called");
this.myClip.createTextField("myHeader", 10, 10, 100, 0, 0);
this.myText = this.myClip.myHeader;
this.myText.autoSize = true;
this.myText.text = this.myName;
}

MenuItem.prototype.positionMe = function() {
trace("--- positionMe called");
this.myClip._y = [this.myObjName + this.myID-1].myClip._y + [this.myObjName + this.myID-1].myClip._height;
//I have made an effort here to refer to the previous object
//(this objects neighbour)
//but no joy with it written as above!!
}
That is the class in its infancy. The positionMe method should ultimately look at its neighbour check the neighbours height, check for indentations and other little things and then place the movieclip appropriate to this object. But its the checking its neighbour that I can't do.

This is the code that sets it up


Code:
TopMenuItems = new Array("Email", "Boring", "Dull", "Mundane", "Annoying", "Frustrating");

for (var i=0; i<TopMenuItems.length; i++) {
var objName = "menuSingleItem";
var tempItem = this[objName + i];
tempItem = new MenuItem(TopMenuItems[i], i, objName);
tempItem.myInit();
tempItem.positionMe();
}
Take for example the new object responsible for "Boring" : menuSingleItem1. the method called : menuSingleItem1.positionMe() needs to check out whats happening with "Email" : menuSingleItem0, but how do I refer to menuSingleItem0 from the prototype method for menuSingleItem1?

Any suggestions would be fantastic
Thankyou
Robin

View Replies !    View Related
Loosing Reference To My Movie Clip When Create Dynamically
I'm somehow loosing my reference to my movie clip i created dynamically.... can someone tell me what's wrong with this code.

var y=0;
var x=0;
var imageHolderWidth = 276;
var imageHolderHeight = 362;
var gap=50;
// loop through XML and place in array
for (var i=0;i<2;i++) {
var image = "last10_image_"+i.toString();

_root.createEmptyMovieClip(image,50+i);

var imageHolder = eval(image);
imageHolder._x=x;
imageHolder._y=y;
imageHolder.createEmptyMovieClip("_tn"+i,100+i);
mv_sub_image = imageHolder["_tn"+i]

trace(_root[image]["_tn0"]);
with(mv_sub_image){
_x=1.5;
_y=1.3;
_alpha=60;
with(imageHolder){
lineStyle(2,0xA0A0A0);
moveTo(0,0);
lineTo(imageHolderWidth,0);
lineTo(imageHolderWidth,imageHolderHeight);
lineTo(0,imageHolderHeight);
lineTo(0,0);
}
loadMovie("glamour.jpg");
}
_root[image].onRollOut=function(){
_root[image]["_tn0"]._alpha=60;
}
_root[image].onRollOver=function(){
_root[image]["_tn0"]._alpha=100;
}

currentNode = currentNode.nextSibling;
x = x + gap + imageHolderWidth;

//set the max image that can be displayed.
if(i>=1){break};
}




if you look at the trace output .. the first movie clip is undefined after the second loop.

View Replies !    View Related
[F8] Reference Bitmap Object Of Dynamically Loaded Jpeg?
My search skills must be lacking today, so forgive this probably oft asked question, as I've been away from flash development for over a year:

How dow you reference the bitmap object of a jpeg dynamically loaded into a movie clip, from the internet not the library.

I initialize the flash.display.bitmapdata object, load the image into a holder movieclip named "holder", then how do I reference the bitmap object once loaded for use in dissolves, etc?


PHP Code:



this.createEmptyMovieClip('holder',this.getNextHighestDepth());
loadMovie('image.jpeg','holder');




Thanks, sorry my feeble search skills didn't find the answer!

View Replies !    View Related
Dynamically Assign Vars To Text Fields By Reference
Hi All,
I have a task that I'm not quite sure is possible.
I know that in Perl, I can just make a reference to ...well "anything"
But, in Flash AC (which I've just started yesterday), I want to do
this.

Create a bunch of dynamic text fields with instance names that go
"title1_inst", "title2_inst" etc.
Then use methods of the LoadVars Class, to load variables and:

Assign a hyperlink to each dynamic text field that is constructed from
various variables in the external file,
by assigning a variable like this:
<a href="http://www.xyz.com.au/cgi-bin/movie_loader.pl?
movie=MOVIE-01.swf">MOVIE-01</a>

The construction of the actual variable is all working, no problem.

The problem I have encountered is this: When trying to iterate through
a loop, and "dynamically" assign each dynamic text field, well, I
can't work out how to reference the name of each instance. The
following is wrong, but I wanted to do something like this:

myVarLoader = new LoadVars();
myVarLoader.load("http://www.xyz.com.au/media/Flash_Embedded_Video/
movie_list");

// Create function to setup vars on loading of all vars
myVarLoader.onLoad = function (success) {

for (x=1;x<15;x++) {

var build_link = "<a href="+ myVarLoader.link_script + "?movie=" +
myVarLoader["movie"+x] + ">" + myVarLoader["title"+x] + "</a>";

// THE PROBLEM IS HERE, THIS WAS JUST A GUESS AT HOW TO DO IT.
["title"+x+"_inst]text = build_link;

}

How do I reference the name of each text field instance, as I iterate
through the loop?

Also, how do I determine how many vars loaded altogether?

View Replies !    View Related
Dynamically Created Variable Names... How To Create And Reference?
Hey,

I have the following code, and what i am trying to do is run through a loop and create a new movie clip each loop. Since i need to create a new instance name for that movie clip i attach the loop number to the string name. Now how do i reference it later on??

Here is the code..

-------------------------------
for (var i=0; i<itemData.length; i++){
lineStyle(2,0x000000,100);
lineTo(w + (w*i) , (itemData[i]/ vLabel)*vMax);
this.attachMovie("mcGraphPoint", "Point"+i);
Point[i]._x = 250
}
--------------------------------

It's the last line in the code i am referring to. How do i reference a DYNAMICALLY created variable??

G

View Replies !    View Related
Dynamically Created Variable Names... How To Create And Reference?
Hey,

I have the following code, and what i am trying to do is run through a loop and create a new movie clip each loop. Since i need to create a new instance name for that movie clip i attach the loop number to the string name. Now how do i reference it later on??

Here is the code..

-------------------------------
for (var i=0; i<itemData.length; i++){
lineStyle(2,0x000000,100);
lineTo(w + (w*i) , (itemData[i]/ vLabel)*vMax);
this.attachMovie("mcGraphPoint", "Point"+i);
Point[i]._x = 250
}
--------------------------------

It's the last line in the code i am referring to. How do i reference a DYNAMICALLY created variable??

G

View Replies !    View Related
Dynamically Assigned Movieclip Variable Is Not Taking In Object Reference
I have the code below that's supposed to assign the reference of a programmatically created textfield(_root["logoInfo"+i+"_txt"]) to a movie clip variable(_root["logoInfo"+i+"_mc"].info) created at runtime.

when i trace _root["logoInfo"+i+"_txt"], the reference checks out okay but when _root["logoInfo"+i+"_mc"].info is traced, it returns undefined

code:
for(var i=1;i<=logoNum;i++){
_root.createTextField("logoInfo"+i+"_txt", i, 0, 0, 100, 20);
_root["logoInfo"+i+"_mc"].info = _root["logoInfo"+i+"_txt"];
trace(_root["logoInfo"+i+"_mc"].info);
}

View Replies !    View Related
Reference Multiple Instances From A Single Variable?
hello, future lifesavers.

THE SITUATION IN BRIEF: Drag and drop questionnaire with multiple 'drag-things' and multiple droptargets. can I reference multiple targets in one variable, (i.e. a variable declared somewhere for the targets: "these 10 items are ELEPHANT"; and then for the drag-things:"turn ELEPHANT to stage 1") ?

(try and follow me here)...
Ive got (10) target boxes as the same MC (each with a different instance) with 10 separate frames in that MC. Ok so far?

Then, when a certain answer (drag-thing) lands on a target box, it jumps the target box (MC) to a corresponding frame (and the answer itself disappears).

I'm basically trying to get the answers to have a snippet of code that says 'when this, number 1, go on a target, jump the target to its' first stage (frame 1)'.

please please please. I love you.
Mark

p.s. it doesn't matter which answer goes on which target.

View Replies !    View Related
Reference Objects On Multiple Frames From .as File
I have a movie clip that has three frames, each frame contains unique objects that I would like to reference to, however, I am trying to reference the objects from an .as file for that movie clip, I find that I am able to reference the objects on frame 1 only, if I try to reference the objects on frame 2 or 3, I get an error stating the objects don't exist, I found a way to fix this and that is to put the actual code inside of the frames, but I would much rather do this from the .as file, is there a way to do that

View Replies !    View Related
Multiple SWFs In Multiple MovieClips
So I'm trying to load eight swf files at the same time using eight different movie clips (cause i need to move them around) placed in one big movie clip. I'm using a loop that looks like this :


Code:
for (var i = 1; i<=8; i++) {
this.clip_mc.createEmptyMovieClip("spec" + i + "_mc", 10000+1);
this.clip_mc["spec"+i+"_mc"].loadMovie("species/" + i + "_25.swf");
this.clip_mc["spec"+i+"_mc"]._x = 150;
this.clip_mc["spec"+i+"_mc"]._y = 25*i;
}
The problem is that only the last one (number 8 or in fact any number I put as the last one in the loop) shows up on the scene. I'm pretty sure something is wrong with my syntax but I can't figure out what... any tips?

View Replies !    View Related
Generating MovieClips Dynamically
I thougth this was simple: I want an infinite supply of certain draggable items, that is i want to make duplicates of them each time they are dragged away from their original position. I have used the method duplicateMovieClip, wich creates a duplicate of the movieclip, gives it a new name and places it on a new depth.

But i can´t make it work!
here´s my code:

onClipEvent (enterFrame) {
i = 1;
this.onStartDrag = function () {
newMat = mata_mc.duplicateMovieClip(matCopy, +i);
newMat._x = mata_mc._x;
newMat._y = mata_mc._y;
}
}

should I place it on a frame or on the MC?

View Replies !    View Related
How To Put Dynamically Created Movieclips Into One Mc ?
hi
I have created five movieclips using duplicateMovieClip() method.
My question is How to put all these five movieclips into one new movieclip.(as a child movie clips of new one )
Plese help.
Thanks in advance.

View Replies !    View Related
MOving Movieclips Dynamically
Hi all. This is my first posting here, so Im new….and would greatly appreciate a little help in a problem I will do my best to explain.

I found a nifty piece of actionscript (on the net, distributed freely) that makes a movieclip instance move into a position dynamically, with a fade, so it fades in as well as moves. This function was named MoveTo, as you see below the function is set up with its parameters…(by the way, Im using FlashMX 2004)




function MoveTo (clip, fadeType, xTo, yTo, speed)
{
clip.onEnterFrame = function ()
{
this._x += (xTo - this._x) * speed;
this._y += (yTo - this._y) * speed;
if (fadeType == "in" && this._alpha < 100)
{
this._alpha += 5;
}
else if (fadeType == "out" && this._alpha > 10)
{
this._alpha -= 5;
}
};
}

Then later on, on some frames further along (after you’ve clicked a button to go there) it activates the function, and moves a navigational panel specific to a page, in. In the panel is a thumbnail setup for viewing images. On that frame it arrives at (on the _root), to activate the function, is this piece of code for moving the panel in…

nav_bfh.onEnterFrame = function() {
MoveTo(nav_bfh, "in", 73.2, 385, 0.3);
MoveTo(nav_dt, "in", -47, -329, 0.3);
MoveTo(nav_saw, "in", -47, -329, 0.3);
MoveTo(nav_x, "in", -47, -329, 0.3);
MoveTo(nav_sau, "in", -47, -329, 0.3);
MoveTo(nav_per, "in", -47, -329, 0.3);
MoveTo(nav_res, "in", -47, -329, 0.3);
MoveTo(nav_har, "in", -47, -329, 0.3);
MoveTo(nav_ft, "in", -47, -329, 0.3);
MoveTo(nav_and, "in", -47, -329, 0.3);
MoveTo(nav_mod, "in", -47, -329, 0.3);
MoveTo(nav_bag, "in", -47, -329, 0.3);
MoveTo(nav_oma, "in", -47, -329, 0.3);
MoveTo(nav_gra, "in", -47, -329, 0.3);
MoveTo(nav_mau, "in", -47, -329, 0.3);
MoveTo(nav_umn, "in", -47, -329, 0.3);


};

Those little “nav_...” things are the panel instance names. As you can see, there are quite a few of them. If you compare what is in the brackets of each line, to this piece of code…

function MoveTo (clip, fadeType, xTo, yTo, speed)

…from the original setup of the function…you see references to a clip (the “nav_...” clips) and then an “in” for fadeType…as in fade in (you can also set it to fade “out” as well) some x and y references and a speed. Quite straight forward (though it should be mentioned I am not really a programmer and could not write this stuff out of my head)

I like this function, and it is really useful. So I started trying to get a little more clever with it. As I mentioned it is a pic viewing device I am using this on. And so wanted to give the user an option to play through the pics instead of just clicking for them.

The pics load dynamically into a movieclip on the _root called “bg_picloader” when you click a button inside the nav_panel.
There is also a button to play through them. What happens is when you click the button it moves the playhead out of the 1st frame within the movieclip “nav_...” and at intervals I have keyframes which load a different pic into “_root.bg_picloader” and it works. But I want the pics to fade in each time.

So using that earlier piece of code I set up a new function, which looks much the same, only I left out the movement aspects (the xTo, yTo and speed)…in order not to confuse Flash, I changed the name of the function to FadePic… I also changed the word fadeType to fadeHype, (though either way that doesn’t seem to make a diff)

function FadePic (clip, fadeHype)
{
clip.onEnterFrame = function ()
{

if (fadeHype == "in" && this._alpha < 100)
{
this._alpha += 5;
}
else if (fadeHype == "out" && this._alpha > 10)
{
this._alpha -= 5;
}
};
}



Then, within the “nav_...” movieclip, along its timeline, when it calls in a new pic to load (playthrough style) I have placed this piece of code to fade it in…

loadMovie("X_01.jpg", "_root.bg_picloader");

_root.bg_picloader.onEnterFrame = function() {
FadePic(_root.bg_picloader, "in");
};


I forgot to mention that the “bg_picloader” movieclip on the _root has to have an alpha setting of less than 100% to work, which I have done.

It loads in the pics at the given intervals, and that works fine. But it does not fade it in! (it stays as opaque as Ive set it) Ive tried a lot of things, but it wont work. Im sure the error is in that last piece of code I have given(though there are no errors reported in the output when I test it) , I don’t know if it’s the path, or if there is some confusion somewhere else, maybe a confliction. Though I have checked and re-checked my spelling of instances etc.

I hope I have explained this clearly, and that someone can help me out here.

Either way, you will find this a nifty piece of code for moving things dynamically in or out with the fade thing….for making some funky stuff… so go ahead and use it and I hope you get some enjoyment from it at least, as I have.

View Replies !    View Related
Remove Dynamically Placed MovieClips?
How do you remove dynamically placed movieClips from the stage?

my movieClip is exported as scorebullet from the library; this is how I have the array for my project:
code:
var j;
var k;
var i = 0;
cats = new Array();
for (k=0; k<3; k++) {
for (j=0; j<10; j++) {
duplicateMovieClip("scorebullet", "s"+i, 3+i);
bullets[i] = this["s"+i];
with (bullets[i]) {
_x = 8+j*28;
_y = 8+k*25;
}
i++;
}
}


So it creates three rows of ten bullets.

How do I go about removing them from a frame when Im done with them?

I know this doesn't work:

code:
removeMovieClip("scorebullet");

View Replies !    View Related
Getting Movieclips From The Library Dynamically
Hi I'm in the midst of a painstaking port from AS2 to AS3 on a game I have created. Now a piece of code I use a lot is for example;


function wave() {
for(var i:int = 0; i<10; i++) {

enemies.attachMovie("enemy"+i, i);

}
}

that way I can get enemy1, enemy2, enemy3,... and so on from my library.

how do I go about doing he same thing in AS3?
I have tried

var nextEnemy:MovieClip = new [enemy+i] as MovieClip;

and so on, but none of it works, any tips?

View Replies !    View Related
Dynamically Renaming Movieclips
Help needed!

Is it possible to dynamically rename movieclips in Flash? I have been attempting to rename mc's using movieclip._name on a clipEvent, however Flash keeps returning 'undefined'.

I have read elsewhere that it is possible to do this although all my attempts have failed. Is it possible to change a name during runtime, and is ._name a writeable property?

Any help would be much appreciated! thanks!

View Replies !    View Related
Creating Movieclips Dynamically
Hello,

I've been trying to improve a website by moving some pictures around with flash and changing their alpha levels. I'm loading the pictures from the server on purpose so the person I'm developing this for can still use his old webservices. I'm using objects so I can still move the jpeg's around after loading them (I'll post my code below). Now doing all that will not be much of a problem (as far as I can judge that now), but my code is rather elaborate.
I've been able to do some things with a for loop, but some things just do'nt work (it results in an empty screen, but no error messages. I'm not really familiar with object oriented programming, so go easy on me when posing a solution .

Thanks in advance,

Roel


// Initial coordinate positions of MovieClips on the screen
initPos = new Array(4, 4, 208, 4, 412, 4, 616, 4, 4, 158, 208, 158, 412, 158, 616, 158, 4, 312, 208, 312, 412, 312, 616, 312);
// Create movie clip instances.
for (a=1; a<13; a++) {
this.createEmptyMovieClip(["img"+a+"_mc"], this.getNextHighestDepth());
}
//Create Objects to couple to the MovieClips
var mc1_obj:Object = new Object();
var mc2_obj:Object = new Object();
var mc3_obj:Object = new Object();
var mc4_obj:Object = new Object();
var mc5_obj:Object = new Object();
var mc6_obj:Object = new Object();
var mc7_obj:Object = new Object();
var mc8_obj:Object = new Object();
var mc9_obj:Object = new Object();
var mc10_obj:Object = new Object();
var mc11_obj:Object = new Object();
var mc12_obj:Object = new Object();
//Place the MovieClips on the stage when they are loaded
for (a=1; a<13; a++) {
this["mc"+a+"_obj"].onLoadInit = function(target_mc:MovieClip):Void {
var target_depth:Number = target_mc.getDepth();// since the movieclips don't load in the correct order I'm positioning them on the sreen according to their depth property
target_mc._x = initPos[target_depth*2];
target_mc._y = initPos[target_depth*2+1];
};
}
//Create MovieClipLoaders
var img_mc1:MovieClipLoader = new MovieClipLoader();
var img_mc2:MovieClipLoader = new MovieClipLoader();
var img_mc3:MovieClipLoader = new MovieClipLoader();
var img_mc4:MovieClipLoader = new MovieClipLoader();
var img_mc5:MovieClipLoader = new MovieClipLoader();
var img_mc6:MovieClipLoader = new MovieClipLoader();
var img_mc7:MovieClipLoader = new MovieClipLoader();
var img_mc8:MovieClipLoader = new MovieClipLoader();
var img_mc9:MovieClipLoader = new MovieClipLoader();
var img_mc10:MovieClipLoader = new MovieClipLoader();
var img_mc11:MovieClipLoader = new MovieClipLoader();
var img_mc12:MovieClipLoader = new MovieClipLoader();
//Add listeners to the MovieClipLoaders to be able to know when they are fully loaded
for (a=1; a<13; a++) {
this["img_mc"+a].addListener(this["mc"+a+"_obj"]);
}
// Load an image into the MovieClips
img_mc1.loadClip("http://www.kovandun.nl/library/pictures/veld_1a.jpg", img1_mc);
img_mc2.loadClip("http://www.kovandun.nl/library/pictures/veld_2a.jpg", img2_mc);
img_mc3.loadClip("http://www.kovandun.nl/library/pictures/veld_3a.jpg", img3_mc);
img_mc4.loadClip("http://www.kovandun.nl/library/pictures/veld_4a.jpg", img4_mc);
img_mc5.loadClip("http://www.kovandun.nl/library/pictures/veld_5a.jpg", img5_mc);
img_mc6.loadClip("http://www.kovandun.nl/library/pictures/veld_6a.jpg", img6_mc);
img_mc7.loadClip("http://www.kovandun.nl/library/pictures/veld_7a.jpg", img7_mc);
img_mc8.loadClip("http://www.kovandun.nl/library/pictures/veld_8a.jpg", img8_mc);
img_mc9.loadClip("http://www.kovandun.nl/library/pictures/veld_9a.jpg", img9_mc);
img_mc10.loadClip("http://www.kovandun.nl/library/pictures/veld_10a.jpg", img10_mc);
img_mc11.loadClip("http://www.kovandun.nl/library/pictures/veld_11a.jpg", img11_mc);
img_mc12.loadClip("http://www.kovandun.nl/library/pictures/veld_12a.jpg", img12_mc);

View Replies !    View Related
Dynamically Modifying Movieclips
im trying to use this...


Code:
stop();
var shrinkInterval;
var shrinkCount = 1;
shrinkInterval = setInterval(shrinkAll, 50);

function shrinkAll()
{
trace("shrinkAll()"+shrinkCount);
this["maskPiece_"+shrinkCount].play();
shrinkCount++;
if (shrinkCount >= 17) clearInterval(shrinkInterval);
}
the MCs are NOT dynamically attached... but i think i've done this before without dynamically attached them...

i know ive used this with stuff like

_root["maskPiece_"+shrinkCount].play();

with the "_root" in front... but how do i do it inside a movieclip? i thought i was doing this right... but what am i missing?

thanks!

View Replies !    View Related
Glueing MovieClips Together Dynamically
Hi there guys,

Right, to simplify things, I have several shapes on screen ( lets say squares ) that can be dragged and rotated about. Each square has markers on the corners so when in proximity to a corresponding sqaures' markers, they snap together. Problem is, now that they've been glued together, they should be dragged and rotated as one MovieClip. I'm having problems getting my head around they trigonometry needed. Any help appreciated.

View Replies !    View Related
How To Put Dynamically Created Movieclips Into One New Mc ?
hi
Is there a way to dynamically load a specific instance of a movie clip into another? attachMovie() appears to load a clip defined by linkage name directly from the library. What about the case where
one dynamically creates a *specific instance* of a clip in library, modifys it then wants to display it in another blank movieclip?
Please Help
Thanks in advance

View Replies !    View Related
Dynamically Display Movieclips - HELP
I am working on a project that I need some help with.

The project is a build-a-chair deal. The different parts of the chair are in the library as movieclips. I want to be able to send the swf the parts of the chair that need to be shown and have it handle that. For instance builder.swf?back=750&seat=4&rarm=R4&larm=L4&color= 336699

I am working on setting up the movieclips so there are 2 layers. One is the color layer and the other is a semi-transparent image with the contours.

My problem is I have no idea how to dynamically get the options from the querystring and display them in flash.

Can anyone offer me any help or maybe point me to a tutorial that would get me started?

Thanks in advance,
Brent

View Replies !    View Related
Remove Dynamically Placed MovieClips?
How do you remove dynamically placed movieClips from the stage?

my movieClip is exported as scorebullet from the library; this is how I have the array for my project:

ActionScript Code:
var j;
var k;
var i = 0;
cats = new Array();
for (k=0; k<3; k++) {
    for (j=0; j<10; j++) {
        duplicateMovieClip("scorebullet", "s"+i, 3+i);
        bullets[i] = this["s"+i];
        with (bullets[i]) {
            _x = 8+j*28;
            _y = 8+k*25;
        }
        i++;
    }
}

So it creates three rows of ten bullets.

How do I go about removing them from a frame when Im done with them?

I know this doesn;t work:


ActionScript Code:
removeMovieClip("scorecat");

View Replies !    View Related
Dynamically Calling Movieclips
Right, to say I'm getting a little fristrated with this is an understatement.

Basically, I'm using attachMovie to load in a linked movieclip from the library, I then need to dynamically (depending on which part of the movieclip is clicked) load in another linked movieclip into the mc originally loaded.....does that make sense.... Loading the first movieclip is working perfectly, but I'm having real trouble loading in the second into the original.

loadHolder is the function that is working, and is called when the frame runs, loadFabric is the one with issues. It unloads the movie perfectly, but refuses to load the linked movieclip (currently just a red square) in.

Hope someone can spot the no doubt stupid mistake I've made, thanks all!







Attach Code

loadHolder = function(wBag) {
_root.dw_mc.pcb_mc._visible = false;
_global.cBag = wBag;
unloadMovie("holder_mc");
_root.dw_mc.attachMovie(wBag, "holder_mc", 1, {_x: 200, _y: 200});
}

loadFabric = function(selectedBit, fabric) {
var selectedMc:Object = new Object();
selectedMc = "_root.dw_mc.holder_mc." + selectedBit;
trace (selectedMc);
unloadMovie(selectedMc);
selectedMc.attachMovie(fabric, "fabric_mc", 1, {_x: 0, _y: 0});
}

_root.fb_mc.red_mc.onRelease = function() {
selectedBit = "bottom_mc"; //temp until part selection works
loadFabric(selectedBit, "exf_red");
}

View Replies !    View Related
[AS2] Dynamically Adding MovieClips
Hi, I'm just starting to learn AS2 OOP and I've seem to run into a problem. I'm currently building a match making class, but im having trouble with the constructor and attaching MovieClips to the stage. Here's my code:

Frame 1:

ActionScript Code:
var Type:String = "stockMelee";var timeLimit:Number = 0;var Player1:MovieClip = attachMovie("Player1", "Player1", 50);var Enemies:Array = ["Player1"];var Allies:Array = ["none"];var currentLevel:String = "testingGround";var eLimit:Number = 1;var lvLim:Array = [1000, 1000, 1000, 1000];var _Grav:Number = 8;var wGrav:Number = 3;var currentGame = new Game(Type, timeLimit, Player1, Enemies, Allies, currentLevel, eLimit, lvLim, _Grav, wGrav);


Game.as

ActionScript Code:
class Game{    //Varibales    //Level    var matchType : String;    var matchTime : Number;    var levelBounds : Array;    var Level : String;    //Characters    var Player : MovieClip;    var Pl;    var Enemies : Array;    var Allies : Array;    var enemyLimit : Number;    //Gravity    var Gravity : Number;    var waterGrav : Number;    //End Vars    function Game (_Type : String, /*_Stock:Number,*/ _Time : Number, _P, _E : Array, _A : Array, _Lev : String, EL : Number, LB : Array, _G : Number, WG : Number)    {        matchType = _Type;        matchTime = _Time;        levelBounds = LB;        Level = _Lev;        Player = _P;        Enemies = _E;        Allies = _A;        enemyLimit = EL;        Gravity = _G;        waterGrav = WG;        createLevel (Level);        spawnFirstChars ();        var Pl = new Human ("Player1");    }}

View Replies !    View Related
Dynamically Creating Movieclips In AS3
Hi-

I'm currently making the jump from AS2 to AS3, and wondering about how to do a dynamic movieclip creation in AS3, that used to be easy in AS2.

Let's say you are creating an mc which you'd like to create at runtime- for instance you have a bunch of different animation mc's, and you don't know which one you will need until runtime. In AS2, you could handle this case as follows:

var new_mc = attachMovie(desired_anim_linkage, "new_mc", ...);

where 'desired_anim_linkage' is the linkage id of the mc you want to create- this is just a string that can be built however you like, on the fly.

In AS3, we are now forced to use the 'new' operator to create our MC's as far as I know:

var new_mc = new MyAnim();

So the question is- how can we make the call to 'new' dynamic? In other words I'd like to do something lilke:

var myDesiredAnim = "MyAnim";
var new_mc = new myDesiredAnim;

of course this won't work, but hopefully it explains what I'm after...

Thanks

View Replies !    View Related
Move MovieClips' X & Y Relatively/dynamically?
I have about 70 MovieClips and when you rollover one I want it to enlarge and the other MovieClips' x & y to shift so that nothing is overlapping. Does anyone know how to do this or has anyone seen an example? I have attached some screen shots of how I would like this to work. Thanks!

View Replies !    View Related
Dynamically Targeting Movieclips In AS3
Ok so I am very proficent in AS2 or at least I like to think i am and I have been making the leap to AS3 recently but I am having trouble doing something that I am very used to doing in AS2. Its more or less using strings as movieclip names to target them. Whats the best practive in AS3 for doing what I have done in AS2 below?

AS:
var bgImage:MovieClip = bgColors[currentColor + "Bg"];

or

for(i=0; i<maxNum; i++){
var mc:MovieClip = this["navItem" + i];
mc._x = 30*i;
}

So how would I do the samethings in as3?

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved