Jump to content


image follows scrollbar in dynamic text box?


  • You cannot reply to this topic
3 replies to this topic

#1 boogooloo1

    Young Padawan

  • Members
  • Pip
  • 116 posts

Posted 05 March 2007 - 09:42 PM

G'day all,

Thanks to various tutorials, I've got buttons which load external text files into a dynamic text box, and I've worked out how to add images using <img> tags. I've got a scrollbar attached to the text box, but it doesn't show up until the text is bigger than the text box - for that, I used an adaption of this code.

Anyway, it's all looking good, besides the fact that if there IS enough text to need the scroller, and you scroll to read it, the image stays where it is (top and left). Is there any way of getting the image to follow the scrollbar down?

Cheers in advance!

boogooloo1 :)

Here's my code so far:

on (press){
	import mx.transitions.Tween;
import mx.transitions.easing.*;
	loadText = new LoadVars();
	loadText.load("text/solo-duo.txt");
	loadText.onLoad = function(success) {
		if (success) {
			// trace(success);
			_root.text_mc.textbox.html = true;
			_root.text_mc.textbox.htmlText = this.myNews;
			var textmcTween:Tween = new Tween(_root.text_mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
			var textmcTween:Tween = new Tween(_root.cover_mc, "_alpha", Regular.easeOut, 0, 80, 1, true);
		}
	}
;}
on (release){
	_root.text_mc.scroller._visible = (_root.text_mc.textbox.maxscroll > 1);
}


#2 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 05 March 2007 - 11:02 PM

Is your image in the same mc that your scroller scrolls? That would be important :)

#3 boogooloo1

    Young Padawan

  • Members
  • Pip
  • 116 posts

Posted 05 March 2007 - 11:26 PM

Yep - bear in mind that the scrollbar is attached to a dynamic text field, and the image is being placed inside the text field using actionscript.

Cheers!

boog :)

#4 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 06 March 2007 - 09:23 AM

And the image in there is placed there using html? like...
<img src = "imadethisup.com/thing.jpg" />

If that is the case, it might be better to attach the image dynamically. You can use a movieclip loader to do that, and position it inside the scrolling mc. But I think that would take a fair rework of your code :\

I've never put images in using html like that, Ive always loaded them in externally and arranged things around them as needed. I can help you out with that if you need. Its pretty simple once you get the concept.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users