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




[CS3] Next Prev Buttons



hi guys.

i have been trying to find youtube videos, searching flash forums, and maybe im wording this wrong, but i am trying to find an actionscript2.0 for next and previous buttons in flash cs3.

i want the buttons to look like this, say you are going through a portfolio and clicking on next and previous but in one section, such as PRINT, or WEB, or ETC.
heres how i would want it to look:

< 2 of 12 >

and the < would be the prev button and the > would be the next button, and everytime you clikc the next or previous button the first number changes..
and since there are different sections of the portfolio, the next and previous button's script would have to stop at a certain frame number and go back to the frame number where this particular section starts.

does anyone know the script, or could point me to the right place?


an example of how this works would be on www.carlafrank.com
at the bottom right, once you enter her portfolio it has the arrows with 1 of 29.

thank you.



FlashKit > Flash Help > Flash Newbies
Posted on: 08-04-2008, 10:19 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Replacing Dedicated Gallery Buttons For Next/prev Buttons
Hey all, I could use some help with this. It's probably something simple but it beyond my current abilities - any assistance would be aprreciated.

Well I'm using the code from one of the XML gallery tutorials. Currently the code has dedicated buttons for each individual gallery, however I'd like to change it so it only uses next/prev buttons and perhaps use an XML file to establish how many galleries there are, that way it would be easier to add additional galleries later on without cluttering the screen with a whole bunch of buttons.

here's the code...


PHP Code:



function loadXML(loaded) { if (loaded) {  xmlNode = this.firstChild;  image = [];  description = [];  thumbnails = [];   total = xmlNode.childNodes.length;  for (i=0; i<total; i++) {   image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;   description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;   thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;    thumbnails_fn(i);  }  firstImage(); } else {  content = "file not loaded!"; }}xmlData = new XML();xmlData.ignoreWhite = true;xmlData.onLoad = loadXML;xmlData.load("images1.xml");gallery_txt.text = "Gallery 1";// gallery buttonsbtngal1. onRelease = function(){ xmlData.onLoad = loadXML; xmlData.load("images1.xml"); gallery_txt.text = "Gallery 1"; thumbnail_mc.unloadMovie(); p = 0; thumbnail_mc._x = +1;}btngal2. onRelease = function(){ xmlData.onLoad = loadXML; xmlData.load("images2.xml"); gallery_txt.text = "Gallery 2"; thumbnail_mc.unloadMovie(); p = 0; thumbnail_mc._x = +1;}btngal3. onRelease = function(){ xmlData.onLoad = loadXML; xmlData.load("images3.xml"); gallery_txt.text = "Gallery 3"; thumbnail_mc.unloadMovie(); p = 0; thumbnail_mc._x = +1;}///////////////////////////////////// listen = new Object();listen.onKeyDown = function() { if (Key.getCode() == Key.LEFT) {  prevImage(); } else if (Key.getCode() == Key.RIGHT) {  nextImage(); }};Key.addListener(listen);previous_btn.onRelease = function() { prevImage();};next_btn.onRelease = function() { nextImage();};///////////////////////////////////// p = 0;this.onEnterFrame = function() { filesize = picture.getBytesTotal(); loaded = picture.getBytesLoaded(); preloader._visible = true; if (loaded != filesize) {  preloader.preload_bar._xscale = 100*loaded/filesize;  preloader.loadText = Math.round(100*loaded/filesize)+"%"; } else {  preloader._visible = false;  if (picture._alpha<100) {   picture._alpha += 10;  } }};function nextImage() { if (p<(total-1)) {  p++;  if (loaded == filesize) {   picture._alpha = 0;   picture.loadMovie(image[p], 1);   desc_txt.text = description[p];   picture_num();  } }}function prevImage() { if (p>0) {  p--;  picture._alpha = 0;  picture.loadMovie(image[p], 1);  desc_txt.text = description[p];  picture_num(); }}function firstImage() { if (loaded == filesize) {  picture._alpha = 0;  picture.loadMovie(image[0], 1);  desc_txt.text = description[0];  picture_num(); }}function picture_num() { current_pos = p+1; pos_txt.text = current_pos+" of "+total;}function thumbNailScroller() { // thumbnail code! this.createEmptyMovieClip("tscroller", 1000); scroll_speed = 30; tscroller.onEnterFrame = function() { if ((this._ymouse>=thumbnail_mc._y) && (this._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) { if ((this._xmouse>=(hit_right._x-3)) && (thumbnail_mc.hitTest(hit_right))) { thumbnail_mc._x -= scroll_speed; } else if ((this._xmouse<=30) && (thumbnail_mc.hitTest(hit_left))) { thumbnail_mc._x += scroll_speed; } } else { delete tscroller.onEnterFrame; } }; } function thumbnails_fn(k) { thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth()); tlistener = new Object(); tlistener.onLoadInit = function(target_mc) { target_mc._x = hit_left._x+(eval("thumbnail_mc.t"+k)._width+5)*k; target_mc.pictureValue = k; target_mc.onRelease = function() { p = this.pictureValue-1; nextImage(); };target_mc._alpha = 50;target_mc.onRollOver = function() { this._alpha = 200; thumbNailScroller(); }; target_mc.onRollOut = function() { this._alpha = 50; };}; image_mcl = new MovieClipLoader(); image_mcl.addListener(tlistener); image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k); } stop(); 






Thanks

Next, Prev. Buttons Help Plz
Hi,
I have a series of images (01.jpg, 02.jpg, 03.jpg, .....)
and i want t load the pic. with next and prev. buttons, next to load the next picture and prev. to load the prev. one, but it's too much pictures so i want it to be dynamic and at the end of the pictures to disable the next button and at the first picture to disable the prev. button. something like picture gallery

thanks in advance
cheers

Trying To Use Prev And Next Buttons
Hello all,

Does anyone have any good recommendations for a tutorial to create next and previous buttons in AS 3.0?

If anyone is interested in taking a look at what I am trying to do that would be great as well. The file is pretty big so some explanation may be the best.

Thanks everyone.

Help With Next Prev Buttons
i have a movie clip thats populated with paragraphs of text i was hoping to get a little help with the conditional logic that would apply, i had it working but with errors so i took it apart and started from scratch
basically i wanted the next and previous buttons to tween the movie clip the length of 2 paragraphs at a time, stopping at the front and the back heres what i got

if (ztotal>2) {
if(currentpage <=ztotal &&total !=0 ){
var sectin = b_sections.attachMovie("secbut", "secbut", 555);
sectin._x = 1019;
sectin._y = 49;
sectin._alpha = 0;
sectin.tween("_alpha", 100, 1, "linear", 0);
sectin.onRollOver = onDragOver=function () {
this.colorTo(0xFF7300, 1);
};
sectin.onRollOut = onDragOut=function () {
this.colorTo(null, 1);
};
sectin.onRelease = function() {

prevpage = Number(b_sections.pgno.pageno.text)-1;
newpage = Number(b_sections.pgno.pageno.text)+1
trace(sectin._x)
b_sections.pgno.pageno.text = Number(newpage);
this.tween("_y", 22, 1, "easeOutBounce", 0);
b_sections.s_holder.tween("_x", b_sections.s_holder._x-835, 1, "easeOutExpo", 0);
var sectin2 = b_sections.attachMovie("secbut2", "secbut2", 556);

sectin2._x = 1019
sectin2._y = 72;
sectin2._alpha = 0;
sectin2.tween("_alpha", 100, 1, "linear", .5);
sectin2.onRelease = function() {
b_sections.pgno.pageno.text = prevpage;
this.tween("_alpha", 0, 1, "linear", 0);
sectin.tween("_y", 49, 1, "easeOutBounce", 0);
b_sections.s_holder.tween("_x", b_sections.s_holder._x+835, 1, "easeOutExpo", 0, function () {
sectin2.removeMovieClip();
});
};
}
};
}

Help With Next Prev Buttons
i have a movie clip thats populated with paragraphs of text i was hoping to get a little help with the conditional logic that would apply, i had it working but with errors so i took it apart and started from scratch
basically i wanted the next and previous buttons to tween the movie clip the length of 2 paragraphs at a time, stopping at the front and the back heres what i got

PHP Code:



if (ztotal>2) {        if(currentpage <=ztotal &&total !=0 ){        var sectin = b_sections.attachMovie("secbut", "secbut", 555);        sectin._x = 1019;        sectin._y = 49;        sectin._alpha = 0;        sectin.tween("_alpha", 100, 1, "linear", 0);        sectin.onRollOver = onDragOver=function () {            this.colorTo(0xFF7300, 1);        };        sectin.onRollOut = onDragOut=function () {            this.colorTo(null, 1);        };        sectin.onRelease = function() {                        prevpage = Number(b_sections.pgno.pageno.text)-1;            newpage = Number(b_sections.pgno.pageno.text)+1            trace(sectin._x)            b_sections.pgno.pageno.text = Number(newpage);            this.tween("_y", 22, 1, "easeOutBounce", 0);            b_sections.s_holder.tween("_x",  b_sections.s_holder._x-835, 1, "easeOutExpo", 0);            var sectin2 = b_sections.attachMovie("secbut2", "secbut2", 556);                        sectin2._x = 1019            sectin2._y = 72;            sectin2._alpha = 0;            sectin2.tween("_alpha", 100, 1, "linear", .5);            sectin2.onRelease = function() {                b_sections.pgno.pageno.text = prevpage;                this.tween("_alpha", 0, 1, "linear", 0);                sectin.tween("_y", 49, 1, "easeOutBounce", 0);                b_sections.s_holder.tween("_x", b_sections.s_holder._x+835, 1, "easeOutExpo", 0, function () {                    sectin2.removeMovieClip();                });            };            }        };    } 

Next And Prev Pic Buttons
Hi again guys,

I have on my site a picture viewer. I hjave it so that it loads pictures in from the server as you click to view them rather than them being in the flash library. All the buttons fromt the main nav window (small version of the pics) are working fine. The problem is that when you click one and it brings up the viewer I want the person to be able to click one of two forward and back buttons. I have tried to make the forward button like this.


