Create an Account!

Adobe Flash Community Forum for all your Flash, Actionscript and Swift3D Support

Search:
FlashDevils Community
 Recommend Us
 About FlashDevils Community
 Can i become a moderator?
 How do i add Flash to my post?
 
Flash Community Register Flash Forum Control Panel Calendar Member List FAQ Search FLA Files
FlashDevils Community FlashDevils Community > Board > Flash > Flash ActionScript > for loop


  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
JimmyPez
Awesome Devil

Registered: Dec 2005
Local time: 12:05 AM
Location: NY
Posts: 798

for loopPost #1

hey,

i know this is really wrong;

ActionScript:
for(var x=0;x<=6; x++){
        _root.illNav["ill"+ x].gotoAndStop(_root.images.x+1);
};




im trying to make it like this

theres a thumbnail called ill0, ill1, ill2, ill3 etc up to 7

i want those to correspond to a frame in a seperate movie clip timeline

so if you click on ill0 thumbnail, it opens images (which is a movie clip) frame 1.



Report this post to a moderator | IP: Logged

Old Post 04-11-2006 09:41 PM
JimmyPez is offline Click Here to See the Profile for JimmyPez Click here to Send JimmyPez a Private Message Click Here to Email JimmyPez Visit JimmyPez's homepage! Find more posts by JimmyPez Add JimmyPez to your buddy list Edit/Delete Message Reply w/Quote
XemonerdX
veganXcodeXwarrior (StaffMember)

Registered: Apr 2002
Local time: 05:05 AM
Location: The Netherlands
Posts: 4818

Post #2

What you want is for each thumbnail to remember what frame it corresponds to. You can do this using several ways. One is that when the user clicks on a thumbnail it checks the number inside its own name and determines the frame based on that. Another, which I prefer, is to store this number as a property inside each thumbnail and use that. Like so:

ActionScript:
for(var x=0;x<=6; x++){
        // get referent to thumbnail clip
        var thumb = _root.illNav["ill"+x];
        // store x inside thumb
        thumb.myX = x;
        // set onRelease
        thumb.onRelease = function () {
                _root.images.gotoAndStop(this.myX+1);
        }
};


__________________
.:: PoeticTerror.Com ::.
.:: FlashDevils ::.
.:: FlashFocus ::.
.:: GalaxyGoo ::.
.:: OrganicFlash ::.



Report this post to a moderator | IP: Logged

Old Post 04-12-2006 12:41 PM
XemonerdX is offline Click Here to See the Profile for XemonerdX Click here to Send XemonerdX a Private Message Click Here to Email XemonerdX Visit XemonerdX's homepage! Find more posts by XemonerdX Add XemonerdX to your buddy list Edit/Delete Message Reply w/Quote
JimmyPez
Awesome Devil

Registered: Dec 2005
Local time: 12:05 AM
Location: NY
Posts: 798

Post #3

as always

your the man XX



Report this post to a moderator | IP: Logged

Old Post 04-12-2006 02:44 PM
JimmyPez is offline Click Here to See the Profile for JimmyPez Click here to Send JimmyPez a Private Message Click Here to Email JimmyPez Visit JimmyPez's homepage! Find more posts by JimmyPez Add JimmyPez to your buddy list Edit/Delete Message Reply w/Quote
JimmyPez
Awesome Devil

Registered: Dec 2005
Local time: 12:05 AM
Location: NY
Posts: 798

Post #4

I tried to rework this code to do something else, maybe someone can help me.

Im using it to for my nav buttons (b0, b1, b2 etc) to load swfs with similar names (0.swf, 1.swf etc)

im using this code, but its not working

ActionScript:
for(var x=0;x<=10; x++){
        
        var nav = ["b"+x];
        
        nav.myX = x;
        
        nav.onRelease = function () {
                _root.gotoAndPlay(35);
                _level0.myMCL.loadClip(this.myX, 20);
        }
};



