CS3 Reversing rotation
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Reversing rotation

  1. #1
    Junior Member
    Join Date
    Aug 2002
    Posts
    10

    Reversing rotation

    Hi there -

    I got an istock flash of a rotating earth for a client project (http://www.istockphoto.com/stock-fla...php?st=d5556f2) and now the client wants to reverse the rotation of it! Being a newbie, I've looked at the actionscript and can't make heads or tails of it. (I've also tried messing with it to try to understand what each line is doing but also can't figure it out. Can anyone help make sense of this and describe how to reverse the direction???

    It is a masked object and 2 objects that refer to the foreground and the background.
    Here is the script affecting the background object (The foreground is similar, but dmf.scaleX are +105;
    dmf.scaleY +105).

    import flash.display.BitmapData;
    import flash.filters.DisplacementMapFilter;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    var map:BitmapData = new BitmapData(275, 275, true, 2);
    var bmp:MovieClip = this.createEmptyMovieClip("bmp", 10);
    bmp.attachBitmap(map, 0, "auto", true);
    var dmfisplacementMapFilter = new DisplacementMapFilter();
    dmf.mapBitmap = map;
    dmf.mode = "color";
    dmf.scaleX = -105;
    dmf.scaleY = -105;
    dmf.componentX = 1;
    dmf.componentY = 2;
    dmf.alpha = 0;
    bmp._visible = false;
    cont._visible = false;
    img.cacheAsBitmap = true;
    gradient.cacheAsBitmap = true;
    x = 250;
    xadd = -2;
    this.onEnterFrame = function() {
    dmf.mapPoint = new flash.geom.Point(50, 50);
    img.scrollRect = new Rectangle(x, 0, 250, 250);
    x += xadd;
    if (x<1) {
    x = 500;
    }
    map.draw(cont);
    img.filters = [dmf];
    };

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    106
    The onEnterFrame is where the animation is happening. You can adjust either of these places (but not both)
    xadd = -2;//<------- you can change this to xadd = 2
    this.onEnterFrame = function() {
    dmf.mapPoint = new flash.geom.Point(50, 50);
    img.scrollRect = new Rectangle(x, 0, 250, 250);
    x += xadd;//<------- you can change this to x -= xadd
    if (x<1) {
    x = 500;
    }

  3. #3
    Senior Member
    Join Date
    Nov 2012
    Posts
    106
    I wonder why the client would want to reverse the spin of the world? The link shows the earth revolving the way the sun rises.

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

Poll by Flashkit.com