To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash General Help

Reply
 
Thread Tools Search this Thread Display Modes
Old 07-12-2004, 11:36 PM   #1
vulcan_hk
Junior Member
 
Join Date: Feb 2003
Posts: 11
Please help, question on actionscript

I got to load a list of JPGs in a swf, for the code I'm currently using:

MovieClip1.loadMovie("S0001.JPG");
MovieClip1.loadMovie("S0002.JPG");
MovieClip1.loadMovie("S0003.JPG");

But in the real suitation, I need is to load JPGs in MovieClip1, and by pressing Button "Next","Next x2", "Previous" and "Previous x2", it will have an action.

i.e.
MovieClip1 -> loads S0001.JPG as default
After clicking "Next"
MovieClip1 -> loads S0002.JPG
After clicking "Next x2"
MovieClip1 -> loads S0004.JPG
After clicking "Previous"
MovieClip1 -> loads S0003.JPG
After clicking "Previous x2"
MovieClip1 -> loads S0001.JPG
and so on

How can I make the variable (S0001.JPG) split into "S"+"####"+".JPG" which the "####" can be a bigger or smaller number by a function in the button?

Please note that the list of JPGs must be in this format of naming, "S"+"####"+".JPG"

Please help!
vulcan_hk is offline   Reply With Quote
Old 07-13-2004, 02:09 AM   #2
eraser_ad
Senior Member
 
eraser_ad's Avatar
 
Join Date: Apr 2004
Posts: 189
try this

code:

var nNumber:Number = 1;
nextButton.onRelease = function() {
nNumber++;
this.MovieClip1.loadMovie("S"+nNumber+".jpg");
};
prevButton.onRelease = function() {
nNumber--;
this.MovieClip1.loadMovie("S"+nNumber+".jpg");
};

__________________
some smart citation is coming here soon
eraser_ad is offline   Reply With Quote
Old 07-13-2004, 03:45 AM   #3
Insane-Tomato
Junior Member
 
Join Date: Jul 2004
Location: Malaysia
Posts: 8
Quote:
Originally posted by eraser_ad
try this

code:

var nNumber:Number = 1;
nextButton.onRelease = function() {
nNumber++;
this.MovieClip1.loadMovie("S"+nNumber+".jpg");
};
prevButton.onRelease = function() {
nNumber--;
this.MovieClip1.loadMovie("S"+nNumber+".jpg");
};


if you follow eraser_ad's coding, you must change your jpeg file name to S1.jpg, S2.jpg...etc. If you don't want to change you can use like this:


code:

var nNumber:Number = 1;
var fileNum:String;
nextButton.onRelease = function() {
nNumber++;
fileNum = "0000"+sNumber;
fileNum = fileNum.substr(fileNum.length-4, fileNum.length)
this.MovieClip1.loadMovie("S"+fileNum+".jpg");
};

Insane-Tomato is offline   Reply With Quote
Old 07-13-2004, 04:41 AM   #4
vulcan_hk
Junior Member
 
Join Date: Feb 2003
Posts: 11
Thanks Eraser-ad and Insane-Tomato
You guys really helped me a lot!
vulcan_hk is offline   Reply With Quote
Old 07-13-2004, 05:13 AM   #5
eraser_ad
Senior Member
 
eraser_ad's Avatar
 
Join Date: Apr 2004
Posts: 189
thx Insane Tomato
I actually just learned something new from here too. Thanks
__________________
some smart citation is coming here soon
eraser_ad is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash General Help

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:58 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.