whats not working here?



Report this post to a moderator | IP: Logged

Old Post 06-21-2006 04:35 AM
JimmyPez is offline Click Here to See the Profile for JimmyPez Click here to Send JimmyPez a Private Message Click Here to Email JimmyPez Visit JimmyPez's homepage! Find more posts by JimmyPez Add JimmyPez to your buddy list Edit/Delete Message Reply w/Quote
XemonerdX
veganXcodeXwarrior (StaffMember)

Registered: Apr 2002
Local time: 05:05 AM
Location: The Netherlands
Posts: 4818

Post #5

Replace

ActionScript:
var nav = ["b"+x];



with
ActionScript:
var nav = this["b"+x]; // replace 'this' with the appropriate path if it isn't 'this'



And remember that this.myX is 1, not '1.swf', etc..

__________________
.:: PoeticTerror.Com ::.
.:: FlashDevils ::.
.:: FlashFocus ::.
.:: GalaxyGoo ::.
.:: OrganicFlash ::.



Report this post to a moderator | IP: Logged

Old Post 06-21-2006 08:18 AM
XemonerdX is offline Click Here to See the Profile for XemonerdX Click here to Send XemonerdX a Private Message Click Here to Email XemonerdX Visit XemonerdX's homepage! Find more posts by XemonerdX Add XemonerdX to your buddy list Edit/Delete Message Reply w/Quote
JimmyPez
Awesome Devil

Registered: Dec 2005
Local time: 12:05 AM
Location: NY
Posts: 798

Post #6

I think I got it, I'll try it when I get home - Thanks Emo



Report this post to a moderator | IP: Logged

Old Post 06-21-2006 02:57 PM
JimmyPez is offline Click Here to See the Profile for JimmyPez Click here to Send JimmyPez a Private Message Click Here to Email JimmyPez Visit JimmyPez's homepage! Find more posts by JimmyPez Add JimmyPez to your buddy list Edit/Delete Message Reply w/Quote
cluelessCoder
Little Devil

Registered: Sep 2006
Local time: 05:05 AM
Location:
Posts: 4

Post #7

trying to apply above examples. got 24 thumbs, all of which should transform on rollover in the same way. they are thumb1, thumb2, etc

for(var x=0;x<=24; x++){

var whichThumb = this["thumb"+x];

whichThumb.onRollOver = function(){
whichThumb.brightnessTo(0,.3,"easeoutsine");}
};

shouldnt this work? what the missing link? thanks



Report this post to a moderator | IP: Logged

Old Post 09-26-2006 06:47 AM
cluelessCoder is offline Click Here to See the Profile for cluelessCoder Click here to Send cluelessCoder a Private Message Click Here to Email cluelessCoder Find more posts by cluelessCoder Add cluelessCoder to your buddy list Edit/Delete Message Reply w/Quote
XemonerdX
veganXcodeXwarrior (StaffMember)

Registered: Apr 2002
Local time: 05:05 AM
Location: The Netherlands
Posts: 4818

Post #8

Inside the 'onRollOver', when it gets called, 'this' refers to itself. Right now it refers to 'whichThumb', which at the end of the loop refers to the last MC, this.thumb24. So this change should work:

ActionScript:
// change
whichThumb.brightnessTo(0,.3,"easeoutsine");
// to
this.brightnessTo(0,.3,"easeoutsine");


__________________
.:: PoeticTerror.Com ::.
.:: FlashDevils ::.
.:: FlashFocus ::.
.:: GalaxyGoo ::.
.:: OrganicFlash ::.



Report this post to a moderator | IP: Logged

Old Post 09-26-2006 08:25 AM
XemonerdX is offline Click Here to See the Profile for XemonerdX Click here to Send XemonerdX a Private Message Click Here to Email XemonerdX Visit XemonerdX's homepage! Find more posts by XemonerdX Add XemonerdX to your buddy list Edit/Delete Message Reply w/Quote
cluelessCoder
Little Devil

