[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Vertical Scrolling image problem with scripting

Posted on 2008-11-19
2
Medium Priority
?
776 Views
Last Modified: 2013-11-11
Hi experts,
I have some problem with the vertical image scrolling.
When take mouse pointer in the +y-axis the image scroll perfectly and duplicating also works fine.
But when i take the mouse pointer in -y-axis the duplicating movie clip doesn't seems working

 I have a movieClip instance name : myMoviemc, Inside this movieClip I have two layers
1st i have the following actionScript

[CODE]
      movieh = 400;
      h = foto._height;
      speed = 12;

this.onEnterFrame =function() {
      ypos = _parent._ymouse;
      ypos = ypos-(movieh/2);
      foto._y =  foto._y-(ypos/speed);
}
[/CODE]

2nd Layer:
I have a image movieClip, instance name:foto
in side this movieClip i have two more layer


 1st layer : i have the following actionscript.
// duplico il movie clip principale della foto in due e li metto uno sopra e uno sotto
[CODE]
m = 0;
tmi = 2;
while (m<(tmi*2)-2) {
      m++;
      dup = 'image' + m;
      _parent.foto.image.duplicateMovieClip(dup, m+1);
      _parent.foto.image1._y = _parent.foto.image._y+_parent.foto.image._height;
      _parent.foto.image2._y = _parent.foto.image._y-_parent.foto.image._height;
}
[/CODE]

2nd Layer : anohter movieClip instance name: image
on image movieClip i have the following script.

[CODE]
onClipEvent (enterFrame) {
      // truschino per simulare lo scorrimento infinito
      if (_parent._parent.foto._y<-_parent._parent.foto.image._height/2) {
            // trace("a");
            _parent._parent.foto._y = _parent._parent.foto._height/2;
      } else if (_root.foto._y>(_parent._parent.foto._height/2)-8) {
            _parent._parent.foto._y = _parent._parent.foto.image1._height/2;
      }
}

[/CODE]
Please help.
I have also attached the fla,
Note : please rename the drag.jpg to drag.fla

drag.jpg
0
Comment
Question by:skilleddesigner
2 Comments
 
LVL 2

Accepted Solution

by:
iamlfetch earned 2000 total points
ID: 23008116
You made a reference error on the image instance.

replace
[CODE]
onClipEvent (enterFrame) {
      // truschino per simulare lo scorrimento infinito
      if (_parent._parent.foto._y<-_parent._parent.foto.image._height/2) {
            // trace("a");
            _parent._parent.foto._y = _parent._parent.foto._height/2;
      } else if (_root.foto._y>(_parent._parent.foto._height/2)-8) {
            _parent._parent.foto._y = _parent._parent.foto.image1._height/2;
      }
}

[/CODE]
with
[CODE]
onClipEvent (enterFrame) {
      // truschino per simulare lo scorrimento infinito
      if (_parent._parent.foto._y<-_parent._parent.foto.image._height/2) {
            _parent._parent.foto._y = _parent._parent.foto._height/2;
      } else if (_parent._parent.foto._y>(_parent._parent.foto._height/2)) {
            _parent._parent.foto._y = _parent._parent.foto.image1._height/2;
      }
}

[/CODE]

all i did was change the _root to _parent._parent :)
0
 
LVL 2

Author Closing Comment

by:skilleddesigner
ID: 31518168
thanks,
i guess i missed that out :)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
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 what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

591 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