ActionScript Code:
on(release)
{
//PicNumInteger:Number=0;
_root.PicDisplaying.charAt(11) + _root.PicDisplaying.charAt(12));
LengthOfPicPath = _root.PopUpWindow.Display.PicFrame._url.length;
PicNum = _root.PopUpWindow.Display.PicFrame._url.charAt(LengthOfPicPath-7) + _root.PopUpWindow.Display.PicFrame._url.charAt(LengthOfPicPath-6) + _root.PopUpWindow.Display.PicFrame._url.charAt(LengthOfPicPath-5);//_root.PicDisplaying.charAt(10) + _root.PicDisplaying.charAt(11) + _root.PicDisplaying.charAt(12);
PicNumInteger:Number = parseInt(PicNum);
PicNumInteger++;
 
PicNum = String(PicNumInteger);
if(PicNumInteger < 10)
{
PicNum = "00" + String(PicNumInteger);
}
if(PicNumInteger >= 10)
{
PicNum = "0" + String(PicNumInteger);
}
 
_root.PicDisplaying = "Images/Pic" + PicNum.charAt(0) + PicNum.charAt(1) + PicNum.charAt(2) + ".jpg";
_root.PopUpWindow.Display.PicFrame.loadMovie(_root.PicDisplaying);
trace("PicD=" + _root.PicDisplaying.charAt(10) + _root.PicDisplaying.charAt(11) + _root.PicDisplaying.charAt(12));
}


I think the problem is somewhere in this line.


ActionScript Code:
PicNumInteger:Number = parseInt(PicNum);

because when I click on the next button it jumps back to picture one, no matter what picture it on. It seems that the 'PicNumInteger' is not being set as the number by PicNum.

All the pictures being read are names PicXXX.jpg in 001, 002, 003 etc format. Can anyone see the problem, or provide a better way to convert a string into a number?

Thanks Gaz.

FadeSequence W/ Next & Prev Buttons?
i've been working with this script from senocular that fades an image sequence. i would greatly appreciate anyone's input on how to modify it with next and previous buttons that advance the sequence when it is paused.
pleae see attached file.


Code:

FadeSequence = function (args) {
with (args) {
timer++;
if (timer>pauseTime) {
if (timer<pauseTime+fadeTime) {
var curr_fade = timer-pauseTime;
mc1._alpha = 100*curr_fade/fadeTime;
mc2._alpha = 100*(fadeTime-curr_fade)/fadeTime;
} else {
FadeSequenceReset(args);
}
}
}
};
FadeSequenceReset = function (args) {
with (args) {
timer = 0;
mc1._alpha = 0;
mc2._alpha = 100;
mc2.gotoAndStop(mc1._currentframe);
mc1.gotoAndStop(1+(mc1._currentframe%mc1._totalframes));
}
};
FadeSequenceInit = function (sequence, pauseTime, fadeTime) {
var args = new Object();
args.timer = 0;
args.pauseTime = pauseTime;
args.fadeTime = fadeTime;
args.mc1 = sequence;
args.mc2 = args.mc1.duplicateMovieClip(args.mc1._name+"2", 1+args.mc1.getDepth());
args.mc1.stop();
args.mc2.gotoAndStop(2);
FadeSequenceReset(args);
return args;
};
var fadeArgs = FadeSequenceInit(sequence_mc, 48, 24);
this.onEnterFrame = function() {
if (auto_mc._currentframe == 1) {
FadeSequence(fadeArgs);
}
};

Next/Prev Frame Buttons Not Working
I am busy with a portfolio section. I used

on (release) {
nextFrame();

}

&

on (release) {
nextFrame();

}

to move from image to image. the codes are fine, worked on the previous portfolio thing i did, but now, when i click on the buttons, nothing happens, yip probably something very stupid i am doing wrong here. Please help

I have a grpahic symbol, with all the images in that symbols timeline, and also in that timeline i have the buttons layer. wish i could post the file, but its too big

[F8] Gallery Problem With Next/prev Buttons
Hi,

I'm working on a photo gallery and I have some weird things happening, hence the request for help!

When the gallery opens, you can click on any picture, the main one then appears with various buttons:
1. Click on the image and you go back to the thumbnails - fine
2. Click on the cross button and it's the same - fine
3. Don't click on the automatic gallery, it's no on yet!
4. Click on previous and the previous image appears - fine
5. Click on next and the next image appears - nope, that's where the problem is!

For the previous button, I use this code:

var previous = "none";
if (_global.currentImage == 1) {
previous = _global.photoNum;
} else {
previous = _global.currentImage-1;
}

_global.currentImage is the number related to the thumbnail you have clicked.
_global.photoNum is the total number of pictures

After this code, there's all the code for the preloader and it ends by defining the new current image (_global.currentImage = previous;) and loading it (mcLoader.loadClip("images/photo"+previous+".jpg", _level0.images_mc.holder_mc);).

The next button is based on the same code:

var next = "none";
if (_global.currentImage == _global.photoNum) {
next = 1;
} else {
next = _global.currentImage+1;
}

With at the end _global.currentImage = next; and mcLoader.loadClip("images/photo"+next+".jpg", _level0.images_mc.holder_mc);.

Here is the problem, there are three situation you use the next button:

1. On the thumbnails, you click any image. When the main image is loaded, you click first previous, have the new image loaded and then you click next. The next image is loaded and it works fine.

2. On the thumbnails, you click the last image. When the main image is loaded, you click next. The next image (which is then the 1st) is loaded and it works fine.

3. On the thumbnails, you click any image. When the main image is loaded, you click next. Here is the problem: the next image is not loaded!

You can see it here: www.theminnesotafats.com/gallery
When you see that the picture is not loaded, you will have to refresh the page to make it work again.

I hope that those explainations are not too long and that somebody could help me. Thanks!

Invisible Next/Prev Buttons On 1st And Last Pages
I have pages of info I'm pulling from external txt files. I want my btn_prev to not be visible when the last page loads and my btn_next to not be visible when the first page loads. The btns are actually moviclips with instance names btn_next and btn_prev Here is my code:

//Stage Scale
Stage.scaleMode = "exactFit";
width_txt.text = Stage.width;
height_txt.text = Stage.height;
// End Stage Scale

//Stage Resize Listener
var resizeListener:Object = new Object();
resizeListener.onResize = function()
{
width_txt.text = Stage.width;
height_txt.text = Stage.height;
}
Stage.addListener(resizeListener);
// End Stage Resize Listener

// Default Page Number Variable
var currrentPage:Number = 0;

// Movie Clip Variable
var myMCL:MovieClipLoader = new MovieClipLoader();

// Total Pages Var and Load
var myPageTotal:LoadVars = new LoadVars();
myPageTotal.load("pages/pageTotal.txt");

//Pages Var
var infoPageTotal:LoadVars = new LoadVars();


// Page Counter Function
function pageCounter():Void
{
txt_pageNumber.text = (currrentPage + 1) + " / " + Number(myPageTotal.totalPages);
}
myPageTotal.onLoad = function(p_success:Boolean):Void
{
if(p_success)
{
pageCounter();
}
else
{
txt_pageNumber.text = "Error loading file.";
}
}
// End Page Counter Function

// Next Page Function
function nextPage(){
infoPageTotal.load("pages/page" + currrentPage + ".txt");
infoPageTotal.onLoad = function(p_success:Boolean):Void
{
if(p_success)
{
txt_page.htmlText = infoPageTotal.info;
}
else
{
txt_page.text = "Error loading file.";
}
}
}
nextPage();
// End Next Page Function

// Next Button Actions
btn_next.onRelease = function():Void
{
if(currrentPage < Number(myPageTotal.totalPages) - 1)
{
currrentPage ++;
gotoAndPlay(2);
}
else
{
currrentPage = 0;
}
nextPage();
pageCounter();
}
// End Next Button Actions
// Previous Button Actions
btn_prev.onRelease = function():Void
{
if(currrentPage == 0)
{
currrentPage = Number(myPageTotal.totalPages) - 1;
}
else
{
currrentPage --;
gotoAndPlay(6);
}
nextPage();
pageCounter();
}
// End Previous Button Actions
stop();

Thank you in advance for any advice and suggestions.

How To Control Prev/next Buttons With Mousewheel
EDIT: I've attached the fla, scripts, and the tween extension....
The images would put the zip over 500kb, but any dummy images will work....

Hello,

I have a quick question for those who's powers of actionscripting are far superior to my own - which is pretty much anyone....

I downloaded a great little component off of flashden.....here she is: http://flashden.net/files/21662/index.html

What I'd really, really, (do i really need another really?) like to do is scroll through the pictures using the mousewheel.....so when you mousewheel-up it is the same as hitting the "next" button, and when you mousewheel-down its the same as hitting the "prev" button.

Its a very neat file.....I actually understand most of the code and its very well commented, but I have absolutely ZERO experience with mousewheel functions.

Would anyone like to help?


I dunno what part of the code you genii (is that the plural for genius?) need to work your magic, so I'll just paste it all:

ActionScript Code:
function backBright2() {
        mc.prevFrame();
        mc.brightOffsetTo(0, 2, "easeInOut", 0, startSlide());
        mc.brightOffsetTo(0, 2, "easeInOut", startSlide());
}

//code for the next button onPress,
next_btn.onPress = function (){
        prev_btn.enabled = true;
        mc.brightOffsetTo(100, 1, "easeInOut", 0, backBright);
        if (mc._currentframe==mc._totalframes-1) {
        next_btn.enabled = false;
        } else {
        next_btn.enabled = true;
    }
}

//code for the prev button onPress,
prev_btn.onPress = function (){
        next_btn.enabled = true;
        mc.brightOffsetTo(100, 1, "easeInOut", 0, backBright2);
        if (mc._currentframe>2) {
        prev_btn.enabled = true;
        } else {
        prev_btn.enabled = false;
    }
}

//code for the intro box animation
boxMC.xO = boxMC._xscale;
boxMC.xO = boxMC._yscale;

boxMC.tween("_xscale", boxMC.xO + 90, 0.6,"easeinback");
boxMC.tween("_yscale", boxMC.xO + 90, 0.6,"easeinback");

THANK YOU!

Xml Photogallery Prev And Next Buttons Help.plzzzzz
hai to all plz help me

this.thumbnails._y = 30;

myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.load("shirts/shirtprints.xml");
myPhoto.onLoad = function(success) {

numimages = this.firstChild.firstChild.childNodes.length;
spacing = 81;

for (i=0; i<numimages; i++)
{
this.picHolder = this.firstChild.firstChild.childNodes;
this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i*10);
this.thumbHolder._y = i*spacing;
this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 10);
this.thumbLoader.loadMovie(this.picHolder.attributes.thumb);
this.thumbHolder.title = this.picHolder.attributes.desc;
this.thumbHolder.main = this.picHolder.attributes.main;
this.thumbHolder.onRelease = function() {
loader._xscale = 75;
loader._yscale = 75;
loader.loadMovie(this.main);
title_txt.text = this.title;
_root.title_txt.html = true;
};
}
};
this is my code for loading xml photogallery can any one say how to get the no. of the childnode in xml file which is being displayed now. so that i can make previous and next buttons.

this is my xml file:-
<thumb nofimagesperrow="4" nofimagespercol="4" startx="10" starty="10">
<pic thumb="t_shirts/thumb/more/lips.jpg" main="t_shirts/main/more/lips.jpg" desc="lips"/>
<pic thumb="t_shirts/thumb/more/fish.jpg" main="t_shirts/main/more/fish.jpg" desc="fish"/>
<pic thumb="t_shirts/thumb/more/estelle.jpg" main="t_shirts/main/more/estelle.jpg" desc="estelle"/>
<pic thumb="t_shirts/thumb/more/fire_girl.jpg" main="t_shirts/main/more/fire_girl.jpg" desc="fire girl"/>
<pic thumb="t_shirts/thumb/more/christy.jpg" main="t_shirts/main/more/christy.jpg" desc="christy"/>
<pic thumb="t_shirts/thumb/more/bambi.jpg" main="t_shirts/main/more/bambi.jpg" desc="bambi"/>
<pic thumb="t_shirts/thumb/more/MissyBella.jpg" main="t_shirts/main/more/MissyBella.jpg" desc="MissyBella"/>
<pic thumb="t_shirts/thumb/more/angel.jpg" main="t_shirts/main/more/angel.jpg" desc="angel"/>
<pic thumb="t_shirts/thumb/more/butterfly.jpg" main="t_shirts/main/more/butterfly.jpg" desc="butterfly"/>
<pic thumb="t_shirts/thumb/more/bonnet_girl.jpg" main="t_shirts/main/more/bonnet_girl.jpg" desc="bonnet girl"/>
<pic thumb="t_shirts/thumb/more/cat_lady.jpg" main="t_shirts/main/more/cat_lady.jpg" desc="cat lady"/>

Gallery Problem With Next/prev Buttons
Hi,

I'm working on a photo gallery and I have some weird things happening, hence the request for help!

When the gallery opens, you can click on any picture, the main one then appears with various buttons:
1. Click on the image and you go back to the thumbnails - fine
2. Click on the cross button and it's the same - fine
3. Don't click on the automatic gallery, it's no on yet! :)
4. Click on previous and the previous image appears - fine
5. Click on next and the next image appears - nope, that's where the problem is!

For the previous button, I use this code:

var previous = "none";
if (_global.currentImage == 1) {
previous = _global.photoNum;
} else {
previous = _global.currentImage-1;
}

_global.currentImage is the number related to the thumbnail you have clicked.
_global.photoNum is the total number of pictures

After this code, there's all the code for the preloader and it ends by defining the new current image (_global.currentImage = previous;) and loading it (mcLoader.loadClip("images/photo"+previous+".jpg", _level0.images_mc.holder_mc);).

The next button is based on the same code:

var next = "none";
if (_global.currentImage == _global.photoNum) {
next = 1;
} else {
next = _global.currentImage+1;
}

With at the end _global.currentImage = next; and mcLoader.loadClip("images/photo"+next+".jpg", _level0.images_mc.holder_mc);.

Here is the problem, there are three situation you use the next button:

1. On the thumbnails, you click any image. When the main image is loaded, you click first previous, have the new image loaded and then you click next. The next image is loaded and it works fine.

2. On the thumbnails, you click the last image. When the main image is loaded, you click next. The next image (which is then the 1st) is loaded and it works fine.

3. On the thumbnails, you click any image. When the main image is loaded, you click next. Here is the problem: the next image is not loaded!

You can see it here: www.theminnesotafats.com/gallery
When you see that the picture is not loaded, you will have to refresh the page to make it work again.

I hope that those explainations are not too long and that somebody could help me. Thanks!

Setting Visibility For Next/Prev Buttons
I have pages of info I'm pulling from external files. I want my btn_next to not be visible when the last page loads and my btn_prev to not be visible when the first page loads. The btns are actually moviclips with instance names btn_next and btn_prev Here is my code:

//Stage Scale
Stage.scaleMode = "exactFit";
width_txt.text = Stage.width;
height_txt.text = Stage.height;
// End Stage Scale

//Stage Resize Listener
var resizeListener:Object = new Object();
resizeListener.onResize = function()
{
width_txt.text = Stage.width;
height_txt.text = Stage.height;
}
Stage.addListener(resizeListener);
// End Stage Resize Listener

// Default Page Number Variable
var currrentPage:Number = 0;

// Movie Clip Variable
var myMCL:MovieClipLoader = new MovieClipLoader();

// Total Pages Var and Load
var myPageTotal:LoadVars = new LoadVars();
myPageTotal.load("pages/pageTotal.txt");

//Pages Var
var infoPageTotal:LoadVars = new LoadVars();


// Page Counter Function
function pageCounter():Void
{
txt_pageNumber.text = (currrentPage + 1) + " / " + Number(myPageTotal.totalPages);
}
myPageTotal.onLoad = function(p_success:Boolean):Void
{
if(p_success)
{
pageCounter();
}
else
{
txt_pageNumber.text = "Error loading file.";
}
}
// End Page Counter Function

// Next Page Function
function nextPage(){
infoPageTotal.load("pages/page" + currrentPage + ".txt");
infoPageTotal.onLoad = function(p_success:Boolean):Void
{
if(p_success)
{
txt_page.htmlText = infoPageTotal.info;
}
else
{
txt_page.text = "Error loading file.";
}
}
}
nextPage();
// End Next Page Function

// Next Button Actions
btn_next.onRelease = function():Void
{
if(currrentPage < Number(myPageTotal.totalPages) - 1)
{
currrentPage ++;
gotoAndPlay(2);
}
else
{
currrentPage = 0;
}
nextPage();
pageCounter();
}
// End Next Button Actions
// Previous Button Actions
btn_prev.onRelease = function():Void
{
if(currrentPage == 0)
{
currrentPage = Number(myPageTotal.totalPages) - 1;
}
else
{
currrentPage --;
gotoAndPlay(6);
}
nextPage();
pageCounter();
}
// End Previous Button Actions
stop();

I've tried creating a buttonVisibility function but I'm doing something wrong because it either turns one or the other button off completely. Any help would be greatly appreciate. Thank you in advance.

Gallery Problem With Next/prev Buttons
Hi,

I'm working on a photo gallery and I have some weird things happening, hence the request for help!

When the gallery opens, you can click on any picture, the main one then appears with various buttons:
1. Click on the image and you go back to the thumbnails - fine
2. Click on the cross button and it's the same - fine
3. Don't click on the automatic gallery, it's no on yet!
4. Click on previous and the previous image appears - fine
5. Click on next and the next image appears - nope, that's where the problem is!

For the previous button, I use this code:

var previous = "none";
if (_global.currentImage == 1) {
previous = _global.photoNum;
} else {
previous = _global.currentImage-1;
}

_global.currentImage is the number related to the thumbnail you have clicked.
_global.photoNum is the total number of pictures

After this code, there's all the code for the preloader and it ends by defining the new current image (_global.currentImage = previous;) and loading it (mcLoader.loadClip("images/photo"+previous+".jpg", _level0.images_mc.holder_mc);).

The next button is based on the same code:

var next = "none";
if (_global.currentImage == _global.photoNum) {
next = 1;
} else {
next = _global.currentImage+1;
}

With at the end _global.currentImage = next; and mcLoader.loadClip("images/photo"+next+".jpg", _level0.images_mc.holder_mc);.

Here is the problem, there are three situation you use the next button:

1. On the thumbnails, you click any image. When the main image is loaded, you click first previous, have the new image loaded and then you click next. The next image is loaded and it works fine.

2. On the thumbnails, you click the last image. When the main image is loaded, you click next. The next image (which is then the 1st) is loaded and it works fine.

3. On the thumbnails, you click any image. When the main image is loaded, you click next. Here is the problem: the next image is not loaded!

You can see it here: www.theminnesotafats.com/gallery
When you see that the picture is not loaded, you will have to refresh the page to make it work again.

I hope that those explainations are not too long and that somebody could help me. Thanks!

Resize Gallery - Prev/next Buttons
Hi, I am totally new here and you should be patient with me bcs I do not speak English perfectly and I am self-educated in Flash and computer...
I found an auto border resize gallery here in this site which is just perfect for what i was looking. It does not use XML what is realy great (I believe that XML loads images pretty slowly).
However I would like to developpe this gallery with a "next" button and "previous" button to make it able to go through all images by clicking only to one button. In this case it is not necessary to click to each thumbnail.
I found a script in the same resize gallery but it uses xml so it is not exactly the same and i am not so strong in actionscript, i can not change it. Please have a look at the whole actionscript and if you know the answer how to correct the point what I marked in red color, please please let me know !

THE SCRIPT :
----------------
stop();
space = 25;
photo_mc._alpha = 100;
var photo = new Array();
MovieClip.prototype.loadPhoto = function(photo){
photo_mc._alpha = 0;
this.loadMovie(photo);
_level0.onEnterFrame = function(){
// modified the total and loaded so as to round it up to smaller number.
var total = Math.round photo_mc.getBytesTotal)/ 1024);
var loaded = Math.round(photo_mc.getBytesLoaded()/1024);
if (total != 0 && loaded>=total){
var w = photo_mc._width + space;
var h = photo_mc._height + space;
border.resize(w, h);
delete this.onEnterFrame;
picinfo.info.text = photo;
delete this.onEnterFrame;
}
}
};
MovieClip.prototype.resize = function(w, h){
//the higher the slower the resize of the border
var speed = 4;
this.onEnterFrame = function(){
this._width += (w - this._width)/speed;
this._height += (h - this._height)/speed;
nav._x = Math.round(this._x-this._width/2);
nav._y = Math.round(this._y+this._height/2+spacing/2);
prevb._x = nav._x-5;
nextb._x = nav._x+this._width+5;
nextb._y = prevb._y=this._y-this._height/2;
picinfo._y = nextb._y-5;
picinfo._x = border._x-picinfo._width/2;
if( Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1){
this._width = w;
this._height = h;
photo_mc._x = this._x - this._width/2 + space/2;
photo_mc._y = this._y - this._height/2 + space/2;
photo_mc._alpha = 100;
delete this.onEnterFrame;
}
}
};
gallery_xml.load("gallery.xml");
prevb.onRelease = function() {
cur--;
if (cur<0) {
containerMC.loadPic(pArray.length-1);
} else {
containerMC.loadPic(cur);
}
};
nextb.onRelease = function() {
cur++;
if (cur > pArray.length-1) {
containerMC.loadPic(0);
} else {
containerMC.loadPic(cur);
}
};

