A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: drop target :(

  1. #1
    Junior Member
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    6

    drop target :(

    ok.... so i am making this zoom tool so when u drag it on top of this window that is also draggable, it enlarges it to 175%... when you drag it over again.... it sets it back to 100%...

    HOWEVER... it sets it the first time to 175%... then back to 100% on the 2nd drag, but then wont reset it back to 175% again after that... it is like it doesnt recognise the drop target anymore... the same thing occurs if you drag the drop target away from the initial position..... can anyone think of why this is happening?

    on (press) {
    startDrag("/zoombutt");
    }
    on (release) {
    stopDrag();
    if (getProperty("/window1", _yscale) eq 100) {
    if (getProperty("/zoombutt", _droptarget) eq "/window1") {
    setProperty("/window1", _yscale, 175);
    setProperty("/window1", _xscale, 175);
    setProperty("/window1", _alpha, 100);
    setProperty("/window1", _x, 425);
    setProperty("/window1", _y, 50);
    }
    } else {
    setProperty("/window1", _yscale, 100);
    setProperty("/window1", _xscale, 100);

    }
    setProperty("/zoombutt", _x, "510");
    setProperty("/zoombutt", _y, "350"); // if these lines arent present which place the zoombutton back to the original position it works... but it isnt much use if it doesnt set its self back to the original x,y co-ordinates.
    }


    Thanks in advance if anyone can help with this...been trying for a long time..

  2. #2
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    Maybe if you try to put it into a function, it might work:

    Code:
    button1.onPress = function() {
    	startDrag("/zoombutt");
    };
    button1.onRelease = function() {
    	stopDrag();
    	if (getProperty("/window1", _yscale) eq 100) {
    		if (getProperty("/zoombutt", _droptarget) eq "/window1") {
    			setProperty("/window1", _yscale, 175);
    			setProperty("/window1", _xscale, 175);
    			setProperty("/window1", _alpha, 100);
    			setProperty("/window1", _x, 425);
    			setProperty("/window1", _y, 50);
    		}
    	} else {
    		setProperty("/window1", _yscale, 100);
    		setProperty("/window1", _xscale, 100);
    	}
    	setProperty("/zoombutt", _x, "510");
    	setProperty("/zoombutt", _y, "350");
    };
    Although I am not 100% sure. Give it a try though.
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

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