Solved

Scrolling question

Posted on 2007-04-02
6
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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 last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to how to record live broadcast.
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.
Suggested Courses

738 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