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








Why Does For..in Run Backwards?


code:
var testArray = new Array();
for(var i=0;i<10;i++){
testArray[i] = ("entry" + i);
}

for (var testVar in testArray){
trace(testVar)
}


traces:
9
8
7
6
5
4
3
2
1
0

Why is that? Shouldn't it run from 0 to 9




FlashKit > Flash Help > Flash ActionScript
Posted on: 02-03-2008, 09:13 AM


View Complete Forum Thread with Replies

Sponsored Links:

Backwards...possible?
is it possible to play a movie backwards?

View Replies !    View Related
Mc Backwards
Hi i was reading all the other forums and found alot bout playing a mc backwards but none of them worked. I just want o make a simple
movie clip to play backwards when it gets to the frame.

View Replies !    View Related
Backwards
How can i play a movieclip backwards on rollover a button?

View Replies !    View Related
Go Backwards.....
I use Flash MX 2004, and I really need to get some help with this. I have created a movie clip on level0, frame 1. In that movie clip there is a tween, it's a preloader dissapearing, and at the end of the tween I want the Flash to go back to level0 and play another moviclip instance or frame label on frame 2. I thought I could just use the tellTarget or gotoAndPlay funktion. I'm used to using the ../ to go back one level. But it doesn't seem to work. I'm new to Flash MX 2004 so I guess thats my problem.

If anyone could help me with this I would appreciate it enormously.

View Replies !    View Related
Backwards
I wonder if it's possible to make the timeline go backwards

View Replies !    View Related
Can't Go Backwards
I can't make the pixels dissolve so the object reduces to nothing.

import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.Point;


var bmp1:BitmapData = BitmapData.loadBitmap("cave1");
var bmp2:BitmapData = new BitmapData(64,64);
var bmp3:BitmapData = new BitmapData(64,64);
var bmp4:BitmapData = new BitmapData(64,64);

this.createEmptyMovieClip("mc1", this.getNextHighestDepth());
mc1.createEmptyMovieClip("mc11", mc1.getNextHighestDepth());
mc1.mc11.attachBitmap(bmp1, mc1.mc11.getNextHighestDepth());
mc1.mc11._x=100;
mc1.mc11._y=0;




this.createEmptyMovieClip("mc3", this.getNextHighestDepth());
mc3.createEmptyMovieClip("mc33", mc3.getNextHighestDepth());
//bmp2.copyPixels(bmp1,new Rectangle(0,0,bmp1.width,bmp1.height),new Point(0,0));
bmp3.pixelDissolve(bmp1,new Rectangle(0,0,bmp1.width,bmp1.height),
new Point(0,0),0,0);

mc3.mc33.attachBitmap(bmp3, mc3.mc33.getNextHighestDepth());
mc3.mc33._x=0;
mc3.mc33._y=100;

var num:Number=0;

mcbt2.onPress=function()
{
bmp3.pixelDissolve(bmp1,new Rectangle(0,0,bmp1.width,bmp1.height),
new Point(0,0),0,num);
mc3.mc33.attachBitmap(bmp3, mc3.mc33.getNextHighestDepth());
_root.num+=500;
}

mcbt3.onPress=function()
{
bmp3.pixelDissolve(bmp1,new Rectangle(0,0,bmp1.width,bmp1.height),
new Point(0,0),0,0);
mc3.mc33.attachBitmap(bmp4, mc3.mc33.getNextHighestDepth());
bmp3.pixelDissolve(bmp1,new Rectangle(0,0,bmp1.width,bmp1.height),
new Point(0,0),0,num);
mc3.mc33.attachBitmap(bmp3, mc3.mc33.getNextHighestDepth());
_root.num-=100;

}

View Replies !    View Related
Backwards
Hey guys, I have a small problem and would like some help. I created a layer that has 10 separate text pages on it. To navigate from page to page I use an arrow with the script goto and play. Each text page spans 10 frames. when it begins playing it tweens up five frames to 100% opacity where there is a stop action. When I click the forward arrow again it sends a message to play, and then the movie advances to the next frame and the text tweens down 5 frames to 0% opacity and the next text block tweens up 5 frames to 100% where the next stop action is.

