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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

two arrows scrolling behavior 1

Status
Not open for further replies.

Cartier

Technical User
Jan 16, 2003
32
BA
i want to scroll my text field with 2 arrows only. I have this scripts:

1.DOWN ARROW:

on scd
member("tekst").scrollbyline(1)
end

on mouseWithin
mdt
end

on mdt
if the mouseDown=TRUE then scd
end


2. UP ARROW

on mouseWithin
mdt
end

on scu
member("tekst").scrollbyline(-1)
end

on mdt
if the mouseDown=TRUE then scu
end


and its working fine. the problem is ,that i have to put this script directly on the cast member, I can't put it as a behavior.
so for each text field i have to put aditional arrows in a movie.

what i want to know is, does anyone know a script that will do the same as this one, but to be put as a behavior, cause it would make it a lot more easier to work

THANK YOU
 
thanks kenneth, but do u have any example, maybe some link or something, because, i don't have any idea how to do that.

thanks again
vesna
 
OK, since you asked me…

Here's the behaviour script I wrote quickly. Drag & drop this script onto up/down arrow on the stage. When you do that you'll be asked to specify the target text member (in this example "text1" or "text2"), the direction of scroll ("up" or "down") and the amount of scroll (in this example 1 - 100 lines.)
--
property pTargetText, pScrollDirection, pScrollAmount, pMouseEnter

on getPropertyDescriptionList me
tPList = [:]
tPList.addProp(#pTargetText, [#default:"", #format:#string, #comment:"Text member to scroll:", #range:["text1", "text2"]])
tPList.addProp(#pScrollDirection, [#default:"", #format:#string, #comment:"Scroll direction:", #range:["up", "down"]])
tPList.addProp(#pScrollAmount, [#default:1, #format:#integer, #comment:"Scroll amount:", #range:[#min:1, #max:100]])
return tPList
end getPropertyDescriptionList

on mouseEnter me
pMouseEnter = 1
end mouseEnter

on mouseLeave me
pMouseEnter = 0
end mouseLeave

on exitFrame me
if pMouseEnter and the mouseDown then
case pScrollDirection of
"up": tAmount = pScrollAmount
"down": tAmount = - pScrollAmount
end case
member(pTargetText).scrollByLine(tAmount)
end if
end exitFrame

Kenneth Kawamoto
 
hi
this works great with the text fields named text1 and text2, but is there a way to make this script scroll text in some sprite. so i just put different text fields on the same sprite in the movie. i tried to modify this script, but i failed.
dont laugh:

property pTargetText, pScrollDirection, pScrollAmount, pMouseEnter

on getPropertyDescriptionList me
tPList = [:]
tPList.addProp(#pTargetText, [#default:"", #format:#string, #comment:"Text member to scroll:", #range:[sprite 36, "text2"]])
tPList.addProp(#pScrollDirection, [#default:"", #format:#string, #comment:"Scroll direction:", #range:["up", "down"]])
tPList.addProp(#pScrollAmount, [#default:1, #format:#integer, #comment:"Scroll amount:", #range:[#min:1, #max:100]])
return tPList
end getPropertyDescriptionList

on mouseEnter me
pMouseEnter = 1
end mouseEnter

on mouseLeave me
pMouseEnter = 0
end mouseLeave

on exitFrame me
if pMouseEnter and the mouseDown then
case pScrollDirection of
"up": tAmount = pScrollAmount
"down": tAmount = - pScrollAmount
end case
member(pTargetText).scrollByLine(tAmount)
end if
end exitFrame

so if u have some time please help
vesna
 
Sure, here's the modified script: this time you can choose the target sprite (range 1 - 100) instead of the member.
--
property pTargetSprite, pScrollDirection, pScrollAmount, pMouseEnter

on getPropertyDescriptionList me
tPList = [:]
tPList.addProp(#pTargetSprite, [#default:1, #format:#integer, #comment:"Text sprite to scroll:", #range:[#min:1, #max:100]])
tPList.addProp(#pScrollDirection, [#default:"", #format:#string, #comment:"Scroll direction:", #range:["up", "down"]])
tPList.addProp(#pScrollAmount, [#default:1, #format:#integer, #comment:"Scroll amount:", #range:[#min:1, #max:100]])
return tPList
end getPropertyDescriptionList

on mouseEnter me
pMouseEnter = 1
end mouseEnter

on mouseLeave me
pMouseEnter = 0
end mouseLeave

on exitFrame me
if pMouseEnter and the mouseDown then
case pScrollDirection of
"up": tAmount = pScrollAmount
"down": tAmount = - pScrollAmount
end case
sprite(pTargetSprite).member.scrollByLine(tAmount)
end if
end exitFrame

Kenneth Kawamoto
 
you r THE BEST!!!!
thank u sooo much
this is what i was looking for

many regards
vesna
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top