pic1.onPress = function() {
photo_mc.loadPhoto("p1.swf");
};
pic2.onPress = function() {
photo_mc.loadPhoto("p2.swf");
};
pic3.onPress = function() {
photo_mc.loadPhoto("p3.swf");
};
pic4.onPress = function() {
photo_mc.loadPhoto("p4.swf");
};
pic5.onPress = function() {
photo_mc.loadPhoto("p5.swf");
};
pic6.onPress = function() {
photo_mc.loadPhoto("p6.swf");
};
pic7.onPress = function() {
photo_mc.loadPhoto("p7.swf");
};
pic8.onPress = function() {
photo_mc.loadPhoto("p8.swf");
};
pic9.onPress = function() {
photo_mc.loadPhoto("p9.swf");
};
///////////////Modified by Sokhodom Pheng //////////////////define the initiation function
function init(photo) {
photo_mc.loadPhoto(photo);
}
// call the initiation function
//change the image name accordingly
init("p1.swf");

Gallery Problem With Next/prev Buttons
Hi,

I'm working on a photo gallery and I have some weird things happening, hence the request for help!

When the gallery opens, you can click on any picture, the main one then appears with various buttons:
1. Click on the image and you go back to the thumbnails - fine
2. Click on the cross button and it's the same - fine
3. Don't click on the automatic gallery, it's no on yet!
4. Click on previous and the previous image appears - fine
5. Click on next and the next image appears - nope, that's where the problem is!

For the previous button, I use this code:

var previous = "none";
if (_global.currentImage == 1) {
previous = _global.photoNum;
} else {
previous = _global.currentImage-1;
}

_global.currentImage is the number related to the thumbnail you have clicked.
_global.photoNum is the total number of pictures

After this code, there's all the code for the preloader and it ends by defining the new current image (_global.currentImage = previous;) and loading it (mcLoader.loadClip("images/photo"+previous+".jpg", _level0.images_mc.holder_mc);).

The next button is based on the same code:

var next = "none";
if (_global.currentImage == _global.photoNum) {
next = 1;
} else {
next = _global.currentImage+1;
}

With at the end _global.currentImage = next; and mcLoader.loadClip("images/photo"+next+".jpg", _level0.images_mc.holder_mc);.

Here is the problem, there are three situation you use the next button:

1. On the thumbnails, you click any image. When the main image is loaded, you click first previous, have the new image loaded and then you click next. The next image is loaded and it works fine.

2. On the thumbnails, you click the last image. When the main image is loaded, you click next. The next image (which is then the 1st) is loaded and it works fine.

3. On the thumbnails, you click any image. When the main image is loaded, you click next. Here is the problem: the next image is not loaded!

You can see it here: www.theminnesotafats.com/gallery
When you see that the picture is not loaded, you will have to refresh the page to make it work again.

I hope that those explainations are not too long and that somebody could help me. Thanks!

XML Photo Gallery With Prev/next Buttons
Hi,

I am trying to make an xml photo gallery for so many days but constantly getting errors, don't understand why? Please help me..

Here is the XML file:
Code:

<images>
    <pic>
        <img>thumb_winter</img>
        <captions>Winter</captions>
    </pic>
    <pic>
        <img>blue_hill</img>
        <captions>Blue Hill</captions>
    </pic>
</images> 

And here is the AS 3.0 code:
Code:

import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.xml.*;

var list:XMLList= new XMLList();
var loader:URLLoader = new URLLoader();
var req:URLRequest = new URLRequest("images.xml");

loader.load(req);
loader.addEventListener(Event.COMPLETE, onComplete);

function onComplete(ev:Event):void
{
    try {
        if(loader != null)
        {
            var loader:URLLoader = URLLoader(ev.target.data);
            var result:XML = new XML(loader.data);
            var data_xml:XMLDocument = new XMLDocument();
            data_xml.ignoreWhite = true;
            var node:XMLNode = data_xml.firstChild;
            text_txt.text = node.firstChild.attributes['captions']; //added for testing
            this.addChild(text_txt);
        }
        else {
            trace("File not loaded");
        }
    }
    catch(error:Error)
    {
        trace("Error Encountered");
    }


When I run this code..it catches the error & shows "Error Encountered". If I remove try..catch statements..it shows

Code:

to flash.net.URLLoader.
    at photo_fla::MainTimeline/onComplete()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/flash.net:URLLoader::onComplete()

1) how can I show a photo on stage using pic_mc (a movieclip)...I am badly confused because of errors & all.

2) if I put all the pictures & text in an array (ex: my_pic & my_text arrays respectively), now how to put the data on stage (how to show pictures & text from these arrays)?

Which is the best way out of the above two? Sorry for this but I am really very badly confused.

P.S.
On stage I have:
1) pic_mc (a movie clip...Picture holder)
2) Previous & next buttons (to navigate through pictures)
3) text_txt ( a dynamic text box to show picture description)
4) pos_txt ( a dynamic text box to show picture number i.e. 2 out of 10)

Slideshow Help Need Fade And Next/prev Buttons
Hi,

I've been searching everywhere for how to do this and I must be missing something. I am fairly new to Flash, but know some basics AS (2.0) and can find my way around.

I need to create a slideshow where the images fade in and out on a three second lag, BUT also provide next and previous buttons in case the user would rather scroll through themselves.

I've found basic slideshows that allow next/prev buttons to work with with the nextFrame script, but I don't know how to get this to work when there are transitions between images because then the next image is not in the next frame. Does that make sense?

Maybe I'm missing something silly here. Maybe someone has a flash file that simulates this that they could share?

THANK YOU so much in advance!
Susie

Prev Back Buttons On Array Loaded From Txt
Hi everyone,
I´m having trouble with the prev and back button in arrays.
the data it's loaded from an txt, the button labels, the info text and the jpgs loads perfect.
but the prev and back seems to ignore the first array. with the next it opens the first, second, third array, but when it's supost to reload the first one, appears an "error opening the URL" the same on the prev
I'm a newbie in arrays and I'm going crazy whit this, I've tried "var i = 1" and "var i = 0" and nothing.

Other problem is that the user can jump for instance from the first array to de third, and start clicking the prev next buttons, can it be made to recognize the currentItem???

PLEASE HEEEEEEEEEEEEELP

Here's the code


PHP Code:



submenu = "WEBDESIGN";
test1 = new LoadVars();
test1.load("data/menu1.fst");
test1.onLoad = function(success) {
    if (success) {
        sectionNames = this.nome.split("|");
        sectionImages = this.imagem.split("|");
        sectionInfo = this.infos.split("|");
        sectionCount = sectionNames.length;
        menuItemSpacing = 1;
        for (i=1; i<=sectionCount; i++) {
            _root.menu.menuItemBase.duplicateMovieClip("menuItem_"+i, i);
            _root.menu["menuItem_"+i].labelName = sectionNames[i-1];
            _root.menu["menuItem_"+i].labelImage = sectionImages[i-1];
            _root.menu["menuItem_"+i].labelInfo = sectionInfo[i-1];
            _root.menu.menuItem_1.gotoAndStop("end");
            loadMovie("imgs/"+sectionImages[0], _root.img);
            _root.infos = sectionInfo[0];
            if (i != 1) {
                _root.menu["menuItem_"+i]._y = _root.menu["menuItem_"+(i-1)]._y+_root.menu["menuItem_"+(i-1)]._height+menuItemSpacing;
            }
        }
    }
};
_root.menu.menuItemBase._visible = false;
function checkButtons() {
    for (i=1; i<=_root.sectionCount; i++) {
        currentItem = "menuItem_"+i;
        if (currentItem != _root.activeItem) {
            _root.menu["menuItem_"+i].gotoAndStop(1);
        }
    }
}
next_btn.onRelease = function() {
    i++;
    if (i>sectionCount) {
        i = 1;
    }
    loadMovie("imgs/"+sectionImages[i], _root.img);
    _root.infos = sectionInfo[i];
};
prev_btn.onRelease = function() {
    i--;
    if (i == 0) {
        i = sectionCount;
    }
    loadMovie("imgs/"+sectionImages[i], _root.img);
    _root.infos = sectionInfo[i];
};




and the file

Prev Back Buttons On Array Loaded From Txt
Hi everyone,
I'm having trouble with the prev and back button in arrays.
the data it's loaded from an txt, the button labels, the info text and the jpgs loads perfect.
but the prev and back seems to ignore the first array. with the next it opens the first, second, third array, but when it's supost to reload the first one, appears an "error opening the URL" the same on the prev
I'm a newbie in arrays and I'm going crazy trying solving this, I've tried "var i = 1" and "var i = 0" and nothing.

Other problem is that the user can jump for instance from the first array to de third, and start clicking the prev next buttons, can it be made to recognize the currentItem???

PLEASE HEEEEEEEEEEEEELP

here's the file
and here's the code:

PHP Code:



submenu = "WEBDESIGN";
test1 = new LoadVars();
test1.load("data/menu1.fst");
test1.onLoad = function(success) {
    if (success) {
        sectionNames = this.nome.split("|");
        sectionImages = this.imagem.split("|");
        sectionInfo = this.infos.split("|");
        sectionCount = sectionNames.length;
        menuItemSpacing = 1;
        for (i=1; i<=sectionCount; i++) {
            _root.menu.menuItemBase.duplicateMovieClip("menuItem_"+i, i);
            _root.menu["menuItem_"+i].labelName = sectionNames[i-1];
            _root.menu["menuItem_"+i].labelImage = sectionImages[i-1];
            _root.menu["menuItem_"+i].labelInfo = sectionInfo[i-1];
            _root.menu.menuItem_1.gotoAndStop("end");
            loadMovie("imgs/"+sectionImages[0], _root.img);
            _root.infos = sectionInfo[0];
            if (i != 1) {
                _root.menu["menuItem_"+i]._y = _root.menu["menuItem_"+(i-1)]._y+_root.menu["menuItem_"+(i-1)]._height+menuItemSpacing;
            }
        }
    }
};
_root.menu.menuItemBase._visible = false;
function checkButtons() {
    for (i=1; i<=_root.sectionCount; i++) {
        currentItem = "menuItem_"+i;
        if (currentItem != _root.activeItem) {
            _root.menu["menuItem_"+i].gotoAndStop(1);
        }
    }
}
next_btn.onRelease = function() {
    i++;
    if (i>sectionCount) {
        i = 1;
    }
    loadMovie("imgs/"+sectionImages[i], _root.img);
    _root.infos = sectionInfo[i];
};
prev_btn.onRelease = function() {
    i--;
    if (i == 0) {
        i = sectionCount;
    }
    loadMovie("imgs/"+sectionImages[i], _root.img);
    _root.infos = sectionInfo[i];
}; 




Thanks in advance

Limit Results In Array + Next And Prev Buttons
How can I limit the amount of records in an array to be displayed?

Then when you click on a "Next" button go to the next 6?


ActionScript Code:
DefaultValue1 = "House1.jpg::Taken 2-20-05~House2.jpg::Taken 2-21-05~House3.jpg::Taken 2-22-05~House4.jpg::Taken 2-23-05~House5.jpg::Taken 2-24-05~House6.jpg::Taken 2-25-05~House7.jpg::Taken 2-26-05~House1.jpg::Taken 2-20-05~House2.jpg::Taken 2-21-05~House3.jpg::Taken 2-22-05~House4.jpg::Taken 2-23-05~House5.jpg::Taken 2-24-05~House6.jpg::Taken 2-25-05~House7.jpg::Taken 2-26-05~House1.jpg::Taken 2-20-05~House2.jpg::Taken 2-21-05~House3.jpg::Taken 2-22-05~House4.jpg::Taken 2-23-05~House5.jpg::Taken 2-24-05~House6.jpg::Taken 2-25-05~House7.jpg::Taken 2-26-05~House1.jpg::Taken 2-20-05~House2.jpg::Taken 2-21-05~House3.jpg::Taken 2-22-05~House4.jpg::Taken 2-23-05~House5.jpg::Taken 2-24-05~House6.jpg::Taken 2-25-05~House7.jpg::Taken 2-26-05";

var receivedData = {photos:new Array(), texts:new Array(), folders:new Array(), captions:new Array()};
function Parse() {
var temp1 = DefaultValue1.split("~");
for (var i = 0; i<temp1.length; ++i) {
var temp2 = temp1[i].split(":");
receivedData.photos.push(temp2[0]);
receivedData.folders.push(temp2[1]);
receivedData.texts.push(temp2[2]);
}
var temp3 = DefaultValue2.split("~");
for (var j = 0; j<temp3.length; j++) {
receivedData.captions.push(temp3[j]);
}
trace(receivedData.photos);
trace(receivedData.texts);
trace(receivedData.folders);
trace(receivedData.captions);
imageNum.text = receivedData.photos.length;
titleNum.text = receivedData.texts.length;
}
Parse();
var imgPerPage = 6;
//var capPerPage = 6;
//var titlePerPage = 6;
var imgCount = receivedData.photos.length;
var pageCount = Math.ceil(imgCount/imgPerPage);
var currPageNum = 1;
var baseImgNum = ((currPageNum-1)*imgPerPage)+1;
pageInfo.text = "Page "+currPageNum+"of "+pageCount;
nextBtn.onRelease = function() {
currPageNum++;
trace(currPageNum);
if(currPageNum<=pageCount){
pageInfo.text = "Page "+currPageNum+"of "+pageCount;
}else{
nextBtn.enabled = false;
}
if (currPageNum<=pageCount) {
trace("Show Page "+currPageNum);
} else {
trace("There is no page"+currPageNum);
}
};
prevBtn.onRelease = function() {
currPageNum--;
trace(currPageNum);
if(currPageNum<=pageCount){
pageInfo.text = "Page "+currPageNum+"of "+pageCount;
}else{
//prevBtn.enabled = false;
}
if (currPageNum<=pageCount) {
trace("Show Page "+currPageNum);
} else {
trace("There is no page"+currPageNum);
}
};

thanks
d

Next, Prev Frame OnRollover Animation, I Know How To Do It With Buttons But...
Ok here is the thing, I have the following code on my buttons.

ActionScript Code:
onClipEvent (enterFrame) {    if (this.hitTest(_root._xmouse, _root._ymouse, true)) {        this.nextFrame();    } else {        this.prevFrame();    }}

This makes the button animation rewind or play depending on if the mouse is over the button. I want to have this on my buttons but I also want a different movie clip on a different layer to go to the next frame or previous frame depending on the rollover. Basically, I need to know how to add something in addition to:

ActionScript Code:
this.nextFrame();ANDthis.prevFrame();

with a different movieclip in replace of "this". The movieclip is located in my main movie (_root). But when I tried:

ActionScript Code:
_root.MyMovie.prevFrame();

it didn't work. ANy suggestions on how to make it work. THANKS VERY MUCH.

MIke

XML Slide Show With Next And Prev Buttons On Top Of The Pics
Hello all
I've been banging my head on the wall about this and it's all my fault really but that's neither your faut or mine. The point of the matter is I sold my idea but i can't figure it out. I need a Cross Fading XML slide show but with the Next and Previos btns on top of the pictures. the client doesn't want them on the side or below Any help would be Awsome thanks so much

Next/prev Buttons Of Border Resize Gallery
I found an auto border resize gallery which is just perfect because it does not use XML. It is easier and faster load. However I would like to developpe this gallery with a "next" and "previous" buttons, navigating not only by thumbnails.
I found a script (see below in RED) in a similar resize gallery which uses xml , it should be changed to work without xml.
Pls check it and let me know if you have an idea how the right script should be.
Demo : http://www.mozaikart.org/essai/essai1.htm

THE WHOLE SCRIPT :
----------------
stop();
space = 25;
photo_mc._alpha = 100;
var photo = new Array();

MovieClip.prototype.loadPhoto = function(photo){
photo_mc._alpha = 0;
this.loadMovie(photo);
_level0.onEnterFrame = function(){
// modified the total and loaded so as to round it up to smaller number.
var total = Math.round photo_mc.getBytesTotal)/ 1024);
var loaded = Math.round(photo_mc.getBytesLoaded()/1024);
if (total != 0 && loaded>=total){
var w = photo_mc._width + space;
var h = photo_mc._height + space;
border.resize(w, h);
delete this.onEnterFrame;
picinfo.info.text = photo;
delete this.onEnterFrame;
}
}
};

MovieClip.prototype.resize = function(w, h){
//the higher the slower the resize of the border
var speed = 4;
this.onEnterFrame = function(){
this._width += (w - this._width)/speed;
this._height += (h - this._height)/speed;
nav._x = Math.round(this._x-this._width/2);
nav._y = Math.round(this._y+this._height/2+spacing/2);
prevb._x = nav._x-5;
nextb._x = nav._x+this._width+5;
nextb._y = prevb._y=this._y-this._height/2;
picinfo._y = nextb._y-5;
picinfo._x = border._x-picinfo._width/2;
if( Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1){
this._width = w;
this._height = h;
photo_mc._x = this._x - this._width/2 + space/2;
photo_mc._y = this._y - this._height/2 + space/2;
photo_mc._alpha = 100;
delete this.onEnterFrame;
}
}
};

gallery_xml.load("gallery.xml");
prevb.onRelease = function() {
cur--;
if (cur<0) {
containerMC.loadPic(pArray.length-1);
} else {
containerMC.loadPic(cur);
}
};
nextb.onRelease = function() {
cur++;
if (cur > pArray.length-1) {
containerMC.loadPic(0);
} else {
containerMC.loadPic(cur);
}
};

pic1.onPress = function() {
photo_mc.loadPhoto("p1.swf");
};
pic2.onPress = function() {
photo_mc.loadPhoto("p2.swf");
};
pic3.onPress = function() {
photo_mc.loadPhoto("p3.swf");
};
pic4.onPress = function() {
photo_mc.loadPhoto("p4.swf");
};
pic5.onPress = function() {
photo_mc.loadPhoto("p5.swf");
};
pic6.onPress = function() {
photo_mc.loadPhoto("p6.swf");
};
pic7.onPress = function() {
photo_mc.loadPhoto("p7.swf");
};
pic8.onPress = function() {
photo_mc.loadPhoto("p8.swf");
};
pic9.onPress = function() {
photo_mc.loadPhoto("p9.swf");
};

/////////////////////////////////////
//Modified by Sokhodom Pheng //
////////////////////////////////////
//define the initiation function

function init(photo) {
photo_mc.loadPhoto(photo);
}

// call the initiation function
//change the image name accordingly

init("p1.swf");

Next, Prev Frame OnRollover Animation, I Know How To Do It With Buttons But...
Ok here is the thing, I have the following code on my buttons.

ActionScript Code:
onClipEvent (enterFrame) {    if (this.hitTest(_root._xmouse, _root._ymouse, true)) {        this.nextFrame();    } else {        this.prevFrame();    }}

This makes the button animation rewind or play depending on if the mouse is over the button. I want to have this on my buttons but I also want a different movie clip on a different layer to go to the next frame or previous frame depending on the rollover. Basically, I need to know how to add something in addition to:

ActionScript Code:
this.nextFrame();ANDthis.prevFrame();

with a different movieclip in replace of "this". The movieclip is located in my main movie (_root). But when I tried:

ActionScript Code:
_root.MyMovie.prevFrame();

it didn't work. ANy suggestions on how to make it work. THANKS VERY MUCH.

MIke

As3 Grid Image Gallery //prev & Next Buttons
I was hoping someone could point me in the direction of a good tutorial on how to create an as3 grid image gallery with prev and next buttons for the main image that shows.

Thanks

How Do I Add External Images Into An Array,to Cycle Through With Next/prev Buttons
how do i add external images into an array so that i can cycle through the array when the user clicks a next or prev button..

so far i made a button to add one external image to the stage...

buttonStart.onRelease = function() {
container.loadMovie("images/intro1.jpg", 1);
}