Registered: Sep 2006
Local time: 05:05 AM
Location:
Posts: 4

Post #9

thanks a ton. for loops are MINE!



Report this post to a moderator | IP: Logged

Old Post 09-26-2006 01:42 PM
cluelessCoder is offline Click Here to See the Profile for cluelessCoder Click here to Send cluelessCoder a Private Message Click Here to Email cluelessCoder Find more posts by cluelessCoder Add cluelessCoder to your buddy list Edit/Delete Message Reply w/Quote
cluelessCoder
Little Devil

Registered: Sep 2006
Local time: 05:05 AM
Location:
Posts: 4

Post #10

or not
what is wroong with me?

i think i've successfully duplicated my clips, but the _x position thing...

for(var x=1;x<=24; x++){
newThumbname = "thumb" + x
duplicateMovieClip (thumb1, newThumbname, x);
newThumbname._x = x*59;
};



Report this post to a moderator | IP: Logged

Old Post 09-26-2006 05:12 PM
cluelessCoder is offline Click Here to See the Profile for cluelessCoder Click here to Send cluelessCoder a Private Message Click Here to Email cluelessCoder Find more posts by cluelessCoder Add cluelessCoder to your buddy list Edit/Delete Message Reply w/Quote
XemonerdX
veganXcodeXwarrior (StaffMember)

Registered: Apr 2002
Local time: 05:05 AM
Location: The Netherlands
Posts: 4818

Post #11

'newThumbname' is a string, not a reference to the duplicated MovieClip. Also using MovieClip.duplicateMovieClip instead of duplicateMovieClip has the advantage that it returns such a reference.
So combining this:

ActionScript:
for(var x=1;x<=24; x++){
        newThumbname = "thumb" + x;
        var mc = thumb1.duplicateMovieClip (newThumbname, x);
        mc._x = x*59;
}


__________________
.:: PoeticTerror.Com ::.
.:: FlashDevils ::.
.:: FlashFocus ::.
.:: GalaxyGoo ::.
.:: OrganicFlash ::.



Report this post to a moderator | IP: Logged

Old Post 09-27-2006 08:33 AM
XemonerdX is offline Click Here to See the Profile for XemonerdX Click here to Send XemonerdX a Private Message Click Here to Email XemonerdX Visit XemonerdX's homepage! Find more posts by XemonerdX Add XemonerdX to your buddy list Edit/Delete Message Reply w/Quote
cluelessCoder
Little Devil

Registered: Sep 2006
Local time: 05:05 AM
Location:
Posts: 4

Post #12

that did it. thanks again.



Report this post to a moderator | IP: Logged

Old Post 09-27-2006 04:37 PM
cluelessCoder is offline Click Here to See the Profile for cluelessCoder Click here to Send cluelessCoder a Private Message Click Here to Email cluelessCoder Find more posts by cluelessCoder Add cluelessCoder to your buddy list Edit/Delete Message Reply w/Quote
wessel
Little Devil

Registered: Dec 2006
Local time: 05:05 AM
Location: netherlands
Posts: 2

Delete thumbs and reload diffrent tumbsPost #13

can someone help me i'am working with flash and i what to delete my thumbs and i want that the same thumbs are replaced by other thumbs from a different map


i hope that you can read my English i'am not very good in it


mood:
Report this post to a moderator | IP: Logged

Old Post 12-02-2006 02:13 PM
wessel is offline Click Here to See the Profile for wessel Click here to Send wessel a Private Message Click Here to Email wessel Find more posts by wessel Add wessel to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 05:05 AM. Post New Thread    Post A Reply
  Last Thread   Next Thread
Advertising
Show Printable Version | Email this Page | Unsubscribe from this thread | Download thread

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

< FlashDevils - Terms of use >

Copyright, FlashDevils Community, 2002 -
Flash Archive

Links
Books