ActionScript 2.0 :: Dragging Multiple Mcs Using For Loop?
Jan 9, 2009
I have many MCs on the stage ,I just dont want to paste the same code to all MCs one by one..so I want to ust the following loop but not sure where to paste the following code.
ActionScript Code:
myArray=new Array("mc1","mc2","mc3","mc4","mc5","mc6","mc7","mc8","mc9","mc10")
for(i=0; i<=myArray.length; i++){
[Code]......
View 4 Replies
Similar Posts:
Feb 15, 2010
I have need to simultaneously move a slider (called "shadeGrabber") movie clip and a mask. I'd like to do this by dragging the slider and seeing the mask move with it.
The example movie clip on the left (called "PICTURE_WIPE") is what I'm going for, but interactive instead. I'm working in the movie clip on the right (called "PICTURE_WIPE copy 2")
Here's my code, for quick reference (found on the "AS" in the "PICTURE_WIPE copy 2" movie clip:
[Code]....
View 4 Replies
Oct 16, 2010
I just wanted to know if there is a way to startdrag() multiple objects at once. I don't want to use the mousemove/enterframe + x And y offset method of dragging, but just use the built-in startdrag method. Making startdrag function multiple times with different objects didn't work.
View 3 Replies
Jul 20, 2011
I have an extremely simple fla, that I wanted to add one thing to, but can't get it to work right. There are 5 layers, each one has 1 key frame and that's it.
1. "Actions" Layer
Code:
startDrag("mask", true);
[code].....
View 3 Replies
Feb 27, 2010
I have a site that uses a custom cursor, I would also like to be able to drag other objects around. However in flash this seems to be quite difficult. came across this site called senocular and they had a .as file called beginDrag.asThey had some simple useage for the script:
on(press){
this.beginDrag(true,0,0,300,300); // constrained to 300x300 square
}
[code].....
View 1 Replies
Feb 27, 2010
I need to have a custom mouse cursor and also have dragable object on my page. im using flash 8. I came across this site called senocular which had a list of .as files [URL]
and some simple useage such as:
on(press){
this.beginDrag(true,0,0,300,300); // constrained to 300x300 square
}
on(release, releaseOutside){
this.endDrag();
}
I would love to get this to work, however I dont know how to import this into flash 8. I thought classes only worked for flash 9 and actionscript 2.
View 1 Replies
Feb 5, 2012
[Code].....
I have a group of 16 images that I would like to load 1 of each into each movieclip. I want image1 to be inside of visual1, image 2 inside of visual2, and so on. the images are named like, 1960s_(1).png where the 1960 (year) part is coming from the rangeNum variable. The above gives me this error: 1061: Call to a possibly undefined method addChild through a reference with static type int.
View 4 Replies
Aug 25, 2010
How do i word a for loop to make it loop through multiple arrays?I want 1 for loop to loop through multiple arrays in order to move/alter objects.I want to keep the arrays separate.
ActionScript Code:
characters = new Array();
characters[0] = male;
[code]........
View 3 Replies
Sep 2, 2010
i have been building a library that has thumbnails which you click to view the full image. i have built the application it works but i want to change the way the image on the actual thumbnail loads using code instead of manually adding the value to the url loader component.
var myX;var instanceN:String;trace(instanceN);var currentLoad:uint = 0;// current loader and image loadingvar thumbnailURL:String;//Thumbnail URLvar thumbReq:URLRequest;// Thumbnail url requestfor(var k:uint = 0;k < iL_btn.length; k++)[code].....
the loop runs fine without the last line of code which i've commented out.the make up of these thumbnails are a uiLoader component which are each inside there own movieClip.what i wanted this to do was every time the loop runs it currentLoad adds 1 to its value then that value is subbed into instanceN:String and thumbnailURL address that bit works the trace statements read correctly.but my issue is using the instanceN value as the instance name path which then loads the current thumbnailURL value which is the URL address for the thumbnail picture.when i try to load the url address using the commented out code above i got the error .TypeError: Error #1010: A term is undefined and has no properties.the trace statements correct values below
the first value is the currentLoad value.
the second value is the instance name path.
the third is is the URL address for the thumbnail.[code].....
View 3 Replies
Apr 5, 2011
how to imitate a reflection of a movie clip in a "mirror." I don't know if I should have the initial movie clip on custom cursor or have it set to drag... but either way I don't know how to make the second clip the "reflection follow along. Obviously it would need to follow at a slightly offset pattern so that you would be able to see both clips (or majority of them) at the same time. It's for a school project that is due at 9am tomorrow so time is of the essence!!
View 4 Replies
Jan 12, 2012
I have 3 different MovieClips inside my library,
I can put each one severally to the stage,
but I can't put all of them using for loop and addChild();
View 9 Replies
Oct 22, 2007
I really hope someone can help me with this one! I've been trying to loop several embedded flv files in one flash document. I've found some really useful script that works when applied to one flv file in the document, however I don't really know how to adjust the actionscript so that it applies to the other three flv files on the page.[code]
View 2 Replies
Oct 26, 2009
I want to make multiple empty MCs and fill each one with a thumbnail for a menu. I want to do this using for loops so I can control as many as I need.
What's the most efficient way of doing this?
I'm used to creating empty MCs in AS2, but I'm not familiar with the new display object way of handling this method.
So far I have this:
Code:
for (i=0; i<numImages; i++) {
thmb.push(gallery.features.image[i].@thmb.toString());
var imageLoader:Loader;
[Code]....
View 6 Replies
Jul 6, 2010
in a loop i wish to load a sequence of images in an individual movieclip for each. e.g image0 in movieClip0, image1 in movieClip2 etc...
i've set up the loop and the movieclips are added using an array.
addChild(aMovieClips[i]);
when i use loaders.load(new URLRequest("assets/images"+section+cityCode+i+".png"));
it unloads the previous images and only shows one image in the last movieClip.
I then tried using loader[i].load but this didnt work.
I then tried creating the loaders outside of the loop and then adding them to an array but this doesnt seem to work.
specifically it breaks at aMovieClips[i].addChild(aLoaders[i]);
How do i go about adding a different image to each individual movieClip.
View 5 Replies
Oct 20, 2010
I need to put a load of MC's on stage with the use of an array as such:
Code:
for (var i = 1; i = 4; i++) {
if (reg[i] == "singlewall") {
var Wall:MovieClip = new wallClass() as MovieClip;
mainClip.addChild(Wall);
}
}
I need a lot more then 4 though and I need a way to make new "Wall" variables
Tried doing it with:
Code:
for (var i = 1; i = 4; i++) {
if (reg[i] == "singlewall") {
var Wall:MovieClip = new wallClass() as MovieClip;
Wall.name = "mc"+i;
mainClip.addChild(Wall);
}
}
This does not work though, yields an infinite loop somehow
View 4 Replies
Mar 9, 2010
1. Created a flash banner ad on the first scene. Take note they're all under frame one because I used movie clips for the animations (Movie clip ends on the 100th frame and not sure if I need to add a stop(); code there or place the gotoAndStop command). Anyways, moving on.
2. I created a new banner onto another scene which by now I have 2 scenes. Just like scene 1, all the animations and such are all under frame 1.
3. Placed an action script on the first scene to play the next scene.
gotoAndStop("scene 2", 1);
4. For the second I placed the action script:
gotoAndStop("scene 1", 1);
Output:It looks like my banner ad is flipping one scene from another without stopping. I know my action script is not correct. I know you folks are far more experience in flash, so I implore your wisdom.
View 2 Replies
Apr 6, 2010
Is it possible to have multiple conditions within a FOR loop ?
Code:
for (var i:Number = 0; (i < anArray.length & aBoolean = false); i++) {
trace("woah, this worked!");
}
So the loop carrys on as long as 'i' doesnt exceed the length of the array AND a Boolean remains false.
View 3 Replies
May 15, 2009
I have this for loop that is basically pulling some info from an xml file and putting it in a list box. And for each item in the xml, it also adds 2 radio buttons.Everything is working properly except all the radio buttons have the same y location, and i want them to be spaced apart, not on top of each other.I have tried messing around with the y location (rb1.y+105, etc) but I'm not having any luck.
for (var i:uint=0; i<il.length(); i++) {
lb.addItem({data:il.description.text()[i],
label:il.title.text()[i]});
[code].....
View 2 Replies
Feb 24, 2010
Let's say I have ten widgets that have ten items that need to be turned off. What am I doing wrong here?
Code:
for(i=1;i<=10;i++){
var tempWidget = ["widget0" + i];
trace(tempWidget);
tempWidget.item._visible=false;
}
The trace returns the correct value yet the loop doesn't turn the ten items off. Why?
View 2 Replies
Jul 8, 2011
I have several SWF files which are essentially little trivia files, provided to me by a 3rd party. They are individual files that number about 20. I am wondering, how can I play this as a list; like a playlist, and then loop back to restart? I'd like to do this in the stand alone player however it can only seem to load 1 file at a time. How I might look to accomplish this looping playlist?
View 1 Replies
Dec 17, 2011
I'm very new to Adobe Flash CS5.5. Can you create a common instance EG: "Enemy" and then control it like so:
Enemy.x += 1;
So that all instances of Enemy will move forward one pixel each frame? Instead of just one enemy? If this is not possible could I set up some sort of array of enemies like you can in C and try something like:
int EnemyNo = 1;
for(EnemyNo = 1; EnemyNo < 5; EnemyNo++) {
Enemy[EnemyNo].x += 1;
}
Does Flash even support "for" loops?
View 21 Replies
Jul 5, 2010
I simply want to be able to access 3 already created, but not yet added movieclips using a loop. I've tried a few code combination but can't figure out the syntax.[code]
View 2 Replies
Sep 18, 2010
there is something i just dont get regarding motion with multiple movieclips (from a for loop). I have tried many different approaches, and every time there is either all the clips move in the same direction, other times they only move one direction, other times when i get individual motion for each object they dont move smooth, and seems more too move very slowly across the scene but rapidly back and forth in a small area. I dont have any specific code to show, but does anyone have tips or a place to direct me, cause i dont understand the logic of it, however i want to understand.
View 2 Replies
Oct 4, 2010
can I mask multiple object through a loop
should be the question
ActionScript Code:
for (var m = 0; m < mylooper; m++ ) {
MovieClip(holdbox.getChildByName("mytxt" + [m] )).mask = mymask
}
it seems to only mask the last object not all of them
View 3 Replies
May 17, 2011
Is there a way to load multiple images with a loop and an array... i mean without using xml as said all forums that i've already read... i have 15 images and i want to know if it's possible to load all of them without a loader and a URLRequest for each one... there is the position problem too.[code]...
View 9 Replies
Jun 15, 2011
create movieclips in a for loop.Basically I am trying to create a series for movieclips and add these to my stage based on an array of values.
for (var i:Number = 0; i < product_total; i++) {
product_mc.name = productid[i]
addChild(product_mc);
[code]....
This code works fine to add one but I can't add more instances?Appears addChild not render mutiple instances on the stage.
View 2 Replies
Jun 8, 2010
I put together this code that builds a container that contains boxes(squares) in an ordered way. Problem is when I rotate the container, the boxes don't stay in their order. (something to do with swapping depths I think) . In fact, they look a bit confusing. Just create a movieClip 24 x 24 and Name it Box. Create another movieClip and name this one Container. Save them in your library. Then just copy this code and compile. You know the routine.
[Code]...
View 2 Replies
Nov 12, 2003
i'm having a problem with a for loop. The problem is that it doesn't create multiple movieclips with an unique instance, i think it copies over itself.
for( var i = 1, x = -20; i < 4; i++){
if(this['plaatje' +i] != undefined){
_root.again.createEmptyMovieClip("image", i);
[Code]....
View 4 Replies
Apr 16, 2005
Everytime I press a movieClip, i -1(on the output window) should be equal to the number of the movieClip (ex: myClip17, when pressed, should produce in the output window a value of 17 for i-1). Please copy paste this code to a flash document and you'll see what I mean (please don't forget that you have to have linkage in the library for a movieClip symbol that you have to create - it's a circle only with stroke that has w=15 h=15). Every time I click on a number it should appear a circle on it. If the circle is already there it should disappear. But that's not the case. Somehow every movieClip has the order to attach one of the instances of movieclip marca_mc to myClip31.
var mcAcoplado = [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
var diasDoMes = 31+1;
var distEntreTexto = 10;
for (i=1; i<diasDoMes; i++) {
[Code] .....
View 5 Replies
Oct 21, 2005
I have the following XML. Currently it is only pulling one event item from xml data source. I would like to add the ability to pull multiple events listed on the same day.
XML structure:
<year value="2005">
<month value="10">
<day value="20">
<label>Test</label> .....
Code that I am modifying:
_root.dayNode_xml=monthNode_xml.firstChild;
_root.dayNode_xml=setDay(_root.dayNode_xml,1,"squa re1");
Researching I found this code and I'm pretty sure formatted correctly this is the answer to my issues:
if (topLevel != null) {
for (i = 0; i <= topLevel.childNodes.length; i++) {
if (topLevel.childNodes[i].nodeName == "mp3file") {
var track = topLevel.childNodes[i].attributes["track"];
View 1 Replies