PDA

View Full Version : convert to mx script? help anyone?



Lacuna
May 3rd, 2003, 03:26 PM
Good afternoon boys and girls,

I'm doing a tutorial and it's teaching me in Flash 5 and I'm having to convert all the code in to mx. I've done fine thus far but am having troubles with the tell target stuff. Would anyone be able to give me a hand by telling me how flash mx reads tell target code?



On (Press, Drag Over)
Begin Tell Target ("scrollUp")
gotoAndPlay(2)
End Tell Target
End On
On (Release, Release Outside)
Begin Tell Target ("scrollUp")
gotoAndStop(1)
End Tell Target
End On


You guys are wonderful. :love:

~ Seretha

Jubba
May 3rd, 2003, 03:50 PM
On (Press, Drag Over)
Begin Tell Target ("scrollUp")
gotoAndPlay(2)
End Tell Target
End On
On (Release, Release Outside)
Begin Tell Target ("scrollUp")
gotoAndStop(1)
End Tell Target
End On


thats not even Flash 5 code... it looks like Flash 3/4

anyway..


on(press, rollOver){
scollUp.gotoAndPlay(2)
}
on(release, releaseOutside){
scrollUp.gotoAndPlay(1)
}

ahmed
May 3rd, 2003, 04:05 PM
and.. might i add, using movieclips for buttons give you more flexibility.. :
myButtonMC.onPress = myButtonMC.onRollOver = function() {
scrollUp.gotoAndPlay(2)
}
myButtonMC.onRelease = myButtonMC.onReleaseOutside = function() {
scrollUp.gotoAndPlay(1)
}

:)

Jubba
May 3rd, 2003, 04:57 PM
Right, but with ahmeds code, make sure that you put that in the timeline. the code I gave goes directly on the button. :)

Lacuna
May 3rd, 2003, 06:09 PM
thanks for the quick help. ;)

Can someone look this over and let me know if I missed something? The swf I'm creating isn't working properly and I think this is the section.




Set Variable: "currentScroll" = ../:scrolltext.scroll
Set Variable: "max" = ../:scrolltext.maxscroll
If (currentScroll < max)
Set Variable: "../:scrolltext.scroll" = currentScroll + 1
End If


new (mx):


set("currentScroll", scrolltext.scroll);
set("max", scrolltext.maxscroll);
If (currentScroll> 1)
set("scrolltext.scroll", currentScroll -1);
End


Im not quite sure if I did the 'equal' statement correctly.


:love: ~ Seretha

Jubba
May 3rd, 2003, 06:11 PM
where are you getting this code? That is super old code.

This tutorial should be what you are looking for tho:

http://www.kirupa.com/developer/flash5/scrolltext.htm

it looks to be the same thing that you are trying to do. Its Flash 5, but its more recent code than what you are using. That looks like Flash 3/4 again. Where ever you are getting that code from, stop going there...

Lacuna
May 3rd, 2003, 06:19 PM
and i guess just put a 'slider' with the same variables as the arrows to get one of those drag boxes..

Jubba
May 3rd, 2003, 06:25 PM
not realy. I made a file that would do a slider a while ago... let me see if I can drag it up...
http://www.kirupaforum.com/forums/showthread.php?s=&threadid=19278&highlight=scroll+text

right there. Scroll down a little ways and you will see my file.

Lacuna
May 3rd, 2003, 06:36 PM
wow. thanks Jubba. you're such a sweetheart ;)
That's exactly what I've been looking for!

:love: ~ Seretha

Jubba
May 3rd, 2003, 06:37 PM
should have asked sooner ;)

:love:

Lacuna
May 3rd, 2003, 06:46 PM
the only thing I noticed is the dragger doesn't seem to pull down when you click on the down button only once you've dragged it...is that the same for everyone or just my screwy computer?

:love: ~ Seretha

Lacuna
May 3rd, 2003, 06:54 PM
nm...you have really nice code ettiquette. I'm sure I'll be able to sort through this easily enough. It's really difficult sometimes when you get a file that you can't even work through because it seems like things were randomly tossed in...lol

Thanks a lot.

:love: ~ Seretha

Jubba
May 3rd, 2003, 06:58 PM
Did you find the answer? That individual had the same problem and the answer can be found on the second page. :)

