A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: [CS3] Need help with simple math!

  1. #1
    Senior Member
    Join Date
    Sep 2000
    Brazil - São Paulo

    [CS3] Need help with simple math!

    Hey guys, Im almost crashing my head in the wall because of this...

    Let me try to explain, i need to make a simple code that is basic 2 mc's in the stage, a mother movie clip and inside that a child one.

    What I want to do is that the child movie clip determinates the size of the mother, its like a ZOOM issue where the width and height of the mother movie clip must increase so it can frame the child one in full screen.

    My main problem is that as th emovie plays, different child mcs will be displayed and the zoom must focus on each one of them (they appear one at a time).

    Im attaching a swf that explain a little better what im trying, if someone could please help me with that otday, id really appreciate

    the code:

    function call_zoom() {
    	var largura = map.map_zoom._width;
    	var altura = map.map_zoom._height;
    	var goscalex = (map._width*800)/largura;
    	var goscaley = (map._height*600)/altura;
    	var gox = map._x-map.map_zoom._x;
    	var goy = map._y-map.map_zoom._y;
    	onEnterFrame = function () {
    		map._width += (goscalex-map._width)/5;
    		map._height += (goscaley-map._height)/5;
    		map._x += (((map._width*gox)/800)-map._x)/5;
    		map._y += (((map._height*goy)/600)-map._y)/5;
    		if (Math.floor(goscalex)-Math.floor(map._width)<=0) {
    			onEnterFrame = null;
    I think the problem is that after the first zoom, as the mother mc is no longer at 0 x and 0y and the size of it changes, it goes crazy...

    pls someone giv it a try i really need it pls.

    thx in advance!
    Attached Files Attached Files
    "life is interactive"

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