A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Reveal and Un-reveal text upon clicking with animated transition

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    1

    Reveal and Un-reveal text upon clicking with animated transition

    I want to create a simple script in AS2 that can reveal and un-reveal some text upon clicking (and any additional graphic), preferably with a simple transition (likely a tween). How would I go about achieving this? As you can probably tell, I'm completely new to ActionScript, but have a rudimentary understanding of how to operate across Flash itself.

    Any help would be appreciated.

  2. #2
    Member
    Join Date
    Mar 2004
    Posts
    44
    try if this does what you are looking for (I'll try to make it as easy to understand as possible...):

    - create a static text on your stage, anything you like.
    - convert the created text-field into a MovieClip (Press F8) and name it mc_test
    - select the MovieClip and in the properties window, give it the instance-name "test" (without quotes).

    - draw a box anywhere on your stage (this will be our button)
    select the whole box and press F8 to convert it to a movieclip.
    - select the MovieClip of the box and in the properties-window, give it the instance-name "button" (again without qoutes).

    - create a new leyer in your main-scene and name it actions.
    - select the first frame on layer "actions" and press F9 to open the actions-panel
    - try the next piece of ActionScrip 2.0 code:
    Actionscript Code:
    _root.button.onRelease = function(){
        var steps:Number = 10;
        var stepsize:Number = 100 / steps;
        if(invisible == true){
            action = "showit";
            invisible = false;
        } else {
            action = "hideit";
            invisible = true;
        }
        onEnterFrame = function(){
            if(action == "hideit"){
                _root.test._alpha = 0 + (stepsize * steps);
            }else {
                _root.test._alpha = 100 - (stepsize * steps);
            }
            if(steps <= 0){
                delete(onEnterFrame);
            }
            steps--;
        }
    }
    Last edited by basm; 03-02-2010 at 03:35 AM.

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