So as you can see as I advance from page to page with the arrow the text fades in, then out and back in for the next page and then out and so forth and so on.

My problem is when I click the arrow BACK I do not know how to get the fade in and out to work. I can only tell the back arrow to go to a specific frame because I don't think I can have it play in reverse. Anyhow, I would love an answer to this quandry. I have seen it done, but I don't know how to do it.

thanks guys.

View Replies !    View Related
Backwards
Is it possible to play the playhead backwards, if i want to play an animation backwards?

View Replies !    View Related
Backwards
I'm making a photogallery, and to load the pics i'm directing buttons to certain frames of the movie (gotoAndPlay()). Is there a way to make a button play backwards? I need it to go from frame 97 to 75.

View Replies !    View Related
Going Backwards?
I'm trying to make it so in this footer i'm creating you can go back and forth between lyrics. How do I do that? i'm using xml as the source of text. I'll attach both. Nevermind, definately not a footer anymore, it's almost 500 Kb, but I still want to know how it's done.

Here's the link: http://www.filefactory.com/get/v3/f2.php?f=666a5d

I attached the xml file, the only problem is that this forum doesn't support .xml as attachments so i made it a .txt

48 people looking on this forum and not a single one has looked in 19 minutes? !!!

View Replies !    View Related
Backwards
k when i want to play a frame i use

on(press) {
mc.gotoandplay(2);
}

is there anyway to make it play backwards i mean like from frame 40 to 1 ....

View Replies !    View Related
Backwards
What I'm trying to do is play the loaded movie backwards from where the playhead is before the new movie loads when a button is pressed.
(can I do this if i'm using load movie to load my sections, or is there another setup?)

Does anyone know how this is done?

Seb

View Replies !    View Related
Backwards
Is it possible to play the playhead backwards, if i want to play an animation backwards?

View Replies !    View Related
Going Backwards
Hi All,

I suspect this is a really basic question, but much to my chagrin I can't quite figure it out.

I'm doing a portfolio site and all I want to do is a 'previous' and 'next' button.

I've got the images spread over several frames and tweened the alpha to fade in and out.

I can get the 'next' button working just fine by just going to the next frame and letting the playhead run to the next stop script, but the 'previous' button has got me foxed.

So my question is: how do you get the playhead to go in reverse?

Cheers for any insights

Pete

View Replies !    View Related
Playing Backwards?
Is there a way to script somthing to make it so I can play things backwards? I have an animated slide show going, but only half, you can only click foreward, I was wondering if i could have it play backward when you click the back button.
thanks it would save a bunch of "mouse miles"
[Edited by TheJohn on 06-19-2001 at 01:04 AM]

View Replies !    View Related
Backwards Traveling
Hey all!


I have a movie that has forward and backwards button.
for the forward 1 naturally i just say

GoTo frame "frame label"

if for the back i say

GoTo frame "prev. frame label"

Then it goes to that label and runs through 10 frames again until it hits a stop.

I hope u know what i mean
anyways.

is there a code that i could add that when i say GoTo"previous label" that to get to that label my movie travels backwards?

sort of like prev.frame, prev.frame, prev.frame, etc. until it gets to the desired position?

thx in advance.

View Replies !    View Related
Flash Is Backwards...HUH?
Ok this is a true enigma to me.

I'm writing a script for Flash 4. What I am doing, is getting the coordinates of the x position of two different MCs that are consecutively being dragged one after the other for the duration of one frame. Each time a MC is being dragged, it is recording a variable value for that MC's x position. If the mouse is moving, the x positions of each MC are continually changing. But if the mouse stops, the x position of both MCs are the same. when this occurs, I have another MC sitting on the stage that is to be played.
Okay...so here is the weird part. I actually made it work, but it is all backwards. I'm telling the MC sitting on the stage to play when the x coordinates are equal. But in fact, it is playng when the coordinates are not equal. Below I have written the scripts in the way that it does work...but shouldn't. There is a further note at the bottom of the page.

notes:

x = MC1 (called "tracker1")

y = MC2 (called "tracker2")

The Mc sitting on the stage waiting to be played is called "thing".

I am using the "tell target" action because this is for flash 4.

There are three key frames that are being looped. Here are the scripts for each frame.

Frame 1:

startDrag ("/tracker1", true);
x = getProperty ("/tracker1", _x );

Frame 2:

startDrag ("/tracker2", true);
y = getProperty ("/tracker2", _x );
if (x != y) {
tellTarget ("/thing") {
gotoAndPlay ("out");
}
}

Frame 3:

gotoAndPlay (1);


So this is the way it actually works, but it is doing exactly opposite of what is it supposed to do. In frame 2, it should say "if (x ==y)".

AM I MISSING SOMETHING HERE?????

View Replies !    View Related
Play Backwards
How can I make a Movie Clip play backwards?

View Replies !    View Related
Move Backwards Through MC?
Is there a way to tell a movie clip to play from current frame BACK to frame 10 or whatever. To get fluid motion forward and back through an animated mc.
If you could show me some script for that or direct me to the info. I looked through the turorials here-didn't see anything.
Probably been asked a million times.

-Thanks o0Soup0o

View Replies !    View Related
_level0 Backwards
I have two SWF, one on level 0 and the other on level3. They both have a movie clip inside. I need to know an action script that at the end of the m_clip on level3
start to "reverse playing" the movie on level 0 ( I mean from the last frame to the first one playing all frames)
TMH

View Replies !    View Related
Playing A MC Backwards?
Hi Guys,

I got the MC running in a clipholder and it's centered.
I got the stop, play, and unload buttons, but what's the script for playing the MC in reverse?

Here's what I'm using:

telltaget ("clipholder")
stop O;}


