ActionScript 3.0 :: For In Loop Reverse Output
Dec 3, 2010Why does for in loop show different results in as2 and as3
[Code]....
Why does for in loop show different results in as2 and as3
[Code]....
If I do a for loop like this, how can I reverse it so the last result is shown first?
for (var i=0; i<10; i++){ trace ("number " + i)}
what I'm trying to do is have a mc play continuously either forward or backward depending on whether you roll over the "forward" or "reverse" buttons..I've almost got it there, except I can't figure out how to get the reverse to loop after it gets back to the beginning of the animation.
[Code]...
I would like to loop a movie clip forward and reverse by selecting a forward or reverse button. I found the following actions script 3 code on Adobe however the code which plays the mc in reverse is not triggered by a button.[code]...
View 3 RepliesI have this little loop that creates buttons. My aim is to change value of variable 'thevalue' on everytime button is pressed, first button should give value 0, second 1, third 2 and so on.
Code:
for (jo=0; jo<xmlData.firstChild.childNodes.length; jo++) {
value1= xmlData.firstChild.childNodes[jo].attributes.value;
_root.attachMovie("button", jo, (1000-jo), {_x:20, _y:20+(jo*20)});
[Code]....
I have a loop that is supposed to run a set of functions and output movieclips on a main movieclip. Each of these smaller movieclip is supposed to be a tile. The code below is supposed to make 50 movieClips each one from a different reference on the tileSheet. However it outputs 50 of the exact same movieclips.
Code:
var tDMax:int = 50;
//Start Get tiles
function getTiles():void{
tList.graphics.beginFill(0x000000);
tList.graphics.drawRect(0, 0,tWidth * 5, tHeight * 10);
[Code].....
Strange enough whatever I made tDMax which is supposed to be the limit for the loop, that's what all the movieclips become. For example if I put it at 25, then all the movieClips become tiles from the bitmap sheet reference # 25. That leads me to think that it's not passing the variable to the functions correctly, and it's only doing it once the loop finishes. But when I trace things like rowT and colT the references to the bitmap are correctly. And when I trade tn within the other functions that's always correct also..
How can I reorganise the code below so the trace commands output i for each element in the photourls array and not just the last element? In a 6 element array, the trace(i); line outputs 5,5,5,5,5,5 rather than 0,1,2,3,4,5.
[Code]...
So I have this mc: this.slidingMenu it's a mc of a ring shaped menu, which turn around when 2 button get clicked. When the button on the right, mc goes forward until stop(), when the button on the left mc goes reverse until the stop(). In the first case i use gotoanplay, and everything goes fine. For the second I use prevFrame, like this:
[Code]....
Is it possible to have "for each" loop in reverse?
View 2 RepliesI'm quite new to AS3 (coming from php/c#) and like it very much. My problem: trace doesn't output anything in the Output window anymore?!
View 2 RepliesI'm quite new to AS3 (coming from php/c#) and like it very much.My problem: trace doesn't output anything in the Output window anymore?!
View 3 RepliesI'm teaching myself ActionScript and the book I'm reading just got into input text capabilities. The book shows me how to link input text to a variable and output that text to the output window using trace. My question is: how can I display the text that the user input onto the actual movie. For example... if I wanted the visitor to type their name into the input text box and click Submit and then a phrase shows up with their name such as "Hold on Name, my site will be done soon." How do I reference that variable and have it actually display in my movie?
View 5 Repliesvar nextY = 0;
var nextY2 = 18;
for (var count = 0; count < result_lv.typeCount; count++)
{
[code]....
The type count is correct but the information for the project is wrong.
In a game I'm working on, I'm using the ColorTransform class to the turn the 'enemies' red as they fall off the screen after they've been hit by one of the player's 'missles' with the following [code]...
Can I somehow undo the ColorTransform to an enemy once it has been applied, or does he have to stay monochromatic thereafter?
I use this code i found on this forum. i want to control an MC to act like a buttopn, on roll over it plays the movieclip forward, on Rollout it plays the movieclip backwards.
This script works ok, but on when reversing it feels slow and often it doesent reverse to the start of frame 1 in the MC.... It is very sensitive to quick mouse over and out. The quirky reverse is possible because i use prevFrame...is there another thing i can use?
[Code]...
Basically I have just created an animated button using frame labels, and was wondering if there is any way to reverse the timeline.
Currently my code looks like this:
Code:
btnHome.addEventListener(MouseEvent.ROLL_OVER, btnHomeOn);
btnHome.addEventListener(MouseEvent.ROLL_OUT, btnHomeOff);
function btnHomeOn(event:MouseEvent):void {
[code]....
The way it's coded here, if the user removes the mouse from the above the button the timeline continues from homeOff.What I want is for the timeline to reverse from its current position instead of just playing forwards from a fixed point.
I have a quick question for any flash smartypantses out there....I'm looking for the most efficient way to do this weird thing...
I'm trying to create 6 menu buttons (all text) that when you click one, a submenu drops down (more lines of text - that fade in individually).
[Code]....
What I'm having trouble with is figuring out how to get this submenu to "close back up" (animation) when someone clicks one of the other main menus (Colors or Locations, in this example.)
How can I get it to perform this animation BEFORE it navigates to the next menu section?
is it possible to play a movie clip (or simply, main timeline) in reverse order e.g. suppose, there is a movie clip, few frames in that, of course it will play from first frame to end frame, and also, i want them to play from end frame to first frame.
View 8 RepliesI apologize for being a newbie. I have been trying to figure out how to reverse an EKG movieclip to go from right to left instead of the direction it is currently moving:
View 16 RepliesI have to play an flv in reverse but don't know how. I tried embedding the entire flv inside a MC but the result was not pretty.
View 2 RepliesI'm using the following ActionScript for my Flash preloader, what this does is have the preloader bar fill from the top to the bottom.
this.addEventListener(Event.ENTER_FRAME, loading);
function loading(e:Event):void{
var total:Number = this.stage.loaderInfo.bytesTotal;
[Code].....
How would I alter this so that instead, it starts off full and then decreases in size down to zero (downwards)?
I can't able to reverse properly.
Code is
var angle:Number = 0;
var radius:Number = 100 + Math.floor(Math.random() * 101);
// Random object generation
var button:Number = 0;
[code].....
how I reverse through frames.I can certanly have a loop that calls prevframe.But, what I want is to know when I have reached a certain frame.The only way I can think of how to do this is to know the exact number of frames, and then use a loop that loops the exact number of frames I need.
View 3 Replieshow would i use reverse Sin, Cos and Tan in flash so i could do SOA-CAH-TOA?
View 2 RepliesIts been a while since I last posted but I was hoping someone would be able to help me asap. I am so nearly there but something is not quite right. I have alot of faith in this forum so I'm hoping someone out there can help! Here we go:
I have various movie clips within movie clips, these all work fine. Within one of the MC's, i have a button with instance name "left" and one called "right". These are used to cycle through my work (this is for my portfolio). The right button works fine, just plays the timeline of the MC using frame labels. I built my site last year but its going through a complete overhaul on the structure and coding side cos quite simply, its a mess Last year, i placed this code ON the "left" button itself:
[Code]...
How can i play a mc in reverse using as3? i know hwo to do it in as2 but not sure about as3
View 9 Replieshow can i reverse the frames.what i mean is if for example u have a motion tween of a circle sliding to the right.what should i write in the last frame of the motion tween so the circle will go back..._current frame--?
View 9 RepliesI'm working with AS3 and I have two questions. First, to save on having to re-do work, is there a way to simply play the timeline in reverse IE from frame 210 - 200? I've got a page set up to slide in from the right when clicked on, and if you click on the back button, I want the page to slide out to the right again. Figured the easiest way to do this would be to simply reverse the timeline. Just don't know if that's possible in flash.
Secondly I've got it set up in the timeline for a FLVPlayback component to slide in to the center of the stage from the right when its page is clicked on and though this works in the timeline, when I test the movie, it doesn't slide in and if I expand the preview to full screen, the flv and its controls are still on the right side of the stage. how to get the movie to slide in properly?
I'm creating a movieclip that shows some photo samples with two arrows at the bottom. I want it so that if the user presses on the right arrow, the movie clip plays forward and goes toward the end to "shuffle" through the image samples. But I would also like them to be able to press on the left arrow and be able to play the movieclip backwards to "shuffle" back toward the beginning of the images.
The closest thing I can think of that would be similar to this would be the way you can shuffle through album images in iTunes.I just need to know the Actionscript 2.0 code to play the movieclip in reverse.
I have this script to play a movie clip. What do I write to get it play in reverse?
function fadeUp(event:MouseEvent):void { buttonFadeOver_mc.play()