Skip to main content
Participating Frequently
June 3, 2009
Question

How to scroll synchronically an image with a given part of text field?

  • June 3, 2009
  • 1 reply
  • 498 views

Hi,

I have a dynamic text field(DTF) consisting of many lines and DTF has vertical auto-scroll, here we say I have these three lines:

L1.....

L2.....

L3.....

Then I have three separate movie clips( originally images, say img1, img2, and img3).these images are added by as3 on the scrren, above my DTF.

Such this:

L1.......img1

L2.......img2

L3.......img3

What I need help with is: How I can croll down my DTF such taht these images move accordingly with their corresponding text lines?

For example while scrolling down my DTF then img1 should follow the same y-position as L1, and so on.

Any help appreciated!

Hossein R.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
June 3, 2009

use whatever's scrolling the text to adjust the y property of your movieclips.  but that's a poor setup.

you would be better off creating a multiline textfield, autoSizing it so to doesn't scroll at all, add the textfield and the images to a common parent, mask the parent and scroll the y property of the parent.

Participating Frequently
June 3, 2009

Thank you for the answer.

I my application under design there is very little space for making the text filed so big that it does not scroll.

My problem is how to find the varying y-position of a given text line while the user scrolls down/ the text filed.

I think the next problem( i.e. assigning the L1.y to img1),  which hopefully will synchronize the the scrolling of text line and corresponding image,  is easier to solve.

A pice of AS3 code that does this task?

Thanks for any help.

Hossein. R.

kglad
Community Expert
Community Expert
June 3, 2009

"how to find the varying y-position of a given text line while the user scrolls down/ the text filed":

that's why you should follow plan b in the 2nd paragraph.