Solved

Scrolling question

Posted on 2007-04-02
6
215 Views
Last Modified: 2010-04-03
Hi, Experts
I have a script that import images from external folder. The script also create a menu on top of each image. I would like to be able to move these images and menus up and down by using scrolling function. However, it can only scroll the last image only. I think it is kind hard to explain, does anyone have idea how to make all images to scroll ? Thanks

var _loc1 = this;
//
function loadMe() {
      myX = 62;
      myY = 125;
      gap = 105;
      gap2 = 0.66;
      max = 4;
      counter = 0;
      for (n=1; n<howMany; n++) {
            mc = _loc1.createEmptyMovieClip("myTarget"+n, 20+n);
            trace("Project list n = "+n);
            picture = "netblue/"+projects[n]+".jpg";
            mc.loadMovie(picture);
            if (counter>max) {
                  counter = 0;
                  myY = myY+gap;
            }
            // end if                                                      
            mc._x = myX+gap*counter;
            mc._y = myY*gap2;
            trace("counter:"+counter);
            ++counter;
      }
      // end of for
      if (howMany>20) {
            trace("Too many!!");
            //for (i=20; i>20; i++) {
            trace("Trace n = "+n);
            //}
      }
}
// End of the function
function buildMenu() {
      myX = 62;
      myY = 125;
      gap = 105;
      gap2 = 0.66;
      max = 4;
      counter = 0;
      for (i=1; i<howMany; i++) {
            mc = _loc1.attachMovie("button", "button"+i, 50+i);
            trace("Menu list --   "+i);
            mc.i = i;
            _loc1.myName = i;
            _loc1.myName = _loc1.projects[i];
            mc.person.text = _loc1.myName;
            trace("myName --   "+myName);
            _loc1.n = i;
            if (counter>max) {
                  counter = 0;
                  myY = myY+gap;
            }
            // end if                                                      
            mc._x = myX+gap*counter;
            mc._y = myY*gap2;
            trace("counter:"+counter);
            ++counter;
      }
      // end of for
}

_loc1.upStatus = 0;
//
var myListener = new Object();
myListener.onLoadInit = function(target_mc) {
      this.imageborder = 9;
      target_mc._x = -(target_mc._width/2);
      target_mc._y = -(target_mc._height/2);
      trace("Picture width  "+target_mc._width);
      //Load white BG
      _loc1.attachMovie("whiteOutBG", "whiteOutBG", 9998);
      _loc1.whiteOutBG._width = target_mc._width+2*this.imageborder;
      _loc1.whiteOutBG._height = target_mc._height+2*this.imageborder;
      _loc1.whiteOutBG._x = 322;
      _loc1.whiteOutBG._y = 222;
};
var mcLoader = new MovieClipLoader();
mcLoader.addListener(myListener);
//Scroller part --- need fix
increment = 20;
downLimit = -112;
upLimit = 0;
down.onPress = function() {
      if (picture._y>downLimit) {
            mc._y = mc._y-increment;
      }
};
up.onPress = function() {
      if (mc._y<upLimit) {
            mc._y = mc._y+increment;
      }
};
// End of the function
#include "netblue/netblueList.as"
var scrolling = 0;
var howMany = projects.length;
var n = 1;
loadMe();
buildMenu();
var myName;
stop();
0
Comment
Question by:mingchih
  • 3
  • 3
6 Comments
 
LVL 1

Expert Comment

by:Fern2
ID: 18835327
Can you upload a ZIP file with your files, so we can take a look at it?
0
 

Author Comment

by:mingchih
ID: 18840368
Hi
Here is the Fla link http://www.brianlinstudio.com/scrollerExample.zip
Thanks
0
 
LVL 1

Accepted Solution

by:
Fern2 earned 500 total points
ID: 18842758
Replace this with your current code and try. Should work.

var _loc1 = this;
//
function loadMe() {
      myX = 62;
      myY = 125;
      gap = 105;
      gap2 = 0.66;
      max = 4;
      counter = 0;
      var ScrollMovie:MovieClip = _loc1.createEmptyMovieClip("ScrollMovie",1);
      for (n=1; n<howMany; n++) {
            mc = ScrollMovie.createEmptyMovieClip("myTarget"+n, 20+n);
            picture = "netblue/"+projects[n]+".jpg";
            eval("ScrollMovie.myTarget"+n).loadMovie(picture);
            if (counter>max) {
                  counter = 0;
                  myY = myY+gap;
            }
            // end if                                                      
            mc._x = myX+gap*counter;
            mc._y = myY*gap2;
      ++counter;
      }
}
// End of the function
function buildMenu() {
      myX = 62;
      myY = 125;
      gap = 105;
      gap2 = 0.66;
      max = 4;
      counter = 0;
      for (i=1; i<howMany; i++) {
            //mc = ScrollMovie.createEmptyMovieClip("myTarget"+n, 20+n);
            mc = ScrollMovie.attachMovie("button", "button"+i, 50+i);
            mc.i = i;
            _loc1.myName = i;
            _loc1.myName = _loc1.projects[i];
            mc.person.text = _loc1.myName;
            _loc1.n = i;
            if (counter>max) {
                  counter = 0;
                  myY = myY+gap;
            }
            // end if                                                      
            mc._x = myX+gap*counter;
            mc._y = myY*gap2;
            ++counter;
      }
      // end of for
}
_loc1.upStatus = 0;
//
var myListener = new Object();
myListener.onLoadInit = function(target_mc) {
      this.imageborder = 9;
      target_mc._x = -(target_mc._width/2);
      target_mc._y = -(target_mc._height/2);
      //Load white BG
      _loc1.attachMovie("whiteOutBG", "whiteOutBG", 9998);
      _loc1.whiteOutBG._width = target_mc._width+2*this.imageborder;
      _loc1.whiteOutBG._height = target_mc._height+2*this.imageborder;
      _loc1.whiteOutBG._x = 322;
      _loc1.whiteOutBG._y = 222;
};
var mcLoader = new MovieClipLoader();
mcLoader.addListener(myListener);
//Scroller
increment = 20;
downLimit = -112;
upLimit = 0;
down.onPress = function() {
      if (ScrollMovie._y>downLimit) {
            ScrollMovie._y = ScrollMovie._y-increment;
      }
};
up.onPress = function() {
      if (ScrollMovie._y<upLimit) {
            ScrollMovie._y = ScrollMovie._y+increment;
      }
};
// End of the function
#include "netblue/netblueList.as"
var scrolling = 0;
var howMany = projects.length;
var n = 1;
loadMe();
buildMenu();
var myName;
stop();
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Expert Comment

by:Fern2
ID: 18842802
Sorry I meant "Replace your current code with this" :(
0
 

Author Comment

by:mingchih
ID: 18846696
Cool, Thanks a lot, Fern.... I may have more Qs about this projects... do you provide info that I can send you my Q on EE ? :)
0
 

Author Comment

by:mingchih
ID: 18848678
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now