telltaget ("clipholder")
play O;}


unloadMovieNum (1);

any help is appreciated.

Thanks

View Replies !    View Related
Backwards Scrolling
i have made a text scroll an i´m trying to script the buttons.
the text is an MC called "txtBox1", with a mask layer and the text layer scrolling down for a few frames, with action 'stop();' on the 1st and last frames.

on the scroll-down button i have this script

on (press)
{
txtBox1.play();
}
on(release,rollOut)
{
txtBox1.stop();
}

ok. This now scrolls down the text by playing the txtBox1 MC
and stops whenever i release the mouse.

problem is now : how the hell do i scroll up ???

if i use txtBox1.prevFrame(); i´ll have to click up quite a lot

thanx for any help

have phun

View Replies !    View Related
How To Get MC's To Play Backwards?
I have a small MC, that I duplicated, but instead of rearranging the frames, is there any way to just make it play backwards?

View Replies !    View Related
HELP Backwards On X Axis?
Ok, here's my problem, the following code is used to randomly scroll symbols from left to right on the x axis at random speeds, sizes, transparency's and at random heights on the y axis.

onClipEvent (load) {
a = random(100)+50;
_x = Math.random()*750;
speed = Math.random()*5+1;
_y = Math.random()*300-(_height/2);
_xscale = a;
_yscale = a;
_alpha = Math.random()*30+40;
}
onClipEvent (enterFrame) {
b = random(100)+50;
_x += speed;
if (_x>=750) {
_xscale = b;
_yscale = b;
speed = Math.random()*5+1;
_y = Math.random()*300-(_height/2);
_x = _width*-1;
_alpha = Math.random()*30+40;
}
}

But I want to scroll the symbols from right to left. When I change these lines, speed = Math.random()*5+1;, to speed = Math.random()*-5-1;, it works but it does'nt loop like is supposed to. Go to http://www.isometricshadows.com/movi...m_movement.swf to get an idea of what i mean.

