Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,641 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,093 people online right now. Registration is fast and FREE... Join Now!




flash thumb image slider

 
Reply to this topicStart new topic

flash thumb image slider

shweta.honey25
post 17 Sep, 2008 - 11:14 PM
Post #1


New D.I.C Head

*
Joined: 15 Sep, 2008
Posts: 15

i design or coding a image slider plz help that how to move thumbs images by next button or prev button anyone know that...............
User is offlineProfile CardPM

Go to the top of the page

pemcconnell
post 18 Sep, 2008 - 03:16 AM
Post #2


D.I.C Regular

Group Icon
Joined: 5 Aug, 2008
Posts: 394



Thanked 35 times

Dream Kudos: 75
My Contributions


you can place them all in their own frame within a movieclip, which has a stop(); on frame 1. Then on the parent movieclip, you can use nextFrame or prevFrame
User is offlineProfile CardPM

Go to the top of the page

shweta.honey25
post 18 Sep, 2008 - 04:10 AM
Post #3


New D.I.C Head

*
Joined: 15 Sep, 2008
Posts: 15

QUOTE(pemcconnell @ 18 Sep, 2008 - 04:16 AM) *

you can place them all in their own frame within a movieclip, which has a stop(); on frame 1. Then on the parent movieclip, you can use nextFrame or prevFrame



but my image slider is totally dynamic there is no movieclip in its library:
ok i paste the code of my flash : plz help me


var myGalleryXML = new XML();
myGalleryXML.ignoreWhite = true;
myGalleryXML.load("slideshow.xml");
myGalleryXML.onLoad = function() {

_root.gallery_x = myGalleryXML.firstChild.attributes.gallery_x;
_root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;
_root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;
_root.Image_width = myGalleryXML.firstChild.attributes.Image_width;

_root.myImages = myGalleryXML.firstChild.childNodes;
_root.myImagesTotal = myImages.length;

_root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;
_root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;

_root.full_x = myGalleryXML.firstChild.attributes.full_x;
_root.full_y = myGalleryXML.firstChild.attributes.full_y;
createContainer();
createMask();
callThumbs();
scrolling();
};


function callThumbs() {
_root.createEmptyMovieClip("container_mc",_root.getNextHighestDepth());
container_mc._x = _root.gallery_x;
container_mc._y = _root.gallery_y;

var clipLoader = new MovieClipLoader();
var preloader = new Object();
clipLoader.addListener(preloader);

for (i=0; i<myImagesTotal; i++) {
thumbURL = myImages[i].attributes.thumb_url;

myThumb_mc = container_mc.createEmptyMovieClip(i, container_mc.getNextHighestDepth() );
myThumb_mc._x = (_root.Image_width)*i;
myThumb_mc._alpha = 70;
trace("Shweta");
clipLoader.loadClip("thumbs/"+thumbURL,myThumb_mc);

preloader.onLoadStart = function(target) {
target.createTextField("my_txt",target.getNextHighestDepth,0,0,100,20);
target.my_txt.selectable = false;
};

preloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
};

preloader.onLoadComplete=function(target){
new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
target.my_txt.removeTextField();

target.onRelease=function(){
callFullImage(this._name);
}

target.onRollOver=function(){
this._alpha=100;
};

target.onRollOut=function(){
this._alpha=70;
};
}
}
}

/***********************************thumbs end*****************/

function callFullImage(myNumber) {

myURL = myImages[myNumber].attributes.full_url;
myTitle = myImages[myNumber].attributes.title;

_root.createEmptyMovieClip("fullImage_mc",_root.getNextHighestDepth());
fullImage_mc._x = _root.full_x;
fullImage_mc._y = _root.full_y;

var fullClipLoader = new MovieClipLoader();
var fullPreloader = new Object();
fullClipLoader.addListener(fullPreloader);

fullPreloader.onLoadStart = function(target) {
target.createTextField("my_txt",fullImage_mc.getNextHighestDepth,0,0,200,20);
target.my_txt.selectable = false;
};

fullPreloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
};