Lacuna
May 3rd, 2003, 07:05 PM
actually i got it fixed just a second ago. i actually just put a


dragger._y = dragger._y-1;

and added


up.onRollOver =


to the up.onPress function and vice vera with the down. works great.

:love: ~ Seretha

Lacuna
May 3rd, 2003, 09:07 PM
NO.. Dont run...lol...please...I know it's a lotta code but Jubba if you're out there I'm experiencing a problem with the dragger popping down about 10 or so pixels once the draggers been used. I've tried editing some of it but with no avail.. any ideas for me to try out?





dragger.onPress = dragger.onMouseDown = function ()
{
this.startDrag (true, line._x, line._y, line._x, (line._height + line._y)); //drags the bar
//this.startDrag(
this.onEnterFrame = function ()
{
ratio = Math.round ((this._y - line._y) * 100 / line._height); // finds the ratio. % that the bar has moved on line
if (Number (scrollableText.scroll) <= Number (scrollableText.maxscroll) && Number (scrollableText.scroll) > 0)
{
scrollableText.scroll = ratio * scrollableText.maxscroll / line._height; //scrolls the text
}
};
};
dragger.onRelease = dragger.onReleaseOutside = dragger.onMouseDown = function ()
{
this.onEnterFrame = function ()
{
this._y = ((scrollableText.scroll*(line._height*line._height ))/(100*scrollableText.maxscroll))+line._y //moves the drag-box with the scroll of the ttextbox
};
stopDrag ();
};
up.onRelease = up.onReleaseOutside = up.onRollOut =down.onRelease = down.onReleaseOutside = down.onRollOut = function ()
{
this.onEnterFrame = null; //turns off the button functions.
};
up.onPress = up.onRollOver = function ()
{
this.onEnterFrame = function ()
{
currentScroll = scrollableText.scroll;
if (Number (currentScroll) > 1)
{
scrollableText.scroll = currentScroll - 1; //scrolls the text up.
dragger._y = dragger._y-1;
}
};
};

down.onPress = down.onRollOver = function (dscroll)
{
this.onEnterFrame = function ()
{
currentScroll = scrollableText.scroll;
if (Number (currentScroll) < Number (scrollableText.maxscroll))
{
scrollableText.scroll = Number (currentScroll) + 1; // scrolls the text down.
dragger._y = dragger._y+1;
}
};
};
/*_root.onMouseDown = function () // this function just traces the values of the max and current scroll of the text box.
{
trace ("max=" + scrollableText.maxscroll);
trace ("cur=" + scrollableText.scroll);
};*/
scrollableText = "This is the test text that will be scrolled.
Jubba is going to murder his roommate in his sleep because he is
an arse! This is the test text that will be scrolled. Jubba is going to murder his roommate in his sleep because he is an arse! This
is the test text that will be scrolled. Jubba is going to murder his roommate in his sleep because he is an arse! This is the test text
that will be scrolled. Jubba is going to murder his roommate in his sleep because he is an arse! This is the test text that will be
scrolled. Jubba is going to murder his roommate in his sleep because he is an arse! This is the test text that will be scrolled.
Jubba is going to murder his roommate in his sleep because he is an arse! This is the test text that will be scrolled. Jubba is going
to murder his roommate in his sleep because he is an arse! "

Jubba
May 3rd, 2003, 09:09 PM
can you send me the file? it would be easier for me to debug that way.

*****Removed E-mail Address*******

Lacuna
May 3rd, 2003, 09:32 PM
thanks. it should have gone through by now.

:love: ~ Seretha

Jubba
May 3rd, 2003, 10:10 PM
Find this code:


this.onEnterFrame = function ()
{
this._y = ((scrollableText.scroll * (line._height * line._height)) / (100 * scrollableText.maxscroll)) + line._y;
// moves the drag-box with the scroll of the ttextbox
};
stopDrag ();

and replace it with this code.



this.onEnterFrame = function ()
{
if (scrollableText.scroll <=1)
{
this._y = (((scrollableText.scroll - 1) * (line._height * line._height)) / (100 * scrollableText.maxscroll)) + line._y;
// moves the drag-box with the scroll of the ttextbox
}
else
{
this._y = (((scrollableText.scroll) * (line._height * line._height)) / (100 * scrollableText.maxscroll)) + line._y;
}
};
stopDrag ();


that will stop the skipping around.