need help to load image(no xml) using buttons

  • anujbux
  • Newbie
  • Newbie
  • anujbux
  • Posts: 8

Post 3+ Months Ago

I'm trying to make a gallery where I can load external Images in to the main movie using two buttons.

one is for next, and another for previous..
I'm using this code for the buttons
Code: [ Select ]
 
n = 1;
p = 1;
 
load_btn.onRelease = function() {                                   //next button
    holder_mc.loadMovie("images/pic"+n+".jpg");
    n++;
    if (n>=6) {
        n = 1;
    }
};
 
load_btn2.onRelease = function() {                                 //previous button
    holder_mc.loadMovie("images/pic"+p+".jpg");
    p = p-1;
    if (p<=0) {
        p = 5;
    }
};
  1.  
  2. n = 1;
  3. p = 1;
  4.  
  5. load_btn.onRelease = function() {                                   //next button
  6.     holder_mc.loadMovie("images/pic"+n+".jpg");
  7.     n++;
  8.     if (n>=6) {
  9.         n = 1;
  10.     }
  11. };
  12.  
  13. load_btn2.onRelease = function() {                                 //previous button
  14.     holder_mc.loadMovie("images/pic"+p+".jpg");
  15.     p = p-1;
  16.     if (p<=0) {
  17.         p = 5;
  18.     }
  19. };

My all images are named like "pic1.jpg, pic2.jpg, pic.jpg" and so on

now what I want is - to link this two buttons so that when I click on the next button and reach to a picture(say pic8.jpg), and then when I click on the previous button there I want to see the pic7.jpg to load. and the same for the reverse motion also

hope I explained that :| , my english is not good so please do a bit extra effort to understand the problem.

Thank you all in advance...
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

It actually looks to me like it should work. The only issue I see is that you are asking Flash to find holder_mc INSIDE of load_btn and load_btn2. When you give Flash a clip name its assuming
Code: [ Select ]
myMC.action
// is the same as
this.myMC.action
  1. myMC.action
  2. // is the same as
  3. this.myMC.action
I don't know how your movie is setup but assuming that your buttons and holder_mc are on the same timeline you would need
Code: [ Select ]
this._parent.holder_mc.loadMovie("images/pic"+p+".jpg");
in both buttons onRelease code. (I added the red text)

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 11 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.