Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scroll help please 1

Status
Not open for further replies.

essentialDF

Technical User
Jan 12, 2005
31
hi everyone --

I'm pretty new to flash and have a question about scrolling.

I have a dynamic text field in my movie that I am attempting to scroll without using components. I'd rather not "see" a scroller per se, but, rather use "up" and "down" arrows right next to each other.

This is what I have applied to the down button so far:


Code:
on (press) {
radiatorText.scroll+=2
}

With this code, the user must click everytime to advance the text two lines, how can I alter or add to the code so that it scrolls when the button is held down???

Can't seem to find a tutorial on this anywhere.
Can anyone help me out with the action script to make this baby scroll continuously onPress :)

Thanks
sm
 
There are lots of ways to do this: here's a way to do the job from the main timeline (where 'up' and 'down' are the instance names of your scroll buttons):

Code:
up.onPress = function() {
	doScroll(-1);
};
down.onPress = function() {
	doScroll(1);
};
up.onRelease = down.onRelease=function () {
	doScroll(0);
};
//
doScroll = function (val) {
	this.onEnterFrame = function() {
		this.radiatorText.scroll += val;
		if (!val) delete this.onEnterFrame;
	};
};
 
Thanks, I've applied that code (to the buttons right?), but get an output error that reads:

**Error** Scene=Scene 1, layer=btns, frame=1:Line 2: Operator '=' must be followed by an operand
    doScroll(-1);

**Error** Scene=Scene 1, layer=btns, frame=1:Line 1: Statement must appear within on handler
up.onPress = function() {

**Error** Scene=Scene 1, layer=btns, frame=1:Line 3: Unexpected '}' encountered
};

Total ActionScript Errors: 3 Reported Errors: 3

I've tried to make these changes, but end up with even more output errors! This stuff doesn't come easy to me. What do you think I'm doing wrong here??

Any suggestions are greatly appreciated.
Thanks :)
Sean
 
Thanks for helping,

So I've applied that script to the main timeline, given the buttons instance names "up" and "down" and called the text box "radiatorText".

I get just two out-put errors now:

**Error** Scene=Scene 1, layer=actions, frame=1:Line 3: Operator '=' must be followed by an operand
    doScroll(-1);

**Error** Scene=Scene 1, layer=actions, frame=1:Line 4: Unexpected '}' encountered
};

Total ActionScript Errors: 2 Reported Errors: 2

I'm not sure what it's asking for when it says the operator should be followed by "operand"???

Cheers,
Sean
 
I appreciate your help immensely :)

I'm loading the text externally and just can't get the thing to scroll, even though the AS you provided produces no errors.

I've uploaded a .sit with the .fla and .txt here:

Do you think you could have a look to see what I'm doing wrong??

I would really appreciate it :) :)
 
But this .fla must be in a MX2004 format? I'm on MX only still...

Unexpected file format! Can't open your .fla.
You'd have a better chance of getting an answer if your .fla was in a MX only format.

You would have to save a copy of your MX2004 .fla, (using Save as...) and changing the Document type to MX only in the Save as... window.

Then zip it up again... And post the link.


Regards. Affiliate Program - Web Hosting - Web Design
 
I'm really embarrassed!!

Thanks for ALL your help, everything works perfectly.

Cheers,
Sean M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top