i need like 100 images that i want to add externally into an array so that i can click through each image with next and prev buttons.

Button Array & Prev/NextImage Buttons Interaction. How Can I Do This?
Hi
In my Photo gallery I have a buttons array that i like to interact with my Previous and Next button

Like it is now ( take a look att www.apneaimages.com ) when I push one of the buttons they turn BLUE and stay there (visited)
But I like that they turn blue when I use the prev and next Button

my Button array is:


Code:
myButtons = [btn1, btn2, btn3];
Then the Next Button script is:


Code:
function nextImage() {
clearInterval(myInterval);
if (cur == pArray.length-1) {
containerMC.loadPic(0);
} else {
containerMC.loadPic(cur+1);
}
}
There must be a way to arhive this if I use the cur & pArray but how can I do this?

XML And Flash Photogallery Using Thumbnail Pictures Instead Of Prev/next Buttons?
Hi, I would like to know if it is possible to have a selection of thumbnail pictures that I can click on and they would call in the picture, instead of pressing the previous/next buttons to move to the next picture, is there anyway that I could use thumbnails as the means of going through the selection of photos?

E.g., I would have about 4 thumbnails of the other pictures that are in my photogallery, and any of them could be clicked on and that would load in the correct picture, in exactly the same way as it would if I were using the previous and next buttons, but I can choose to view them in any order.

Any/all help is appreciated.

Making His SlideShow Gallery Have Pause, Prev, Next, Play Buttons - Without Skipping
Hi,

I went through a list of post discussing different modifications to the slideshow and photo gallery tutorials but i didn't read of anyone trying to combine slideshow and photo gallery functionality. The slideshow is driven by an onEnterFrame and loops through how ever many number of images (nodes in the xml) and then displays them automatically..but the photo gallery script advances (prev or next) based on onRelease events of the key press or click of the buttons.

However, I was trying to combine both and noticed immediately that while in the onEnterFrame ..if pressing the next button a couple of times...the count gets messed up and the slideshow advances really quickly for however many number of times you have clicked (prev or next)...if once..you may not notice...but if twice...(i.e. on 2 and clicking twice to 4..then it jumps to 6..then 8..etc..)..for larger sequences of clicks..you notice..4..8..12..16..

I was wondering what would be a good fix for this..
considering both prevImage() and nextImage() functions determine how p is controlled before calling the slideshow() function?

//nextImage function

Code:

function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
slideshow();
}
}
}
//Slideshow function

Code:
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}
}

Prev & Next Button Goes To Prev Or Next LABEL
I'm trying to make an interactive presentation reminiscent of powerpoint but I can't get the prev and next buttons to work. Here's what I have...

a MC with all the images (sudo slides). The timeline begins with a stop action on frame1. Each image has a 15-frame Alpha fade which has a frame label on the first frame and a stop action on the last frame (so frame label "img1" goes from frame2 to frame16 then stops, frame label "img2" goes from frame17 to frame 32 then stops, etc.)

Outside of that MC in the main timeline I have the buttons prevBtn and nextBtn. What I need to do is get those buttons to go to the next label.

I know I can do gotoAndPlay("img2"); but I want the button to go to the next frame label no matter what it's named.

I tried an array but I've never dealt with arrays before so I don't think I did it right. The code I have for the array is:

mylabels = new array("img1","img2","img3");
currentLabel = 0;

//Go to next label
gotoAndPlay(mylabels[(currentLabel + 1)]);

//Go to previous label
gotoAndPlay(mylabels[(currentLabel - 1)]);

I got this from someone else who was trying to help but I don't know where to put any of it or if it will even do what I need.

I've also tried to use the _currentFrame+15 or _currentFrame-15 but that doesn't work either. I only know a small amount of AS so I may have done that one wrong too....

Any help would be appreciated. (btw, i'm using AS2 and Flash CS3)

Adding Sound Buttons, Cutting Off Prev Sound
Hi - I want to add a few audio narration clips via buttons to this page, inside each section:

http://www.chartscans.com/csalerts.swf


When the movie starts, it autoplays a bg music + narration nonlooped single track.

How can I add say a button that loads/plays an external mp3 And also shuts off the first sound that had started?

any ideas?



thx flash dudes..

How Can I Make "Next" And "Prev" Buttons Work For Photo Site?
This seemed like such an easy thing to do but I can't figure it out. I have a series of photos I want to display. Each one fades in. How do I make a navigation system with only "NEXT" and "PREV" buttons?

here's a good example of what I'm looking for:
http://www.simonladefoged.com/ how did they do that?

thanks in advance.

How Do I Code "next" And "prev" Buttons?
This seemed like such an easy thing to do but I can't figure it out. I have a series of photos I want to display. Each one fades in. How do I make a navigation system with only "NEXT" and "PREV" buttons?

here's a good example of what I'm looking for:
http://www.simonladefoged.com/

thanks in advance.

Next/Prev Frame()
Okay, I have a movie named 'TESTMOVIE' when this code below is applied it works very nicely. When TESTMOVIE is rolled over it plays the movie until it hits the next keyframe or stop(). When rolled off it plays in reverse until the previous stop().

Code:
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.nextFrame();
} else {
this.prevFrame();
}
}

BUT, this code below on a button on goes to TESTMOVIE's next frame and stops, which I think is what the prevFrame() is supposed to do. So, how do I get this code below to run like the code above, playing the movie until it hits a stop, not just stopping on the next frame??

Thanks!

Code:
on (rollOver) {
_root.TESTMOVIE.nextFrame();

}
on (rollOut) {
_root.TESTMOVIE.prevFrame();

}

XML Prev Or Next 10 Items
Hey,

I created a guestbook with an external xml file.
You can enter items into the xml file.

But the problem now is that al the entries are showed.
Now I want to have that I can browse between the files.

That I can see the next or previous 10 entries.

This is the code I used.


Code:
menuXml = new XML();
menuXml.ignoreWhite = true;
menuXml.onLoad = function(success) {
if (success) {
menuItem = this.firstChild.childNodes;
for (var i = 0; i<menuItem.length; i++) {
item = content_mc.attachMovie("itemClip", "itemClip"+i, i);
item._x = 0;
item._y = 101*i;
item.useHandCursor = true;
// Info in sublist
item.myBericht.text = menuItem[i].attributes.bericht;
item.myEmail.text = menuItem[i].attributes.email;
item.myGender.text = menuItem[i].attributes.geslacht + " :: mail";
item.myData.text = menuItem[i].attributes.datum + " :: " + menuItem[i].attributes.naam + " ( " + menuItem[i].attributes.plaats + " ) " + "wrote:";

}
}
};
menuXml.load("gastenboek.xml");
Who can help me with this?
I dont think it's hard to find but I just cant manage it.

Thx in advance

XML: Prev Or Next 10 Items
Hey,

I created a guestbook with an external xml file.
You can enter items into the xml file.

But the problem now is that al the entries are showed.
Now I want to have that I can browse between the files.

That I can see the next or previous 10 entries.

This is the code I used.


Code:
menuXml = new XML();
menuXml.ignoreWhite = true;
menuXml.onLoad = function(success) {
if (success) {
menuItem = this.firstChild.childNodes;
for (var i = 0; i<menuItem.length; i++) {
item = content_mc.attachMovie("itemClip", "itemClip"+i, i);
item._x = 0;
item._y = 101*i;
item.useHandCursor = true;
// Info in sublist
item.myBericht.text = menuItem[i].attributes.bericht;
item.myEmail.text = menuItem[i].attributes.email;
item.myGender.text = menuItem[i].attributes.geslacht + " :: mail";
item.myData.text = menuItem[i].attributes.datum + " :: " + menuItem[i].attributes.naam + " ( " + menuItem[i].attributes.plaats + " ) " + "wrote:";

}
}
};
menuXml.load("gastenboek.xml");
Who can help me with this?
I dont think it's hard to find but I just cant manage it.

Thx in advance

[Help] NEXT & PREV Button [Please]
Dear fellaz... i had something trouble in my prev & next btns.
shortly desc is... i wanna display the messages 1 page 1 messages. but how... oh.. once again.. the system is php + sql + flash....

allright tis the code.

for the next buttons :


Code:
on (release) {
if(current.text == total.text) { return; }
loadMyData(Number(current.text));
}
for the prev buttons :


Code:
on (release) {

loadMyData(Number(current.text))-1;
}
and here's the frame script...


Code:
// di frame 1
loadMyData = function(n){
datanya = new LoadVars();
datanya.startid = n;
datanya.onLoad = function(){
panggil();
};
datanya.sendAndLoad("gbdata.php",datanya,"POST");
}
panggil = function(){
name.text = datanya.name;
email.text = datanya.email;
url.text = datanya.url;
msg.text = datanya.msg;
total.text = datanya.total;
current.text = datanya.current;
};
// load data pertama
loadMyData(0);

and here's the php script...


Code:
<?
include("dbconnect.php");

$qry = mysql_query("SELECT id FROM book");
$totalRec = mysql_num_rows($qry);

$getnews = mysql_query("SELECT * FROM book ORDER BY id LIMIT $_POST[startid], 1");
while($r=mysql_fetch_array($getnews)){
extract($r);
print("&name=$name");
print("&email=$email");
print("&url=$url");
print("&msg=$msg");
print("&total=$totalRec");
print("&current=$id");
}

?>
The case is.. i cant back to the previous messages.
thanks for your attentions and sorry for my english

Next And Prev Function
hi everyone!

i'm trying to build next/prev buttons to add to an existing slider bar. The slider bar scrolls as the mouse moves over it, and stops when the mouse is in center 'x'. I've used the LoadMovie to dynamically load each photo when clicked. Here is the Movie as it stands right now-->

http://www.mastelectric.com/projects.html

The client really likes the setup, but wants to have next/prev buttons for the user to be able to manually 'slideshow' their way through, in addition to the current functionality. The photos still need to load dynamcially to keep oversize to a minimum.

Can someone help me flush out this code? I imagine it will go something like this:

for x = 1 to 46
next_btn.onRelease = function {

case: (target_mc has NO pic loaded)
then load p1.jpg

case: (target_mc is occupied)
then get (current picNum ((i.e.p34.jpg)) and load picNum +1

if picNum = 47
then next_btn.visible = false

};

XML: Prev Or Next 10 Items
Hey,

I created a guestbook with an external xml file.
You can enter items into the xml file.

But the problem now is that al the entries are showed.
Now I want to have that I can browse between the files.

That I can see the next or previous 10 entries.

This is the code I used.


Code:
menuXml = new XML();
menuXml.ignoreWhite = true;
menuXml.onLoad = function(success) {
if (success) {
menuItem = this.firstChild.childNodes;
for (var i = 0; i<menuItem.length; i++) {
item = content_mc.attachMovie("itemClip", "itemClip"+i, i);
item._x = 0;
item._y = 101*i;
item.useHandCursor = true;
// Info in sublist
item.myBericht.text = menuItem[i].attributes.bericht;
item.myEmail.text = menuItem[i].attributes.email;
item.myGender.text = menuItem[i].attributes.geslacht + " :: mail";
item.myData.text = menuItem[i].attributes.datum + " :: " + menuItem[i].attributes.naam + " ( " + menuItem[i].attributes.plaats + " ) " + "wrote:";

}
}
};
menuXml.load("gastenboek.xml");
Who can help me with this?
I dont think it's hard to find but I just cant manage it.

Thx in advance

Next And Prev Frame
Hi everyone,

I have a few buttons (all movieclips) that i want to resize whenever somebody hovers on them. The button should go back to it's original size on mouse-out. So i created a movieclip for all of them. The movie is nothing but 10 frames from size a to size b.

Now everytime somebody hovers a button i'd like the movieclip to play forward untill the mouse-out. If the mouse is out i want to play the movie backwards from that point.

Something like this but then more advanced so the movie actually plays forward and backward.


Code:
on (press, release, rollOver, dragOver) {
nextFrame();
}
on (releaseOutside, rollOut) {
prevFrame();
}
Anyone has a suggestion or a turorial?

Prev/next Btn With Gallery
I have to say that Dustman has been amazing in explaining my other screwups. So far I've managed to get my XML gallery thing going with descriptions and thumbnails. The last nasty part is setting up the previous/next buttons to cycle through images.

Here's the current code. Everything else works but the buttons - I guess the questions are:
a - is syntax correct (the relevant code is under the desc_text.text call
b- have I put this in the wrong area
c- anything else you can suggest

CODE#include "DrawBox.as"
#include "lmc_tween_as1.as"

function  loadXML(loaded)  {
    _global.Images = new Array();
    var xmlNode = this.firstChild;
    var total = xmlNode.childNodes.length;
    for (var i=0; i<total; i++) {
        var myImage = new Object();
        myImage.filename = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
        myImage.description = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
        myImage.thumbnail = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
//            trace("myImage.filename= " + myImage.filename);
//            trace("myImage.description= " + myImage.description);
//            trace("myImage.thumbnail= " + myImage.thumbnail);
        _global.Images.push(myImage);
    }
      setupGallery();
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("imagesBW.xml");


function setupGallery()
{
      currentHolder = 0;
      theDepth = 1000;
      gap = 10;
      
      _global.imageLoaded = false;
      _global.imageFaded = false;
      _global.selectedImage = 0;
      
      this.createEmptyMovieClip("thumb_mc", theDepth++ + 10000);
      this.createEmptyMovieClip("img0_mc", theDepth++ + 10000);
      this.createEmptyMovieClip("img1_mc", theDepth++ + 10000);
      
      this.attachMovie("FScrollPaneSymbol", "thumb_sp", 1000, {_x:35, _y:this.border_mc._y});
      this.thumb_sp.setSize(100 * 2 + gap * 2 + 16 - 5, 308);
      this.thumb_sp.boundingBox_mc._alpha = 0;
      
      this.thumb_sp.setStyleProperty("arrow", 0xffffff);
      this.thumb_sp.setStyleProperty("scrollTrack", 0x000000);
      this.thumb_sp.setStyleProperty("face", 0x000000);
      
      for (var i = 0; i < _global.Images.length; i++)
      {
            this.thumb_mc.createEmptyMovieClip("thumb" + i + "_mc", theDepth++);
            this.thumb_mc.createEmptyMovieClip("thumb" + i + "_tmp_mc", theDepth++);
            this.thumb_mc["thumb" + i + "_mc"]._x = ((i % 2) * (100 + gap));
            this.thumb_mc["thumb" + i + "_mc"]._y = Math.floor(i / 2) * (100 + gap);
            this.thumb_mc["thumb" + i + "_mc"].loadMovie(_global.Images[i].thumbnail);
                  
            this.thumb_mc["thumb" + i + "_tmp_mc"].no = i;
            this.thumb_mc["thumb" + i + "_tmp_mc"].onEnterFrame = function()
            {
                  var _mc = this._parent["thumb" + this.no + "_mc"];
                  var l = _mc.getBytesLoaded();
                  var t = _mc.getBytesTotal();
                  
                  if ((l >= t) && (t > 20) && (_mc._width > 1))
                  {
                        _mc.num = this.no;
                        _mc._alpha = 50;
                        _mc.onPress = function()
                        {
                              if ((_global.selectedImage != this.num) && (_global.imageLoaded) && (_global.imageFaded))
                              {
                                    loadImage(this.num);
                              }
                        }
                        _mc.onRollOver = function()
                        {
                              this.alphaTo(100, 0.5, "easeOutQuad");
                        }
                        _mc.onRollOut = function()
                        {
                              this.alphaTo(50, 0.25, "easeOutQuad");
                              this.line_mc.removeMovieClip();
                        }
                        this._parent._parent.thumb_sp.setScrollContent(this._parent);
                        this._parent._parent.thumb_sp.refreshPane();
                        
                        delete this.onEnterFrame;
                        this.removeMovieClip();
                  }
            }
      }

      loadImage(_global.selectedImage);
}

function loadImage(num)
{
      _global.imageLoaded = false;
      _global.imageFaded = false;
      
      this.createEmptyMovieClip("img0_tmp_mc", theDepth++);
      this.createEmptyMovieClip("img1_tmp_mc", theDepth++);
      
      this["img" + currentHolder + "_mc"].removeMovieClip();
      this.createEmptyMovieClip(["img" + currentHolder + "_mc"], theDepth++ + 10000);
      this["img" + currentHolder + "_mc"]._x = 245;
      this["img" + currentHolder + "_mc"]._y = 10;
      this["img" + currentHolder + "_mc"].loadMovie(_global.Images[num].filename);
      this["img" + currentHolder + "_tmp_mc"].onEnterFrame = function()
      {
            var _mc = this._parent["img" + currentHolder + "_mc"];
            var l = _mc.getBytesLoaded();
            var t = _mc.getBytesTotal();
            
            if ((l >= t) && (t > 20) && (_mc._width > 1))
            {
                  var _w = _mc._width;
                  var _h = _mc._height;
                  
                  var _b_mc = this._parent.border_mc;
                  var maxW = _b_mc._width;
                  var maxH = _b_mc._height;
                  
                  var scaleX = scaleY = scaleFactor = 100;
                  
                  if (_w > maxW)
                  {
                        scaleX = maxW / _w * 100;
                  }
                  if (_h > maxH)
                  {
                        scaleY = maxH / _h * 100;
                  }
                  scaleFactor = Math.min(scaleX, scaleY);
                  
                  _mc._alpha = 1;
                  _mc._xscale = _mc._yscale = scaleFactor;
                  _mc._x = _b_mc._x + Math.floor((maxW - _mc._width) / 2);
                  _mc._y = _b_mc._y + Math.floor((maxH - _mc._height) / 2);
                  
                  desc_txt.text = _global.Images[num].description;
                  
                  previous_btn.onRelease = function() {
                  if (_global.Images[num]>0) {
                          _global.Images[num]--;
                        picture.loadMovie(_global.Images[num], 1);
                          desc_txt.text = _global.Images[num].description;
                              }
                        }
                        
                          next_btn.onRelease = function() {
                  if (_global.Images[num]<0) {
                          _global.Images[num]++;
                        picture.loadMovie(_global.Images[num], 1);
                          desc_txt.text = _global.Images[num].description;
                              }
                        }
                  
                  
                  _global.imageLoaded = true;
                  _global.selectedImage = num;
                  delete this.onEnterFrame;
                  this.removeMovieClip();
            }
      }
      this["img" + ((currentHolder + 1) % 2) + "_tmp_mc"].onEnterFrame = function()
      {
            if (_global.imageLoaded)
            {
                  var _mc1 = this._parent["img" + currentHolder + "_mc"];
                  var _mc2 = this._parent["img" + ((currentHolder + 1) % 2) + "_mc"];
                  
                  if (_mc1._alpha < 100)
                  {
                        _mc1._alpha += 5;
                        _mc2._alpha -= 10;
                  }
                  else
                  {
                        _mc1._alpha = 100;
                        _mc2._alpha = 0;
                        currentHolder = (currentHolder + 1) % 2;
                        _global.imageFaded = true;
                        
                        delete this.onEnterFrame;
                        this.removeMovieClip();
                  }
            }
      }
}

Prev Button
ok, now i am closer, but you see were the prev.onrelease statement is, it allows the song to play from the beginning and not go to the previous and thats with this._parent.prevSong; and not this._parent.prevSong(); as this would give me a url undefined error. Anybody knows why?

Code:

//Setup sound object
var s:Sound = new Sound();
s.onSoundComplete = playSong;
s.setVolume(100);
var theNumber:Number = 0;
var isPlaying:Boolean = false;
//Array of songs
var sa:Array = new Array();
var display:Array=new Array();

//Currently playing song
var cps:Number=-1;

//position of music
var pos:Number;

//Load the Songs XML
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
   var nodes:Array = this.firstChild.childNodes;
   for(var i=0;i<nodes.length;i++)
   {
      sa.push(nodes[i].attributes.url);
      display.push(nodes[i].attributes.display);
   }
   playSong();
}

xml.load("songs.xml");

//play mp3 file
function playSong():Void
{
   s= new Sound();
   s.setVolume(20);
   s.onSoundComplete = playSong;
   preloadloadBar._xscale = 1;
   if(cps==sa.length-1)
   {
      cps=0;
      s.loadSound(sa[cps],true);
   }
   else
   {
      s.loadSound(sa[++cps],true);
   }
   pause.gotoAndStop("pause");
}
   
//pauses the music
function pauseIt():Void
{
   pos=s.position;
   s.stop();
}

function unPauseIt():Void
{
   s.start(pos/1000);
}

//Music Controls
//play pause toggle
pause.onRollOver = function()
{
   if(this._currentframe==1)this.gotoAndStop("pauseover");
   else this.gotoAndStop("playover");
}

pause.onRollOut = pause.onReleaseOutside = function()
{
   if(this._currentframe==10)this.gotoAndStop("pause");
   else this.gotoAndStop("play");
}

pause.onRelease = function()
{
   if(this._currentframe==10)
   {
      this.gotoAndStop("playover");
      this._parent.pauseIt();
   }
   else
   {
      this.gotoAndStop("pauseover");
      this._parent.unPauseIt();
   }
}



//next button
next.onRollOver = function()
{
   this.gotoAndStop("nextover");
}

next.onRollOut = next.onReleaseOutside=function()
{
   this.gotoAndStop("next");
}

next.onRelease = function()
{
   this._parent.playSong();
}


//Display Time.
function setTime() {
var totalSeconds:Number = s.duration/1000;
var s_seconds:Number = s.position/1000;

var minutes:Number = Math.floor(totalSeconds/60);
var seconds = Math.floor(totalSeconds)%60;
var e_minutes:Number = Math.floor(s_seconds/60);
var e_seconds = Math.floor(s_seconds%60);

//format time
if (seconds<10) {
seconds = "0"+seconds;
}
if (e_seconds<10) {
e_seconds = "0"+e_seconds;
}

timeDisplay.tt.text = minutes+":"+seconds;
timeDisplay.et.text = e_minutes+":"+e_seconds;
}
var timeRoutine = setInterval(setTime, 100);


   



//next
next.onRelease = function() {
s.stop();
s = new Sound();
this._parent.playSong();
setInterval(setTime, 100);
};

function playSong():Void {
s=new Sound();
s.onSoundComplete=playSong;

if (cps == sa.length-1) {
cps = 0;
s.loadSound(sa[cps], true);
displayTags();
} else {
s.loadSound(sa[++cps], true);
displayTags();
}
}

//display ID3 tags
function displayTags() {
s.onID3 = function() {
display_Artist.text = " "+s.id3.artist+"
";
display_Song.text = (cps+1)+". "+s.id3.songname+"
";
};
}

   // initial x position fo the dragger
dragger._x = line_mc._x+line_mc._width-2;

// volume slider release function
dragger.onRelease = dragger.onReleaseOutside =  function() {
   this.stopDrag();
   delete dragger.onEnterFrame;
}

// volume slider on press and drag function
dragger.onPress = function() {
   this.startDrag(false, line_mc._x, this._y, line_mc._width+line_mc._x-2, this._y);
   dragger.onEnterFrame = function() {
      var Volume:Number= dragger._x-line_mc._x;
      s.setVolume(Volume);
   }
}

   //-----------------------------------------------------------------------Preloadbar
preloadBar.onEnterFrame = function() {
   var t:Number = Math.round(theTime/1000);
   this._xscale = (s.getBytesLoaded()/s.getBytesTotal())*100;
   sTotal.text =s.duration/1000;
};
//----------------------------------------------------------- ---------Progress bar
function soundProgress() {
   progressBar._xscale = (s.position/s.duration)*100;
   sProgress.text = ((_root._xmouse - preloadBar._x)/preloadBar._width)*10;
};

function prevSong():Void {
   s = new Sound();
   s.onSoundComplete = playSong;
   if (cps == 0) {
      cps = songArray.length - 1;
      s.loadSound(songArray[cps].earl, true);
   } else {
      s.loadSound(songArray[--cps].earl, true);
   }
   trackInfo.text = songArray[cps].artist + " - " + songArray[cps].track;
   playPause.gotoAndStop("pause");
}

//prev button
prev.onRollOver = function()
{
   this.gotoAndStop("prevOver");
}

prev.onRollOut = prev.onReleaseOutside=function()
{
   this.gotoAndStop("prev");
};

prev.onRelease = function() {
                this._parent.prevSong;
      this._parent.unPauseIt();
     
      playpause.gotoAndStop("pause");
   
};


formatTime = function (millisecs){
   var secs = Math.floor(millisecs/1000);
   var mins = Math.floor(secs/60);
   secs %= 60;
   if (secs < 10) secs = "0"+ secs;
   if (mins < 10) mins = "0"+ mins;
   return mins +":"+ secs;   
}







function playSonglist():Void {
s=new Sound();
s.onSoundComplete=playSong;

if (cps == sa.length-1) {
cps = 0;
s.loadSound(sa[cps], true);
displayTags();
} else {
s.loadSound(sa[++cps], true);
displayTags();
}
}

var alist:XML = new XML();
alist.ignoreWhite = true;

alist.onLoad = function(){
   var songs:Array = this.firstChild.childNodes;
   for(i=0;i<songs.length;i++){
      audiolist.addItem(songs[i].attributes.display,songs[i].attributes.url);
   }
   
   playSonglist.play(audiolist.getItemAt(0).data);
   audiolist.selectedIndex = 0;
}

var aulist:Object = new Object();

aulist.change = function(){
   playSonglist(audiolist.getItemAt(audiolist.selectedIndex).data);
}

audiolist.addEventListener("change",aulist);

alist.load("songs.xml");

Prev Frame Memorization
hi
this is sort of complicated to.......explain but i'll do my best
i have a movie where there are 5 buttons, 2 different animations, and 5 different text
the animation names are.......lets say:
mc1
mc2
each animation is grouped with one button and one text
but there are only 2 animations so they are grouped as followed:
button 1 with mc1 with text 1
button 2 with mc2 with text 2
button 3 with mc1 with text 3
button 4 with mc2 with text 4
button 5 with mc1 with text 5
the frames of the animations are played BEFORE the text comes up
so for example, after button 1 is release, it plays the mc1 animation, THEN, after the animation, text 1 pops up
ok now here's my problem
since mc1 is repeated for button 1, 3, 5
if the user presses button 1, it plays animation and text pops up. After that, if they press button 3, there won't an animation, because it was played when button 1 was press. Thus, text 3 shows up without the mc1 animation
so basically what this means is that for button 3,
onRelease, if prev button pressed was 1 or 5, don't play animation and show text
else if prev button pressed was 2 or 4, play animation THEN show text
i know i did a bad job explaining this but......just hope someone understands
THANKS!!!!!!!!

Publish Prev. ? And HitTest
Code:
onClipEvent (enterFrame) {
var score=0;
//you could have used 32 instead of key.SPACE
if (Key.isDown(Key.SPACE)) {
_root.fire.gotoAndPlay(2);
}
if (_root.fire.hitTest(_root.box1)) {
_root.fire._alpha=0;
_root.box1.gotoAndStop(2);
}
if (_root.fire.hitTest(_root.box1)) {
_root.score=++score;
}
}
That code works for a hitTest, but once the "fire" mc hits "box1" it will not allow me to push the spacebar again. How do I tell it to allow the user to push the bar multiple times after it has hit "box1". I want to be able to push the bar more than once.

Also, how do I change the HTML publish settings to be IE instead of Netscape?

PREV And NEXT Button Dilemna
hi guys,

this is killing me. i had it working up until a few days ago when the client had me make some dramatic changes to a few things...now the AS is BS...


Code:
// Determines whether Prev/Next (images) should be visible;

if (imagethumb<=3){
_root.prevthumbimage._visible=0;
} else {
_root.prevthumbimage._visible=1;
}

if (imagethumb < /:numthumbs){
_root.nextthumbimage._visible=1;
} else {
_root.nextthumbimage._visible=0;
}

if (imagethumb == /:numthumbs){
_root.nextthumbimage._visible=0;
}



imagethumb is a number, initially 1, a loop loads some thumbnails, and each time it loads one imagethumb increases by 1.

the prev and next button ++ or -- imagethumb...

/:numthumbs is the number of thumbs, an asp script works this value out...

three thumbnails are displayed per "page".

this is the code for loading the thumbnails:

Code:
// Loads thumbnails (images). imagethumb is previously defined as 1
for (i=1; i<4; i++){
image=eval("/:thumbimg" add imagethumb);
currentimage="../actors/" add name add "/" add image;
this["imagethumb"+i].loadMovie(currentimage);
this["imagethumb"+i]._xscale=27;
this["imagethumb"+i]._yscale=27;
imagethumb++;
}



thanks in advance guys!
Ben

Prev And Next Frame (flash 5)
i have tried continuously to get this to work, but it just isnt. i want to make this so you can go more than 1 previous frame or more than one next frame, ive tried doing a nextFrame (9) (for example), but it jsut isnt working, thanks much.

[F8] Next/prev Button Touble
My teacher wants us to create a flash gallery with buttons that load the next/previous image. I got the "next" button working, but the "prev" button also loads the next image. Even after two semesters of learning this I still can't get the basics.

Anyway here is the code for both the "next" and "prev" buttons, to make the loadPrevImage function I just copied the loadNextImage function and changed the numbers. I think I missed something when altering the code.

Please note that I did not write this myself, I just used the code the teacher showed us.

code:

function loadNextImage() {
var clip:MovieClip;
// swap
if(currMC == 1) {
this.mc1.removeMovieClip();
this.mc1 = this.theRoot.createEmptyMovieClip("mc1_mc", 1);
clip = this.mc1;
currMC = 2;
} else {
this.mc2.removeMovieClip();
this.mc2 = this.theRoot.createEmptyMovieClip("mc2_mc", 2);
clip = this.mc2;
currMC = 1;
}

this.loader.loadClip(this.folder + this.imageArray[this.currImg], clip);

// rotate image in array
this.currImg++;
if (this.currImg == this.imageArray.length) {
this.currImg = 0;
}
}

function loadPrevImage() {
var clip:MovieClip;
// swap
if(currMC == 2) {
this.mc2.removeMovieClip();
this.mc2 = this.theRoot.createEmptyMovieClip("mc2_mc", 2);
clip = this.mc2;
currMC = 1;
} else {
this.mc1.removeMovieClip();
this.mc1 = this.theRoot.createEmptyMovieClip("mc1_mc", 1);
clip = this.mc1;
currMC = 2;
}

this.loader.loadClip(this.folder + this.imageArray[this.currImg], clip);

// rotate image in array
this.currImg--;
if (this.currImg == this.imageArray.length) {
this.currImg = 0;
}
}



Thank you for your time, and please hurry this is due soon.

Copyright © 2005-08 www.BigResource.com, All rights reserved