A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How would i do this is AS3?

  1. #1
    Junior Member
    Join Date
    Jul 2008
    Posts
    2

    How would i do this is AS3?

    Hi,

    I have some old code that i would like to re-use in and AS3 project, it was written in AS2. To be honest im not totally up with AS3...

    This is the code i have from the AS2 project. Basically it just takes each frame from an array and matches it to a particular frame in a lipsync movie clip...

    Thanks in advance..

    Andy

    onClipEvent(load) {
    //amplitude array created by FlashAmp using a scale of 50 and a rate of 12 fps
    //no smoothing (see additional example below)

    amplitude=[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 3, 3, 3, 2, 1, 2, 2, 1, 2, 2, 2, 3];
    }


    onClipEvent(enterframe) {
    //set x and y scale of speaker to full size plus value from array.
    //array value is determined by the playback head position in main timeline.
    //this._xscale = 85 + amplitude[_root._currentFrame-1]
    //this._yscale = 85 + amplitude[_root._currentFrame-1]
    //that is, frame 7 - 1 = index 6, (6th place in zero-based array, value of 39).


    myFrame = amplitude[_root._currentframe-1] + 1;
    this.gotoAndStop(myFrame);


    }

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    It's kind of weird code but I think I see what it's trying to do...Try dropping this into the first frame inside the clip. Also, be aware that this will break if your root timeline goes past 24 (or how many are in that array) frames.

    PHP Code:
    var amplitude:Array = [000000001123333212212223]; 

    addEventListener(Event.ENTER_FRAME, function(e:Event):void{
        
    gotoAndStopamplitude[root.currentFrame 1] + );
    }); 

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