A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Scaling objects with AS2

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Posts
    29

    Scaling objects with AS2

    What I am trying to do can't be that difficult. I just can't seem to find the answer.

    I have a purple box on the stage. I turned this box into a movie clip with the instance name of "purple." onEnterFrame, I want to increase the wdith of that box. It is currently 11.75px. I want it to ease into 40px. I want this to happen onEnterFrame.

    I am using Actionscript 2.

    Any ideas?

  2. #2
    Senior Member hts5000's Avatar
    Join Date
    Oct 2007
    Posts
    160
    This will change the width of the box:

    purple._width = 40.0;

    I dont know about the "ease" part but this should increase the size incrementally

    Actionscript Code:
    this.onEnterFrame = function(){
    purple._width += 3;
    if (purple._width >= 40){
    delete this.onEnterFrame;
    purple._width = 40;
    }
    }

  3. #3
    Senior Member Robb@exo's Avatar
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    1,540
    There are a few approaches that can be taken.
    1.
    PHP Code:
    this.onEnterFrame = function() {
        
    purple._width 40;

    2.
    PHP Code:
    this.onEnterFrame = function() {
        
    purple._width += 4;
        if(
    purple._width 40) {
            
    purple._width 40;
        }

    3.
    PHP Code:
    import mx.transitions.Tween;
    import mx.transitions.easing.*;

    this.onEnterFrame = function() {
        var 
    txw:Object = new Object(purple"_width"Regular.easeOut11.75401true);

    HTH.
    Wile E. Coyote - "Clear as mud?"

Tags for this Thread

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