A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Help with converting AS2 code to run on more modern flash player

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    26

    Help with converting AS2 code to run on more modern flash player

    Sorry for the silly question.

    I have an effect in a FLA file, which works when the Publish Settings are set for Flash Player 6. When I move up to Flash Player 7 or above, the effect no longer works.

    The effect is simple - the eyes follow the mouse:
    http://jimpix.co.uk/junk/00001.swf

    I have another effect in a different FLA file, which won't work when the Publish Settings are earlier than Flash Player 7.

    I'd like to update the code in the mouse / eye follow FLA, so that it'll work on Flash Player 7 or above. Trouble is I know nothing about ActionScript.

    I wondered if anyone might please be able to look at the AS, to see if it would be a big job to update the code to work on Flash Player 7 or above.

    The code is below, and the FLA is here:
    http://jimpix.co.uk/junk/00001.fla

    Any advice much appreciated. Thank you.

    Code:
    // Set up prototypes
    movieClip.protoType.innit = function () {
    	slowSpeed = 0.9;
    	springAmount = 12;
    	targetSize = 100;
    	amount = 100;
    }
    movieClip.protoType.elas = function () {
    	xDiff = _x - _root._xmouse;
    	yDiff = _y - _root._ymouse;
    	aDiff = Math.sqrt((xDiff * xDiff) + (yDiff * yDiff));
    	if (aDiff < amount) {
    		targetSize = 100 + (200 - (aDiff * 2));
    	} else {
    		targetSize = 100;
    	}
    	sizeDifX = targetSize - _xscale;
    	sizeDifY = targetSize - _yscale;
    	elasX = (elasX + sizeDifX / springAmount) * slowSpeed;
    	elasY = (elasY + sizeDifY / springAmount) * slowSpeed;
    	_xscale += elasX;
    	_yscale += elasY;
    }
    // Misc
    //_root._quality = "BEST";
    fscommand("allowscale", false);
    stop();
    And then some separate AS held in an empty MC on the stage (MC = 'mouse'):

    Code:
    onClipEvent (load) {
    	startDrag(this, true);
    }
    Last edited by gloopy; 09-17-2009 at 01:39 PM.

  2. #2
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    Ok, I can't open the .fla and I have no idea what's going on with the code you pasted, but I don't think its the code in the .swf .

    The problem with the example is that the pupils dont really follow the mouse if its in the area of the eye.

    Try this example instead, its flash cs3 format.
    Attached Files Attached Files
    New sig soon

  3. #3
    Junior Member
    Join Date
    Aug 2009
    Posts
    26
    Thank you! That is really helpful. Sorry you could not open the FLA.

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