View Replies !    View Related
Play Backwards?
I have some keyframes that open a subnavigation, and it would be cool if I could close it by just playing it backwards..... how do you tell the playhead to go backwards like 50 frames?

View Replies !    View Related
Play Mc Backwards
hi there,

anyone,
what is the easiest way to get a mc to play backwards?

thank you.

View Replies !    View Related
Problem With Backwards....
How can i play the maint timeline backwards. A movieclip is no problem, but the maint timeline ?

Thanks for help.
Juergen

View Replies !    View Related
Playing Backwards...
I was wondering if its possible tomake a movie kind of play backwards. I know the answer will probably be no, because it just doesn't seem normal. I want to know, because i want to make movies, that when you rollover, it does something, but when you roll off the thing it was doing goes back to the normal state.

I.E. On rollover, a line comes across the screen, and on rollout, the line goes back the way it came. I want to make it so that it goes back from where it came, not from the end of the frame sequence, but back from where it got to. I'm just wondering if this is possible.

I reckon there is some sort of complex actionscript that will make this happen (i don't know though), but could some one tell me if it is possible to "rewind" the movie?

View Replies !    View Related
Play Backwards
Hi there,

I've a question again
I wanna make a 2 buttons. That's not the difficult part but what I don't know is the action that I must add to it. Button1 must play the movie when the mouse is over it and must quit playing when the mouse rolls out. Button2 must play the movie BACKWARDS when the mous is over it and also quit playing when the mouse rolls out. Can somebody give me the code for this pleaze?

Grtz
Joost

View Replies !    View Related
Yet Another Backwards MC Question
hi all

i've got a movieclip that plays an animation for when i roll over a button. What i want is this : when the mouse rolls off the button, the clip plays backwards (therefore returning to the original state smoothly)

i've tried 2 different techniques, both of which involved a variable e.g 'playback' which became true and therefore caused the clip to play backwards. The problem is that i have 8 buttons, and because the code is something like this;

onClipEvent (enter frame)
if playback = true
this.frame=_currentframe -1

*note: this isn't exactly the code, so i don't need to know about any syntax errors here :P *

but what happens is that when i roll the mouse off, ALL 8 BUTTONS play backwards.

how do i specify a target for the backwards playing?

thanks a lot
Stuart

View Replies !    View Related
Reverse Or Backwards
I need a tutorial where the movieclip is starts if i rollOver and plays backwards from the picture he is playing if i rollOut.

Can someone please help me

View Replies !    View Related
Backwards MC Still Not Working
hi,

i posted about this a while ago and got some responses, but i still haven't been able to get it working...

i'm setting up a basic navigation menu thing, and i've got an animation for the button rollover. When the mouse rolls off, i want the clip to play backwards. Currently what happens is that when rolloff occurs, ALL the clips play backwards.
all the searches i've done on the topic haven't been specific enough for me...

I was just wondering if anyone either knows a definite solution for this problem, or could possibly look at my fla.

if you can, please PM me with your email so i can send the fla (it's under 100k)

thanks a lot
Stuart

View Replies !    View Related
Oh My, It's Printing Backwards?
It's reaaaaaally anoying, strange, ridiculous, but my flash is printed backwards and down-to-top-changed in SOME navigators.
¿Has anyone seen it? ¿Does anybody have a solution?

Please, i'm really desperate.

Thanx in advance...

View Replies !    View Related
Backwards Movie
i've got a movie of a book animation. i want to be able to go backwards through the book, but i don't want to animate the pages turning backwards or reverse the frames and make a 200 frame nightmare that takes forever to load. Is there an actionscript way of telling a movie to go to a certain frame and play backwards?

View Replies !    View Related
Backwards Movies
Finally, after long last i figured out how to make a movieclip play backwards. This is my button code:

on (release) {
for ( i=1; i<12; i++) {
this.prevFrame()
};
}

(i know the OOP way to do this is set-up a function, i'm just trying to get it to work, then i'll do that.)

My problem is this: when the button clicks, it jumps back 12 frames, instead of playing them one by one in reverse order, which is what i want it to do. Is there a way to make it delay and play each frame as it counts backward. Any help will be much appreciated.

View Replies !    View Related
Rewind/Backwards Help
Hi there,
I see that this code was posted in this section before to reverse/backward a movie clip.

[code]
button_mc.onPress = function(){
this.onEnterFrame = function(){
your_mc.gotoAndStop(_currentframe-1);
}
}
//
button_mc.onRelease=function(){
this.onEnterFrame=null;
}

I understand what this code does...but don't have a clue how to use it in context of my movie clip. I have a clip that I wish to reverse with a button that controls that so when the button is selected the movie clip rewinds to the first frame and stops. Do I put the button inside the clip or on the main timeline where my clip is, also what is meant by button_mc? What has to be changed there? And also does this or your_mc have to be changed?
Give me your feedback, I'm pretty new to this actionscript game!

View Replies !    View Related
Movie Backwards
Hi,

I have an idea for a movie of mine; but have no idea how to do it. When the movie has ended, I want it to play backwards at a fast speed. That effect is sometimes used in movies; don't know any example at the moment though.
I think it is possible with actionscript; but no idea how.

Anyone know how to do this?? Thank you.

-carrejans-

View Replies !    View Related
Playing The Mc Backwards?
Heloooo, i am trying to iron out a slight glitch that is making a tweening motion look sketchy.

I have am mc which has a tweening motion, it is am mc which holds my navigation. It is positioned at the edge of the screen in frame 1 and
and is at its fully visible position in frame 15.

attatched to the mci have the following code;

onClipEvent (mouseMove) {
if (_root._xmouse > 0 &&_root._xmouse < 150) {
if (_currentframe < _totalframes) {
play();
}
} else if (_currentframe > 0) {
prevFrame();
showing = false;
}
}

The problem is that the movie (navigation) comes on the screen on rollover but when i move the mouse off the mc (navigation) if you dont move the mouse all the time, it stops on its way back to frame 1; so if say i move the mouse 10 mm away the mc starts to rewind, but if i stop moving the mouse in any direction the movie stops rewinding and wont move again until i move the mouse?

please advise if you can.

The _x and_y coords are the dimensions of the navigation mc, _x150 being the furthest point in its width

View Replies !    View Related
Playing Backwards
What I'm trying to do is play the loaded movie backwards from where the playhead is before the new movie loads when a button is pressed.
(can I do this if i'm using load movie to load my sections, or is there another setup?)

Does anyone know how this is done?

Seb

View Replies !    View Related
How To Make A MC Go Backwards
Hi

Can anyone help me with action scripting so i can make a MC go backwards

thx

View Replies !    View Related
Play MC Backwards
Using Flash MX

How can I get a MC to play backwords (probably through an onRelease event)?

Thanks

View Replies !    View Related
Play .swf BACKWARDS
Here is what I want to do ...

I have imported an .avi file into a Movie Clip inside my .swf.

When the .avi file is done playing, I would like it to play BACKWARDS to give the "look" of a loop. Is there an action script to do this?

View Replies !    View Related
Scrolling Backwards..
How can I make a tween play backwards when an arrow is pressed? I have a text tween and have a down arrow and an up arrow, but I'm not sure how to make the up arrow scroll back from the current frame when pressed.

Thanks,

Adam

View Replies !    View Related
Play Backwards
ok i want it so that when you rollover somthing it plays but when oyu rollout it plays backward from that point i have seen joe weitzel do it on his page and i would like to know how i heard of a rewind() function but i dunno if it is a myth thanks for the help

View Replies !    View Related
Stepping Backwards
I have a project I'm currently working on for my client and after much work in prototyping the initial site and after much research, it appears I am going to have to jump back and develop the site in AS 1 (my previous prototype was built for Flash player 7 AS2 compatability).

My problem is that I have been working primarily in AS 2 for some time now and there is a concept I want to re-do with AS1 now that I am going to have to re-do this whole thing.

I have a master.swf file that is my container for my project. On the first frame of this master.swf I originally had this code here to simplify production and just easily load swf files to my object by refering to it by its variable name:

stop();
var myMCL:MovieClipLoader = new MovieClipLoader();

Then in any of my exteranl movies, I could just use the following code (say on a button for example) to call the MovieClipLoader object and load the respective swf:

onRelease = function () {
_level0.myMCL.loadClip("overall.swf", 6);
};

Now, since I must re-do this protoype for compatability for AS1 and Flash Player 6..I'm stuck on what the equivalent to what I previously had would be with AS1.

I tried something like this, but it is not working

On my master.swf file i put the following code on my first frame (i'm sure my syntax isnt correct):

stop();
var my_mcl:MovieClip = new MovieClip.createEmptyMovieClip();

..and then on a button i would put smething like this?

onRelease = function () {
_level0.my_mcl.loadMovieNum("overall.swf", 6);
};


Anyone understand what I'm saying, or am I confusing you. If so, let me know and I will try and explain better. Like I said, this attempt to work with the above AS 1 wasnt working so any and all help/code clean up would be soooo awesome. Thanks ahead of time

View Replies !    View Related
Countdown Backwards?
hey how can i make a dynamic field go from the number 1-1000 within a matter of 3 seconds?

View Replies !    View Related
Playing Backwards
can someone help me achieving a backward timeline playing with a on rollOut action? I want my mc (it has a button inside) to play forward with a on rollOver but if i leave the button it must start moving backwards.

needless to say that during the back movement if i step over the button again it must resume the normal playing.

i've achieved almost everything except the backward movement. i'm on this for two days now with no sollution in sight

by the way, i'm trying to achive a "glow" effect activated with the on rollOver.

thx in advance

View Replies !    View Related
Playing Backwards <<
Hi I am very new to flash & Action Scripting but can't fathom why this doesn't work.

I have a basic navigation with some drop downs (attached) upon rollover they show more buttons, and because of a hidden button underneath the movie returns to a single button upon rolling over the hidden button.

Simple.

However, I thought it would be easy to change my Rollover state to basically play the frame in reverse until frame 1 so the links seem to unbuild neatly.

I used to code VB (many years ago) and whilst i remember nothing I did retain a tiny amount of logic - or so I thought.

Why doesn't something like this work:

on (rollOver) {
if (this._currentframe = 2) {
stop();
} else {
prevFrame();
}
}

Daft i know. Also looping seems quite hard as there is no Loop command in the index? Or the 'Then' command?

I have seen many scripts that make this work, but I want to understand why it works before I use it otherwise i am not going to get anywhere.



Thanks in advance

View Replies !    View Related
Run Loadbar Backwards...?
Have been messing with my loader script trying to make it so the loadbar runs in reverse...From 100% width to 0% width. And decreasing in size from left to right.
You know how most preloaders start small on the left and grow to the right...well I want to start full and shrink to the feft.
Make sense? How do I modify this script?


Quote:




bytes_loaded = Math.round(_root.getBytesLoaded())+1;
bytes_total = Math.round(_root.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
_root.loadBar._width = getPercent*100;
_root.loadText = Math.round(getPercent*100);
if (bytes_loaded >= bytes_total) {
_root.gotoAndPlay(5);
}






What I want to accomplish is, Reveal a logo underneath the bar from left to right.

Thanks, Mike

View Replies !    View Related
Button Backwards
When I make a button that is animated and I put my mouse over it it starts animating . When i remove my button from the button it get back to the first place, but i want it to animate back not just stop, how do I do that??

View Replies !    View Related
Play Backwards
I was wondering how to make flash play backwards at same frame rate as forwards.
Thanx

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