fullPreloader.onLoadComplete = function(target) {
new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
target.my_txt.text = myTitle;
};
fullClipLoader.loadClip("Images/"+myURL,fullImage_mc);

}
/***********************full Images end*******************************/

function createMask() {

_root.createEmptyMovieClip("mask_mc",_root.getNextHighestDepth());

mask_mc._x = _root.gallery_x;
mask_mc._y = _root.gallery_y;

mask_mc.beginFill(0x000000,100);
mask_mc.lineTo(_root.gallery_width,0);
mask_mc.lineTo(_root.gallery_width,_root.gallery_height);
mask_mc.lineTo(0,_root.gallery_height);
mask_mc.lineTo(0,0);

container_mc.setMask(_root.mask_mc);

}
/*******************************mask end*****************************************/
function scrolling() {

_root.onEnterFrame = function() {
if (mask_mc._xmouse<(mask_mc._width/2) || mask_mc._xmouse>(mask_mc._width)) {
container_mc._x += Math.cos(((mask_mc._xmouse)/mask_mc._width)*Math.PI)*100;
if (container_mc._x>mask_mc._x) {
container_mc._x = mask_mc._x;
}
if (container_mc._x<(mask_mc._x-(container_mc._width-mask_mc._width))) {
container_mc._x = mask_mc._x-(container_mc._width-mask_mc._width);
}
}
};
}

import mx.transitions.Tween;
import mx.transitions.easing.*;



User is offlineProfile CardPM

Go to the top of the page

BetaWar
post 18 Sep, 2008 - 04:52 AM
Post #4


#include <soul.h>

Group Icon
Joined: 7 Sep, 2006
Posts: 1,987



Thanked 78 times

Dream Kudos: 1175
My Contributions


Please remember to post your code in the [code] Paster Code Here [/code] tags, that makes it a lot easier to read.

Well, you have a single movieclip at least (granted you are creating it dynamically). I would suggest creating a single "thumb_holder" movie clip and attach all the thumbs to a movieclip that you add the the thumb_holder mc (so each thumb has its own movieclip) and have all the thumb mcs equally spaced so you just move the thumb_holder mc to move all the thumbs.

Hope that makes sense.
User is offlineProfile CardPM

Go to the top of the page

shweta.honey25
post 18 Sep, 2008 - 05:36 AM
Post #5


New D.I.C Head

*
Joined: 15 Sep, 2008
Posts: 15


thanx but i can't understand whta u r saying ...........................i will try..........
User is offlineProfile CardPM

Go to the top of the page

BetaWar
post 18 Sep, 2008 - 04:27 PM
Post #6


#include <soul.h>

Group Icon
Joined: 7 Sep, 2006
Posts: 1,987



Thanked 78 times

Dream Kudos: 1175
My Contributions


Okay, so, you have this line of code:
CODE
_root.createEmptyMovieClip("mask_mc",_root.getNextHighestDepth());


Which creates a new (and blank) movieclip.

What I am saying is create another movieclip that you call holder:
CODE
var holder:MovieClip = _root.createEmptyMovieClip("holder_mc",_root.getNextHighestDepth());


Then, for each image you are attaching create a new movieclip inside of holder:
CODE
var newMc:MovieClip = holder.createEmptyMovieClip("thumb_"+holder.getNextHighestDepth(), _root.getNextHighestDepth());

And attach the thumb nail to the movie clip.

Then set mask_mc to work with holder. Now, when you need to move which thumbnails are being viewed you simply change the x/y coordinates of holder and the whole thing will be updated. This takes out a lot of looping that you would have to do otherwise and also makes it easy to add a portion that allows you to show a larger image.

Hope that makes more sense.
User is offlineProfile CardPM

Go to the top of the page

shweta.honey25
post 18 Sep, 2008 - 08:43 PM
Post #7


New D.I.C Head

*
Joined: 15 Sep, 2008
Posts: 15

thanx its more helpfull
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 04:36AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month