dcsimg
A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Scrolling pixel fonts on whole integers - help!

  1. #1
    Junior Member
    Join Date
    Sep 2002
    Posts
    5

    Scrolling pixel fonts on whole integers - help!

    Hi -

    I would like to know how to scroll a pixel font and have it stop on a whole integer value on a roll out function.

    I keep finding posts that say you SHOULD do this but I can't find a post or tutorial that says specifically how.

    I emailed fontsforflash and they suggested I post an inquiry here, which wasn't very helpful but I'm hoping someone here will be.

    My knowledge of ActionScripting is still fairly beginner so please be as specific as possible.

    My current code for the scroll action (which works fine on antialiased fonts) is:

    on (rollOver) {
    tellTarget ("/upaction") {
    gotoAndPlay ("up");
    }
    }
    on (rollOut) {
    tellTarget ("/upaction") {
    gotoAndStop ("stop");
    }
    }

    The down action is similar:

    on (rollOver) {
    tellTarget ("/scroll") {
    play ();
    }
    }
    on (rollOut) {
    tellTarget ("/scroll") {
    stop ();
    }
    }

    The text itself is a movie clip scrolling behind a mask.

    Also, if anyone has any tips to add to this on easing the stop action for a smooth stop that would be really nice too.

    Thanks in advance!

  2. #2
    Junior Member
    Join Date
    Jan 2002
    Posts
    24
    Why don't you just read the _x or _y value of the object, and then set it to the integer value of same?

    wholeX = parseInt(myObject._x)
    myObject._x = wholeX


    That should work..

    Rich

  3. #3
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    i'm sure there is another code. The one that actually scrolls the MC, ie: alters it's _y position. It's there that you need to add a 'Math.round' to the position so it rounds up the _y property, avoiding the decimals.
    parseInt just converts strings to numbers. What you want is to get rid of the decimals.
    gparis

  4. #4
    Junior Member
    Join Date
    Sep 2002
    Posts
    5

    Still need help...

    Thanks for responding -

    I guess I wasn't very clear about my inexperience with ActionScript so I'll just say that it's pretty beginner and ask how I would use the Math () round script or the other suggestion someone made.

    I tried using the Math () round dealie but it didn't work - probably because I put it in the wrong spot or something. I don't know. Any further insight/suggestions?

    I was really hoping to find a working example with the script somewhere here but I didn't have any luck. Does anyone know of something like that?

  5. #5
    Junior Member
    Join Date
    Jan 2002
    Posts
    24
    Why don't you post your action script code and we can edit what you've got..

    Rich

  6. #6
    Junior Member
    Join Date
    Sep 2002
    Posts
    5

    My current script...

    This is the script I currently use on my "up" and "down" buttons to scroll any antialiased font. Is there someway to modify this to scroll a pixel font or do I need a different script entirely?


    on (rollOver) {
    tellTarget ("/upaction") {
    gotoAndPlay ("up");
    }
    }
    on (rollOut) {
    tellTarget ("/upaction") {
    gotoAndStop ("stop");
    }
    }

    The down action is similar:

    on (rollOver) {
    tellTarget ("/scroll") {
    play ();
    }
    }
    on (rollOut) {
    tellTarget ("/scroll") {
    stop ();
    }
    }

  7. #7
    Junior Member
    Join Date
    Jan 2002
    Posts
    24
    What actions are executed when calling the various frames in other movie clips you have referenced in that code?

    That is the code I am looking for..

    Rich

  8. #8
    Junior Member
    Join Date
    Sep 2002
    Posts
    5

    Code...

    I have an "up Action" MC that is empty with a stop action on the first frame and this code on the frame following:


    tellTarget ("/scroll") {
    prevFrame ();
    }
    gotoAndPlay ("up");

    I hope that's what you were looking for...

  9. #9
    Junior Member
    Join Date
    Jan 2002
    Posts
    24
    Hi..

    Well none of this code shows me up the movie is actually moving..

    I'm guessing that is one frame "up"

    If you want to e-mail me an attachment with the FLA, you can send it to rwmorey71@hotmail.com

    Rich

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center