ActionScript 3.0 :: How To Get MovieClip To Loop
Apr 21, 2011
I have created an bar of thumbnails and added as3 code so that the imagebar scrolls to the right or left depending where the mouse pointer is located. However once you reach the end or beginning of the clip it just stops. How can I make it loop to beginning or end (depending on which way you're scrolling?? I'm very new to Flash and as3 as a warning.
Here is my code so far.
MovieClip(root).addEventListener(Event.ENTER_FRAME, enterFrameHandler);
function enterFrameHandler(event:Event):void{if (MovieClip(root).mouseX > 600 && mouseX < 800 && mouseY > 450){imgBar.nextFrame();
}if (MovieClip(root).mouseX > 800 && mouseY > 450){imgBar.nextFrame();
imgBar.nextFrame();
}if (MovieClip(root).mouseX < 300 && mouseX >100 && mouseY > 450){imgBar.prevFrame();
}if (MovieClip(root).mouseX < 100 && mouseY > 450){imgBar.prevFrame();imgBar.prevFrame();}}
View 4 Replies
Similar Posts:
Apr 18, 2010
I'm trying to create a movieclip object that contains another movieclip that continuously loops. My current problem is, no matter what I try, the embedded movieclip will not play inside the one containing it. It would be significantly more work to design the looping animations in actionscript than through using the IDE, so I would prefer not to have to dynamically create these loops.
View 1 Replies
Apr 26, 2011
I got a Flash AS2 website and I need to get all the buttons inside an instancied movieclip (to define an specific property for each one). I've been searching for an hour or more, but I just got solutions for AS3
View 2 Replies
Aug 31, 2010
I have got this example of drag and throw its working fine..But i need to add some more feature what code should i add to make this in loop and besides that i want this slide to scroll through numbered buttons..like in this example [URL]
View 11 Replies
Nov 11, 2010
im trying to make a For loop that when run will create a movieclip containing 3 text boxes (title, summary, date) for each one of the XML items. Am i way off here?
Actionscript Code:
function onLoaded_2(e:Event):void{ xml_2 = new XML(e.target.data); xml_2.ignoreWhite = true; var il:XMLList=xml_2.channel.item; for(var
[code].....
View 1 Replies
Aug 5, 2011
I am trying to do this in as3
for (var i = 0; i < 8; i++) {
var clip = "markerMC" + i;
this.scoreGridMC[clip]._visible = false;
}
But I get compile errors all the time.
View 1 Replies
Sep 12, 2011
I am trying to coding a part of a program which is creating different listener for the same object by using a for, but the problem is that the result for all of them is the same, In the following you can find my code:
for( var i:int=0;i<10;i++){
var obj = new MyClass();
obj.y = i*30;
[code]...
My goal of writing the code above is, by clicking on the first obj, the program writes 0 in output, by clicking on second one, writes 1 and so on, but this code give me 10 for all the objects.I should add that no matter there is an obj or not in myOtherMovieClip area, by clicking in that area, I got the same value.
View 3 Replies
Jan 17, 2010
Trying to convert a project from as2 to as3. Take this simple function:
Code:
function add_tf(contents:String,target_clr:uint,font_size:Number,a_type:Number,a_thickness:Number,a_sharpness:Number,target_width:Number, target_height:Number) {
var format:TextFormat=new TextFormat ;
var tf:TextField=new TextField ;
[Code] .....
How do I reference the newly created textfield into a for loop?
View 4 Replies
Sep 17, 2004
This is really holding me up, so I hope someone can help me fast. I need to store each value of my for loop in a separate instance of my movieclip, but the movieclip only seems to pick up the last value of the loop.
Why is this and can I do this any other way apart from storing the value in a textfield or creating a loop within the movieclip?
View 3 Replies
Oct 28, 2006
i have a for loop and i want to do things with it:
for(i;i<=2;i++){
if(box+i._width>20){
var box_width:Tween = new Tween(box+i, "_width", Elastic.easeOut, 750, 20, 3, true);
[Code]....
View 5 Replies
Jul 29, 2009
I've got a movieClip that's scrolling across the stage that loops nicely (kinda like the many cloud animations out there).
I've set the clip up to stop it's scrolling on a rollOver, and start up again on the rollOut.
My problem is that after the rollOut the loop doesn't work. The movieClip just keeps travelling.
Code:
blue.onEnterFrame = function() {
blue._x -= 2;
if (blue._x<=-0) {
[Code]....
View 5 Replies
Jan 12, 2012
I have a series of movie clips that are named image1, image2, image3, etc. And I need to modify their visibility with a loop (make them all visible=false), but I just can't seem to get it right...
View 1 Replies
Sep 1, 2002
I have an .fla with multiple movieclips. For most of these, as one finishes, it calls the next with code like _parent.nextmovieclip_mc.play(); on that next movieclip (the one to be played), the first frame is blank with actionscript stop(); so that it won't begin at the start of the movie. nearly every movieclip plays just once and this has worked fine. I have run into a snag because I want *one* of these to loop 20 times, and I'm trying to do a loop, but either it plays once and stops or never plays. this clip should not begin at the outset of the movie, and so like the others above, it has a blank keyframe with a stop(); for frame 1
[Code]...
View 3 Replies
Sep 17, 2004
I need to store each value of my for loop in a separate instance of my movieclip, but the movieclip only seems to pick up the last value of the loop. Why is this and can I do this any other way apart from storing the value in a textfield or creating a loop within the movieclip?
View 3 Replies
Sep 23, 2009
for (var i:int = 1; i <= 8; i++) {
this["b" + i].visible=true
}
I am wondering whether I can set all b1,...b8 movieclip to visible except b7?should I identify each movieclip to visible each or a script can be written in 1 line?
View 1 Replies
Jul 18, 2011
Why cant i do this in actionscript 3
[Code]...
Is there another way to achieve the same results?
View 1 Replies
Jan 26, 2010
I've got a load of videos
var ns1:NetStream = new NetStream(nc);
container1.compMa.theVideo.attachVideo(ns1);
ns1.play("sukh_diesel.flv", 1);
var ns2:NetStream = new NetStream(nc);
container2.compMa.theVideo.attachVideo(ns2);
ns2.play("sukh_beneath.flv", 1);
And 4 more, which I've left out to be concise. I want to pause them with
function pauseVid(){
this.ns1.pause();
for(i=1;i<7;i++){
this["ns"+i]pause();
}}
The commented out line:
this.ns1.pause()
works, but when I try it in a loop it can't access it?
View 1 Replies
Aug 28, 2009
i have 10 movieclips mc1_mc-mc5_mc and coin1_mc-coin5_mc on stage i aded listeners in for lop tat is working.when i click mc1_mc i want to make coin2_mc-coin5_mc invisible and coin1_mc and if i press mc2_mc then coin2_mc should wil b visible others invisible.i used folowing code but when i click any movieclip every objects in stage is becoming invisible.
Code:
for (var i=1; i<6; i++)
{
["mc"+i+"_mc"]addEventListener(MouseEvent.CLICK,clicked);
}
[Code]....
View 5 Replies
Nov 8, 2009
I have a movie clip (mc_moviegroup) which is made of a group of many dynamic text fields. I want to loop through the dynamic text field children of mc_moviegroup and pull out their text values in a string. Does a movie clip have a property which gives the number of it's children movieclips?
View 2 Replies
Jan 26, 2010
I've got a load of videos
ActionScript Code:
var ns1:NetStream = new NetStream(nc);
container1.compMa.theVideo.attachVideo(ns1);
ns1.play("sukh_diesel.flv", 1);
[Code] .....
Works, but when I try it in a loop it can't access it?
View 3 Replies
Dec 2, 2010
I have a horizontal scroll bar that I need to appear to loop around continuously. I've managed to get it moving on its own since the last time I posted, however the loop is proving more difficult.
The move function is here:
Code:
public function movemouse() {
lst.onEnterFrame = function () {
var speed:Number = -1;
this._x += speed;
[Code].....
View 1 Replies
Apr 17, 2007
I've got a form with radio buttons which were duplicated depending on the response from the database. However, when they are selected (even though they have the same group name) it is possible to select more than one. I've got round this problem by adding the selected one to a blank array and removing it from an array with all the possible radio buttons in. This then enables me to get the selected value and use it, and However, the other values (which are in another array) still show as selected (i.e. the dot is in the middle of the button) which isnt good. I've set up a loop which should go through each value in the "unclicked" array and set the radiobutton corresponding to it to unselected. The code I have is below:
for (i=0; i < unclicked.length; i++)
{
_root.RB[i].radioButtoni.selected = false;
[code]....
View 5 Replies
Jun 5, 2007
what's the easiest way for making a loop for videos (or images) coming from a xml file? i have a list of videos that needs to be loaded into movieclips...but i m not getting hw to make a loop for the videos?
View 3 Replies
Sep 18, 2007
I have a frame that plays and checks and prints the width of a movieclip, but the movieclip is constantly changing size, so I would like the textfield to show the movieclip width as is scales. I would assume I need to create a method of looping the code that checks the width, maybe a setinterval?
Code:
ypos.text = (this.rulerslave.picture_mc._width);
xpos.text = ("1");
[code].....
View 4 Replies
Sep 17, 2009
For the last couple of days I've been trying to find an example of a draggable movieclip (with mouse) in Y-axis which also can loop. This movieclip will load several different dynamic SWF-files from a XML file, but they are all the same width and height.I want this movieclip draggable in Y-axis only, and it should loop when you reach the end. But I can't figure it out tbh.What I want to achieve is similar to this: But in a vertical direction and when you grab something all 3 images that are visible should follow the mouse movement.Here is a code that I've written, you can drag the "container"-movieclip, but I can't figure out how to loop it and everytime I press and drag it again, the movieclip pops back to Y:0 at the mouse-pointer, hard to explain
import caurina.transitions.*;
import flash.display.Sprite;
import flash.events.Event;
[code].....
View 2 Replies
Apr 2, 2010
For some reason the x++ loop to move clip doesn't work. There must be an easy fault.
cX=iButton[i].x;
while (cX>iX) {
iButton[i].x=cX;
cX--
}
It should move a thing smoothly, as I understand it, but it doesn't. It completes the while and then shows the iButton at iX, completing the loop without showing a thing meanwhile. I even put a 1000-count for{} loop to slow it down, but it just delayed the final outcome. I also tried to move the moving to a separate function, and into a package. (It's these menus I want to slow down.)
View 3 Replies
Jun 7, 2009
I am dynamically adding a set of grid lines to a movieclip using a for loop. And I was wondering how I go about removing all of them so that I can add another set of grid lines to the same movieclip.This may sound weird but what I am doing is dynamically creating a table from an array and I wanted to dynamically add gridlines in between the table entries depending on how many entries there are in the array. I got this to work fine but when you go from one table with more entries to a table with less then the grid lines from the longer table are still there.Hence I want to be able to remove all the grid line instances before creating the next table.
View 6 Replies
Jul 29, 2009
I've got a movieClip that's scrolling across the stage that loops nicely (kinda like the many cloud animations out there).
I've set the clip up to stop it's scrolling on a rollOver, and start up again on the rollOut.
My problem is that after the rollOut the loop doesn't work. The movieClip just keeps travelling.
Code:
blue.onEnterFrame = function() {
blue._x -= 2;
if (blue._x<=-0) {
[Code]....
View 5 Replies
Sep 11, 2009
I've set up an associative array and then loop through each object in the array to animate it.Later on, however,I have a function that will manipulate these objects.How do I set up a command in the loop that will track the location of each object for later use in the next function, as each of the objects will continue to move around the stage until user presses key to send them to another location? (the final location for the tween is known, but not it's original location as it's free to move around until the tween function is activate).I'm looking into getChildIndex, but can't find enough info to understand how this works and whether it's what I need.
View 10 Replies
Aug 30, 2011
Actionscript Code:
public function Main():void {
var my1:MovieClip = new Sp();
var my2:MovieClip = new Jp();
var my3:SimpleButton = new But();
var rel;
for (var i:Number = 0; i < 3; i++) {
rel = "my" + (i + 1);
trace(rel);
addChild(rel);
}
See the above script, Here I don't wanna add the MovieClip and button class separately using "addChild" like,
Actionscript Code:
addChild(my1);addChild(my2);addChild(my3);
So I used for loop function. But it is showing error:
TypeError: Error #1034: Type Coercion failed: cannot convert "my1" to flash.display.DisplayObject.
at com.priyan::Main()
at mainFile_fla::MainTimeline/frame1()
View 2 Replies