×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    1

    Zooming problem in FlashLite 2.1 with AS 2.0

    i have the problem in zooming...
    inside the flash,there have consists 6 button of up,down,left right, zoom in and zoom out
    when i click the key in the device central simulates!(e.g. click left and zoom in)
    it will be zooming in deep in deeper of the image and start hanging!

    any idea to solve this?

    This is the code in below:
    stop();
    print_btn.onRelease = function() {
    print("map", "bmax");

    };
    var pressedBtn = null;
    moveUp.pressed = false;
    moveUp.onPress = doPress;
    moveLeft.pressed = false;
    moveLeft.onPress = doPress;
    moveRight.pressed = false;
    moveRight.onPress = doPress;
    moveDown.pressed = false;
    moveDown.onPress = doPress;
    //
    zoomIn.pressed = false;
    zoomIn.onPress = doPress;
    zoomOut.pressed = false;
    zoomOut.onPress = doPress;
    //
    function doPress() {
    pressedBtn = this;
    this.pressed = true;
    onMouseUp = function () {
    pressedBtn = null;
    this.pressed = false;
    delete this.onMouseUp;
    };
    }
    function doClamp(low, value, high) {
    return Math.min(Math.max(value, low), high);
    }
    function initMap() {
    map.areaW = mask_mc._width;
    map.areaH = mask_mc._height;
    map._x = map.areaX=mask_mc._x;
    map._y = map.areaY=mask_mc._y;
    map.maxX = map.areaX+map.areaW;
    map.maxY = map.areaY+map.areaH;
    map.inc = 10;
    map.maxZoom = 200;
    map._xscale = map._yscale=map.minZoom=100/Math.min(map._width/mask_mc._width, map._height/mask_mc._height);
    map.tmp1 = 0;
    map.tmp2 = 0;
    //
    map.onEnterFrame = function() {
    switch (pressedBtn) {
    case null :
    break;
    case zoomIn :
    if (this._xscale<this.maxZoom) {
    this.tmp1 = this._width;
    this.tmp2 = this._height;
    this._yscale = this._xscale++;
    this._x -= (this._width-this.tmp1)/2;
    this._y -= (this._height-this.tmp2)/2;
    }
    break;
    case zoomOut :
    if (this._xscale>this.minZoom) {
    this.tmp1 = this._width;
    this.tmp2 = this._height;
    this._yscale = this._xscale--;
    this.tmp1 = this._x+(this.tmp1-this._width)/2;
    this.tmp2 = this._y+(this.tmp2-this._height)/2;
    this._x = doClamp(this.maxX-this._width, this.tmp1, this.areaX);
    this._y = doClamp(this.maxY-this._height, this.tmp2, this.areaY);
    }
    break;
    case moveLeft :
    if (this._x+this.inc<this.areaX) {
    this._x += this.inc;
    }
    break;
    case moveRight :
    if (this._x+this._width-this.inc>this.maxX) {
    this._x -= this.inc;
    }
    break;
    case moveUp :
    if (this._y+this.inc<this.areaY) {
    this._y += this.inc;
    }
    break;
    case moveDown :
    if (this._y+this._height-this.inc>this.maxY) {
    this._y -= this.inc;
    }
    break;
    default :
    break;
    }
    };
    }
    initMap();

    Thanks in advance for your assistance.

    Regards,
    Vaan_Dino
    Last edited by vaan_dino; 2010-01-14 at 14:05.

  2. #2
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Smile Re: Zooming problem in FlashLite 2.1 with AS 2.0

    Well! the easiest and known way to zoom in/out a movie clip is :
    Code:
    mymc._xscale = mymc._yscale += 5; //zoom in
    mymc._xscale = mymc._yscale -= 5; //zoom out
    and this is what u used in ur code.You can also increment/decrement _height and _width properties to zoom in/out a movie clip.In ur case, i dont think it is an actionscript issue but slowing down while zooming is because :
    1- Image Processing is somewhat heavy tasks for processor.
    2- You are doing these operation on a big resolution image encapsulated in a movie clip instance.
    To fix it simply put a limit (upto which ur app not slows down) in your zoming in/out function .Moreover, u can take a look at this article :
    Zoom_and_Rotate_Gestures_in_FlashLite_for_touch-enabled_devices

    Best Regards,
    SajiSoft

Similar Threads

  1. 编译Qt样例出错,请看如下
    By TD3 in forum [Archived] Qt General ( Qt技术)
    Replies: 14
    Last Post: 2009-12-24, 03:23
  2. Flashlite: softkey problem on real device
    By ngocnhan in forum [Archived] Flash Lite on Nokia Devices
    Replies: 1
    Last Post: 2009-12-21, 10:34
  3. Carbide.c++ & UIQ 2.1 SDK problem
    By venire in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 4
    Last Post: 2006-03-14, 11:33
  4. Problem sending SMS using Nokia 6210 and SDK 2.1
    By tarnaigy in forum PC Suite API and PC Connectivity SDK
    Replies: 4
    Last Post: 2006-02-01, 22:01
  5. Problem with SIP Plug-in for Series 60 SDK 2.0
    By jalakuri in forum Symbian Tools & SDKs
    Replies: 27
    Last Post: 2005-08-22, 09:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×